Write additional fields to adi log file
This commit is contained in:
parent
38ab24ba79
commit
22432c7fea
@ -333,7 +333,7 @@ QByteArray ADIF::QSOToADIF(QString const& hisCall, QString const& hisGrid, QStri
|
||||
, QString const& rptSent, QString const& rptRcvd, QDateTime const& dateTimeOn
|
||||
, QDateTime const& dateTimeOff, QString const& band, QString const& comments
|
||||
, QString const& name, QString const& strDialFreq, QString const& m_myCall
|
||||
, QString const& m_myGrid, QString const& operator_call)
|
||||
, QString const& m_myGrid, QString const& operator_call, QMap<QString, QString> const &additionalFields)
|
||||
{
|
||||
QString t;
|
||||
t = "<call:" + QString::number(hisCall.length()) + ">" + hisCall;
|
||||
@ -363,6 +363,12 @@ QByteArray ADIF::QSOToADIF(QString const& hisCall, QString const& hisGrid, QStri
|
||||
if (operator_call!="")
|
||||
t+=" <operator:" + QString::number(operator_call.length()) +
|
||||
">" + operator_call;
|
||||
|
||||
foreach(auto key, additionalFields.keys()){
|
||||
auto value = additionalFields[key];
|
||||
t += QString(" <%1:%2>%3").arg(key).arg(value.length()).arg(value);
|
||||
}
|
||||
|
||||
return t.toLatin1 ();
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ class ADIF
|
||||
, QString const& rptRcvd, QDateTime const& dateTimeOn, QDateTime const& dateTimeOff
|
||||
, QString const& band, QString const& comments, QString const& name
|
||||
, QString const& strDialFreq, QString const& m_myCall, QString const& m_myGrid
|
||||
, QString const& operator_call);
|
||||
, QString const& operator_call, const QMap<QString, QString> &additionalFields);
|
||||
|
||||
|
||||
struct QSO
|
||||
|
29
logqso.cpp
29
logqso.cpp
@ -114,9 +114,18 @@ void LogQSO::loadSettings ()
|
||||
m_comments = m_settings->value ("LogComments", "").toString();
|
||||
|
||||
resetAdditionalFields();
|
||||
auto additionalFields = QSet<QString>::fromList(m_settings->value("AdditionalFields", {}).toStringList());
|
||||
auto additionalFields = m_settings->value("AdditionalFields", {}).toStringList();
|
||||
QSet<QString> additionalFieldsSet;
|
||||
foreach(auto key, additionalFields){
|
||||
if(key.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
if(additionalFieldsSet.contains(key)){
|
||||
continue;
|
||||
}
|
||||
|
||||
createAdditionalField(key);
|
||||
additionalFieldsSet.insert(key);
|
||||
}
|
||||
|
||||
m_settings->endGroup ();
|
||||
@ -131,7 +140,11 @@ void LogQSO::storeSettings () const
|
||||
|
||||
auto additionalFields = QStringList{};
|
||||
foreach(auto field, m_additionalFieldsControls){
|
||||
additionalFields.append(field->property("fieldKey").toString());
|
||||
auto key = field->property("fieldKey").toString();
|
||||
if(key.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
additionalFields.append(key);
|
||||
}
|
||||
m_settings->setValue ("AdditionalFields", additionalFields);
|
||||
|
||||
@ -194,6 +207,15 @@ void LogQSO::accept()
|
||||
QString hisCall,hisGrid,mode,submode,rptSent,rptRcvd,dateOn,dateOff,timeOn,timeOff,band,operator_call;
|
||||
QString comments,name;
|
||||
|
||||
QMap<QString, QString> additionalFields;
|
||||
foreach(auto field, m_additionalFieldsControls){
|
||||
auto key = field->property("fieldKey").toString();
|
||||
if(key.isEmpty()){
|
||||
continue;
|
||||
}
|
||||
additionalFields[key] = field->text();
|
||||
}
|
||||
|
||||
hisCall=ui->call->text().toUpper();
|
||||
hisGrid=ui->grid->text().toUpper();
|
||||
mode = ui->mode->text().toUpper();
|
||||
@ -218,7 +240,8 @@ void LogQSO::accept()
|
||||
adifile.init(adifilePath);
|
||||
|
||||
QByteArray ADIF {adifile.QSOToADIF (hisCall, hisGrid, mode, submode, rptSent, rptRcvd, m_dateTimeOn, m_dateTimeOff, band
|
||||
, comments, name, strDialFreq, m_myCall, m_myGrid, operator_call)};
|
||||
, comments, name, strDialFreq, m_myCall, m_myGrid, operator_call, additionalFields)};
|
||||
|
||||
if (!adifile.addQSOToFile (ADIF))
|
||||
{
|
||||
MessageBox::warning_message (this, tr ("Log file error"),
|
||||
|
Loading…
Reference in New Issue
Block a user