#include "logbook.h" #include #include #include "countrydat.h" #include "Configuration.hpp" LogBook::LogBook (Configuration const * configuration) : config_ {configuration} { } void LogBook::match (QString const& call, QString const& mode, QString const& grid, QString &countryName, bool &callWorkedBefore, bool &countryWorkedBefore, bool &gridWorkedBefore, QString const& band) const { if (call.length() > 0) { auto const& mode_to_check = (config_ && !config_->highlight_by_mode ()) ? QString {} : mode; callWorkedBefore = worked_before_.call_worked (call, mode_to_check, band); gridWorkedBefore = worked_before_.grid_worked(grid, mode_to_check, band); countryName = worked_before_.countries ().find (call); countryWorkedBefore = worked_before_.country_worked (countryName, mode_to_check, band); } } bool LogBook::add (QString const& call , QString const& grid , QString const& band , QString const& mode , QByteArray const& ADIF_record) { return worked_before_.add (call, grid, band, mode, ADIF_record); } QByteArray LogBook::QSOToADIF (QString const& hisCall, QString const& hisGrid, QString const& mode, 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& myCall, QString const& myGrid, QString const& txPower, QString const& operator_call, QString const& xSent, QString const& xRcvd) { QString t; t = "" + hisCall; t += " " + hisGrid; t += " " + mode; t += " " + rptSent; t += " " + rptRcvd; t += " " + dateTimeOn.date().toString("yyyyMMdd"); t += " " + dateTimeOn.time().toString("hhmmss"); t += " " + dateTimeOff.date().toString("yyyyMMdd"); t += " " + dateTimeOff.time().toString("hhmmss"); t += " " + band; t += " " + strDialFreq; t += " " + myCall; t += " " + myGrid; if(txPower!="") t += " " + txPower; if(comments!="") t += " " + comments; if(name!="") t += " " + name; if(operator_call!="") t+=" " + operator_call; if(xRcvd!="") { QString t1=""; if(xRcvd.split(" ").size()==2) t1=xRcvd.split(" ").at(1); if(t1.toInt()>0) { t += " " + t1; } else { t += " " + t1; } } return t.toLatin1(); }