dataproxy and callsign validation fix

This commit is contained in:
ea4k 2023-01-01 18:26:01 +01:00
parent ed19610de8
commit 9122aad121
17 changed files with 589 additions and 414 deletions

View File

@ -1,6 +1,14 @@
TBD - 2.3.1 TBD - 2.3.1
- Bugfix: When no validating callsigns, some ADIF fields were exported even if they were empty. - Bugfix: When no validating callsigns, some ADIF fields were exported even if they were empty.
- Bugfix: In some conditions, not identified propagation modes were exported as "NO". - Bugfix: In some conditions, not identified propagation modes were exported as "NO". (Closes #518)
- Bugfix: VUCC_GRIDS validation was not properly done.
- Bugfix: It was not possible to select the second pair of freqs of a Sat (Closes #483)
- Bugfix: Export/Upload lists of QSOs where not properly created due to cal validation issues.
TEST: Bugfix: LoTW export was not using the selected grid when exporting (Closes #539)
- Improvement: Code improvement in the MainWindowInputQSO class.
- UI: Removed the locator, TX Freq and RX freq widgets from the Satellite tab. (Closes #534, 535, #536)
TEST: Bug: Export all in macOS opens another "empty" windows while exporting.
TEST: Bug: When uploading to LoTW, no calls are shown
Oct 2022 - 2.3 Oct 2022 - 2.3
- Improvement: Code optimization (TNX JohnS0819) - Improvement: Code optimization (TNX JohnS0819)

View File

@ -42,6 +42,8 @@ DataProxy_SQLite::DataProxy_SQLite(const QString &_parentFunction, const QString
util = new Utilities(Q_FUNC_INFO); util = new Utilities(Q_FUNC_INFO);
util->setVersion(_softVersion); util->setVersion(_softVersion);
util->setCallValidation(false); util->setCallValidation(false);
util->setLongPrefixes(getLongPrefixes());
util->setSpecialCalls(getSpecialCallsigns());
qso = new QSO; qso = new QSO;
db = new DataBase(Q_FUNC_INFO, _softVersion, util->getKLogDBFile()); db = new DataBase(Q_FUNC_INFO, _softVersion, util->getKLogDBFile());
@ -254,6 +256,11 @@ int DataProxy_SQLite::getModeIdFromSubModeId(const int _sm)
return getIdFromModeName(getNameFromSubMode(getSubModeFromId(_sm))); return getIdFromModeName(getNameFromSubMode(getSubModeFromId(_sm)));
} }
void DataProxy_SQLite::setCallValidation(const bool _v)
{
util->setCallValidation(_v);
}
bool DataProxy_SQLite::isModeDeprecated (const QString &_sm) bool DataProxy_SQLite::isModeDeprecated (const QString &_sm)
{ {
logEvent (Q_FUNC_INFO, "Start", Debug); logEvent (Q_FUNC_INFO, "Start", Debug);
@ -968,12 +975,12 @@ int DataProxy_SQLite::getLastQSOid()
QDate DataProxy_SQLite::getFirstQSODateFromCall (const QString &_call) QDate DataProxy_SQLite::getFirstQSODateFromCall (const QString &_call)
{ {
//qDebug() << "DataProxy_SQLite::getFirstQSODateFromCall: " << _call << QT_ENDL; qDebug() << Q_FUNC_INFO << ": " << _call;
QSqlQuery query; QSqlQuery query;
QString stringQuery; QString stringQuery;
QDate _date; QDate _date;
if (util->isValidCall(_call)) if (util->isValidCall(_call, true))
{ {
stringQuery = QString("SELECT qso_date from log where station_callsign='%1' ORDER BY qso_date ASC LIMIT 1").arg(_call); stringQuery = QString("SELECT qso_date from log where station_callsign='%1' ORDER BY qso_date ASC LIMIT 1").arg(_call);
} }
@ -983,6 +990,7 @@ QDate DataProxy_SQLite::getFirstQSODateFromCall (const QString &_call)
} }
bool sqlOK = query.exec(stringQuery); bool sqlOK = query.exec(stringQuery);
qDebug() << Q_FUNC_INFO << ": " << query.lastQuery();
if (sqlOK) if (sqlOK)
{ {
@ -995,19 +1003,19 @@ QDate DataProxy_SQLite::getFirstQSODateFromCall (const QString &_call)
query.finish(); query.finish();
if (_date.isValid()) if (_date.isValid())
{ {
//qDebug() << "DataProxy_SQLite::getFirstQSODateFromCall: END OK" << QT_ENDL; qDebug() << Q_FUNC_INFO << ": END OK" << QT_ENDL;
return _date; return _date;
} }
else else
{ {
//qDebug() << "DataProxy_SQLite::getFirstQSODateFromCall: END-1 " << QT_ENDL; qDebug() << Q_FUNC_INFO << ": END-1 " << QT_ENDL;
return QDate(); return QDate();
} }
} }
else else
{ {
query.finish(); query.finish();
//qDebug() << "DataProxy_SQLite::getFirstQSODateFromCall: END-2" << QT_ENDL; qDebug() << Q_FUNC_INFO << ": END-2" << QT_ENDL;
return QDate(); return QDate();
} }
} }
@ -1015,18 +1023,18 @@ QDate DataProxy_SQLite::getFirstQSODateFromCall (const QString &_call)
{ {
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery()); emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery());
query.finish(); query.finish();
//qDebug() << "DataProxy_SQLite::getFirstQSODateFromCall: END-3" << QT_ENDL; qDebug() << Q_FUNC_INFO << ": END-3" << QT_ENDL;
return QDate(); return QDate();
} }
} }
QDate DataProxy_SQLite::getLastQSODateFromCall (const QString &_call) QDate DataProxy_SQLite::getLastQSODateFromCall (const QString &_call)
{ {
//qDebug() << "DataProxy_SQLite::getLastQSODateFromCall: " << _call << QT_ENDL; qDebug() << Q_FUNC_INFO << ": " << _call;
QSqlQuery query; QSqlQuery query;
QString stringQuery; QString stringQuery;
QDate _date; QDate _date;
if (util->isValidCall(_call)) if (util->isValidCall(_call, true))
{ {
stringQuery = QString("SELECT qso_date from log where station_callsign='%1' ORDER BY qso_date DESC LIMIT 1").arg(_call); stringQuery = QString("SELECT qso_date from log where station_callsign='%1' ORDER BY qso_date DESC LIMIT 1").arg(_call);
} }
@ -1048,19 +1056,19 @@ QDate DataProxy_SQLite::getLastQSODateFromCall (const QString &_call)
query.finish(); query.finish();
if (_date.isValid()) if (_date.isValid())
{ {
//qDebug() << "DataProxy_SQLite::getLastQSODateFromCall: OK" << QT_ENDL; qDebug() << Q_FUNC_INFO << ": OK" << QT_ENDL;
return _date; return _date;
} }
else else
{ {
//qDebug() << "DataProxy_SQLite::getLastQSODateFromCall: END-1" << QT_ENDL; qDebug() << Q_FUNC_INFO << ": END-1" << QT_ENDL;
return QDate(); return QDate();
} }
} }
else else
{ {
query.finish(); query.finish();
//qDebug() << "DataProxy_SQLite::getLastQSODateFromCall: END-2" << QT_ENDL; qDebug() << Q_FUNC_INFO << ": END-2" << QT_ENDL;
return QDate(); return QDate();
} }
} }
@ -1068,7 +1076,7 @@ QDate DataProxy_SQLite::getLastQSODateFromCall (const QString &_call)
{ {
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery()); emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery());
query.finish(); query.finish();
//qDebug() << "DataProxy_SQLite::getLastQSODateFromCall: END-3" << QT_ENDL; qDebug() << Q_FUNC_INFO << ": END-3" << QT_ENDL;
return QDate(); return QDate();
} }
} }
@ -3517,7 +3525,7 @@ int DataProxy_SQLite::lotwUpdateQSLReception (const QString &_call, const QDateT
QList<int> DataProxy_SQLite::getQSOsListLoTWToSend(const QString &_stationCallsign, const QString &_myGrid, const QDate &_startDate, const QDate &_endDate, bool _justQueued, int _logN) QList<int> DataProxy_SQLite::getQSOsListLoTWToSend(const QString &_stationCallsign, const QString &_myGrid, const QDate &_startDate, const QDate &_endDate, bool _justQueued, int _logN)
{ {
//qDebug() << "DataProxy_SQLite::getQSOsListLoTWToSend Call/Start/end: " << _stationCallsign << _startDate.toString("yyyyMMdd") << "/" << _endDate.toString("yyyyMMdd") << QT_ENDL; qDebug() << "DataProxy_SQLite::getQSOsListLoTWToSend Call/Start/end: " << _stationCallsign << _myGrid << _startDate.toString("yyyyMMdd") << "/" << _endDate.toString("yyyyMMdd") << QT_ENDL;
QList <int> qsoList; QList <int> qsoList;
qsoList.clear(); qsoList.clear();
@ -3528,17 +3536,17 @@ QList<int> DataProxy_SQLite::getQSOsListLoTWToSend(const QString &_stationCallsi
QString queryString; QString queryString;
QString _queryST_string; QString _queryST_string;
if (util->isValidCall(_stationCallsign)) if (util->isValidCall(_stationCallsign, true))
{ {
_queryST_string = QString("station_callsign='%1'").arg(_stationCallsign); _queryST_string = QString("station_callsign='%1'").arg(_stationCallsign);
} }
else if (_stationCallsign == "ALL") else if (_stationCallsign == "ALL")
{ {
_queryST_string = QString("station_callsign!='ALL'"); _queryST_string = QString("((station_callsign!='ALL') OR (station_callsign IS NULL) OR (station_callsign=''))");
} }
else else
{ {
_queryST_string = QString("(station_callsign='' OR station_callsign IS NULL)"); _queryST_string = QString("((station_callsign!='ALL') OR (station_callsign IS NULL))");
} }
QString _queryGrid_string; QString _queryGrid_string;
@ -3546,9 +3554,9 @@ QList<int> DataProxy_SQLite::getQSOsListLoTWToSend(const QString &_stationCallsi
{ {
_queryGrid_string = QString("my_gridsquare='%1'").arg(_myGrid); _queryGrid_string = QString("my_gridsquare='%1'").arg(_myGrid);
} }
else if (_stationCallsign == "ALL") else if (_myGrid == "ALL")
{ {
_queryGrid_string = QString("my_gridsquare!='ALL'"); _queryGrid_string = QString("(my_gridsquare!='ALL' OR my_gridsquare IS NULL)");
} }
else else
{ {
@ -3577,7 +3585,7 @@ QList<int> DataProxy_SQLite::getQSOsListLoTWToSend(const QString &_stationCallsi
_query_logNumber.clear (); _query_logNumber.clear ();
} }
queryString = QString("SELECT id, qso_date FROM log WHERE %1 AND %2 %3 AND %4").arg(_queryST_string).arg(_query_justQueued).arg(_query_logNumber).arg(_queryGrid_string); queryString = QString("SELECT id, qso_date FROM log WHERE %1 AND %2 AND %3 AND %4").arg(_queryST_string).arg(_queryGrid_string).arg(_query_justQueued).arg(_query_logNumber);
// queryString = QString("SELECT id, qso_date FROM log WHERE ") + _queryST_string + " AND " + _query_justQueued; // queryString = QString("SELECT id, qso_date FROM log WHERE ") + _queryST_string + " AND " + _query_justQueued;
@ -3585,7 +3593,7 @@ QList<int> DataProxy_SQLite::getQSOsListLoTWToSend(const QString &_stationCallsi
QSqlQuery query; QSqlQuery query;
bool sqlOK = query.exec(queryString); bool sqlOK = query.exec(queryString);
//qDebug() << "DataProxy_SQLite::getQSOsListLoTWToSend Query: " << query.lastQuery() ; qDebug() << "DataProxy_SQLite::getQSOsListLoTWToSend Query: " << query.lastQuery() ;
if (sqlOK) if (sqlOK)
{ {
@ -3620,28 +3628,27 @@ QList<int> DataProxy_SQLite::getQSOsListLoTWToSend(const QString &_stationCallsi
QStringList DataProxy_SQLite::getGridsToBeSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified, int _logN) QStringList DataProxy_SQLite::getGridsToBeSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified, int _logN)
{ {
//qDebug() << Q_FUNC_INFO << " - Start"; qDebug() << Q_FUNC_INFO << " - Start";
QStringList grids; QStringList grids;
grids.clear (); grids.clear ();
QDate tmpDate;
QString aux = QString(); QString aux = QString();
QStringList qs; QStringList qs;
qs.clear(); qs.clear();
QString queryString; QString queryString;
QString _queryST_string; QString _queryST_string;
if (util->isValidCall(_stationCallsign)) if (util->isValidCall(_stationCallsign, true))
{ {
_queryST_string = QString("station_callsign='%1'").arg(_stationCallsign); _queryST_string = QString("station_callsign='%1'").arg(_stationCallsign);
} }
else if (_stationCallsign == "ALL") else if (_stationCallsign == "ALL")
{ {
_queryST_string = QString("station_callsign!='ALL'"); _queryST_string = QString("((station_callsign!='ALL') OR (station_callsign IS NULL) OR (station_callsign=''))");
} }
else else
{ {
_queryST_string = QString("(station_callsign='' OR station_callsign IS NULL)"); _queryST_string = QString("((station_callsign='') OR (station_callsign IS NULL))");
} }
QString _query_justQueued; QString _query_justQueued;
@ -3663,12 +3670,12 @@ QStringList DataProxy_SQLite::getGridsToBeSent(const QString &_stationCallsign,
{ {
_query_logNumber.clear (); _query_logNumber.clear ();
} }
queryString = QString("SELECT DISTINCT my_gridsquare FROM log WHERE station_callsign = '%1' AND my_gridsquare<>'' AND qso_date>='%2' AND qso_date<='%3' AND %4").arg(_stationCallsign).arg(util->getDateSQLiteStringFromDate(_startDate)).arg(util->getDateSQLiteStringFromDate(_endDate.addDays (1))).arg(_query_justQueued); queryString = QString("SELECT DISTINCT my_gridsquare FROM log WHERE station_callsign = '%1' AND ((my_gridsquare<>'') OR (my_gridsquare IS NOT NULL)) AND qso_date>='%2' AND qso_date<='%3' AND %4").arg(_stationCallsign).arg(util->getDateSQLiteStringFromDate(_startDate)).arg(util->getDateSQLiteStringFromDate(_endDate.addDays (1))).arg(_query_justQueued);
QSqlQuery query; QSqlQuery query;
bool sqlOK = query.exec(queryString); bool sqlOK = query.exec(queryString);
//qDebug() << Q_FUNC_INFO << ": " << query.lastQuery (); qDebug() << Q_FUNC_INFO << ": " << query.lastQuery ();
if (sqlOK) if (sqlOK)
{ {
@ -3676,7 +3683,11 @@ QStringList DataProxy_SQLite::getGridsToBeSent(const QString &_stationCallsign,
if (query.isValid()) if (query.isValid())
{ {
aux.clear(); aux.clear();
grids.append ((query.value(0)).toString()); aux = (query.value(0)).toString();
if (aux.length()>1)
{
grids.append ((query.value(0)).toString());
}
} }
} }
} }
@ -3685,14 +3696,13 @@ QStringList DataProxy_SQLite::getGridsToBeSent(const QString &_stationCallsign,
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery()); emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery());
query.finish(); query.finish();
grids.sort (); grids.sort ();
qDebug() << Q_FUNC_INFO << " - END-1";
return grids; return grids;
} }
query.finish(); query.finish();
grids.sort(); grids.sort();
qDebug() << Q_FUNC_INFO << " - END";
return grids; return grids;
//qDebug() << Q_FUNC_INFO << " - END";
} }
QList<int> DataProxy_SQLite::getQSOsListClubLogToSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified, int _logN) QList<int> DataProxy_SQLite::getQSOsListClubLogToSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified, int _logN)
@ -3708,13 +3718,13 @@ QList<int> DataProxy_SQLite::getQSOsListClubLogToSent(const QString &_stationCal
QString queryString; QString queryString;
QString _queryST_string; QString _queryST_string;
if (util->isValidCall(_stationCallsign)) if (util->isValidCall(_stationCallsign, true))
{ {
_queryST_string = QString("station_callsign='%1'").arg(_stationCallsign); _queryST_string = QString("station_callsign='%1'").arg(_stationCallsign);
} }
else if (_stationCallsign == "ALL") else if (_stationCallsign == "ALL")
{ {
_queryST_string = QString("station_callsign!='ALL'"); _queryST_string = QString("((station_callsign!='ALL') OR (station_callsign IS NULL) OR (station_callsign=''))");
} }
else else
{ {
@ -3800,17 +3810,17 @@ QList<int> DataProxy_SQLite::getQSOsListEQSLToSent(const QString &_stationCallsi
QString queryString; QString queryString;
QString _queryST_string; QString _queryST_string;
if (util->isValidCall(_stationCallsign)) if (util->isValidCall(_stationCallsign, true))
{ {
_queryST_string = QString("station_callsign='%1'").arg(_stationCallsign); _queryST_string = QString("station_callsign='%1'").arg(_stationCallsign);
} }
else if (_stationCallsign == "ALL") else if (_stationCallsign == "ALL")
{ {
_queryST_string = QString("station_callsign!='ALL'"); _queryST_string = QString("((station_callsign!='ALL') OR (station_callsign IS NULL) OR (station_callsign=''))");
} }
else else
{ {
_queryST_string = QString("(station_callsign OR station_callsign IS NULL)"); _queryST_string = QString("(station_callsign='' OR station_callsign IS NULL)");
} }
QString _query_justModified; QString _query_justModified;
@ -3837,7 +3847,7 @@ QList<int> DataProxy_SQLite::getQSOsListEQSLToSent(const QString &_stationCallsi
queryString = QString("SELECT id, qso_date FROM log WHERE %1 AND %2 '%3'").arg(_queryST_string).arg(_query_justQueued).arg(_query_logNumber); queryString = QString("SELECT id, qso_date FROM log WHERE %1 AND %2 '%3'").arg(_queryST_string).arg(_query_justQueued).arg(_query_logNumber);
*/ */
queryString = QString("SELECT id, qso_date FROM log WHERE ") + _queryST_string + " AND " + _query_justModified; queryString = QString("SELECT id, qso_date FROM log WHERE ") + _queryST_string + _query_justModified;
QSqlQuery query; QSqlQuery query;
@ -3889,13 +3899,13 @@ QList<int> DataProxy_SQLite::getQSOsListQRZCOMToSent(const QString &_stationCall
QString queryString; QString queryString;
QString _queryST_string; QString _queryST_string;
if (util->isValidCall(_stationCallsign)) if (util->isValidCall(_stationCallsign, true))
{ {
_queryST_string = QString("station_callsign='%1'").arg(_stationCallsign); _queryST_string = QString("station_callsign='%1'").arg(_stationCallsign);
} }
else if (_stationCallsign == "ALL") else if (_stationCallsign == "ALL")
{ {
_queryST_string = QString("station_callsign!='ALL'"); _queryST_string = QString("((station_callsign!='ALL') OR (station_callsign IS NULL) OR (station_callsign=''))");
} }
else else
{ {
@ -3966,9 +3976,10 @@ QList<int> DataProxy_SQLite::getQSOsListQRZCOMToSent(const QString &_stationCall
} }
QList<int> DataProxy_SQLite::getQSOsListToBeExported(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate) QList<int> DataProxy_SQLite::getQSOsListToBeExported(const QString &_stationCallsign, const QString &_grid, const QDate &_startDate, const QDate &_endDate)
{ {
//qDebug() << Q_FUNC_INFO << ": Call/Start/end: " << _stationCallsign << _startDate.toString("yyyyMMdd") << "/" << _endDate.toString("yyyyMMdd") << QT_ENDL; qDebug() << Q_FUNC_INFO << QString("Call: %1, Grid: %2, StartDate: %3, EndDate: %4").arg(_stationCallsign).arg(_grid).arg(_startDate.toString("yyyyMMdd")).arg(_endDate.toString("yyyyMMdd"));
QList <int> qsoList; QList <int> qsoList;
qsoList.clear(); qsoList.clear();
QDate tmpDate; QDate tmpDate;
@ -3978,18 +3989,37 @@ QList<int> DataProxy_SQLite::getQSOsListToBeExported(const QString &_stationCall
QString queryString; QString queryString;
QString _queryST_string; QString _queryST_string;
if (util->isValidCall(_stationCallsign)) if (util->isValidCall(_stationCallsign, true))
{ {
qDebug() << Q_FUNC_INFO << ": Valid call";
_queryST_string = QString("station_callsign='%1'").arg(_stationCallsign); _queryST_string = QString("station_callsign='%1'").arg(_stationCallsign);
} }
else if (_stationCallsign == "ALL") else if (_stationCallsign == "ALL")
{ {
_queryST_string = QString("station_callsign!='ALL'"); qDebug() << Q_FUNC_INFO << ": ALL";
_queryST_string = QString("((station_callsign!='ALL') OR (station_callsign IS NULL) OR (station_callsign=''))");
} }
else else
{ {
qDebug() << Q_FUNC_INFO << ": Non valid nor ALL";
_queryST_string = QString("(station_callsign='' OR station_callsign IS NULL)"); _queryST_string = QString("(station_callsign='' OR station_callsign IS NULL)");
} }
QString _queryGrid_String;
if (util->isValidGrid (_grid))
{
_queryGrid_String = QString("AND my_gridsquare='%1'").arg(_grid);
}
else if (_grid == "ALL")
{
_queryGrid_String = QString();
//_queryGrid_String = QString("((my_gridsquare!='ALL') OR (my_gridsquare IS NULL))");
}
else
{
_queryGrid_String = QString("AND (my_gridsquare='' OR my_gridsquare IS NULL)");
}
/* Modify accordingly to add log number support /* Modify accordingly to add log number support
QString _query_logNumber; QString _query_logNumber;
if (doesThisLogExist (_logN)) if (doesThisLogExist (_logN))
@ -4004,12 +4034,12 @@ QList<int> DataProxy_SQLite::getQSOsListToBeExported(const QString &_stationCall
*/ */
queryString = QString("SELECT id, qso_date FROM log WHERE ") + _queryST_string ; queryString = QString("SELECT id, qso_date FROM log WHERE ") + _queryST_string + _queryGrid_String;
QSqlQuery query; QSqlQuery query;
bool sqlOK = query.exec(queryString); bool sqlOK = query.exec(queryString);
//qDebug() << Q_FUNC_INFO << ": Query: " << query.lastQuery() << QT_ENDL; qDebug() << Q_FUNC_INFO << ": Query: " << query.lastQuery() << QT_ENDL;
if (sqlOK) if (sqlOK)
{ {
@ -4055,17 +4085,18 @@ QList<int> DataProxy_SQLite::getQSOsListeQSLNotSent(const QString &_stationCalls
QString queryString; QString queryString;
QString _queryST_string; QString _queryST_string;
if (util->isValidCall(_stationCallsign)) if (util->isValidCall(_stationCallsign, true))
{ {
_queryST_string = QString("station_callsign='%1'").arg(_stationCallsign); _queryST_string = QString("station_callsign='%1'").arg(_stationCallsign);
} }
else if (_stationCallsign == "ALL") else if (_stationCallsign == "ALL")
{ {
_queryST_string = QString("station_callsign!='ALL'");
_queryST_string = QString("((station_callsign!='ALL') OR (station_callsign IS NULL) OR (station_callsign=''))");
} }
else else
{ {
_queryST_string = QString("(station_callsign='' OR station_callsign IS NULL)"); _queryST_string = QString("((station_callsign='') OR (station_callsign IS NULL))");
} }
QString _query_justQueued; QString _query_justQueued;
@ -4987,12 +5018,12 @@ int DataProxy_SQLite::getDBSatId(const QString &_arrlId)
} }
else else
{ {
//qDebug() << "DataProxy_SQLite::getSatelliteUplink: query failed: " << query.lastQuery() << QT_ENDL; //qDebug() << Q_FUNC_INFO << ": query failed: " << query.lastQuery() << QT_ENDL;
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery()); emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery());
query.finish(); query.finish();
} }
//qDebug() << "DataProxy_SQLite::getSatelliteUplink: final: " << aux ; //qDebug() << ":: final: " << aux ;
query.finish(); query.finish();
return aux; return aux;
} }
@ -5032,9 +5063,9 @@ QStringList DataProxy_SQLite::getSatellitesList()
} }
QString DataProxy_SQLite::getSatelliteUplink(const QString &_sat) QString DataProxy_SQLite::getSatelliteUplink(const QString &_sat, int _pair)
{ {
//qDebug() << "DataProxy_SQLite::getSatelliteUplink: " << _sat << QT_ENDL; //qDebug() << "DataProxy_SQLite::getSatelliteUplink: " << _sat << QT_ENDL;
QString aux = QString(); QString aux = QString();
//QString aux2 = QString(); //QString aux2 = QString();
//double fr1, fr2, fr; //double fr1, fr2, fr;
@ -5049,7 +5080,7 @@ QString DataProxy_SQLite::getSatelliteUplink(const QString &_sat)
if (query.isValid()) if (query.isValid())
{ {
aux = query.value(0).toString(); aux = query.value(0).toString();
aux = QString::number(getFreqFromRange(aux)); aux = QString::number(getFreqFromRange(aux, _pair));
} }
else else
{ {
@ -5072,7 +5103,7 @@ QString DataProxy_SQLite::getSatelliteUplink(const QString &_sat)
} }
QString DataProxy_SQLite::getSatelliteDownlink(const QString &_sat) QString DataProxy_SQLite::getSatelliteDownlink(const QString &_sat, int _pair)
{ {
//qDebug() << "DataProxy_SQLite::getSatelliteDownlink: " << _sat << QT_ENDL; //qDebug() << "DataProxy_SQLite::getSatelliteDownlink: " << _sat << QT_ENDL;
QString aux = QString(); QString aux = QString();
@ -5090,7 +5121,7 @@ QString DataProxy_SQLite::getSatelliteDownlink(const QString &_sat)
if (query.isValid()) if (query.isValid())
{ {
aux = query.value(0).toString(); aux = query.value(0).toString();
aux = QString::number(getFreqFromRange(aux)); aux = QString::number(getFreqFromRange(aux,_pair));
} }
else else
{ {
@ -5331,7 +5362,7 @@ QString DataProxy_SQLite::getSateliteArrlIdFromId(const int _id)
return aux; return aux;
} }
double DataProxy_SQLite::getFreqFromRange(QString _fr) double DataProxy_SQLite::getFreqFromRange(QString _fr, int _pair)
{ //May even receive: 145.900-146.00 and should return the mid in the range (145.950) { //May even receive: 145.900-146.00 and should return the mid in the range (145.950)
//qDebug() << "DataProxy_SQLite::getFreqFromRange: " << _fr << QT_ENDL; //qDebug() << "DataProxy_SQLite::getFreqFromRange: " << _fr << QT_ENDL;
QString fr1, fr2, aux; QString fr1, fr2, aux;
@ -5345,11 +5376,13 @@ double DataProxy_SQLite::getFreqFromRange(QString _fr)
aux = _fr; aux = _fr;
if (aux.contains(',')) if (aux.contains(','))
{ // Potentially somethink like: 435.030-435.456,146.180 { // Potentially somethink like: 435.030-435.456,146.180
// We select the first range if((_pair<0) || (_pair>1))
{
_pair = 0;
}
//qDebug() << "DataProxy_SQLite::getFreqFromRange: has several freqs: " << aux << QT_ENDL; //qDebug() << "DataProxy_SQLite::getFreqFromRange: has several freqs: " << aux << QT_ENDL;
aux = aux.section(',', 0, 0); // We select the first package aux = aux.section(',', _pair, _pair); // We select the selected package
} }
if (aux.contains('-')) // Potentially somethink like: 435.030-435.456 if (aux.contains('-')) // Potentially somethink like: 435.030-435.456
{ {

View File

@ -67,7 +67,7 @@ public:
int getIdFromBandName(const QString& _bandName); int getIdFromBandName(const QString& _bandName);
int getSubModeIdFromSubMode(const QString &_subModeName); int getSubModeIdFromSubMode(const QString &_subModeName);
int getModeIdFromSubModeId(const int _sm); int getModeIdFromSubModeId(const int _sm);
void setCallValidation(const bool _v);
QStringList getFields(); QStringList getFields();
QStringList getBands(); QStringList getBands();
QStringList getModes(); QStringList getModes();
@ -188,7 +188,7 @@ public:
QList<int> getQSOsListClubLogToSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified=true, int _logN = -1); QList<int> getQSOsListClubLogToSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified=true, int _logN = -1);
QList<int> getQSOsListEQSLToSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified=true); QList<int> getQSOsListEQSLToSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified=true);
QList<int> getQSOsListQRZCOMToSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified=true); QList<int> getQSOsListQRZCOMToSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified=true);
QList<int> getQSOsListToBeExported(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate); QList<int> getQSOsListToBeExported(const QString &_stationCallsign, const QString &_grid, const QDate &_startDate, const QDate &_endDate);
QStringList getGridsToBeSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified=true, int _logN = -1); QStringList getGridsToBeSent(const QString &_stationCallsign, const QDate &_startDate, const QDate &_endDate, bool _justModified=true, int _logN = -1);
@ -273,8 +273,8 @@ public:
bool addSatellite(const QString &_arrlId, const QString &_name, const QString &_downLink, const QString &_upLink, const QString &_mode, int id = -1); bool addSatellite(const QString &_arrlId, const QString &_name, const QString &_downLink, const QString &_upLink, const QString &_mode, int id = -1);
int getDBSatId(const QString &_arrlId); int getDBSatId(const QString &_arrlId);
QStringList getSatellitesList(); QStringList getSatellitesList();
QString getSatelliteUplink(const QString &_sat); QString getSatelliteUplink(const QString &_sat, int _pair=0);
QString getSatelliteDownlink(const QString &_sat); QString getSatelliteDownlink(const QString &_sat, int _pair=0);
QString getSatelliteMode(const QString &_sat); QString getSatelliteMode(const QString &_sat);
QString getSatelliteFullUplink(const QString &_sat); QString getSatelliteFullUplink(const QString &_sat);
QString getSatelliteFullDownlink(const QString &_sat); QString getSatelliteFullDownlink(const QString &_sat);
@ -330,7 +330,7 @@ private:
bool dbCreated; bool dbCreated;
DataBase *db; DataBase *db;
QStringList sortBandIdBottonUp(const QStringList _qs); QStringList sortBandIdBottonUp(const QStringList _qs);
double getFreqFromRange(QString _fr); //May even receive: 145.900-146.00 and should return the mid in the range (145.950) double getFreqFromRange(QString _fr, int _pair = 0); //May even receive: 145.900-146.00 and should return the mid in the range (145.950)
QStringList getColumnNamesFromTable(const QString &_tableName); QStringList getColumnNamesFromTable(const QString &_tableName);
int getPrefixId(const QString &_qrz); int getPrefixId(const QString &_qrz);

View File

@ -34,6 +34,8 @@ FileManager::FileManager(DataProxy_SQLite *dp)
//qDebug() << "FileManager::FileManager()-3: Dir(2)" << _klogDir << QT_ENDL; //qDebug() << "FileManager::FileManager()-3: Dir(2)" << _klogDir << QT_ENDL;
dataProxy = dp; dataProxy = dp;
util = new Utilities(Q_FUNC_INFO); util = new Utilities(Q_FUNC_INFO);
util->setLongPrefixes(dataProxy->getLongPrefixes());
util->setSpecialCalls(dataProxy->getSpecialCallsigns());
util->setCallValidation(false); util->setCallValidation(false);
db = new DataBase(Q_FUNC_INFO, klogVersion, util->getKLogDBFile()); db = new DataBase(Q_FUNC_INFO, klogVersion, util->getKLogDBFile());
world = new World(dataProxy, Q_FUNC_INFO); world = new World(dataProxy, Q_FUNC_INFO);
@ -163,7 +165,7 @@ void FileManager::setSendQSLByDefault (const bool _send)
sendEQSLByDefault = _send; sendEQSLByDefault = _send;
} }
QList<int> FileManager::adifLogExportReturnList(const QString& _fileName, const QString &_callsign, const QDate &_startDate, const QDate &_endDate, const int _logN, const ExportMode _em) QList<int> FileManager::adifLogExportReturnList(const QString& _fileName, const QString &_callsign, const QString &_grid, const QDate &_startDate, const QDate &_endDate, const int _logN, const ExportMode _em)
//QList<int> FileManager::adifLogExportReturnList(const QString& _fileName, const QString &_callsign, const QDate &_startDate, const QDate &_endDate, const int _logN, const bool LoTWOnly) //QList<int> FileManager::adifLogExportReturnList(const QString& _fileName, const QString &_callsign, const QDate &_startDate, const QDate &_endDate, const int _logN, const bool LoTWOnly)
{ {
//qDebug() << Q_FUNC_INFO << ": Start)" << _fileName << "/" << _callsign << QT_ENDL; //qDebug() << Q_FUNC_INFO << ": Start)" << _fileName << "/" << _callsign << QT_ENDL;
@ -188,6 +190,7 @@ QList<int> FileManager::adifLogExportReturnList(const QString& _fileName, const
QString queryStringCount; QString queryStringCount;
QString queryString; QString queryString;
QString _queryStation; QString _queryStation;
QString _queryGrid;
if (util->isValidCall(_callsign)) if (util->isValidCall(_callsign))
{ {
@ -202,6 +205,15 @@ QList<int> FileManager::adifLogExportReturnList(const QString& _fileName, const
_queryStation = QString(" station_callsign =''"); _queryStation = QString(" station_callsign =''");
} }
if (util->isValidGrid(_grid))
{
_queryGrid = QString(" AND my_gridsquare = '%1'").arg(_grid);
}
else
{
_queryGrid = QString();
}
QString _queryDateFrom; QString _queryDateFrom;
if (_startDate.isValid()) if (_startDate.isValid())
@ -248,7 +260,7 @@ QList<int> FileManager::adifLogExportReturnList(const QString& _fileName, const
// LoTW Required fields: call sign, UTC Date, UTC time, Mode, Band // LoTW Required fields: call sign, UTC Date, UTC time, Mode, Band
// LoTW Optional fields: RX band, Frecuency TX, frecuency RX, Propagation mode, Satellite // LoTW Optional fields: RX band, Frecuency TX, frecuency RX, Propagation mode, Satellite
queryStringCount = QString("SELECT COUNT (id) FROM log WHERE") + _queryStation + QString(" AND lotw_qsl_sent='Q'") + _queryDateFrom + _queryDateTo; queryStringCount = QString("SELECT COUNT (id) FROM log WHERE") + _queryStation + _queryGrid + QString(" AND lotw_qsl_sent='Q'") + _queryDateFrom + _queryDateTo;
queryString = QString("SELECT id, call, freq, bandid, band_rx, freq_rx, modeid, gridsquare, my_gridsquare, qso_date, prop_mode, sat_name, station_callsign FROM log WHERE") + _queryStation + QString(" AND lotw_qsl_sent='Q'") + _queryDateFrom + _queryDateTo; queryString = QString("SELECT id, call, freq, bandid, band_rx, freq_rx, modeid, gridsquare, my_gridsquare, qso_date, prop_mode, sat_name, station_callsign FROM log WHERE") + _queryStation + QString(" AND lotw_qsl_sent='Q'") + _queryDateFrom + _queryDateTo;
} }
else if (_em == ModeClubLog) else if (_em == ModeClubLog)
@ -502,7 +514,8 @@ bool FileManager::adifQSOsExport(const QString& _fileName, QList<int> _qsos)
void FileManager::setCallValidation (const bool _b) void FileManager::setCallValidation (const bool _b)
{ {
//util->setCallValidation(_b); //util->setCallValidation(_b);
util->setCallValidation(false); util->setCallValidation(_b);
dataProxy->setCallValidation(_b);
} }

View File

@ -76,7 +76,7 @@ public:
//QList<int> (const QString& _fileName, const QString &_callsign, const QDate &_startDate, const QDate &_endDate, const int _logN, const bool LoTWOnly); //QList<int> (const QString& _fileName, const QString &_callsign, const QDate &_startDate, const QDate &_endDate, const int _logN, const bool LoTWOnly);
bool adifQSOsExport(const QString& _fileName, QList<int> _qsos); bool adifQSOsExport(const QString& _fileName, QList<int> _qsos);
QList<int> adifLogExportReturnList(const QString& _fileName, const QString &_callsign, const QDate &_startDate, const QDate &_endDate, const int _logN, const ExportMode _em); QList<int> adifLogExportReturnList(const QString& _fileName, const QString &_callsign, const QString &_grid, const QDate &_startDate, const QDate &_endDate, const int _logN, const ExportMode _em);
bool adifLogExport(const QString& _fileName, const int _logN); bool adifLogExport(const QString& _fileName, const int _logN);
bool adifLogExportMarked(const QString& _fileName); bool adifLogExportMarked(const QString& _fileName);
bool adifReqQSLExport(const QString& _fileName); bool adifReqQSLExport(const QString& _fileName);

View File

@ -703,6 +703,7 @@ bool MainWindowInputQSO::eventFilter (QObject *object, QEvent *event)
{ {
//qDebug() << Q_FUNC_INFO << ": " << QString::number(event->type ()); //qDebug() << Q_FUNC_INFO << ": " << QString::number(event->type ());
} }
//qDebug() << Q_FUNC_INFO << ": " << object->objectName();
if ((event->type() == QEvent::KeyPress) || (event->type() == QEvent::ShortcutOverride)) { if ((event->type() == QEvent::KeyPress) || (event->type() == QEvent::ShortcutOverride)) {
//qDebug() << Q_FUNC_INFO << "KEY PRESSED"; //qDebug() << Q_FUNC_INFO << "KEY PRESSED";
@ -714,12 +715,9 @@ bool MainWindowInputQSO::eventFilter (QObject *object, QEvent *event)
//qDebug() << Q_FUNC_INFO << "emitting to hand over to mainQSO Input"; //qDebug() << Q_FUNC_INFO << "emitting to hand over to mainQSO Input";
emit handOverFocusSignal(); emit handOverFocusSignal();
} }
// special tab handling here // special tab handling here
return true; return true;
} }
} }
return QWidget::event(event); return QWidget::event(event);
} }

View File

@ -35,17 +35,16 @@ MainWindowSatTab::MainWindowSatTab(DataProxy_SQLite *dp, QWidget *parent) :
satNameComboBox = new QComboBox; satNameComboBox = new QComboBox;
satNameLineEdit = new QLineEdit; satNameLineEdit = new QLineEdit;
satModeLineEdit = new QLineEdit; satModeLineEdit = new QLineEdit;
satDXLocatorLineEdit = new QLineEdit;
satOtherLabel = new QLabel; satOtherLabel = new QLabel;
satBandTXComboBox = new QComboBox; satBandTXComboBox = new QComboBox;
satBandRXComboBox = new QComboBox; satBandRXComboBox = new QComboBox;
txFreqSpinBox = new QDoubleSpinBox; //txFreqSpinBox = new QDoubleSpinBox;
rxFreqSpinBox = new QDoubleSpinBox; //rxFreqSpinBox = new QDoubleSpinBox;
keepThisDataForNextQSOQcheckbox = new QCheckBox; keepThisDataForNextQSOQcheckbox = new QCheckBox;
dataProxy = dp; dataProxy = dp;
locator = new Locator;
util = new Utilities(Q_FUNC_INFO); util = new Utilities(Q_FUNC_INFO);
createUI(); createUI();
@ -67,7 +66,6 @@ MainWindowSatTab::MainWindowSatTab(DataProxy_SQLite *dp, QWidget *parent) :
} }
MainWindowSatTab::~MainWindowSatTab(){ MainWindowSatTab::~MainWindowSatTab(){
delete(locator);
delete(util); delete(util);
delete(dataProxy); delete(dataProxy);
} }
@ -76,18 +74,16 @@ void MainWindowSatTab::createUI()
{ {
connect(satNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSatNameTextChanged() ) ); connect(satNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSatNameTextChanged() ) );
connect(satModeLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSatModeTextChanged() ) ); connect(satModeLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSatModeTextChanged() ) );
connect(satDXLocatorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSatDXLocTextChanged() ) ); //connect(satDXLocatorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSatDXLocTextChanged() ) );
connect(satNameLineEdit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()) ); connect(satNameLineEdit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()) );
connect(satModeLineEdit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()) ); connect(satModeLineEdit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()) );
connect(satDXLocatorLineEdit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()) ); //connect(satDXLocatorLineEdit, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()) );
connect(satNameComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSatNameComboBoxChanged() ) ) ; connect(satNameComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSatNameComboBoxChanged() ) ) ;
connect(satBandRXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSatBandRXComboBoxChanged()) ) ; connect(satBandRXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSatBandRXComboBoxChanged()) ) ;
connect(satBandTXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSatBandTXComboBoxChanged()) ) ; connect(satBandTXComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSatBandTXComboBoxChanged()) ) ;
connect(txFreqSpinBox, SIGNAL(valueChanged(double)), this, SLOT(slotSatFreqTXChanged(double)) ) ;
connect(rxFreqSpinBox, SIGNAL(valueChanged(double)), this, SLOT(slotSatFreqRXChanged(double)) ) ;
connect (keepThisDataForNextQSOQcheckbox, SIGNAL(clicked()), this, SLOT(slotSatKeepThisDataClicked()) ); connect (keepThisDataForNextQSOQcheckbox, SIGNAL(clicked()), this, SLOT(slotSatKeepThisDataClicked()) );
QLabel *keepLabel = new QLabel(); QLabel *keepLabel = new QLabel();
@ -106,7 +102,6 @@ void MainWindowSatTab::createUI()
satNameComboBox->setToolTip(tr("Select the satellite you are using.")); satNameComboBox->setToolTip(tr("Select the satellite you are using."));
satBandTXComboBox->setToolTip(tr("UpLink band.")); satBandTXComboBox->setToolTip(tr("UpLink band."));
satBandRXComboBox->setToolTip(tr("DownLink band.")); satBandRXComboBox->setToolTip(tr("DownLink band."));
satDXLocatorLineEdit->setToolTip(tr("Locator of the DX station. This box is synchronized with the Locator box in the QSO tab."));
QLabel *upLinkLabel = new QLabel(); QLabel *upLinkLabel = new QLabel();
upLinkLabel->setText(tr("UpLink")); upLinkLabel->setText(tr("UpLink"));
@ -124,21 +119,17 @@ void MainWindowSatTab::createUI()
satModeLabel->setText(tr("Mode")); satModeLabel->setText(tr("Mode"));
satModeLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); satModeLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight);
QLabel *satDXLocLabel = new QLabel();
satDXLocLabel->setText(tr("DX Locator"));
satDXLocLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight);
//QLabel *satOtherLabel = new QLabel(); //QLabel *satOtherLabel = new QLabel();
satOtherLabel->setText(tr("Other")); satOtherLabel->setText(tr("Other"));
satOtherLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); satOtherLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight);
txFreqSpinBox->setDecimals(3); //txFreqSpinBox->setDecimals(3);
txFreqSpinBox->setMaximum(99999); //txFreqSpinBox->setMaximum(99999);
txFreqSpinBox->setSuffix(" " + tr("MHz")); //txFreqSpinBox->setSuffix(" " + tr("MHz"));
rxFreqSpinBox->setDecimals(3); //rxFreqSpinBox->setDecimals(3);
rxFreqSpinBox->setMaximum(99999); //rxFreqSpinBox->setMaximum(99999);
rxFreqSpinBox->setSuffix(" " + tr("MHz")); //rxFreqSpinBox->setSuffix(" " + tr("MHz"));
QHBoxLayout *keepLayout = new QHBoxLayout; QHBoxLayout *keepLayout = new QHBoxLayout;
keepLayout->addWidget(keepLabel); keepLayout->addWidget(keepLabel);
@ -147,8 +138,6 @@ void MainWindowSatTab::createUI()
QHBoxLayout *lastlineLayout = new QHBoxLayout; QHBoxLayout *lastlineLayout = new QHBoxLayout;
//lastlineLayout->addWidget(satModeLabel); //lastlineLayout->addWidget(satModeLabel);
lastlineLayout->addWidget(satModeLineEdit); lastlineLayout->addWidget(satModeLineEdit);
lastlineLayout->addWidget(satDXLocLabel);
lastlineLayout->addWidget(satDXLocatorLineEdit);
QGridLayout *tabLayout = new QGridLayout; QGridLayout *tabLayout = new QGridLayout;
@ -165,8 +154,8 @@ void MainWindowSatTab::createUI()
//tabLayout->addWidget(satModeLineEdit,3,1,1,-1); //tabLayout->addWidget(satModeLineEdit,3,1,1,-1);
tabLayout->addWidget(satNameLineEdit,0,2); tabLayout->addWidget(satNameLineEdit,0,2);
tabLayout->addWidget(txFreqSpinBox,1,2); //tabLayout->addWidget(txFreqSpinBox,1,2);
tabLayout->addWidget(rxFreqSpinBox,2,2); //tabLayout->addWidget(rxFreqSpinBox,2,2);
tabLayout->addLayout(keepLayout,3,2); tabLayout->addLayout(keepLayout,3,2);
tabLayout->setSizeConstraint(QLayout::SetFixedSize); tabLayout->setSizeConstraint(QLayout::SetFixedSize);
@ -175,7 +164,7 @@ void MainWindowSatTab::createUI()
void MainWindowSatTab::slotSatNameComboBoxChanged() void MainWindowSatTab::slotSatNameComboBoxChanged()
{ {
//qDebug() << "MainWindowSatTab::slotSatNameComboBoxChanged: " << satNameComboBox->currentText() << QT_ENDL; //qDebug() << "MainWindowSatTab::slotSatNameComboBoxChanged: " << satNameComboBox->currentText() << QT_ENDL;
if (modifying || (satNameComboBox->currentText().length()<4)) if (modifying || (satNameComboBox->currentText().length()<4))
{ {
return; return;
@ -252,49 +241,6 @@ void MainWindowSatTab::slotSatModeTextChanged()
*/ */
} }
void MainWindowSatTab::setLocator(const QString &_t)
{
//qDebug() << "MainWindowSatTab::setLocator: " << _t << QT_ENDL;
satDXLocatorLineEdit->setText(_t.toUpper());
//qDebug() << "MainWindowSatTab::setLocator - END: " << QT_ENDL;
}
void MainWindowSatTab::slotSatDXLocTextChanged()
{
//qDebug() << "MainWindowSatTab::slotSatDXLocTextChanged: " << satDXLocatorLineEdit->text() << QT_ENDL;
int cursorP = satDXLocatorLineEdit->cursorPosition();
satDXLocatorLineEdit->setText((util->getClearSQLi(satDXLocatorLineEdit->text())).toUpper());
if ( locator->isValidLocator(satDXLocatorLineEdit->text()) )
{
if (getDarkMode())
{
satDXLocatorLineEdit->setPalette(palWhite);
}
else
{
satDXLocatorLineEdit->setPalette(palBlack);
}
satDXLocatorLineEdit->setToolTip(tr("Locator of the DX station. This box is synchronized with the Locator box in the QSO tab."));
//if (!modifying)
//{
// emit dxLocatorChanged((satDXLocatorLineEdit->text()).toUpper());
//}
}
else
{
satDXLocatorLineEdit->setPalette(palRed);
satDXLocatorLineEdit->setToolTip(tr("Locator of the DX station. Format should be Maidenhead like IN70AA up to 10 characters."));
}
satDXLocatorLineEdit->setCursorPosition(cursorP);
emit dxLocatorChanged(satDXLocatorLineEdit->text());
//qDebug() << "MainWindowSatTab::slotSatDXLocTextChanged - END" << QT_ENDL;
}
QString MainWindowSatTab::getSatName() QString MainWindowSatTab::getSatName()
{ {
// Sat name must follow the format CC-NN to make it compatible with LOTW // Sat name must follow the format CC-NN to make it compatible with LOTW
@ -398,14 +344,12 @@ void MainWindowSatTab::clear(bool _full)
modifying = false; modifying = false;
if ((keepThisDataForNextQSOQcheckbox->isChecked()) || (!_full)) if ((keepThisDataForNextQSOQcheckbox->isChecked()) || (!_full))
{ {
satDXLocatorLineEdit->clear();
} }
else else
{ {
satModeLineEdit->clear(); satModeLineEdit->clear();
satNameComboBox->setCurrentIndex(0); satNameComboBox->setCurrentIndex(0);
satNameLineEdit->clear(); satNameLineEdit->clear();
satDXLocatorLineEdit->clear();
} }
if (_full) if (_full)
{ {
@ -532,137 +476,64 @@ void MainWindowSatTab::slotSatBandRXComboBoxChanged()
{ {
return; return;
} }
bool freqInBand = dataProxy->isThisFreqInBand(satBandRXComboBox->currentText(), QString::number(rxFreqSpinBox->value()));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
rxFreqSpinBox->setValue(dataProxy->getLowLimitBandFromBandName(satBandRXComboBox->currentText()));
}
//qDebug() << "MainWindowsatTab::slotSatBandRXComboBoxChanged-END" << QT_ENDL;
autofillSatMode();
}
void MainWindowSatTab::slotSatFreqRXChanged(const double _f) bool freqInBand = dataProxy->isThisFreqInBand(satBandRXComboBox->currentText(), QString::number(freqRX));
{
//qDebug() << Q_FUNC_INFO << ": spingBox: " << QString::number(rxFreqSpinBox->value()) << QT_ENDL;
//qDebug() << Q_FUNC_INFO << ": f: " << QString::number(_f) << QT_ENDL;
//qDebug() << Q_FUNC_INFO << ": freqRx:" << QString::number(freqRX) << QT_ENDL;
if (util->isSameFreq (freqRX, _f))
{
return;
}
freqRX = _f;
if (getDarkMode())
{
rxFreqSpinBox->setPalette(palWhite);
}
else
{
rxFreqSpinBox->setPalette(palBlack);
}
if (modifying)
{
return;
}
int bandId = dataProxy->getBandIdFromFreq(rxFreqSpinBox->value());
if (bandId<1)
{ //This prevent that a non-hamradio frequency is used on TX
//qDebug() << Q_FUNC_INFO << ": Not in band, exiting... " << QT_ENDL;
rxFreqSpinBox->setToolTip(tr("RX Frequency in MHz.\nFrequency is not in a hamradio band!"));
rxFreqSpinBox->setPalette(palRed);
}
else
{
rxFreqSpinBox->setToolTip(tr("RX Frequency in MHz."));
bool freqInBand = dataProxy->isThisFreqInBand(satBandRXComboBox->currentText(), QString::number(rxFreqSpinBox->value()));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
satBandRXComboBox->setCurrentIndex(satBandRXComboBox->findText(dataProxy->getBandNameFromFreq(rxFreqSpinBox->value()), Qt::MatchCaseSensitive));
}
}
emit satRxFreqChanged(rxFreqSpinBox->value());
//qDebug() << Q_FUNC_INFO << " - END";
}
void MainWindowSatTab::slotSatBandTXComboBoxChanged()
{
//qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged: -" << satBandTXComboBox->currentText() << QT_ENDL;
if (updatingBands || modifying || (satBandTXComboBox->currentText().length()<2))
{
return;
}
bool freqInBand = dataProxy->isThisFreqInBand(satBandTXComboBox->currentText(), QString::number(txFreqSpinBox->value()));
if(!freqInBand) if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band { // If the freq does not belong to the current band, we need to update the band
//qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged changing to: Band: " << satBandTXComboBox->currentText() << QT_ENDL; //qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged changing to: Band: " << satBandTXComboBox->currentText() << QT_ENDL;
//qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged changing to: " << QString::number(dataProxy->getLowLimitBandFromBandName(satBandTXComboBox->currentText())) << QT_ENDL; //qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged changing to: " << QString::number(dataProxy->getLowLimitBandFromBandName(satBandTXComboBox->currentText())) << QT_ENDL;
txFreqSpinBox->setValue(dataProxy->getLowLimitBandFromBandName(satBandTXComboBox->currentText()));
//setUpLinkFreq(dataProxy->getLowLimitBandFromBandName(satBandTXComboBox->currentText())); updateRXFreq(dataProxy->getLowLimitBandFromBandName(satBandRXComboBox->currentText()));
}
//qDebug() << "MainWindowsatTab::slotSatBandRXComboBoxChanged-END" << QT_ENDL;
autofillSatMode();
}
void MainWindowSatTab::slotSatBandTXComboBoxChanged()
{
//qDebug() << Q_FUNC_INFO << " - " << satBandTXComboBox->currentText();
if (updatingBands || modifying || (satBandTXComboBox->currentText().length()<2))
{
return;
}
//qDebug() << Q_FUNC_INFO << " - Freq: " << QString::number(freqTX);
QString tmpBand = satBandTXComboBox->currentText();
bool freqInBand = dataProxy->isThisFreqInBand(tmpBand, QString::number(freqTX));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged changing to: Band: " << satBandTXComboBox->currentText() << QT_ENDL;
//qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged changing to: " << QString::number(dataProxy->getLowLimitBandFromBandName(satBandTXComboBox->currentText())) << QT_ENDL;
QString tmpFreq = dataProxy->getFreqFromBandId(dataProxy->getIdFromBandName(satBandTXComboBox->currentText()));
//qDebug() << ": Normal" << dataProxy->getSatelliteUplink(getSatName());
//qDebug() << ": Normal1" << dataProxy->getSatelliteUplink(getSatName(), 1);
//qDebug() << ": Normal2" << dataProxy->getSatelliteUplink(getSatName(), 2);
//qDebug() << ": Full" << dataProxy->getSatelliteFullUplink(getSatName());
double upLink = tmpFreq.toDouble();
double downLink = 0.0;
if (dataProxy->isThisFreqInBand(tmpBand,dataProxy->getSatelliteUplink(getSatName(),1)) )
{
upLink = (dataProxy->getSatelliteUplink(getSatName(),1)).toDouble();
downLink = (dataProxy->getSatelliteDownlink(getSatName(),1)).toDouble();
updateRXFreq(downLink);
}
else if (dataProxy->isThisFreqInBand(tmpBand,dataProxy->getSatelliteUplink(getSatName(),0)) )
{
upLink = (dataProxy->getSatelliteUplink(getSatName(),0)).toDouble();
downLink = (dataProxy->getSatelliteDownlink(getSatName(),1)).toDouble();
updateRXFreq(downLink);
}
updateTXFreq(upLink);
} }
//qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged-END" << QT_ENDL; //qDebug() << "MainWindowsatTab::slotSatBandTXComboBoxChanged-END" << QT_ENDL;
autofillSatMode(); autofillSatMode();
} }
void MainWindowSatTab::slotSatFreqTXChanged(const double _f)
{
//qDebug() << Q_FUNC_INFO << QString::number(txFreqSpinBox->value());
// user changes TX Freq
// If band is real and band is configured, bandcombo is selected
// If band is real and not configured, we launch the band config and select the band.
// if band is real emit the band
if (util->isSameFreq (freqTX, _f))
{
//qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
freqTX = _f;
if (getDarkMode())
{
txFreqSpinBox->setPalette(palWhite);
}
else
{
txFreqSpinBox->setPalette(palBlack);
}
if (modifying)
{
//qDebug() << Q_FUNC_INFO << " - END-2";
return;
}
int bandId = dataProxy->getBandIdFromFreq(txFreqSpinBox->value());
if (bandId<1)
{ //This prevent that a non-hamradio frequency is used on TX
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: Not in band, exiting... " << QT_ENDL;
txFreqSpinBox->setToolTip(tr("TX Frequency in MHz.\nFrequency is not in a hamradio band!"));
txFreqSpinBox->setPalette(palRed);
}
else
{
txFreqSpinBox->setToolTip(tr("TX Frequency in MHz."));
bool freqInBand = dataProxy->isThisFreqInBand(satBandTXComboBox->currentText(), QString::number(txFreqSpinBox->value()));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: If the freq does not belong to the current band, we need to update the band" << QT_ENDL;
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: We define UoLink to: " << dataProxy->getBandNameFromFreq(txFreqSpinBox->value()) << QT_ENDL;
satBandTXComboBox->setCurrentIndex(satBandTXComboBox->findText(dataProxy->getBandNameFromFreq(txFreqSpinBox->value()), Qt::MatchCaseSensitive));
//setUpLinkFreq(dataProxy->getLowLimitBandFromBandName(satBandTXComboBox->currentText()));
}
//autofillSatMode();
}
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: Emitting: " << QString::number(txFreqSpinBox->value()) << QT_ENDL;
emit satTxFreqChanged(txFreqSpinBox->value());
//qDebug() << Q_FUNC_INFO << " - END";
}
void MainWindowSatTab::setUpLink(const QString &_t) void MainWindowSatTab::setUpLink(const QString &_t)
{ {
//qDebug() << Q_FUNC_INFO << "Start: " << _t ; //qDebug() << Q_FUNC_INFO << "Start: " << _t ;
if (satBandTXComboBox->currentText () == _t) if (satBandTXComboBox->currentText () == _t)
{ {
//qDebug() << Q_FUNC_INFO << "END-1"; //qDebug() << Q_FUNC_INFO << "END-1";
@ -671,12 +542,17 @@ void MainWindowSatTab::setUpLink(const QString &_t)
int index = satBandTXComboBox->findText(_t, Qt::MatchCaseSensitive); int index = satBandTXComboBox->findText(_t, Qt::MatchCaseSensitive);
//qDebug() << "MainWindowsatTab::setUpLink: new index: " << QString::number(index) << QT_ENDL; //qDebug() << "MainWindowsatTab::setUpLink: new index: " << QString::number(index) << QT_ENDL;
//qDebug() << "MainWindowsatTab::setUpLink: current index: " << QString::number(satBandTXComboBox->currentIndex()) << QT_ENDL; //qDebug() << "MainWindowsatTab::setUpLink: current index: " << QString::number(satBandTXComboBox->currentIndex()) << QT_ENDL;
int indexRX; //int indexRX;
if (index>=0) if (index>=0)
{ {
satBandTXComboBox->setCurrentIndex(index); satBandTXComboBox->setCurrentIndex(index);
if ( dataProxy->getIdFromBandName("2M") == dataProxy->getIdFromBandName(_t) ) }
{ /*
if (index>=0)
{
satBandTXComboBox->setCurrentIndex(index);
if ( dataProxy->getIdFromBandName("2M") == dataProxy->getIdFromBandName(_t) )
{
//qDebug() << satNameComboBox->currentText() ; //qDebug() << satNameComboBox->currentText() ;
if (satNameComboBox->findText("AO-7 - AMSAT-OSCAT 7", Qt::MatchCaseSensitive)) if (satNameComboBox->findText("AO-7 - AMSAT-OSCAT 7", Qt::MatchCaseSensitive))
{ {
@ -686,7 +562,6 @@ void MainWindowSatTab::setUpLink(const QString &_t)
{ {
indexRX = satBandRXComboBox->findText("70CM", Qt::MatchCaseSensitive); indexRX = satBandRXComboBox->findText("70CM", Qt::MatchCaseSensitive);
} }
satBandRXComboBox->setCurrentIndex(indexRX); satBandRXComboBox->setCurrentIndex(indexRX);
} }
else if ( dataProxy->getIdFromBandName("70CM") == dataProxy->getIdFromBandName(_t) ) else if ( dataProxy->getIdFromBandName("70CM") == dataProxy->getIdFromBandName(_t) )
@ -695,49 +570,133 @@ void MainWindowSatTab::setUpLink(const QString &_t)
satBandRXComboBox->setCurrentIndex(indexRX); satBandRXComboBox->setCurrentIndex(indexRX);
} }
} }
*/
//qDebug() << Q_FUNC_INFO << "END"; //qDebug() << Q_FUNC_INFO << "END";
} }
void MainWindowSatTab::setUpLinkFreq(const double _t) void MainWindowSatTab::setUpLinkFreq(const double _t)
{ {
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_t); //qDebug() << Q_FUNC_INFO << ": " << QString::number(_t);
if (util->isSameFreq (freqTX, _t)) updateTXFreq(_t);
{
//qDebug() << Q_FUNC_INFO << "END-1";
return;
}
txFreqSpinBox->setValue(_t);
setUpLink(dataProxy->getBandNameFromFreq(_t)); setUpLink(dataProxy->getBandNameFromFreq(_t));
//qDebug() << Q_FUNC_INFO << "END"; //qDebug() << Q_FUNC_INFO << "END";
} }
double MainWindowSatTab::getRXFreq() double MainWindowSatTab::getRXFreq()
{ {
//qDebug() << "MainWindowsatTab::getRXFreq " << QT_ENDL; //qDebug() << "MainWindowsatTab::getRXFreq " << QT_ENDL;
return rxFreqSpinBox->value(); return freqRX;
} }
//double MainWindowSatTab::getTXFreq()
//{
// return freqTX;
//}
void MainWindowSatTab::setDownLinkFreq(const double _t) void MainWindowSatTab::setDownLinkFreq(const double _t)
{ {
//qDebug() << "MainWindowsatTab::setDownLinkFreq: " << QString::number(_t) << QT_ENDL; //qDebug() << Q_FUNC_INFO << ": " << QString::number(_t);
if (util->isSameFreq (freqRX, _t)) if (util->isSameFreq (freqRX, _t))
{ {
//qDebug() << Q_FUNC_INFO << " - I same freq"; //qDebug() << Q_FUNC_INFO << " - Is same freq";
return; return;
} }
rxFreqSpinBox->setValue(_t); updateRXFreq(_t);
QString downLinkBand = dataProxy->getBandNameFromFreq(_t); QString downLinkBand = dataProxy->getBandNameFromFreq(freqRX);
int index = satBandRXComboBox->findText(downLinkBand, Qt::MatchCaseSensitive); int index = satBandRXComboBox->findText(downLinkBand, Qt::MatchCaseSensitive);
//qDebug() << Q_FUNC_INFO << ": " << downLinkBand;
if (index>=0) if (index>=0)
{ {
satBandRXComboBox->setCurrentIndex(index); satBandRXComboBox->setCurrentIndex(index);
} }
//qDebug() << Q_FUNC_INFO << " - END";
}
//qDebug() << "MainWindowsatTab::setDownLinkFreq END" << QT_ENDL; void MainWindowSatTab::updateRXFreq(const double _f)
{
//qDebug() << Q_FUNC_INFO << QString::number(_f);
if (util->isSameFreq (freqRX, _f))
{
//qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
freqRX = _f;
if (modifying)
{
//qDebug() << Q_FUNC_INFO << " - END-2";
return;
}
int bandId = dataProxy->getBandIdFromFreq(freqRX);
if (bandId>=1)
{ //This prevent that a non-hamradio frequency is used on TX
//qDebug() << Q_FUNC_INFO << " - Freq not in ham band";
bool freqInBand = dataProxy->isThisFreqInBand(satBandRXComboBox->currentText(), QString::number(freqRX));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << Q_FUNC_INFO << " - Freq in current band";
QString aux;
aux = dataProxy->getBandNameFromFreq(freqRX);
if (satBandRXComboBox->findText(aux, Qt::MatchCaseSensitive)<0)
{
addNewBand(aux);
}
//addNewBand(const QString &_p)
satBandRXComboBox->setCurrentIndex(satBandRXComboBox->findText(aux, Qt::MatchCaseSensitive));
}
}
emit satRxFreqChanged(freqRX);
//qDebug() << Q_FUNC_INFO << " - END";
}
void MainWindowSatTab::updateTXFreq(const double _f)
{
//qDebug() << Q_FUNC_INFO << QString::number(txFreqSpinBox->value());
// user changes TX Freq
// If band is real and band is configured, bandcombo is selected
// If band is real and not configured, we launch the band config and select the band.
// if band is real emit the band
if (util->isSameFreq (freqTX, _f))
{
//qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
freqTX = _f;
if (modifying)
{
//qDebug() << Q_FUNC_INFO << " - END-2";
return;
}
int bandId = dataProxy->getBandIdFromFreq(freqTX);
if (bandId>=1)
{ //This prevent that a non-hamradio frequency is used on TX
bool freqInBand = dataProxy->isThisFreqInBand(satBandTXComboBox->currentText(), QString::number(freqTX));
if(!freqInBand)
{ // If the freq does not belong to the current band, we need to update the band
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: If the freq does not belong to the current band, we need to update the band" << QT_ENDL;
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: We define UpLink to: " << dataProxy->getBandNameFromFreq(txFreqSpinBox->value()) << QT_ENDL;
QString aux = dataProxy->getBandNameFromFreq(freqTX);
//qDebug() << Q_FUNC_INFO << QString("FreqTx = %1 / Band = %2").arg(freqTX).arg(aux);
if (satBandTXComboBox->findText(aux, Qt::MatchCaseSensitive)<0)
{
addNewBand(aux);
}
satBandTXComboBox->setCurrentIndex(satBandTXComboBox->findText(aux, Qt::MatchCaseSensitive));
//setUpLinkFreq(dataProxy->getLowLimitBandFromBandName(satBandTXComboBox->currentText()));
}
//autofillSatMode();
}
//qDebug() << "MainWindowsatTab::slotSatFreqTXChanged: Emitting: " << QString::number(txFreqSpinBox->value()) << QT_ENDL;
emit satTxFreqChanged(freqTX);
//qDebug() << Q_FUNC_INFO << " - END";
} }
void MainWindowSatTab::setBandsOfSat(const QString &_p) void MainWindowSatTab::setBandsOfSat(const QString &_p)
@ -768,8 +727,7 @@ void MainWindowSatTab::setBandsOfSat(const QString &_p)
else else
{ {
//qDebug() << "MainWindowSatTab::setBandsOfSat upLink: setting to ZERO (should be = RX) " << QT_ENDL; //qDebug() << "MainWindowSatTab::setBandsOfSat upLink: setting to ZERO (should be = RX) " << QT_ENDL;
txFreqSpinBox->setValue(0); updateTXFreq(0.0);
//satBandTXComboBox->setCurrentIndex(0);
} }
if (downLink>0) if (downLink>0)
@ -781,7 +739,7 @@ void MainWindowSatTab::setBandsOfSat(const QString &_p)
else else
{ {
//qDebug() << "MainWindowSatTab::setBandsOfSat downLink: setting to ZERO" << QT_ENDL; //qDebug() << "MainWindowSatTab::setBandsOfSat downLink: setting to ZERO" << QT_ENDL;
rxFreqSpinBox->setValue(0); updateRXFreq(0.0);
//satBandRXComboBox->setCurrentIndex(0); //satBandRXComboBox->setCurrentIndex(0);
} }
//qDebug() << "MainWindowSatTab::setBandsOfSat downLink: emiting: " << QString::number(downLink)<< QT_ENDL; //qDebug() << "MainWindowSatTab::setBandsOfSat downLink: emiting: " << QString::number(downLink)<< QT_ENDL;
@ -799,6 +757,8 @@ void MainWindowSatTab::addNewBand(const QString &_p)
} }
QStringList bands; QStringList bands;
bands.clear(); bands.clear();
int indexRX = satBandRXComboBox->currentIndex();
int indexTX = satBandTXComboBox->currentIndex();
//qDebug() << "MainWindowSatTab::addNewBand: RX Id: " << QString::number(satBandRXComboBox->count()) << QT_ENDL; //qDebug() << "MainWindowSatTab::addNewBand: RX Id: " << QString::number(satBandRXComboBox->count()) << QT_ENDL;
//qDebug() << "MainWindowSatTab::addNewBand: TX Id: " << QString::number(satBandTXComboBox->count()) << QT_ENDL; //qDebug() << "MainWindowSatTab::addNewBand: TX Id: " << QString::number(satBandTXComboBox->count()) << QT_ENDL;
@ -817,6 +777,8 @@ void MainWindowSatTab::addNewBand(const QString &_p)
//bands.removeDuplicates(); //bands.removeDuplicates();
emit newBandsToBeAdded(bands); emit newBandsToBeAdded(bands);
satBandRXComboBox->setCurrentIndex(indexRX);
satBandTXComboBox->setCurrentIndex(indexTX);
//addBands(bands); //addBands(bands);
//qDebug() << "MainWindowSatTab::addNewBand: 2 RX Id: " << QString::number(satBandRXComboBox->count()) << QT_ENDL; //qDebug() << "MainWindowSatTab::addNewBand: 2 RX Id: " << QString::number(satBandRXComboBox->count()) << QT_ENDL;
//qDebug() << "MainWindowSatTab::addNewBand: 2 TX Id: " << QString::number(satBandTXComboBox->count()) << QT_ENDL; //qDebug() << "MainWindowSatTab::addNewBand: 2 TX Id: " << QString::number(satBandTXComboBox->count()) << QT_ENDL;
@ -851,8 +813,8 @@ void MainWindowSatTab::slotSatKeepThisDataClicked()
void MainWindowSatTab::autofillSatMode() void MainWindowSatTab::autofillSatMode()
{ {
//qDebug() << Q_FUNC_INFO ; //qDebug() << Q_FUNC_INFO ;
QString downLinkBand = bandToLetter(dataProxy->getBandNameFromFreq(rxFreqSpinBox->value())); QString downLinkBand = bandToLetter(dataProxy->getBandNameFromFreq(freqRX));
QString upLinkBand = bandToLetter(dataProxy->getBandNameFromFreq(txFreqSpinBox->value())); QString upLinkBand = bandToLetter(dataProxy->getBandNameFromFreq(freqTX));
satModeLineEdit->setText(upLinkBand + "/" + downLinkBand); satModeLineEdit->setText(upLinkBand + "/" + downLinkBand);
} }
@ -926,3 +888,4 @@ bool MainWindowSatTab::getDarkMode()
return false; return false;
} }
} }

View File

@ -60,8 +60,10 @@ public:
void setUpLinkFreq(const double _t); void setUpLinkFreq(const double _t);
void setDownLinkFreq(const double _t); void setDownLinkFreq(const double _t);
void updateTXFreq(const double _f);
void updateRXFreq(const double _f);
void setLocator(const QString &_t); //void setLocator(const QString &_t);
void refreshData(); void refreshData();
void setModifying (const bool _m); void setModifying (const bool _m);
void setKeep(const bool _b); void setKeep(const bool _b);
@ -85,12 +87,12 @@ signals:
private slots: private slots:
void slotSatNameTextChanged(); void slotSatNameTextChanged();
void slotSatModeTextChanged(); void slotSatModeTextChanged();
void slotSatDXLocTextChanged(); //void slotSatDXLocTextChanged();
void slotSatNameComboBoxChanged(); void slotSatNameComboBoxChanged();
void slotSatBandRXComboBoxChanged(); void slotSatBandRXComboBoxChanged();
void slotSatBandTXComboBoxChanged(); void slotSatBandTXComboBoxChanged();
void slotSatFreqRXChanged(const double _f); //void slotSatFreqRXChanged(const double _f);
void slotSatFreqTXChanged(const double _f); //void slotSatFreqTXChanged(const double _f);
void slotReturnPressed(); void slotReturnPressed();
void slotSatKeepThisDataClicked(); void slotSatKeepThisDataClicked();

View File

@ -179,6 +179,7 @@ void MainQSOEntryWidget::setLogLevel (const DebugLogLevel _b)
void MainQSOEntryWidget::setCallValidation (const bool _b) void MainQSOEntryWidget::setCallValidation (const bool _b)
{ {
util->setCallValidation(_b); util->setCallValidation(_b);
dataProxy->setCallValidation(_b);
} }
void MainQSOEntryWidget::slotCheckBoxClicked() void MainQSOEntryWidget::slotCheckBoxClicked()

View File

@ -700,7 +700,7 @@ void MainWindow::createActionsCommon(){
connect(hamlib, SIGNAL(freqChanged(double)), this, SLOT(slotHamlibTXFreqChanged(double)) ); connect(hamlib, SIGNAL(freqChanged(double)), this, SLOT(slotHamlibTXFreqChanged(double)) );
connect(hamlib, SIGNAL(modeChanged(QString)), this, SLOT(slotHamlibModeChanged(QString)) ); connect(hamlib, SIGNAL(modeChanged(QString)), this, SLOT(slotHamlibModeChanged(QString)) );
connect(lotwUtilities, SIGNAL(actionProcessLoTWDownloadedFile(QString)), this, SLOT(slotLoTWDownloadedFileProcess(QString)) ); connect(lotwUtilities, SIGNAL(actionProcessLoTWDownloadedFile(QString)), this, SLOT(slotLoTWDownloadedFileProcess(QString)) );
connect(adifLoTWExportWidget, SIGNAL(selection(QString, QDate, QDate, ExportMode)), this, SLOT(slotADIFExportSelection(QString, QDate, QDate, ExportMode)) ); connect(adifLoTWExportWidget, SIGNAL(selection(QString, QString, QDate, QDate, ExportMode)), this, SLOT(slotADIFExportSelection(QString, QString, QDate, QDate, ExportMode)) );
connect(dataProxy, SIGNAL(queryError(QString, QString, QString, QString)), this, SLOT(slotQueryErrorManagement(QString, QString, QString, QString)) ); connect(dataProxy, SIGNAL(queryError(QString, QString, QString, QString)), this, SLOT(slotQueryErrorManagement(QString, QString, QString, QString)) );
connect(dataProxy, SIGNAL(debugLog(QString, QString, DebugLogLevel)), this, SLOT(slotCaptureDebugLogs(QString, QString, DebugLogLevel)) ); connect(dataProxy, SIGNAL(debugLog(QString, QString, DebugLogLevel)), this, SLOT(slotCaptureDebugLogs(QString, QString, DebugLogLevel)) );
@ -5277,6 +5277,7 @@ bool MainWindow::processConfigLine(const QString &_line){
{ {
//myLocator = ; //myLocator = ;
myDataTabWidget->setMyLocator(value.toUpper()); myDataTabWidget->setMyLocator(value.toUpper());
adifLoTWExportWidget->setDefaultMyGrid(value.toUpper());
} }
} }
else if(field=="NEWONECOLOR") else if(field=="NEWONECOLOR")
@ -5591,6 +5592,7 @@ bool MainWindow::processConfigLine(const QString &_line){
util->setCallValidation(util->trueOrFalse (value)); util->setCallValidation(util->trueOrFalse (value));
mainQSOEntryWidget->setCallValidation(util->trueOrFalse (value)); mainQSOEntryWidget->setCallValidation(util->trueOrFalse (value));
filemanager->setCallValidation(util->trueOrFalse (value)); filemanager->setCallValidation(util->trueOrFalse (value));
adifLoTWExportWidget->setCallValidation(util->trueOrFalse (value));
} }
//else if(field=="LATESTBACKUP") //else if(field=="LATESTBACKUP")
//{ //{
@ -5600,7 +5602,7 @@ bool MainWindow::processConfigLine(const QString &_line){
//qDebug() << "MainWindow::processConfigLine: NONE: " << QT_ENDL; //qDebug() << "MainWindow::processConfigLine: NONE: " << QT_ENDL;
//} //}
// Lines are: Option = value; // Format of lines is: Option = value;
//qDebug() << Q_FUNC_INFO << "(" << field << "/" << value << ")" << " - END"; //qDebug() << Q_FUNC_INFO << "(" << field << "/" << value << ")" << " - END";
logEvent(Q_FUNC_INFO, "END", Debug); logEvent(Q_FUNC_INFO, "END", Debug);
return true; return true;
@ -5973,11 +5975,11 @@ void MainWindow::showNumberOfSavedQSO(const QString &_fn, const int _n)
//qDebug() << "MainWindow::showNumberOfSavedQSO - END" << QT_ENDL; //qDebug() << "MainWindow::showNumberOfSavedQSO - END" << QT_ENDL;
} }
void MainWindow::fileExportADIF(const QString &_st, const QDate &_startDate, const QDate &_endDate) void MainWindow::fileExportADIF(const QString &_st, const QString &_grid, const QDate &_startDate, const QDate &_endDate)
{ {
//qDebug() << "MainWindow::fileExportADIF " << _st << QT_ENDL; //qDebug() << "MainWindow::fileExportADIF " << _st << QT_ENDL;
QString fileName = QFileDialog::getSaveFileName(this, tr("Save ADIF File"), util->getHomeDir(), "ADIF (*.adi *.adif)"); QString fileName = QFileDialog::getSaveFileName(this, tr("Save ADIF File"), util->getHomeDir(), "ADIF (*.adi *.adif)");
QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _st, _startDate, _endDate, currentLog, ModeADIF); QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _st, _grid, _startDate, _endDate, currentLog, ModeADIF);
showNumberOfSavedQSO(fileName, qsos.count()); showNumberOfSavedQSO(fileName, qsos.count());
@ -6003,7 +6005,7 @@ void MainWindow::slotADIFExportAll()
fileName = fileName + ".adi"; fileName = fileName + ".adi";
} }
//qDebug() << "MainWindow::slotADIFExportAll-1: " << fileName << QT_ENDL; //qDebug() << "MainWindow::slotADIFExportAll-1: " << fileName << QT_ENDL;
QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _callToUse, dataProxy->getFirstQSODateFromCall(_callToUse), dataProxy->getLastQSODateFromCall(_callToUse), -1, ModeADIF); QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _callToUse, QString(), dataProxy->getFirstQSODateFromCall(_callToUse), dataProxy->getLastQSODateFromCall(_callToUse), -1, ModeADIF);
//qDebug() << "MainWindow::slotADIFExportAll-3" << QT_ENDL; //qDebug() << "MainWindow::slotADIFExportAll-3" << QT_ENDL;
showNumberOfSavedQSO(fileName, qsos.count()); showNumberOfSavedQSO(fileName, qsos.count());
@ -6011,9 +6013,9 @@ void MainWindow::slotADIFExportAll()
logEvent(Q_FUNC_INFO, "END", Debug); logEvent(Q_FUNC_INFO, "END", Debug);
} }
void MainWindow::fileExportLoTW(const QString &_st, const QDate &_startDate, const QDate &_endDate) void MainWindow::fileExportLoTW(const QString &_st, const QString &_grid, const QDate &_startDate, const QDate &_endDate)
{ {
//qDebug() << "MainWindow::fileExportLoTW - Start: " << _st << "/" <<_startDate.toString("yyyyMMdd") <<"/" << _endDate.toString("yyyyMMdd") << QT_ENDL; qDebug() << "MainWindow::fileExportLoTW - Start: " << _st << "/" << _grid <<_startDate.toString("yyyyMMdd") <<"/" << _endDate.toString("yyyyMMdd") << QT_ENDL;
QMessageBox msgBox; QMessageBox msgBox;
@ -6041,7 +6043,7 @@ void MainWindow::fileExportLoTW(const QString &_st, const QDate &_startDate, con
QString fileName = util->getLoTWAdifFile(); QString fileName = util->getLoTWAdifFile();
QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _st, _startDate, _endDate, currentLog, ModeLotW); QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _st, _grid, _startDate, _endDate, currentLog, ModeLotW);
if (qsos.count() <= 0) if (qsos.count() <= 0)
{ // TODO: Check if errors should be managed. { // TODO: Check if errors should be managed.
@ -6131,7 +6133,7 @@ void MainWindow::fileExportClubLog(const QString &_st, const QDate &_startDate,
//QString fileName = "klog-clublog-upload.adi"; //QString fileName = "klog-clublog-upload.adi";
QString fileName = util->getClubLogFile(); QString fileName = util->getClubLogFile();
QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _st, _startDate, _endDate, currentLog, ModeClubLog); QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _st, QString(), _startDate, _endDate, currentLog, ModeClubLog);
if (qsos.count() <= 0) if (qsos.count() <= 0)
{ // TODO: Check if errors should be managed. { // TODO: Check if errors should be managed.
@ -6193,7 +6195,7 @@ void MainWindow::fileExportEQSL(const QString &_st, const QDate &_startDate, con
//QString fileName = "klog-eqsl-upload.adi"; //QString fileName = "klog-eqsl-upload.adi";
QString fileName = util->getEQSLFile(); QString fileName = util->getEQSLFile();
QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _st, _startDate, _endDate, currentLog, ModeEQSL); QList<int> qsos = filemanager->adifLogExportReturnList(fileName, _st, QString(), _startDate, _endDate, currentLog, ModeEQSL);
if (qsos.count() <= 0) if (qsos.count() <= 0)
{ // TODO: Check if errors should be managed. { // TODO: Check if errors should be managed.
@ -6206,7 +6208,7 @@ void MainWindow::fileExportEQSL(const QString &_st, const QDate &_startDate, con
//qDebug() << "MainWindow::fileExportEQSL -END " << QT_ENDL; //qDebug() << "MainWindow::fileExportEQSL -END " << QT_ENDL;
} }
void MainWindow::slotADIFExportSelection(const QString &_st, const QDate &_startDate, const QDate &_endDate, const ExportMode _eM) void MainWindow::slotADIFExportSelection(const QString &_st, const QString &_grid, const QDate &_startDate, const QDate &_endDate, const ExportMode _eM)
{ {
//qDebug() << "MainWindow::slotADIFExportSelection - Start: " << _st << "/" <<_startDate.toString("yyyyMMdd") <<"/" << _endDate.toString("yyyyMMdd") << QT_ENDL; //qDebug() << "MainWindow::slotADIFExportSelection - Start: " << _st << "/" <<_startDate.toString("yyyyMMdd") <<"/" << _endDate.toString("yyyyMMdd") << QT_ENDL;
@ -6214,11 +6216,11 @@ void MainWindow::slotADIFExportSelection(const QString &_st, const QDate &_start
{ {
case ModeADIF: // General ADIF case ModeADIF: // General ADIF
//qDebug() << "MainWindow::slotADIFExportSelection - ADIF" << QT_ENDL; //qDebug() << "MainWindow::slotADIFExportSelection - ADIF" << QT_ENDL;
fileExportADIF(_st, _startDate, _endDate); fileExportADIF(_st, _grid, _startDate, _endDate);
break; break;
case ModeLotW: // LoTW case ModeLotW: // LoTW
//qDebug() << "MainWindow::slotADIFExportSelection - LoTW" << QT_ENDL; //qDebug() << "MainWindow::slotADIFExportSelection - LoTW" << QT_ENDL;
fileExportLoTW(_st, _startDate, _endDate); fileExportLoTW(_st, _grid, _startDate, _endDate);
break; break;
case ModeClubLog: // General ADIF case ModeClubLog: // General ADIF
//qDebug() << "MainWindow::slotADIFExportSelection - ClubLog" << QT_ENDL; //qDebug() << "MainWindow::slotADIFExportSelection - ClubLog" << QT_ENDL;
@ -6758,7 +6760,7 @@ void MainWindow::qsoToEdit (const int _qso)
aux1 = (query.value(nameCol)).toString(); aux1 = (query.value(nameCol)).toString();
//qDebug() << "MainWindow::qsoToEdit: - GRIDSQUARE: " << aux1 << QT_ENDL; //qDebug() << "MainWindow::qsoToEdit: - GRIDSQUARE: " << aux1 << QT_ENDL;
QSOTabWidget->setDXLocator(aux1); QSOTabWidget->setDXLocator(aux1);
satTabWidget->setLocator(aux1); //satTabWidget->setLocator(aux1);
nameCol = rec.indexOf("operator"); nameCol = rec.indexOf("operator");
aux1 = (query.value(nameCol)).toString(); aux1 = (query.value(nameCol)).toString();
@ -7099,7 +7101,7 @@ void MainWindow::slotLocatorTextChanged(const QString &_loc)
if ( locator->isValidLocator(_loc) ) if ( locator->isValidLocator(_loc) )
{ {
infoWidget->showDistanceAndBearing(myDataTabWidget->getMyLocator(), _loc); infoWidget->showDistanceAndBearing(myDataTabWidget->getMyLocator(), _loc);
satTabWidget->setLocator(_loc); //satTabWidget->setLocator(_loc);
} }
logEvent(Q_FUNC_INFO, "END", Debug); logEvent(Q_FUNC_INFO, "END", Debug);
} }
@ -7107,7 +7109,7 @@ void MainWindow::slotLocatorTextChanged(const QString &_loc)
void MainWindow::slotMyLocatorTextChanged(const QString &_loc) void MainWindow::slotMyLocatorTextChanged(const QString &_loc)
{ {
//qDebug() << "MainWindowMy::slotMyLocatorTextChanged: " <<_loc << QT_ENDL; //qDebug() << "MainWindowMy::slotMyLocatorTextChanged: " <<_loc << QT_ENDL;
logEvent(Q_FUNC_INFO, "Start", Debug); logEvent(Q_FUNC_INFO, "Start", Debug);
if ( locator->isValidLocator(_loc)) if ( locator->isValidLocator(_loc))
{ {
@ -8644,7 +8646,7 @@ void MainWindow::backupCurrentQSO()
logEvent(Q_FUNC_INFO, "- 061", Devel); logEvent(Q_FUNC_INFO, "- 061", Devel);
qso->setOperatorCallsign (myDataTabWidget->getOperator ()); qso->setOperatorCallsign (myDataTabWidget->getOperator ());
logEvent(Q_FUNC_INFO, "- 062", Devel); logEvent(Q_FUNC_INFO, "- 062", Devel);
bool ok = qso->setStationCallsign (myDataTabWidget->getStationCallsign ()); qso->setStationCallsign (myDataTabWidget->getStationCallsign ());
//qDebug() << Q_FUNC_INFO << ": Previous went: " << util->boolToQString(ok); //qDebug() << Q_FUNC_INFO << ": Previous went: " << util->boolToQString(ok);
logEvent(Q_FUNC_INFO, "- 063", Devel); logEvent(Q_FUNC_INFO, "- 063", Devel);
qso->setMySOTA_REF (myDataTabWidget->getMySOTA ()); qso->setMySOTA_REF (myDataTabWidget->getMySOTA ());

View File

@ -204,7 +204,7 @@ private slots:
void slotLoTWExport(); void slotLoTWExport();
void slotLoTWDownload(); void slotLoTWDownload();
void slotLoTWFullDownload(); void slotLoTWFullDownload();
void slotADIFExportSelection(const QString &_st, const QDate &_startDate, const QDate &_endDate, const ExportMode _eM); void slotADIFExportSelection(const QString &_st, const QString &_grid, const QDate &_startDate, const QDate &_endDate, const ExportMode _eM);
void slotADIFExportAll(); void slotADIFExportAll();
void slotADIFImport(); void slotADIFImport();
@ -336,10 +336,10 @@ private:
bool setUDPServer(const bool _b); bool setUDPServer(const bool _b);
void logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level); void logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level);
void setLogLevel(const DebugLogLevel _sev); void setLogLevel(const DebugLogLevel _sev);
void fileExportLoTW(const QString &_st, const QDate &_startDate, const QDate &_endDate); void fileExportLoTW(const QString &_st, const QString &_grid, const QDate &_startDate, const QDate &_endDate);
void fileExportClubLog(const QString &_st, const QDate &_startDate, const QDate &_endDate); void fileExportClubLog(const QString &_st, const QDate &_startDate, const QDate &_endDate);
void fileExportEQSL(const QString &_st, const QDate &_startDate, const QDate &_endDate); void fileExportEQSL(const QString &_st, const QDate &_startDate, const QDate &_endDate);
void fileExportADIF(const QString &_st, const QDate &_startDate, const QDate &_endDate); void fileExportADIF(const QString &_st, const QString &_grid, const QDate &_startDate, const QDate &_endDate);
bool callTQSL(const QString &_filename, const QString &_call); bool callTQSL(const QString &_filename, const QString &_call);
void showNumberOfSavedQSO(const QString &_fn, const int _n); void showNumberOfSavedQSO(const QString &_fn, const int _n);
//QString getCallToUseForLoTWExportUpload(); //QString getCallToUseForLoTWExportUpload();

View File

@ -30,7 +30,7 @@
Utilities::Utilities(const QString &_parentName) Utilities::Utilities(const QString &_parentName)
{ {
parentName = _parentName; parentName = _parentName;
//qDebug() << "Utilities::Utilities" ; qDebug() << Q_FUNC_INFO << " (" << _parentName << ")";
init(); init();
} }
@ -40,6 +40,7 @@ Utilities::~Utilities()
void Utilities::init() void Utilities::init()
{ {
qDebug() << Q_FUNC_INFO << " - Start";
validateCalls = false; validateCalls = false;
softwareVersion = "0.0"; softwareVersion = "0.0";
longPrefixes.clear(); longPrefixes.clear();
@ -53,7 +54,7 @@ void Utilities::init()
logLevels << "None" << "Info" << "Debug" << "Devel"; logLevels << "None" << "Info" << "Debug" << "Devel";
setLogColumnNames(); setLogColumnNames();
//callValidation = true; qDebug() << Q_FUNC_INFO << " - END";
} }
void Utilities::setLogLevel(DebugLogLevel _l) void Utilities::setLogLevel(DebugLogLevel _l)
@ -728,11 +729,10 @@ bool Utilities::isAPrefix (const QString &_c)
void Utilities::setLongPrefixes (const QStringList &_p) void Utilities::setLongPrefixes (const QStringList &_p)
{ {
//qDebug() << Q_FUNC_INFO << ": Start count: " << QString::number(_p.count()); qDebug() << Q_FUNC_INFO << ": Start count: " << QString::number(_p.count());
longPrefixes.clear(); longPrefixes.clear();
//longPrefixes = _p;
longPrefixes.append(_p); longPrefixes.append(_p);
//qDebug() << Q_FUNC_INFO << ": count: " << QString::number(longPrefixes.count()); qDebug() << Q_FUNC_INFO << ": count: " << QString::number(longPrefixes.count());
} }
void Utilities::setSpecialCalls (const QStringList &_p) void Utilities::setSpecialCalls (const QStringList &_p)
@ -914,24 +914,28 @@ QString Utilities::getMainCallFromComplexCall(const QString &_complexCall)
return call; return call;
} }
bool Utilities::isValidCall(const QString &_c) bool Utilities::isValidCall(const QString &_c, bool _force)
{// https://life.itu.int/radioclub/rr/art19.pdf {// https://life.itu.int/radioclub/rr/art19.pdf
//logEvent (QString("%1-%2").arg(Q_FUNC_INFO).arg(parentName), QString("Start = %1").arg(_c), Debug); //logEvent (QString("%1-%2").arg(Q_FUNC_INFO).arg(parentName), QString("Start = %1").arg(_c), Debug);
//qDebug() << QString("%1-%2").arg(Q_FUNC_INFO).arg(parentName) << "Start: " << _c; //qDebug() << QString("%1-%2").arg(Q_FUNC_INFO).arg(parentName) << "Start: " << _c;
//qDebug() << Q_FUNC_INFO << ": " << _c; qDebug() << Q_FUNC_INFO << ": " << _c;
// Prefixes are at least 2 chars // Prefixes are at least 2 chars
if (!validateCalls)
if ((!validateCalls) && (!_force))
{ {
//qDebug() << Q_FUNC_INFO << "001 - Not validating calls: " << _c; qDebug() << Q_FUNC_INFO << "001 - Not validating calls: " << _c;
//logEvent (QString("%1-%2").arg(Q_FUNC_INFO).arg(parentName), QString("END - 001 - true"), Debug); //logEvent (QString("%1-%2").arg(Q_FUNC_INFO).arg(parentName), QString("END - 001 - true"), Debug);
return true; return true;
} }
qDebug() << Q_FUNC_INFO << " - Long prefixes: " << QString::number(longPrefixes.count());
if (longPrefixes.count()<100) if (longPrefixes.count()<100)
{ {
qDebug() << Q_FUNC_INFO << "Long prefixes < 100 " << _c;
return false; return false;
} }
QString call = _c; QString call = _c;
//qDebug() << Q_FUNC_INFO << "000 " << _c; qDebug() << Q_FUNC_INFO << "000 " << _c;
if (isAKnownCall(call)) if (isAKnownCall(call))
{ {
//qDebug() << Q_FUNC_INFO << "001 - Known call: " << _c; //qDebug() << Q_FUNC_INFO << "001 - Known call: " << _c;

View File

@ -98,7 +98,7 @@ public:
// Validations // Validations
bool isValidDate(const QDate _d); bool isValidDate(const QDate _d);
bool isValidDateTime(const QString &_d); bool isValidDateTime(const QString &_d);
bool isValidCall(const QString &_c); bool isValidCall(const QString &_c, bool _force=false);
bool isSameFreq(const double fr1, const double fr2); bool isSameFreq(const double fr1, const double fr2);
bool isValidBandId(const int _b); bool isValidBandId(const int _b);

View File

@ -32,9 +32,12 @@ AdifLoTWExportWidget::AdifLoTWExportWidget(DataProxy_SQLite *dp, const QString &
//qDebug() << ": " << _parentFunction; //qDebug() << ": " << _parentFunction;
#else #else
#endif #endif
qDebug() << Q_FUNC_INFO << " - Start: " + _parentFunction;
dataProxy = dp; dataProxy = dp;
starting = true;
util = new Utilities(Q_FUNC_INFO); util = new Utilities(Q_FUNC_INFO);
util->setLongPrefixes(dataProxy->getLongPrefixes());
util->setSpecialCalls(dataProxy->getSpecialCallsigns());
stationCallsignComboBox = new QComboBox; stationCallsignComboBox = new QComboBox;
myGridSquareComboBox = new QComboBox; myGridSquareComboBox = new QComboBox;
startDate = new QDateEdit; startDate = new QDateEdit;
@ -46,9 +49,12 @@ AdifLoTWExportWidget::AdifLoTWExportWidget(DataProxy_SQLite *dp, const QString &
numberLabel = new QLabel; numberLabel = new QLabel;
selectedEMode = ModeLotW; //By default this widget will be used for LoTW Export. selectedEMode = ModeLotW; //By default this widget will be used for LoTW Export.
defaultStationCallsign = QString(); defaultStationCallsign = QString();
defaultMyGrid = QString();
util->setLongPrefixes(dataProxy->getLongPrefixes()); util->setLongPrefixes(dataProxy->getLongPrefixes());
util->setSpecialCalls(dataProxy->getSpecialCallsigns()); util->setSpecialCalls(dataProxy->getSpecialCallsigns());
createUI(); createUI();
starting = false;
qDebug() << Q_FUNC_INFO << " - END";
} }
AdifLoTWExportWidget::~AdifLoTWExportWidget() AdifLoTWExportWidget::~AdifLoTWExportWidget()
{ {
@ -57,14 +63,27 @@ AdifLoTWExportWidget::~AdifLoTWExportWidget()
void AdifLoTWExportWidget::setDefaultStationCallsign(const QString &_st) void AdifLoTWExportWidget::setDefaultStationCallsign(const QString &_st)
{ {
qDebug() << Q_FUNC_INFO << " - Start";
if (util->isValidCall(_st)) if (util->isValidCall(_st))
{ {
defaultStationCallsign = _st; defaultStationCallsign = _st;
} }
qDebug() << Q_FUNC_INFO << " - END";
}
void AdifLoTWExportWidget::setDefaultMyGrid(const QString &_st)
{
qDebug() << Q_FUNC_INFO << " - Start";
if (util->isValidGrid(_st))
{
defaultMyGrid = _st;
}
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::createUI() void AdifLoTWExportWidget::createUI()
{ {
qDebug() << Q_FUNC_INFO << " - Start";
//fillStationCallsignComboBox(); //fillStationCallsignComboBox();
tableWidget->setSortingEnabled (true); tableWidget->setSortingEnabled (true);
stationCallsignComboBox->setToolTip(tr("Select the Station Callsign that you want to use to upload the log.")); stationCallsignComboBox->setToolTip(tr("Select the Station Callsign that you want to use to upload the log."));
@ -77,7 +96,6 @@ void AdifLoTWExportWidget::createUI()
//endDate->setDate(QDate::currentDate()); //endDate->setDate(QDate::currentDate());
endDate->setToolTip(tr("Select the end date to export the QSOs. The default date is the date of the last QSO with this station callsign.")); endDate->setToolTip(tr("Select the end date to export the QSOs. The default date is the date of the last QSO with this station callsign."));
QLabel *stationLabel = new QLabel; QLabel *stationLabel = new QLabel;
stationLabel->setText(tr("Station callsign")); stationLabel->setText(tr("Station callsign"));
@ -93,7 +111,6 @@ void AdifLoTWExportWidget::createUI()
okButton->setText(tr("Ok")); okButton->setText(tr("Ok"));
cancelButton->setText(tr("Cancel")); cancelButton->setText(tr("Cancel"));
hv = tableWidget->verticalHeader(); hv = tableWidget->verticalHeader();
hv->hide(); hv->hide();
hv->setStretchLastSection(true); hv->setStretchLastSection(true);
@ -105,8 +122,6 @@ void AdifLoTWExportWidget::createUI()
tableWidget->setColumnCount(header.length()); tableWidget->setColumnCount(header.length());
tableWidget->setHorizontalHeaderLabels(header); tableWidget->setHorizontalHeaderLabels(header);
QGridLayout *mainLayout = new QGridLayout; QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(topLabel, 0, 0, 1, -1); mainLayout->addWidget(topLabel, 0, 0, 1, -1);
mainLayout->addWidget(stationLabel, 1, 0); mainLayout->addWidget(stationLabel, 1, 0);
@ -131,184 +146,252 @@ void AdifLoTWExportWidget::createUI()
connect(myGridSquareComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotMyGridChanged() ) ) ; connect(myGridSquareComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotMyGridChanged() ) ) ;
connect(okButton, SIGNAL(clicked()), this, SLOT(slotOKPushButtonClicked() ) ); connect(okButton, SIGNAL(clicked()), this, SLOT(slotOKPushButtonClicked() ) );
connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCancelPushButtonClicked() ) ); connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCancelPushButtonClicked() ) );
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::setDefaultStationComboBox() void AdifLoTWExportWidget::setDefaultStationComboBox()
{ {
qDebug() << Q_FUNC_INFO << " - Start";
//stationCallsignComboBox->blockSignals(true);
if (!util->isValidCall(defaultStationCallsign)) if (!util->isValidCall(defaultStationCallsign))
{ {
qDebug() << Q_FUNC_INFO << " - END-1";
//stationCallsignComboBox->blockSignals(false);
return; return;
} }
if (stationCallsignComboBox->findText(defaultStationCallsign, Qt::MatchCaseSensitive) >= 0) if (stationCallsignComboBox->findText(defaultStationCallsign, Qt::MatchCaseSensitive) >= 0)
{ {
stationCallsignComboBox->setCurrentIndex(stationCallsignComboBox->findText(defaultStationCallsign, Qt::MatchCaseSensitive)); stationCallsignComboBox->setCurrentIndex(stationCallsignComboBox->findText(defaultStationCallsign, Qt::MatchCaseSensitive));
} }
//stationCallsignComboBox->blockSignals(false);
qDebug() << Q_FUNC_INFO << " - END";
}
void AdifLoTWExportWidget::setDefaultMyGridComboBox()
{
qDebug() << Q_FUNC_INFO << " - Start";
if (!util->isValidGrid(defaultMyGrid))
{
qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
if (myGridSquareComboBox->findText(defaultMyGrid, Qt::MatchCaseSensitive) >= 0)
{
myGridSquareComboBox->setCurrentIndex(myGridSquareComboBox->findText(defaultMyGrid, Qt::MatchCaseSensitive));
qDebug() << Q_FUNC_INFO << ": 1: " << myGridSquareComboBox->currentText();
}
else if (myGridSquareComboBox->count()>=3)
{
myGridSquareComboBox->findText(myGridSquareComboBox->itemText(2), Qt::MatchCaseSensitive);
qDebug() << Q_FUNC_INFO << ": 2: " << myGridSquareComboBox->currentText();
}
else
{
qDebug() << Q_FUNC_INFO << ": 3";
}
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::fillStationCallsignComboBox() void AdifLoTWExportWidget::fillStationCallsignComboBox()
{ {
//qDebug() << "AdifLoTWExportWidget::fillStationCallsignComboBox" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - Start";
//qDebug() << "AdifLoTWExportWidget::fillStationCallsignComboBox: " << QString::number(stationCallsignComboBox->count()) << QT_ENDL; //stationCallsignComboBox->blockSignals(true);
stationCallsignComboBox->clear(); stationCallsignComboBox->clear();
//qDebug() << "AdifLoTWExportWidget::fillStationCallsignComboBox-1" << QT_ENDL; qDebug() << Q_FUNC_INFO << " -1" ;
stationCallsignComboBox->addItem(tr("Not defined")); stationCallsignComboBox->addItem(tr("Not defined"));
//qDebug() << "AdifLoTWExportWidget::fillStationCallsignComboBox-2" << QT_ENDL; qDebug() << Q_FUNC_INFO << " -2" ;
if (currentExportMode == ModeADIF) if (currentExportMode == ModeADIF)
{ {
//qDebug() << "AdifLoTWExportWidget::fillStationCallsignComboBox-3" << QT_ENDL; qDebug() << Q_FUNC_INFO << " -3";
stationCallsignComboBox->addItem(tr("All")); stationCallsignComboBox->addItem(tr("ALL"));
//qDebug() << "AdifLoTWExportWidget::fillStationCallsignComboBox-4" << QT_ENDL; qDebug() << Q_FUNC_INFO << " -4";
} }
//qDebug() << "AdifLoTWExportWidget::fillStationCallsignComboBox-99" << QString::number(currentExportMode); if (currentExportMode == ModeLotW)
stationCallsignComboBox->addItems(dataProxy->getStationCallSignsFromLogWithLoTWPendingToSend(logNumber)); {
//qDebug() << "AdifLoTWExportWidget::fillStationCallsignComboBox-END" << QT_ENDL; qDebug() << Q_FUNC_INFO << " -3";
stationCallsignComboBox->addItems(dataProxy->getStationCallSignsFromLogWithLoTWPendingToSend(logNumber));
qDebug() << Q_FUNC_INFO << " -4";
}
else
{
qDebug() << Q_FUNC_INFO << " -5";
stationCallsignComboBox->addItems(dataProxy->getStationCallSignsFromLog(logNumber));
qDebug() << Q_FUNC_INFO << " -6";
}
//stationCallsignComboBox->blockSignals(false);
qDebug() << QString::number(stationCallsignComboBox->count());
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::fillStationMyGridComboBox() void AdifLoTWExportWidget::fillStationMyGridComboBox()
{ {
//qDebug() << Q_FUNC_INFO << " - Start"; qDebug() << Q_FUNC_INFO << " - Start";
// Keep the grid that is shown now // Keep the grid that is shown now
// clean and fill the combo. // clean and fill the combo.
// If the saved locator is in the list, it is selected. // If the saved locator is in the list, it is selected.
//myGridSquareComboBox->blockSignals(true);
QString tempGrid = myGridSquareComboBox->currentText (); QString tempGrid = myGridSquareComboBox->currentText ();
myGridSquareComboBox->clear(); myGridSquareComboBox->clear();
myGridSquareComboBox->addItem(tr("Not defined"));
QStringList grids; QStringList grids;
grids.clear (); grids.clear ();
grids.append (dataProxy->getGridsToBeSent (stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), true, logNumber)); if (currentExportMode != ModeLotW)
myGridSquareComboBox->addItems(grids); {
myGridSquareComboBox->addItem(tr("Not defined"));
myGridSquareComboBox->addItem(tr("ALL"));
grids.append (dataProxy->getGridsToBeSent (stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), false, logNumber));
}
else
{
grids.append (dataProxy->getGridsToBeSent (stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), true, logNumber));
}
myGridSquareComboBox->addItems(grids);
if (myGridSquareComboBox->findText(tempGrid, Qt::MatchCaseSensitive) >= 0) if (myGridSquareComboBox->findText(tempGrid, Qt::MatchCaseSensitive) >= 0)
{ {
myGridSquareComboBox->setCurrentIndex(myGridSquareComboBox->findText(tempGrid, Qt::MatchCaseSensitive)); myGridSquareComboBox->setCurrentIndex(myGridSquareComboBox->findText(tempGrid, Qt::MatchCaseSensitive));
} }
//myGridSquareComboBox->blockSignals(false);
//qDebug() << Q_FUNC_INFO << " - END"; qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::setTopLabel(const QString &_t) void AdifLoTWExportWidget::setTopLabel(const QString &_t)
{ {
qDebug() << Q_FUNC_INFO << " - Start";
topLabel->setText(_t); topLabel->setText(_t);
qDebug() << Q_FUNC_INFO << " - END";
}
void AdifLoTWExportWidget::fillDates()
{
// Shows the first and last QSO done with one specific callsign.
qDebug() << Q_FUNC_INFO << " - Start";
//startDate->blockSignals(true);
//endDate->blockSignals(true);
startDate->setDate(dataProxy->getFirstQSODateFromCall(stationCallsignComboBox->currentText()));
endDate->setDate(dataProxy->getLastQSODateFromCall(stationCallsignComboBox->currentText()));
//startDate->blockSignals(false);
//endDate->blockSignals(false);
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::fillTable() void AdifLoTWExportWidget::fillTable()
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable " << QT_ENDL; qDebug() << Q_FUNC_INFO << " - Start";
QList<int> qsos; QList<int> qsos;
qsos.clear(); qsos.clear();
bool justQueued = true; bool justQueued = true;
switch (currentExportMode) switch (currentExportMode)
{ {
case ModeADIF: case ModeADIF:
justQueued = false; justQueued = false;
//qDebug() << "AdifLoTWExportWidget::fillTable ADIF" << QT_ENDL; qDebug() << Q_FUNC_INFO << " ADIF";
break; break;
case ModeLotW: case ModeLotW:
//qDebug() << "AdifLoTWExportWidget::fillTable LoTW" << QT_ENDL; qDebug() << Q_FUNC_INFO << " LoTW";
justQueued = true; justQueued = true;
break; break;
case ModeClubLog: case ModeClubLog:
//qDebug() << "AdifLoTWExportWidget::fillTable ClubLog" << QT_ENDL; qDebug() << Q_FUNC_INFO << " ClubLog";
//justQueued = true; //justQueued = true;
break; break;
case ModeEQSL: case ModeEQSL:
//qDebug() << "AdifLoTWExportWidget::fillTable EQSL" << QT_ENDL; qDebug() << Q_FUNC_INFO << " EQSL";
justQueued = true; justQueued = true;
break; break;
case ModeQRZ: case ModeQRZ:
//qDebug() << "AdifLoTWExportWidget::fillTable QRZ" << QT_ENDL; qDebug() << Q_FUNC_INFO << " QRZ";
justQueued = true; justQueued = true;
break; break;
} }
if (stationCallsignComboBox->currentIndex() == 0) if (stationCallsignComboBox->currentIndex() == 0)
{ // Not defined station_callsign (blank) { // Not defined station_callsign (blank)
//qDebug() << "AdifLoTWExportWidget::fillTable blank station callsign " << QT_ENDL; qDebug() << Q_FUNC_INFO << " blank station callsign ";
qsos.append(dataProxy->getQSOsListLoTWToSend(QString(), myGridSquareComboBox->currentText(), startDate->date(), endDate->date(), justQueued, logNumber)); qsos.append(dataProxy->getQSOsListLoTWToSend(QString(), myGridSquareComboBox->currentText(), startDate->date(), endDate->date(), justQueued, logNumber));
} }
else if((stationCallsignComboBox->currentIndex() == 1) && (currentExportMode == ModeADIF)) else if((stationCallsignComboBox->currentIndex() == 1) && (currentExportMode == ModeADIF))
{ // ALL stations, no matter the station. { // ALL stations, no matter the station.
//qDebug() << "AdifLoTWExportWidget::fillTable ALL station callsign " << QT_ENDL; qDebug() << Q_FUNC_INFO << " ALL station callsign ";
qsos.append(dataProxy->getQSOsListLoTWToSend("ALL", myGridSquareComboBox->currentText (), startDate->date(), endDate->date(), justQueued, logNumber)); qsos.append(dataProxy->getQSOsListLoTWToSend("ALL", myGridSquareComboBox->currentText (), startDate->date(), endDate->date(), justQueued, logNumber));
//qsos.append(dataProxy->getQSOsListToBeExported(stationCallsignComboBox->currentText(), startDate->date(), endDate->date()));
} }
else else
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable OTHER station callsign " << QT_ENDL; qDebug() << Q_FUNC_INFO << " OTHER station callsign ";
if (currentExportMode == ModeClubLog) if (currentExportMode == ModeClubLog)
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable Mode ClubLog" << QT_ENDL; qDebug() << Q_FUNC_INFO << " Mode ClubLog";
qsos.append(dataProxy->getQSOsListClubLogToSent(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), true, logNumber)); qsos.append(dataProxy->getQSOsListClubLogToSent(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), true, logNumber));
} }
else if (currentExportMode == ModeEQSL) else if (currentExportMode == ModeEQSL)
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable Mode eQSL" << QT_ENDL; qDebug() << Q_FUNC_INFO << " Mode eQSL";
qsos.append(dataProxy->getQSOsListEQSLToSent(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), true)); qsos.append(dataProxy->getQSOsListEQSLToSent(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), true));
} }
else if (currentExportMode == ModeQRZ) else if (currentExportMode == ModeQRZ)
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable Mode QRZ" << QT_ENDL; qDebug() << Q_FUNC_INFO << " Mode QRZ";
qsos.append(dataProxy->getQSOsListQRZCOMToSent(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), true)); qsos.append(dataProxy->getQSOsListQRZCOMToSent(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), true));
} }
else if (currentExportMode == ModeLotW) else if (currentExportMode == ModeLotW)
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable Mode QRZ" << QT_ENDL; qDebug() << Q_FUNC_INFO << " Mode LoTW";
qsos.append(dataProxy->getQSOsListLoTWToSend (stationCallsignComboBox->currentText(), myGridSquareComboBox->currentText (), startDate->date(), endDate->date(), true, logNumber)); qsos.append(dataProxy->getQSOsListLoTWToSend (stationCallsignComboBox->currentText(), myGridSquareComboBox->currentText (), startDate->date(), endDate->date(), true, logNumber));
//qsos.append(dataProxy->getQSOsListQRZCOMToSent(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), true));
} }
else else
{//(currentExportMode == ModeADIF) {//(currentExportMode == ModeADIF)
//qDebug() << "AdifLoTWExportWidget::fillTable Mode LoTW" << QT_ENDL; qDebug() << Q_FUNC_INFO << " Mode ELSE";
qsos.append(dataProxy->getQSOsListToBeExported(stationCallsignComboBox->currentText(), startDate->date(), endDate->date())); qsos.append(dataProxy->getQSOsListToBeExported(stationCallsignComboBox->currentText(), myGridSquareComboBox->currentText(), startDate->date(), endDate->date()));
} }
} }
//qDebug() << "AdifLoTWExportWidget::fillTable: -3" << QT_ENDL; //qDebug() << Q_FUNC_INFO << " -3" ;
tableWidget->clearContents(); tableWidget->clearContents();
tableWidget->setRowCount(0); tableWidget->setRowCount(0);
if (tableWidget->columnCount()>0) if (tableWidget->columnCount()>0)
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable pre FOR" << QT_ENDL; //qDebug() << Q_FUNC_INFO << " pre FOR";
for (int i=0; i<qsos.length(); i++) for (int i=0; i<qsos.length(); i++)
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable in FOR " << QString::number(i) << QT_ENDL; //qDebug() << Q_FUNC_INFO << " in FOR " << QString::number(i);
addQSO(qsos.at(i)); addQSO(qsos.at(i));
} }
} }
numberLabel->setText(tr("QSOs: ") + QString::number(qsos.count())); numberLabel->setText(tr("QSOs: ") + QString::number(qsos.count()));
if (qsos.count()>0) if (qsos.count()>0)
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable Enable OKButton" << QT_ENDL; //qDebug() << Q_FUNC_INFO << " Enable OKButton";
okButton->setEnabled(true); okButton->setEnabled(true);
} }
else else
{ {
//qDebug() << "AdifLoTWExportWidget::fillTable Disable OKButton" << QT_ENDL; //qDebug() << Q_FUNC_INFO << " Disable OKButton";
okButton->setEnabled(false); okButton->setEnabled(false);
} }
//qDebug() << "AdifLoTWExportWidget::fillTable END" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::addQSO(const int _qsoID) void AdifLoTWExportWidget::addQSO(const int _qsoID)
{ {
//qDebug() << "AdifLoTWExportWidget::addQSO: " << QString::number(_qsoID) << QT_ENDL; //qDebug() << "AdifLoTWExportWidget::addQSO: " << QString::number(_qsoID);
//qDebug() << Q_FUNC_INFO << " - Start";
QStringList qsoToAdd; QStringList qsoToAdd;
qsoToAdd.clear(); qsoToAdd.clear();
qsoToAdd << dataProxy->getQSODetailsForLoTWDownload(_qsoID); qsoToAdd << dataProxy->getQSODetailsForLoTWDownload(_qsoID);
//qDebug() << "AdifLoTWExportWidget::addQSO: Columns: " << QString::number(tableWidget->columnCount()) << QT_ENDL; //qDebug() << "AdifLoTWExportWidget::addQSO: Columns: " << QString::number(tableWidget->columnCount());
//qDebug() << "AdifLoTWExportWidget::addQSO: qsoToAdd-length: " << QString::number(qsoToAdd.length()) << QT_ENDL; //qDebug() << "AdifLoTWExportWidget::addQSO: qsoToAdd-length: " << QString::number(qsoToAdd.length());
if (qsoToAdd.length() == tableWidget->columnCount()) if (qsoToAdd.length() == tableWidget->columnCount())
{ {
@ -316,104 +399,151 @@ void AdifLoTWExportWidget::addQSO(const int _qsoID)
for (int i = 0; i<qsoToAdd.length(); i++) for (int i = 0; i<qsoToAdd.length(); i++)
{ {
//qDebug() << "AdifLoTWExportWidget::addQSO: qsoToAdd.at(i): " << qsoToAdd.at(i) << QT_ENDL; //qDebug() << "AdifLoTWExportWidget::addQSO: qsoToAdd.at(i): " << qsoToAdd.at(i);
QTableWidgetItem *newItemID = new QTableWidgetItem(qsoToAdd.at(i)); QTableWidgetItem *newItemID = new QTableWidgetItem(qsoToAdd.at(i));
newItemID->setTextAlignment(Qt::AlignCenter); newItemID->setTextAlignment(Qt::AlignCenter);
newItemID->setFlags(Qt::NoItemFlags); newItemID->setFlags(Qt::NoItemFlags);
tableWidget->setItem(tableWidget->rowCount()-1, i, newItemID); tableWidget->setItem(tableWidget->rowCount()-1, i, newItemID);
} }
} }
//qDebug() << Q_FUNC_INFO << " - END";
//qDebug() << "AdifLoTWExportWidget::addQSO: - END" << QT_ENDL;
} }
void AdifLoTWExportWidget::slotStationCallsignChanged() void AdifLoTWExportWidget::slotStationCallsignChanged()
{ {
//qDebug() << "AdifLoTWExportWidget::slotStationCallsignChanged" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - Start";
if (stationCallsignComboBox->count()<1) if (starting)
{ {
//qDebug() << "AdifLoTWExportWidget::slotStationCallsignChanged count <1 " << QT_ENDL; qDebug() << Q_FUNC_INFO << " - END-1";
return; return;
} }
//qDebug() << "AdifLoTWExportWidget::slotStationCallsignChanged-01" << QT_ENDL; if (stationCallsignComboBox->count()<1)
startDate->setDate(dataProxy->getFirstQSODateFromCall(stationCallsignComboBox->currentText())); {
//qDebug() << "AdifLoTWExportWidget::slotStationCallsignChanged-02" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - END-1";
endDate->setDate(dataProxy->getLastQSODateFromCall(stationCallsignComboBox->currentText())); return;
//qDebug() << "AdifLoTWExportWidget::slotStationCallsignChanged-03" << QT_ENDL; }
//qDebug() << Q_FUNC_INFO << " - 01" ;
fillDates();
//qDebug() << Q_FUNC_INFO << " - 03" ;
fillStationMyGridComboBox(); fillStationMyGridComboBox();
fillTable (); updateIfNeeded();
qDebug() << Q_FUNC_INFO << " - END";
}
//qDebug() << "AdifLoTWExportWidget::slotStationCallsignChanged - END" << QT_ENDL; void AdifLoTWExportWidget::updateIfNeeded()
{
if (currentCall != stationCallsignComboBox->currentText())
{
fillTable();
}
else if (currentGrid != myGridSquareComboBox->currentText())
{
fillTable();
}
else if (currentStart != startDate->date())
{
fillTable();
}
else if (currentEnd != endDate->date())
{
fillTable();
}
} }
void AdifLoTWExportWidget::slotMyGridChanged() void AdifLoTWExportWidget::slotMyGridChanged()
{ {
qDebug() << Q_FUNC_INFO << " - Start: " << myGridSquareComboBox->currentText();
if (starting)
{
qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
fillTable(); fillTable();
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::slotDateChanged() void AdifLoTWExportWidget::slotDateChanged()
{ {
//slotStationCallsignChanged(); qDebug() << Q_FUNC_INFO << " - Start";
slotStationCallsignChanged (); if (starting)
{
qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
updateIfNeeded();
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::slotOKPushButtonClicked() void AdifLoTWExportWidget::slotOKPushButtonClicked()
{ {
//qDebug() << "AdifLoTWExportWidget::slotOKPushButtonClicked" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - Start";
this->hide(); this->hide();
if (stationCallsignComboBox->currentIndex() == 0) if (stationCallsignComboBox->currentIndex() == 0)
{ {
emit selection("NOT", startDate->date(), endDate->date(), currentExportMode); emit selection("NOT", myGridSquareComboBox->currentText(), startDate->date(), endDate->date(), currentExportMode);
} }
else if (stationCallsignComboBox->currentIndex() == 1) else if (stationCallsignComboBox->currentIndex() == 1)
{ {
if ((currentExportMode == ModeLotW) || (currentExportMode == ModeClubLog) || (currentExportMode == ModeQRZ)|| (currentExportMode == ModeEQSL)) if ((currentExportMode == ModeLotW) || (currentExportMode == ModeClubLog) || (currentExportMode == ModeQRZ)|| (currentExportMode == ModeEQSL))
{ {
emit selection(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), currentExportMode); emit selection(stationCallsignComboBox->currentText(), myGridSquareComboBox->currentText(), startDate->date(), endDate->date(), currentExportMode);
} }
else else
{ {
emit selection("ALL", startDate->date(), endDate->date(), currentExportMode); emit selection("ALL", myGridSquareComboBox->currentText(), startDate->date(), endDate->date(), currentExportMode);
} }
} }
else else
{ {
emit selection(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), currentExportMode); emit selection(stationCallsignComboBox->currentText(), myGridSquareComboBox->currentText(), startDate->date(), endDate->date(), currentExportMode);
} }
//qDebug() << "AdifLoTWExportWidget::slotOKPushButtonClicked - END" << QT_ENDL; //qDebug() << "AdifLoTWExportWidget::slotOKPushButtonClicked - END";
close(); close();
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::slotCancelPushButtonClicked() void AdifLoTWExportWidget::slotCancelPushButtonClicked()
{ {
//qDebug() << "AdifLoTWExportWidget::slotCancelPushButtonClicked" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - Start";
close(); close();
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::closeEvent(QCloseEvent *event) void AdifLoTWExportWidget::closeEvent(QCloseEvent *event)
{ {
//qDebug() << "AdifLoTWExportWidget::closeEvent" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - Start";
event->accept(); event->accept();
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::showEvent(QShowEvent *event) void AdifLoTWExportWidget::showEvent(QShowEvent *event)
{ {
//qDebug() << "AdifLoTWExportWidget::showEvent" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - Start";
starting = true;
startDate->setDate(dataProxy->getFirstQSODateFromCall(stationCallsignComboBox->currentText())); //myGridSquareComboBox->blockSignals(true);
endDate->setDate(dataProxy->getLastQSODateFromCall(stationCallsignComboBox->currentText())); //stationCallsignComboBox->blockSignals(true);
//startDate->blockSignals(true);
//endDate->blockSignals(true);
fillStationCallsignComboBox();
qDebug() << Q_FUNC_INFO << ": 1 - " << stationCallsignComboBox->currentText();
setDefaultStationComboBox(); setDefaultStationComboBox();
qDebug() << Q_FUNC_INFO << ": 2 - " << stationCallsignComboBox->currentText();
fillDates();
qDebug() << Q_FUNC_INFO << ": 3 - " << stationCallsignComboBox->currentText();
fillStationMyGridComboBox();
setDefaultMyGridComboBox();
qDebug() << Q_FUNC_INFO << ": 4 - " << stationCallsignComboBox->currentText();
starting = false;
updateIfNeeded();
qDebug() << Q_FUNC_INFO << ": 5 - " << stationCallsignComboBox->currentText();
event->accept(); event->accept();
//qDebug() << "AdifLoTWExportWidget::showEvent - END" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::setExportMode(const ExportMode _EMode) void AdifLoTWExportWidget::setExportMode(const ExportMode _EMode)
{ {
//qDebug() << "AdifLoTWExportWidget::setExportMode" << QT_ENDL; qDebug() << Q_FUNC_INFO << " - Start";
currentExportMode = _EMode; currentExportMode = _EMode;
if (currentExportMode == ModeLotW) if (currentExportMode == ModeLotW)
{ {
@ -440,12 +570,14 @@ void AdifLoTWExportWidget::setExportMode(const ExportMode _EMode)
setWindowTitle("KLog - QSOs to be exported to ADIF."); setWindowTitle("KLog - QSOs to be exported to ADIF.");
topLabel->setText(tr("This table shows the QSOs that will be exported to ADIF.")); topLabel->setText(tr("This table shows the QSOs that will be exported to ADIF."));
} }
fillStationCallsignComboBox(); //fillStationCallsignComboBox();
//qDebug() << "AdifLoTWExportWidget::setExportMode-END" << QT_ENDL; //slotStationCallsignChanged();
qDebug() << Q_FUNC_INFO << " - END";
} }
void AdifLoTWExportWidget::setLogNumber(const int _logN) void AdifLoTWExportWidget::setLogNumber(const int _logN)
{ {
qDebug() << Q_FUNC_INFO << " - Start";
if (dataProxy->doesThisLogExist (_logN)) if (dataProxy->doesThisLogExist (_logN))
{ {
logNumber = _logN; logNumber = _logN;
@ -454,4 +586,11 @@ void AdifLoTWExportWidget::setLogNumber(const int _logN)
{ {
logNumber = -1; logNumber = -1;
} }
qDebug() << Q_FUNC_INFO << " - END";
}
void AdifLoTWExportWidget::setCallValidation(const bool _v)
{
util->setCallValidation(_v);
dataProxy->setCallValidation(_v);
} }

View File

@ -42,6 +42,8 @@ public:
void setExportMode(const ExportMode _EMode); void setExportMode(const ExportMode _EMode);
void setLogNumber(const int _logN); void setLogNumber(const int _logN);
void setDefaultStationCallsign(const QString &_st); void setDefaultStationCallsign(const QString &_st);
void setDefaultMyGrid(const QString &_st);
void setCallValidation(const bool _v);
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
@ -55,7 +57,7 @@ private slots:
void slotMyGridChanged(); void slotMyGridChanged();
signals: signals:
void selection(QString _st, QDate _startD, QDate _endD, ExportMode _exportMode); void selection(QString _st, QString _grid, QDate _startD, QDate _endD, ExportMode _exportMode);
private: private:
void createUI(); void createUI();
@ -64,7 +66,10 @@ private:
void addQSO(const int _qsoID); void addQSO(const int _qsoID);
void fillStationCallsignComboBox(); void fillStationCallsignComboBox();
void fillStationMyGridComboBox(); void fillStationMyGridComboBox();
void fillDates();
void setDefaultStationComboBox(); void setDefaultStationComboBox();
void setDefaultMyGridComboBox();
void updateIfNeeded();
DataProxy_SQLite *dataProxy; DataProxy_SQLite *dataProxy;
Utilities *util; Utilities *util;
@ -81,7 +86,11 @@ private:
ExportMode currentExportMode; ExportMode currentExportMode;
int logNumber; int logNumber;
QString defaultStationCallsign; QString defaultStationCallsign, defaultMyGrid;
QString currentCall, currentGrid;
QDate currentStart, currentEnd;
bool starting;
}; };

View File

@ -47,7 +47,6 @@ private slots:
void test_Constructor(); void test_Constructor();
void test_SatMode(); void test_SatMode();
private: private:
DataProxy_SQLite *dataProxy; DataProxy_SQLite *dataProxy;
MainWindowSatTab *mainWindowSattab; MainWindowSatTab *mainWindowSattab;
@ -106,7 +105,9 @@ void tst_MainQSOEntryWidget::test_SatMode()
freq = dataProxy->getLowLimitBandFromBandName("2M"); freq = dataProxy->getLowLimitBandFromBandName("2M");
mainWindowSattab->setUpLinkFreq(freq); mainWindowSattab->setUpLinkFreq(freq);
mainWindowSattab->setDownLinkFreq(freq); mainWindowSattab->setDownLinkFreq(freq);
//qDebug() << mainWindowSattab->getSatMode() << endl; //qDebug() << mainWindowSattab->getSatMode();
//qDebug() << QString::number(mainWindowSattab->getRXFreq());
//qDebug() << QString::number(mainWindowSattab->getTXFreq());
QVERIFY2(mainWindowSattab->getSatMode() == "V/V", "2m Mode not V"); QVERIFY2(mainWindowSattab->getSatMode() == "V/V", "2m Mode not V");
//qDebug() << Q_FUNC_INFO << ": 70cm"; //qDebug() << Q_FUNC_INFO << ": 70cm";
@ -128,9 +129,9 @@ void tst_MainQSOEntryWidget::test_SatMode()
QVERIFY2(mainWindowSattab->getSatMode() == "S/S", "13cm Mode not S"); QVERIFY2(mainWindowSattab->getSatMode() == "S/S", "13cm Mode not S");
//qDebug() << Q_FUNC_INFO << ": 6cm" ; //qDebug() << Q_FUNC_INFO << ": 6cm" ;
//freq = dataProxy->getLowLimitBandFromBandName("6CM"); freq = dataProxy->getLowLimitBandFromBandName("6CM");
//mainWindowSattab->setUpLinkFreq(freq); mainWindowSattab->setUpLinkFreq(freq);
//mainWindowSattab->setDownLinkFreq(freq); mainWindowSattab->setDownLinkFreq(freq);
//QVERIFY2(mainWindowSattab->getSatMode() == "C/C", "6cm Mode not C"); //QVERIFY2(mainWindowSattab->getSatMode() == "C/C", "6cm Mode not C");
//qDebug() << Q_FUNC_INFO << ": 3cm" ; //qDebug() << Q_FUNC_INFO << ": 3cm" ;

View File

@ -261,6 +261,8 @@ void tst_Utilities::test_isValidCall()
QVERIFY2(util->isValidCall("EA4"), "Should be true: EA4"); QVERIFY2(util->isValidCall("EA4"), "Should be true: EA4");
QVERIFY2(util->isValidCall("-"), "Should be true: EAK4"); QVERIFY2(util->isValidCall("-"), "Should be true: EAK4");
QVERIFY2(util->isValidCall("QQQ/EA4K"), "Should be true: QQQ/EA4K"); QVERIFY2(util->isValidCall("QQQ/EA4K"), "Should be true: QQQ/EA4K");
QVERIFY2(util->isValidCall("EA4K", true), "EA4K forced");
QVERIFY2(!util->isValidCall("EAK", true), "EAK forced");
util->setCallValidation (true); util->setCallValidation (true);
} }