Added log details to the call activity menu
This commit is contained in:
+15
-6
@@ -101,14 +101,17 @@ void ADIF::load()
|
||||
, extractField (record, "BAND")
|
||||
, extractField (record, "MODE")
|
||||
, extractField (record, "SUBMODE")
|
||||
, extractField (record, "QSO_DATE"));
|
||||
, extractField (record, "QSO_DATE")
|
||||
, extractField (record, "NAME")
|
||||
, extractField (record, "COMMENT")
|
||||
);
|
||||
}
|
||||
inputFile.close ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ADIF::add(QString const& call, QString const& band, QString const& mode, QString const& submode, QString const& date)
|
||||
void ADIF::add(QString const& call, QString const& band, QString const& mode, QString const& submode, QString const& date, QString const& name, QString const& comment)
|
||||
{
|
||||
QSO q;
|
||||
q.call = call;
|
||||
@@ -116,6 +119,9 @@ void ADIF::add(QString const& call, QString const& band, QString const& mode, QS
|
||||
q.mode = mode;
|
||||
q.submode = submode;
|
||||
q.date = date;
|
||||
q.name = name;
|
||||
q.comment = comment;
|
||||
|
||||
if (q.call.size ())
|
||||
{
|
||||
_data.insert(q.call,q);
|
||||
@@ -135,13 +141,18 @@ bool ADIF::match(QString const& call, QString const& band) const
|
||||
if ( (band.compare(q.band,Qt::CaseInsensitive) == 0)
|
||||
|| (band=="")
|
||||
|| (q.band==""))
|
||||
{
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QList<ADIF::QSO> ADIF::find(QString const& call) const
|
||||
{
|
||||
return _data.values(call);
|
||||
}
|
||||
|
||||
QList<QString> ADIF::getCallList() const
|
||||
{
|
||||
@@ -154,8 +165,6 @@ QList<QString> ADIF::getCallList() const
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ADIF::getCount() const
|
||||
{
|
||||
|
||||
+8
-3
@@ -21,10 +21,14 @@ class QDateTime;
|
||||
class ADIF
|
||||
{
|
||||
public:
|
||||
|
||||
struct QSO;
|
||||
|
||||
void init(QString const& filename);
|
||||
void load();
|
||||
void add(QString const& call, QString const& band, QString const& mode, const QString &submode, QString const& date);
|
||||
void add(QString const& call, QString const& band, QString const& mode, const QString &submode, QString const& date, const QString &name, const QString &comment);
|
||||
bool match(QString const& call, QString const& band) const;
|
||||
QList<ADIF::QSO> find(QString const& call) const;
|
||||
QList<QString> getCallList() const;
|
||||
int getCount() const;
|
||||
|
||||
@@ -38,12 +42,13 @@ class ADIF
|
||||
, QString const& operator_call);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
struct QSO
|
||||
{
|
||||
QString call,band,mode,submode,date;
|
||||
QString call,band,mode,submode,date,name,comment;
|
||||
};
|
||||
|
||||
private:
|
||||
QMultiHash<QString, QSO> _data;
|
||||
QString _filename;
|
||||
|
||||
|
||||
+41
-13
@@ -59,25 +59,53 @@ void LogBook::match(/*in*/const QString call,
|
||||
bool &callWorkedBefore,
|
||||
bool &countryWorkedBefore) const
|
||||
{
|
||||
if (call.length() > 0)
|
||||
{
|
||||
QString currentBand = ""; // match any band
|
||||
callWorkedBefore = _log.match(call,currentBand);
|
||||
countryName = _countries.find(call);
|
||||
if(call.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
if (countryName.length() > 0) // country was found
|
||||
QString currentBand = ""; // match any band
|
||||
callWorkedBefore = _log.match(call, currentBand);
|
||||
countryName = _countries.find(call);
|
||||
|
||||
if (countryName.length() > 0){ // country was found
|
||||
countryWorkedBefore = _worked.getHasWorked(countryName);
|
||||
else
|
||||
{
|
||||
countryName = "where?"; //error: prefix not found
|
||||
countryWorkedBefore = false;
|
||||
}
|
||||
} else {
|
||||
countryName = "where?"; //error: prefix not found
|
||||
countryWorkedBefore = false;
|
||||
}
|
||||
}
|
||||
|
||||
void LogBook::addAsWorked(const QString call, const QString band, const QString mode, const QString submode, const QString date)
|
||||
bool LogBook::findCallDetails(
|
||||
/*in*/
|
||||
const QString call,
|
||||
/*out*/
|
||||
QString &date,
|
||||
QString &name,
|
||||
QString &comment) const
|
||||
{
|
||||
_log.add(call,band,mode,submode,date);
|
||||
qDebug() << "looking for call" << call;
|
||||
if(call.isEmpty()){
|
||||
return false;
|
||||
}
|
||||
|
||||
auto qsos = _log.find(call);
|
||||
qDebug() << "found" << qsos.length() << "qsos for call" << call;
|
||||
if(qsos.isEmpty()){
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach(auto qso, qsos){
|
||||
if(date.isEmpty() && !qso.date.isEmpty()) date = qso.date;
|
||||
if(name.isEmpty() && !qso.name.isEmpty()) name = qso.name;
|
||||
if(comment.isEmpty() && !qso.comment.isEmpty()) comment = qso.comment;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LogBook::addAsWorked(const QString call, const QString band, const QString mode, const QString submode, const QString date, const QString name, const QString comment)
|
||||
{
|
||||
_log.add(call,band,mode,submode,date,name,comment);
|
||||
QString countryName = _countries.find(call);
|
||||
if (countryName.length() > 0)
|
||||
_worked.setAsWorked(countryName);
|
||||
|
||||
+8
-1
@@ -25,7 +25,14 @@ public:
|
||||
/*out*/ QString &countryName,
|
||||
bool &callWorkedBefore,
|
||||
bool &countryWorkedBefore) const;
|
||||
void addAsWorked(const QString call, const QString band, const QString mode, const QString submode, const QString date);
|
||||
bool findCallDetails(
|
||||
/*in*/
|
||||
const QString call,
|
||||
/*out*/
|
||||
QString &date,
|
||||
QString &name,
|
||||
QString &comment) const;
|
||||
void addAsWorked(const QString call, const QString band, const QString mode, const QString submode, const QString date, const QString name, const QString comment);
|
||||
|
||||
private:
|
||||
CountryDat _countries;
|
||||
|
||||
Reference in New Issue
Block a user