klog-2.4.1/ 0000755 0001750 0001750 00000000000 15003153303 011423 5 ustar devel devel klog-2.4.1/logwindow.h 0000644 0001750 0001750 00000014770 15003153303 013616 0 ustar devel devel #ifndef KLOG_LOGWINDOW_H
#define KLOG_LOGWINDOW_H
/***************************************************************************
logwindow.h - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include "dataproxy_sqlite.h"
#include "logmodel.h"
#include "awards.h"
#include "utilities.h"
class LogWindow : public QWidget
{
Q_OBJECT
friend class tst_LogWindow;
public:
LogWindow(Awards *awards, QWidget *parent = nullptr);
~LogWindow();
void createlogPanel(const int _currentLog);
void clear();
void refresh();
void setCurrentLog(const int _currentLog);
void qslSentViaBureau(const int _qsoId); //Maybe this could be defined as private and call it with an action, if needed.
void qslRecViaBureau(const int _qsoId); //Maybe this could be defined as private and call it with an action, if needed.
void qslRecViaDirect(const int _qsoId);
bool isQSLReceived(const int _qsoId);
bool isQSLSent(const int _qsoId);
//void setProxyModel (const bool _p);
void sortColumn(const int _c);
void setColumns(const QStringList &_columns);
signals:
void actionQSODoubleClicked(const int _qsoid);
void actionDeleteQSO(const int _qsoid);
void updateAwards();
void updateSearchText();
//void qsoFound(const QStringList _qs); // Each: QString with format: Fieldname:value
void queryError(QString functionFailed, QString errorCodeS, QString nativeError, QString failedQuery); // To alert about any failed query execution
//void clearError();
void deleteTheseQSOs(QList _qsos);
void exportToADIFTheseQSOs(QList _qsos);
void uploadToQRZcomTheseQSOs(QList _qsos);
private slots:
void slotDoubleClickLog(const QModelIndex & index);
void slotRighButtonFromLog(const QPoint& pos);
void slotQSLSentViaBureauFromLog();
void slotQSLSentViaDirectFromLog();
void slotQSLRecViaDirectFromLog();
void slotQSLRecViaBureauFromLog();
void slotQsoDeleteFromLog();
void slotQSOToEditFromLog();
void slotQueryErrorManagement(QString functionFailed, QString errorCodeS, QString nativeError, QString failedQuery);
void slotCheckQRZCom();
void slotCheckDXHeatCom();
void slotQSOsDeselectAll();
void slotQSOsSelectAll();
void slotQSOsDeleteFromLog();
void slotQSOsExportFromLog();
void slotQSOsUploadToLoTWFromLog();
void slotQSOsUploadToClubLogFromLog();
void slotQSOsUploadToEQSLFromLog();
void slotMultipleQSLSentViaBureauFromLog();
void slotMultipleQSLSentViaDirectFromLog();
void slotMultipleQSLRecViaBureauFromLog();
void slotMultipleQSLRecViaDirectFromLog();
void slotQSOsQRZUploadFromLog();
void slotOnSectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);
private:
void createUI();
void createActionsCommon();
void createActions();
void retoreColumsOrder();
void deleteQSO(const int _qsoID);
void rightButtonFromLogMenu(const int trow);
void rightButtonMultipleFromLogMenu();
void showMenuRightButtonFromLogCreateActions();
void showColumn(const QString &_columnName);
void setDefaultData();
void setColumnsOfLog(const QStringList &_columns);
QStringList getOrderedVisibleHeaders() const;
DataProxy_SQLite *dataProxy;
LogModel *logModel;
//QItemSelectionModel *selectionModel;
Awards *awards;
//DXCCStatusWidget *dxccStatusWidget;
//eLogClubLog *elogClublog;
QTableView *logView;
QLabel *logLabel;
QAction *delQSOFromLogAct;
QAction *qsoToEditFromLogAct;
QAction *qslSentViaBureauFromLogAct;
QAction *qslSentViaDirectFromLogAct;
QAction *qslRecViaBureauFromLogAct;
QAction *qslRecViaDirectFromLogAct;
QAction *checkQRZCOMFromLogAct;
QAction *checkDXHeatFromLogAct;
//Multiple selection actions
QAction *multipleDeselectAll;
QAction *multipleSelectAll;
QAction *multipleDelQSOsFromLogAct;
QAction *multipleExportToADIFFromLogAct;
QAction *multipleQueueForLoTWFromLogAct;
QAction *multipleQueueForClubLogFromLogAct;
QAction *multipleQueueForQRZCOMFromLogAct;
QAction *multipleQueueForEQSLFromLogAct;
QAction *multipleQslSentViaBureauFromLogAct;
QAction *multipleQslSentViaDirectFromLogAct;
QAction *multipleQslRecViaBureauFromLogAct;
QAction *multipleQslRecViaDirectFromLogAct;
//QAction *moveToAnotherLog; // MOves the selected QSOs to another log.
int currentLog;
Utilities *util;
QStringList columns;
//LogViewSortFilterProxyModel *proxyModel;
//bool sortingThroughProxyModel;
};
/*
class ItemDelegate: public QStyledItemDelegate
{
Q_OBJECT
public:
ItemDelegate(QWidget *parent=nullptr){}
QString displayText(const QVariant &value, const QLocale &locale) const;
//QString displayText (const QVariant &value);
};
*/
#endif // LOGWINDOW_H
klog-2.4.1/elogclublog.cpp 0000644 0001750 0001750 00000062175 15003153303 014440 0 ustar devel devel /***************************************************************************
elogclublog.cpp - description
-------------------
begin : feb 2015
copyright : (C) 2015 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include "elogclublog.h"
#include
#include
#include
#include
//#include
//https://clublog.freshdesk.com/support/solutions/59800
eLogClubLog::eLogClubLog()
{
//qDebug()<< "eLogClubLog::eLogClubLog" ;
//email = QString();
//pass = QString();
qsos.clear();
api = "9467beee93377e82a276b0a777d388b5c933d044";
currentQSO = -1;
manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotQsoUploadFinished(QNetworkReply*)));
//stationCallsign = QString();
uploadingFile = false;
util = new Utilities(Q_FUNC_INFO);
//qDebug()<< "eLogClubLog::eLogClubLog - END" ;
}
eLogClubLog::~eLogClubLog()
{
delete(util);
delete(manager);
//qDebug()<< "eLogClubLog::~eLogClubLog" ;
}
void eLogClubLog::slotQsoUploadFinished(QNetworkReply *data)
{
//qDebug()<< "eLogClubLog::slotQsoUploadFinished" ;
result = data->error();
//qDebug()<< Q_FUNC_INFO << " - Result = " << QString::number(result);
const QByteArray sdata = data->readAll();
QString text = QString();
if (currentQSO>0)
{
emit actionReturnDownload(result, currentQSO);
currentQSO = -1;
}
if (result == QNetworkReply::NoError)
{
text = "ClubLog: " + prepareToTranslate(sdata);
//qDebug()<< sdata;
//qDebug()<< Q_FUNC_INFO << " - NO ERROR";
if (uploadingFile)
{
uploadingFile = false;
emit signalFileUploaded(result, qsos);
qsos.clear();
return;
}
}
else if (result == QNetworkReply::HostNotFoundError)
{
//qDebug()<< Q_FUNC_INFO << " - Result = Host Not found! = " << QString::number(result) ;
text = "ClubLog: " + tr("Host not found!");
//TODO: Mark the previous QSO as not sent to clublog
}
else if (result == QNetworkReply::TimeoutError)
{
//qDebug()<< Q_FUNC_INFO << " - Result = Time out error! = " << QString::number(result) ;
text = "ClubLog: " + tr("Timeout error!");
//TODO: Mark the previous QSO as not sent to clublog
}
else if (result == 201)
{
text = "ClubLog: " + tr("It seems to be a CREDENTIALS ERROR; check your email and password.");
QMessageBox::warning(nullptr, tr("KLog - ClubLog"),
tr("It seems that your ClubLog credentials are not correct.") + "\n" +
tr("Please check your credentials in the setup. ClubLog uploads will be disabled."),
QMessageBox::Ok);
emit disableClubLogAction(true);
}
/*
else if (result == 202)
{
//qDebug()<< Q_FUNC_INFO << " - Result = Password Error! = " << QString::number(result) ;
text = "ClubLog: " + tr("It seems to be a PASSWORD ERROR; check your password.");
int i = QMessageBox::warning(nullptr, tr("KLog - ClubLog"),
tr("It seems that your ClubLog password is not correct.") + "\n" +
tr("Please check your password in the setup. ClubLog uploads will be disabled."),
QMessageBox::Ok);
emit disableClubLogAction(true);
//TODO: Mark the previous QSO as not sent to clublog
}
*/
else if (result == 203)
{
text = "ClubLog: " + tr("QSO dupe or not existing (#%1)... ").arg(result);
QMessageBox::warning(nullptr, tr("KLog - ClubLog"),
tr("We have received an undefined error from Clublog (%1)").arg(result) + "\n" +
tr("This error may be caused for the QSO being duplicated or, if removing, trying to remove a non existing QSO."),
QMessageBox::Ok);
}
else
{
//qDebug()<< Q_FUNC_INFO << " - Result = UNDEFINED = " << QString::number(result) ;
text = "ClubLog: " + tr("Undefined error number (#%1)... ").arg(result);
QMessageBox::warning(nullptr, tr("KLog - ClubLog"),
tr("We have received an undefined error from Clublog (%1)").arg(result) + "\n" +
tr("Please check your config in the setup and contact the KLog development team if you can't fix it. ClubLog uploads will be disabled."),
QMessageBox::Ok);
emit disableClubLogAction(true);
//TODO: Mark the previous QSO as not sent to clublog
}
//qDebug()<< Q_FUNC_INFO << " - Result = " << QString::number(result);
//qDebug()<< Q_FUNC_INFO << " - Result Text = " << text;
//emit done();
//emit signalFileUploaded(result, qsos);
emit showMessage(text);
}
void eLogClubLog::slotFileUploadFinished(QNetworkReply *data)
{
//qDebug()<< "eLogClubLog::slotFileUploadFinished" ;
result = data->error();
//qDebug()<< "eLogClubLog::slotFileUploadFinished - Result = " << QString::number(result);
const QByteArray sdata = data->readAll();
QString text;
if (result == QNetworkReply::NoError)
{
text = "ClubLog: " + prepareToTranslate(sdata);
//qDebug()<< "eLogClubLog::slotFileUploadFinished - Result = NoError = " << QString::number(result) ;
//qDebug()<< sdata;
}
else if (result == QNetworkReply::HostNotFoundError)
{
//qDebug()<< "eLogClubLog::slotFileUploadFinished - Result = Host Not found! = " << QString::number(result) ;
text = "ClubLog: " + tr("Host not found!");
}
else if (result == QNetworkReply::TimeoutError)
{
//qDebug()<< "eLogClubLog::slotFileUploadFinished - Result = Time out error! = " << QString::number(result) ;
text = "ClubLog: " + tr("Timeout error!");
}
else
{
//qDebug()<< "eLogClubLog::slotFileUploadFinished - Result = UNDEFINED = " << QString::number(result) ;
text = "ClubLog: " + tr("Undefined error...");
}
//qDebug()<< "eLogClubLog::slotFileUploadFinished - Result = " << QString::number(result);
//emit done();
emit showMessage(text);
}
void eLogClubLog::downloadProgress(qint64 received, qint64 total) {
//qDebug()<< "eLogClubLog::downloadProgress: " << QString::number(received) << "/" << QString::number(total);
//qDebug()<< received << total;
emit actionShowProgres(received, total);
}
void eLogClubLog::slotErrorManagement(QNetworkReply::NetworkError networkError)
{
//qDebug()<< "eLogClubLog::slotErrorManagement: " << QString::number(networkError);
result = networkError;
}
int eLogClubLog::sendQSO(QStringList _qso)
{
//qDebug() << "eLogClubLog::sendQSO: " << email << "/" << pass << "/" << api ;
//qDebug()<< "eLogClubLog::sendQSO:: length = " << QString::number(_qso.length());
// First Data in the QStringList is the QSO id, not to be sent to clublog but used in the signal actionReturnDownload(const int _i, const int _qsoId);
for(int i = 0; i<_qso.length(); i++)
{
//qDebug()<< "eLogClubLog::sendQSO = qso-at: "<< QString::number(i) << "- " << _qso.at(i);
}
if (_qso.length()!=18)
{
//qDebug() << "eLogClubLog::sendQSO:: length - END";
return -1;
}
currentQSO = (_qso.at(0)).toInt();
_qso.removeFirst();
//_qso.removeFirst();
//qDebug()<< "eLogClubLog::sendQSO CALL TO USE (before checking): " << _qso.at(16);
//qDebug()<< "eLogClubLog::sendQSO default StationCallsign): " << stationCallsign;
QString tempCall = _qso.at(16);
if (tempCall.length()<1)
{
tempCall = stationCallsign;
}
//qDebug()<< "eLogClubLog::sendQSO CALL TO USE: " << tempCall;
_qso.removeLast();
QString qso = getClubLogAdif(_qso);
//qDebug()<< "eLogClubLog::sendQSO: " << qso;
QUrlQuery params;
params.addQueryItem("adif",qso);
//qDebug() << "eLogClubLog::sendQSO: QSO: " << qso;
//qDebug() << "eLogClubLog::sendQSO: END";
uploadingFile = false;
return sendDataParams(tempCall, params, true);
//return sendData(tempCall, qso);
}
/*
int eLogClubLog::deleteQSOid(const int _qsoId)
{
//qDebug()<< "eLogClubLog::deleteQSOid: " << QString::number(_qsoId);
// email, password, callsign, dxcall, datetime, bandid, api
QString dxcall, datatime, bandid;
QUrlQuery params;
params
}
*/
int eLogClubLog::sendDataParams(const QString &_clublogCall, const QUrlQuery &_params, bool _adding)
{
//qDebug()<< Q_FUNC_INFO << ": Call: " << _clublogCall;
//qDebug()<< Q_FUNC_INFO << ": : Params: " << _params.query(QUrl::FullyEncoded).toUtf8();
//qDebug()<< Q_FUNC_INFO << ": email = " << email;
//qDebug()<< Q_FUNC_INFO << ": Pass = " << pass;
QUrl serviceUrl;
if (_adding)
{
//serviceUrl = QUrl("https://secure.clublog.org/realtime.php");
serviceUrl = QUrl("https://clublog.org/realtime.php");
}
else
{
//serviceUrl = QUrl("https://secure.clublog.org/delete.php");
serviceUrl = QUrl("https://clublog.org/delete.php");
}
QByteArray postData;
QUrlQuery params;
params.addQueryItem("email",email);
params.addQueryItem("password",pass);
if (_clublogCall.length()>2)
{
params.addQueryItem("callsign",_clublogCall);
//qDebug()<< Q_FUNC_INFO << ": - callsign 1: " << _clublogCall;
}
else
{
params.addQueryItem("callsign",stationCallsign);
}
//qDebug()<< Q_FUNC_INFO << ": - query before send/delete: " << params.query(QUrl::FullyEncoded).toUtf8();
if (_adding)
{
params.addQueryItem("api",api);
postData = params.query(QUrl::FullyEncoded).toUtf8();
postData = postData + "&" + _params.query(QUrl::FullyEncoded).toUtf8();
params.setQuery(postData);
//TODO: ADD the params
}
else
{
//TODO: ADD the params
postData = params.query(QUrl::FullyEncoded).toUtf8();
postData = postData + "&" + _params.query(QUrl::FullyEncoded).toUtf8() ;
params.setQuery(postData);
params.addQueryItem("api",api);
}
postData = params.query(QUrl::FullyEncoded).toUtf8();
QNetworkRequest request(serviceUrl);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
//qDebug() << Q_FUNC_INFO << ": " << postData;
manager->post(request, postData);
//qDebug()<< Q_FUNC_INFO << ": - END";
return -1;
}
/*
int eLogClubLog::sendData(const QString &_clublogCall, const QString &_q)
{
//qDebug()<< "eLogClubLog::sendData: " << _q;
QUrl serviceUrl = QUrl("https://secure.clublog.org/realtime.php");
QByteArray postData;
//QByteArray postData;
QUrlQuery params;
params.addQueryItem("email",email);
params.addQueryItem("password",pass);
if (_clublogCall.length()>2)
{
params.addQueryItem("callsign",_clublogCall);
//qDebug()<< "eLogClubLog::sendData - callsign 1: " << _clublogCall;
}
else
{
params.addQueryItem("callsign",stationCallsign);
//ERROR
}
params.addQueryItem("api",api);
params.addQueryItem("adif",_q);
postData = params.query(QUrl::FullyEncoded).toUtf8();
//qDebug()<< "eLogClubLog::sendData - query: " << postData;
//postData = params.encodedQuery();
// Call the webservice
//QNetworkAccessManager *networkManager = new QNetworkAccessManager;
QNetworkRequest request(serviceUrl);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
//connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotQsoUploadFinished(QNetworkReply*)));
manager->post(request, postData);
return -1;
}
*/
QString eLogClubLog::getClubLogAdif(const QStringList _q)
{
//qDebug() << "eLogClubLog::getClubLogAdif: " << QString::number(_q.length());
// _qso must include 16 ordered fields than can be empty or contain data. This function builds the ADIF QSO
/* http://clublog.freshdesk.com/support/solutions/articles/53202-which-adif-fields-does-club-log-use-
ClubLog only accepts the following ADIF fields:
QSO_DATE
TIME_ON
TIME_OFF (this is stored independently and used for log matching as well as ADIF exports)
QSLRDATE
QSLSDATE
CALL
OPERATOR
MODE
BAND
BAND_RX
FREQ
QSL_RCVD
LOTW_QSL_RCVD
QSL_SENT
DXCC
PROP_MODE
CREDIT_GRANTED
RST_SENT
RST_RCVD
NOTES
*/
if (_q.length()!=16)
{
return QString();
}
for (int i = 0; i< _q.length(); i++)
{
//qDebug()<< QString("eLogClubLog::getClubLogAdif: (%1): %2").arg(i).arg(_q.at(i));
}
QString qso, aux1;
qso.clear();
aux1 = _q.at(0);
//qDebug()<< "eLogClubLog::getClubLogAdif: Date: " << _q.at(0) ;
if (QDate::fromString(aux1, "yyyyMMdd").isValid())
{
qso = "" + aux1 + " ";
}
else
{
//qDebug() << "eLogClubLog::getClubLogAdif: END error ";
return QString();
}
//qso = "" + _q.at(0) + " ";
qso = qso + "" + _q.at(1) + " ";
//qDebug()<< "eLogClubLog::getClubLogAdif: 10" ;
if ((_q.at(2)).length()>0)
{
qso = qso + "" + _q.at(2) + " ";
}
//qDebug()<< "eLogClubLog::getClubLogAdif: 20" ;
if ((_q.at(3)).length()>0)
{
qso = qso + "" + _q.at(3) + " ";
}
//qDebug()<< "eLogClubLog::getClubLogAdif: 30" ;
qso = qso + "" + _q.at(4) + " ";
//qDebug()<< "eLogClubLog::getClubLogAdif: 40" ;
if ((_q.at(5)).length()>0)
{
qso = qso + "" + _q.at(5) + " ";
}
//qDebug()<< "eLogClubLog::getClubLogAdif: 50" ;
qso = qso + "" + _q.at(6) + " ";
//qDebug()<< "eLogClubLog::getClubLogAdif: 60" ;
qso = qso + "" + _q.at(7) + " ";
//qDebug()<< "eLogClubLog::getClubLogAdif: 70" ;
if ((_q.at(8)).length()> 2)
{
qso = qso + "" + _q.at(8) + " ";
}
if ((_q.at(9)).length()> 2)
{
qso = qso + "" + _q.at(9) + " ";
}
//qDebug()<< "eLogClubLog::getClubLogAdif: 90" ;
qso = qso + "" + _q.at(10) + " ";
//qDebug()<< "eLogClubLog::getClubLogAdif: 100" ;
qso = qso + "" + _q.at(11) + " ";
//qDebug()<< "eLogClubLog::getClubLogAdif: 110" ;
//qso = qso + "" + _q.at(12) + " ";
//qDebug()<< "eLogClubLog::getClubLogAdif: 120" ;
if ((_q.at(13)).toInt()> 0)
{
qso = qso + "" + _q.at(13) + " ";
}
//qDebug()<< "eLogClubLog::getClubLogAdif: 130'" ;
if ((_q.at(14)).toInt()> 0)
{
qso = qso + "" + _q.at(14) + " ";
}
//qDebug()<< "eLogClubLog::getClubLogAdif: 140" ;
if ((_q.at(15)).length()>0)
{
qso = qso + "" + _q.at(15) + " ";
}
//qDebug()<< "eLogClubLog::getClubLogAdif: 150" ;
qso = qso + "";
//qDebug()<< "eLogClubLog:: - QSO: " << qso;
//qDebug()<< "eLogClubLog::getClubLogAdif: 100" ;
return qso;
}
void eLogClubLog::setDefaultCallsign(const QString &_defaultStationCallsign)
{
stationCallsign = _defaultStationCallsign;
}
int eLogClubLog::deleteQSO(QStringList _qso)
{
//qDebug()<< "eLogClubLog::deleteQSO: length = " << QString::number(_qso.length());
//qDebug()<< "eLogClubLog::deleteQSO: " << email << "/" << pass << "/" << api ;
//qDebug()<< "eLogClubLog::deleteQSO: email = " << email;
//qDebug()<< "eLogClubLog::deleteQSO: Pass = " << pass;
// email, password, callsign, dxcall, datetime (sqlite format, not ADIF), bandid (only the number, not ADIF), api
if (_qso.length()!=18)
{
return -1;
}
for (int i = 0; i<_qso.length(); i++)
{
//qDebug()<< QString("eLogClubLog::deleteQSO: qso.at(%1) = %2").arg(i).arg(_qso.at(i));
}
QString dxcall, sdateTime, bandid;
QString tempCall = _qso.at(17);
if (tempCall.length()<1)
{
tempCall = stationCallsign;
}
dxcall = _qso.at(5);
QDateTime dateTime;
dateTime.setDate(QDate::fromString(_qso.at(1), "yyyyMMdd"));
dateTime.setTime(QTime::fromString(_qso.at(2), "HHmmss"));
if (!dateTime.isValid())
{
return -1;
}
sdateTime = dateTime.toString("yyyy-MM-dd HH:mm:ss");
//qDebug()<< QString("eLogClubLog::deleteQSO: DateTime = %1").arg(sdateTime);
//qDebug()<< QString("eLogClubLog::deleteQSO: band-1: ") << _qso.at(8);
bandid = (_qso.at(8)).chopped(1);
//qDebug()<< QString("eLogClubLog::deleteQSO: band-2: ") << bandid;
bool ok;
bandid.toInt(&ok);
if (!ok)
{ // This check is to capture potential QSOs in 222Mhz (AKA 1.25)
bandid = bandid.chopped(1);
//qDebug()<< QString("eLogClubLog::deleteQSO: band-3: ") << bandid;
}
//qDebug()<< QString("eLogClubLog::deleteQSO: bandid = %1").arg(bandid);
if (bandid.toInt()<=0)
{
return -2;
}
QUrlQuery params;
params.addQueryItem("dxcall", dxcall);
params.addQueryItem("datetime", sdateTime);
params.addQueryItem("bandid", bandid);
//params.addQueryItem("adif",qso);
uploadingFile = false;
return sendDataParams(tempCall, params, false);
//return sendData(qso);
}
QString eLogClubLog::prepareToTranslate(const QString &_m)
{
//qDebug()<< "eLogClubLog:: = prepareToTranslate" << _m;
if (_m == "Callsign missing")
{
return tr("Callsign missing");
}
else if (_m == "Invalid callsign")
{
return tr("Invalid callsign");
}
else if (_m == "Skipping SWL callsign")
{
return tr("Skipping SWL callsign");
}
else if (_m == "Callsign is your own call")
{
return tr("Callsign is your own call");
}
else if (_m == "Invalid callsign with no DXCC mapping")
{
return tr("Invalid callsign with no DXCC mapping");
}
else if (_m == "Updated QSO")
{
return tr("Updated QSO");
}
else if (_m == "Invalid ADIF record")
{
return tr("Invalid ADIF record");
}
else if (_m == "Missing ADIF record")
{
return tr("Missing ADIF record");
}
else if (_m == "Test mode - parameters ok, no action taken")
{
return tr("Test mode - parameters ok, no action taken");
}
else if (_m == "Excessive API Usage")
{
return tr("Excessive API Usage");
}
else if (_m == "Internal Error")
{
return tr("Internal Error");
}
else if (_m == "Rejected")
{
return tr("Rejected");
}
else if (_m == "QSO Duplicate")
{
return tr("QSO Duplicate");
}
else if (_m == "QSO Modified")
{
return tr("QSO Modified");
}
else if (_m == "Missing Login")
{
return tr("Missing Login");
}
else if (_m == "QSO OK")
{
return tr("QSO OK");
}
else if (_m == "Upload denied")
{
return tr("Upload denied");
}
else if (_m == "No callsign selected")
{
return tr("No callsign selected");
}
else if (_m == "No match found")
{
return tr("No match found");
}
else if (_m == "Dropped QSO")
{
return tr("Dropped QSO");
}
else if (_m == "OK")
{
return tr("OK");
}
else if (_m == "Login rejected")
{
return tr("Login rejected");
}
else if (_m == "Upload denied")
{
return tr("Upload denied");
}
else if (_m == "Rejected: Callsign is your own call")
{
return tr("Rejected: Callsign is your own call");
}
else
{
return _m;
}
}
int eLogClubLog::modifyQSO (QStringList _oldQSO, QStringList _newQSO)
{
//qDebug()<< QString("eLogClubLog::modifyQSO");
int x = -1;
x = deleteQSO(_oldQSO);
x = sendQSO(_newQSO);
return x;
}
void eLogClubLog::sendLogFile(const QString &_file, QList _qso, bool _overwrite)
{
//qDebug()<< Q_FUNC_INFO << ": " << _file;
qsos.clear();
qsos.append(_qso);
QUrl serviceUrl;
serviceUrl = QUrl("https://clublog.org/putlogs.php");
QByteArray postData;
QUrlQuery params;
// FIRST PARAMS is the file
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
QByteArray blob;
//QFile *file = new QFile("_file");
QFile *file = new QFile(util->getClubLogFile());
if (file->open(QIODevice::ReadOnly)) /* Flawfinder: ignore */
{
blob = file->readAll();
}
else
{
//qDebug()<< Q_FUNC_INFO << ": ERROR File not opened";
return;
}
file->close();
// The rest of the form goes as usual
//qDebug()<< Q_FUNC_INFO << ": email: " << email;
//qDebug()<< Q_FUNC_INFO << ": apPass: " << appPass;
//qDebug()<< Q_FUNC_INFO << ": stationcall: " << stationCallsign;
//qDebug()<< Q_FUNC_INFO << ": api: " << api;
QHttpPart emailPart;
emailPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"email\""));
emailPart.setBody(email.toUtf8());
QHttpPart passPart;
passPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"password\""));
passPart.setBody(appPass.toUtf8());
QHttpPart callPart;
callPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"callsign\""));
callPart.setBody(stationCallsign.toUtf8());
QHttpPart apiPart;
apiPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"api\""));
apiPart.setBody(api.toUtf8());
QString one;
if (_overwrite)
{
one = QString("1");
}
else
{
one = QString("0");
}
//QString one = QString("1");
QHttpPart clearPart;
clearPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"clear\""));
clearPart.setBody(one.toUtf8());
QHttpPart filePart;
QString aux = QString("form-data; name=\"file\"; filename=\"%1\"").arg(_file);
filePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream"));
filePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(aux));
filePart.setBody(blob);
multiPart->append(filePart);
multiPart->append(emailPart);
multiPart->append(passPart);
multiPart->append(callPart);
multiPart->append(clearPart);
multiPart->append(apiPart);
uploadingFile = true;
QNetworkRequest request(serviceUrl);
manager->post(request, multiPart);
//qDebug() << Q_FUNC_INFO << ": " << multiPart;
//qDebug()<< "eLogClubLog::sendLogFile - END";
}
void eLogClubLog::loadSettings()
{
QSettings settings(util->getCfgFile (), QSettings::IniFormat);
settings.beginGroup ("ClubLog");
email = settings.value ("ClubLogEmail").toString ();
pass = settings.value ("ClubLogPass").toString ();
appPass = settings.value ("ClubLogAppPass").toString ();
settings.endGroup ();
}
klog-2.4.1/adif.h 0000644 0001750 0001750 00000011757 15003153303 012512 0 ustar devel devel #ifndef KLOG_ADIF_H
#define KLOG_ADIF_H
/***************************************************************************
adif.h - description
-------------------
begin : ago 2023
copyright : (C) 2023 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
/*
This class implements general controls on ADIF standard
Refer to https://www.adif.org/
This classs hould not need to query the DB neither the DataProxy Class
*/
#include
#include
#include
#include
#include
//#include "locator.h"
#include "klogdefinitions.h"
class Adif : public QObject {
Q_OBJECT
//friend class tst_Adif;
public:
Adif(const QString &_parentName);
~Adif();
void init();
bool isValidFreq(const QString &_b); //>0
bool isValidPower(const QString &_b); //>0
bool isValidK_Index(const QString &_b); //0-9
bool isValidCQz(const QString &_b); //1-40
bool isValidITUz(const QString &_b); // 1-90
bool isValidDXCC(const QString &_b); // 0-522
bool isValidAge(const QString &_b); // 0-120
bool isValidDistance(const QString &_b); //>0.0
bool isValidAnt_EL(const QString &_b); //>=0-360
bool isValidAnt_AZ(const QString &_b); //>=-90-90
bool isValidA_Index(const QString &_b); //0-400
bool isValidIOTA_islandID(const QString &_b); //1-99999999
bool isValidNRBursts(const QString &_b); //>0
bool isValidPings(const QString &_b); //>0
bool isValidSFI(const QString &_b); //0-300
bool isValidSTX(const QString &_b); //>=0
bool isValidSRX(const QString &_b); //>=0
bool isValidFISTS(const QString &_b); //>0
bool isValidUKSMG(const QString &_b); //>0
bool isValidTenTen(const QString &_b); //>0
bool isValidLogId(const QString &_b); //>0
bool isValidAltitude (const QString &_s); // > 10000 (10000 is a default value in KLog)
bool isValidAntPath(const QString &_s);
bool isValidMode (const QString &_s);
bool isValidQSO_COMPLETE(const QString &_s); // "Y", "N", "NIL", "?"
QString getQSO_COMPLETEFromDB(const QString &_s); // Translates the DB value into an ADIF value
bool isValidPOTA(const QString &_s); // TODO
bool isValidWWFF_Ref(const QString &_s); // TODO
bool isValidQSLRCVD(const QString &_s, bool _importing=true); // Y, I, or V) (V on import only)
bool isValidQSLSENT(const QString &_s); // Y, Q, or I
void setLogLevel(DebugLogLevel _l);
QString getADIFField(const QString &_fieldName, const QString &_data);
QString getADIFBoolFromBool(const bool _b); // Will produce the ADIF format if a bool is received
void setModes(const QStringList &_modes); //TODO: Do not depend on external source to fill
signals:
void debugLog (QString _func, QString _msg, DebugLogLevel _level);
private:
void logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level);
void InitializeHash();
void setARRLSect();
void setContinents();
void setSponsorsList();
bool isValidCall(const QString &_c);
QString parentName;
DebugLogLevel logLevel;
QHash ADIFHash; // Name, type
QStringList notZeroFields; // Numeral ADIF fields where having a Zero makes no sense
QStringList ARRL_sects, continents, sponsorsList, modes;
};
#endif // ADIF_H
klog-2.4.1/showerrordialog.h 0000644 0001750 0001750 00000004260 15003153303 015010 0 ustar devel devel #ifndef KLOG_SHOWERRORDIALOG_H
#define KLOG_SHOWERRORDIALOG_H
/***************************************************************************
showerrordialog.h - description
-------------------
begin : oct 2017
copyright : (C) 2017 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include
#include
#include
class ShowErrorDialog: public QDialog
{
Q_OBJECT
public:
ShowErrorDialog();
~ShowErrorDialog();
void setText(const QString txt);
private slots:
void slotAcceptButtonClicked();
private:
void keyPressEvent(QKeyEvent *event);
QTextBrowser *textBrowser;
QString text;
QLabel *txtLabel;
};
#endif // SHOWERRORDIALOG_H
klog-2.4.1/softwareupdate.cpp 0000644 0001750 0001750 00000027623 15003153303 015176 0 ustar devel devel /***************************************************************************
softwareupdate.cpp - description
-------------------
begin : feb 2017
copyright : (C) 2017 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include "softwareupdate.h"
SoftwareUpdate::SoftwareUpdate(const QString &_klogVersion) : QObject(nullptr)
{
//qDebug() << "SoftwareUpdate::SoftwareUpdate(): " << _klogVersion;
util = new Utilities(Q_FUNC_INFO);
updateDialog = new SoftwareUpdateDialog();
latestVersion = "0.0";
repositoryFound = false;
url = new QUrl;
setVersion(_klogVersion);
callsign = QString();
OSString = QString();
messageShown = false;
OSVersion = QOperatingSystemVersion::currentType();
//qDebug() << "SoftwareUpdate::SoftwareUpdate OSVersion:: " << QString::number(OSVersion) ;
findOS(QOperatingSystemVersion::currentType());
setHeader();
//qDebug() << "SoftwareUpdate::SoftwareUpdate(): - END" ;
}
void SoftwareUpdate::findOS(const int _os)
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_os) ;
switch (_os)
{
case QOperatingSystemVersion::MacOS:
OSString = QString("osx");
break;
case QOperatingSystemVersion::Windows:
OSString = QString("win");
break;
case QOperatingSystemVersion::Unknown:
OSString = QString();
break;
default:
// should never be reached
break;
}
//qDebug() << Q_FUNC_INFO << " - END";
}
SoftwareUpdate::~SoftwareUpdate()
{
delete(updateDialog);
delete(util);
delete(url);
}
void SoftwareUpdate::setVersion(const QString &_klogVersion)
{
//qDebug() << Q_FUNC_INFO << ": " << _klogVersion;
klogVersion = _klogVersion;
latestVersion = klogVersion;
setHeader();
//qDebug() << "SoftwareUpdate::setVersion: END " ;
}
void SoftwareUpdate::slotReadyRead()
{
//qDebug() << "SoftwareUpdate::slotReadyRead: ";
}
void SoftwareUpdate::slotDownloadFinished(QNetworkReply *reply)
{
//qDebug() << Q_FUNC_INFO << " - Start ";
QUrl url = reply->url();
if (url.toString().length()< QString("https://api.github.com/repos/ea4k/klog/releases/latest").length())
{
//qDebug() << Q_FUNC_INFO << ": URL too short" ;
return;
}
QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (reply->error())
{
//qDebug() << Q_FUNC_INFO << ": reply error: " << QString::number(reply->error()) ;
}
else if (!redirectionTarget.isNull())
{
repositoryFound = false;
QUrl newUrl = url.resolved(redirectionTarget.toUrl());
//qDebug() << "SoftwareUpdate::slotDownloadFinished: Redirect: " << newUrl.toString();
url = newUrl;
reply->deleteLater();
connectToURL(url.toString());
//qDebug() << "SoftwareUpdate::slotDownloadFinished - end After connect";
return;
}
else
{
//qDebug() << "SoftwareUpdate::slotDownloadFinished: no redirection" ;
if (checkUpdates(reply))
{
//qDebug() << "SoftwareUpdate::slotDownloadFinished checkupdates true" ;
if (repositoryFound)
{
//qDebug() << "SoftwareUpdate::slotDownloadFinished repository found" ;
if(latestVersion>klogVersion)
{
//qDebug() << "SoftwareUpdate::slotDownloadFinished checkupdates should update!" ;
updateDialog->setVersion(latestVersion, true);
}
updateDialog->show();
latestVersion = klogVersion;
repositoryFound = false;
}
}
else
{
if (repositoryFound && messageShown)
{
//qDebug() << "SoftwareUpdate::slotDownloadFinished checkupdates false!" ;
updateDialog->setVersion(latestVersion, false);
updateDialog->show();
}
//qDebug() << "SoftwareUpdate::slotDownloadFinished: checkupdates false" ;
}
}
reply->deleteLater();
//qDebug() << "SoftwareUpdate::slotDownloadFinished end" ;
}
bool SoftwareUpdate::checkUpdates(QIODevice *data)
{
// Checks if there is a new version in the repository
//qDebug() << "SoftwareUpdate::checkUpdates: " << QString::number(data->size());
QString line, release;
QStringList stringList, klogStringList;
QRegularExpression rx;
QString filterString;
QString fileExtension;
switch (OSVersion)
{
case QOperatingSystemVersion::Unknown:
//qDebug() << "MainWindow::checkUpdates - Unknown" ;
rx.setPattern("klog-(\\d+)(\\.\\d+)?(\\.\\d+)?(\\.\\d+)?(-RC\\d+)?.tar.gz");
filterString = QString("klog");
fileExtension = QString(".tar.gz");
break;
case QOperatingSystemVersion::Windows:
//qDebug() << "MainWindow::checkUpdates - Windows" ;
rx.setPattern("KLog-(\\d+)(\\.\\d+)?(\\.\\d+)?(\\.\\d+)?(-RC\\d+)?-windows-installer.exe");
filterString = QString("KLog");
fileExtension = QString("-windows-installer.exe");
break;
case QOperatingSystemVersion::MacOS:
rx.setPattern("KLog-(\\d+)(\\.\\d+)?(\\.\\d+)?(\\.\\d+)?(-RC\\d+)?.dmg");
filterString = QString("KLog");
fileExtension = QString(".dmg");
//qDebug() << "MainWindow::checkUpdates - macOS" ;
break;
default:
rx.setPattern("klog-(\\d+)(\\.\\d+)?(\\.\\d+)?(\\.\\d+)?(-RC\\d+)?.tar.gz");
filterString = QString("klog");
fileExtension = QString(".tar.gz");
// should never be reached
break;
}
//qDebug() << "SoftwareUpdate::checkUpdates: Before entering the while"<< QT_ENDL;
while (!data->atEnd())
{
//qDebug() << "SoftwareUpdate::checkUpdates: In the while"<< QT_ENDL;
stringList.clear();
klogStringList.clear();
line.clear();
line = data->readLine();
//qDebug() << "SoftwareUpdate::checkUpdates: line: " << line;
if ((line.contains("browser_download_url")) || (line.contains("tarball_url")))
{
//qDebug() << "SoftwareUpdate::checkUpdates: line contains browser_download_url or tarball_url ";
repositoryFound = true;
stringList << line.split(",", QT_SKIP);
klogStringList << stringList.filter(filterString);
release = findMatch (rx, fileExtension, klogStringList);
if (release.length ()>0)
{
updateNeeded(release);
}
//qDebug() << "SoftwareUpdate::checkUpdates: " << line;
}
}
//qDebug() << "SoftwareUpdate::checkUpdates:Latest/Actual: " << latestVersion << "/" << klogVersion;
if (latestVersion > klogVersion)
{
emit updateNeededSignal (true);
//qDebug() << "SoftwareUpdate::checkUpdates: signal true";
return true;
}
else
{
//qDebug() << "SoftwareUpdate::checkUpdates: signal alse 1";
return false;
}
}
QString SoftwareUpdate::findMatch(QRegularExpression rx, const QString &fileExtension, const QStringList &data)
{
QString release = QString();
foreach (QString str, data)
{
//qDebug() << "SoftwareUpdate::findMatch klog: " << str;
//qDebug() << "SoftwareUpdate::findMatch klog - chopped: " << str;
if (rx.match(str).hasMatch())
{
//qDebug() << "SoftwareUpdate::findMatch: MATCH: " << str;
release = str.section("-",1);
//qDebug() << "SoftwareUpdate::findMatch: MATCH-1: " << str;
release = release.section(fileExtension, 0, 0);
//qDebug() << "SoftwareUpdate::findMatch: MATCH-2: " << str;
return release;
}
else
{
//qDebug() << "SoftwareUpdate::findMatch: DOES NOT MATCH: " << str;
}
}
return release;
}
void SoftwareUpdate::updateNeeded(const QString &_newVer)
{
//qDebug() << "SoftwareUpdate::updateNeeded: new: " << _newVer ;
//qDebug() << "SoftwareUpdate::updateNeeded: cur: " << latestVersion ;
if (latestVersion< _newVer)
{
latestVersion = _newVer;
}
//qDebug() << "SoftwareUpdate::updateNeeded - KLogVersion/latestVersion/newver: "<< klogVersion <<"/"<< latestVersion << "/"<<_newVer ;
}
void SoftwareUpdate::needToUpdate(bool _showWithoutVersion)
{ // This is used to connect to the main server URL.
// If _showWithoutVersion is false: We are checking for new versions at KLog start: No message should be shown if no new version is found.
// If _showWithoutVersion is true: The user is manually asking to check. A message should is shown if no new version is found.
//qDebug() << "SoftwareUpdate::needToUpdate (current version: " << klogVersion << ")" ;
messageShown = _showWithoutVersion;
setVersion(klogVersion);
//setTheURL("http://download.klog.xyz");
connectToURL("https://api.github.com/repos/ea4k/klog/releases/latest");
//qDebug() << "SoftwareUpdate::neededToUpdate - END";
}
void SoftwareUpdate::connectToURL(const QString &_url)
{
// This is where the connection takes place.... so first connection may be the main URL but it launches connection after redirections
//qDebug() << "SoftwareUpdate::connectToURL: " << _url;
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
manager->get(QNetworkRequest(QUrl(_url)));
QNetworkReply *reply = manager->get(request);
connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(slotDownloadFinished(QNetworkReply*)));
//qDebug() << "SoftwareUpdate::conectToURL - END";
}
void SoftwareUpdate::setHeader()
{
//qDebug() << Q_FUNC_INFO;
QString ver = util->getAgent(klogVersion);
//qDebug() << "SoftwareUpdate::setHeader - ver: " << ver;
if (callsign.length()>2)
{
ver = ver + "-" + callsign;
}
QByteArray str;
str.clear();
str.append(ver.toUtf8 ());
//qDebug() << "SoftwareUpdate::setHeader: " << str;
request.setRawHeader("User-Agent", str);
//qDebug() << "SoftwareUpdate::setHeader - END" ;
}
void SoftwareUpdate::addCall(const QString &_call)
{
//qDebug() << "SoftwareUpdate::addCall: " << _call;
if (_call.length()>2)
{
//callsign = _call;
setHeader();
}
//qDebug() << "SoftwareUpdate::addCall - END";
}
klog-2.4.1/adif.cpp 0000644 0001750 0001750 00000052137 15003153303 013042 0 ustar devel devel /***************************************************************************
adif.cpp - description
-------------------
begin : jun 2015
copyright : (C) 2015 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
//#include "global.h"
#include "adif.h"
#include "callsign.h"
Adif::Adif(const QString &_parentName)
{
parentName = _parentName;
//qDebug() << Q_FUNC_INFO << " (" << _parentName << ")";
//init();
}
Adif::~Adif()
{
}
void Adif::init()
{
setARRLSect();
setContinents();
setSponsorsList ();
}
void Adif::InitializeHash() {
ADIFHash = {
{"ADDRESS", "MultiLineString"},
{"AGE", "Number"},
{"ALTITUDE", "Number"},
{"ANT_AZ", "Number"},
{"ANT_EL", "Number"},
{"ANT_PATH", "Enumeration"},
{"ARRL_SECT", "Enumeration"},
{"AWARD_SUBMITTED", "SponsoredAwardList"},
{"AWARD_GRANTED", "SponsoredAwardList"},
{"A_INDEX", "Number"},
{"BAND", "Enumeration"},
{"BAND_RX", "Enumeration"},
{"CALL", "String"},
{"CHECK", "String"},
{"CLASS", "String"},
{"CLUBLOG_QSO_UPLOAD_DATE", "Date"},
{"CLUBLOG_QSO_UPLOAD_STATUS", "Enumeration"},
{"CNTY", "Enumeration"},
{"COMMENT", "String"},
{"CONT", "Enumeration"},
{"CONTACTED_OP", "String"},
{"CONTEST_ID", "String"},
{"COUNTRY", "String"},
{"CQZ", "PositiveInteger"},
{"CREDIT_SUBMITTED", "CreditList"},
{"CREDIT_GRANTED", "CreditList"},
{"DARC_DOK", "Enumeration"},
{"DISTANCE", "Number"},
{"DXCC", "Enumeration"},
{"EMAIL", "String"},
{"EQ_CALL", "String"},
{"EQSL_QSLRDATE", "Date"},
{"EQSL_QSLSDATE", "Date"},
{"EQSL_QSL_RCVD", "Enumeration"},
{"EQSL_QSL_SENT", "Enumeration"},
{"FISTS", "PositiveInteger"},
{"FISTS_CC", "PositiveInteger"},
{"FORCE_INIT", "Boolean"},
{"FREQ", "Number"},
{"FREQ_RX", "Number"},
{"GRIDSQUARE", "GridSquare"},
{"GRIDSQUARE_EXT", "GridSquareExt"},
{"GUEST_OP", "String"},
{"HAMLOGEU_QSO_UPLOAD_DATE", "Date"},
{"HAMLOGEU_UPLOAD_STATUS", "Enumeration"},
{"HAMQTH_QSO_UPLOAD_DATE", "Date"},
{"HAMQTH_UPLOAD_STATUS", "Enumeration"},
{"HRDLOG_QSO_UPLOAD_DATE", "Date"},
{"HRDLOG_QSO_UPLOAD_STATUS", "Enumeration"},
{"IOTA", "IOTARefNo"},
{"IOTA_ISLAND_ID", "PositiveInteger"},
{"ITUZ", "PositiveInteger"},
{"K_INDEX", "Integer"},
{"LAT", "Location"},
{"LON", "Location"},
{"LOTW_QSLRDATE", "Date"},
{"LOTW_QSLSDATE", "Date"},
{"LOTW_QSL_RCVD", "Enumeration"},
{"LOTW_QSL_SENT", "Enumeration"},
{"MAX_BURSTS", "Number"},
{"MODE", "Enumeration"},
{"MS_SHOWER", "String"},
{"MY_ALTITUDE", "Number"},
{"MY_ANTENNA", "String"},
{"MY_ARRL_SECT", "Enumeration"},
{"MY_CITY", "String"},
{"MY_CNTY", "Enumeration"},
{"MY_COUNTRY", "String"},
{"MY_CQ_ZONE", "PositiveInteger"},
{"MY_DXCC", "Enumeration"},
{"MY_FISTS", "PositiveInteger"},
{"MY_GRIDSQUARE", "GridSquare"},
{"MY_GRIDSQUARE_EXT", "GridSquareExt"},
{"MY_IOTA", "IOTARefNo"},
{"MY_IOTA_ISLAND_ID", "PositiveInteger"},
{"MY_ITU_ZONE", "PositiveInteger"},
{"MY_LAT", "Location"},
{"MY_LON", "Location"},
{"MY_NAME", "String"},
{"MY_POSTAL_CODE", "String"},
{"MY_POTA_REF", "POTARef"},
{"MY_RIG", "String"},
{"MY_SIG", "String"},
{"MY_SIG_INFO", "String"},
{"MY_SOTA_REF", "SOTARef"},
{"MY_STATE", "Enumeration"},
{"MY_STREET", "String"},
{"MY_USACA_COUNTIES", "SecondarySubdivisionList"},
{"MY_VUCC_GRIDS", "GridSquareList"},
{"MY_WWFF_REF", "WWFFRef"},
{"NAME", "String"},
{"NOTES", "MultilineString"},
{"NR_BURSTS", "Integer"},
{"NR_PINGS", "Integer"},
{"OPERATOR", "String"},
{"OWNER_CALLSIGN", "String"},
{"PFX", "String"},
{"POTA_REF", "POTARef"},
{"PRECEDENCE", "String"},
{"PROP_MODE", "Enumeration"},
{"PUBLIC_KEY", "String"},
{"QRZCOM_QSO_UPLOAD_DATE", "Date"},
{"QRZCOM_QSO_UPLOAD_STATUS", "Enumeration"},
{"QSLMSG", "MultilineString"},
{"QSLRDATE", "Date"},
{"QSLSDATE", "Date"},
{"QSL_RCVD", "Enumeration"},
{"QSL_RCVD_VIA", "Enumeration"},
{"QSL_SENT", "Enumeration"},
{"QSL_SENT_VIA", "Enumeration"},
{"QSL_VIA", "String"},
{"QSO_COMPLETE", "Enumeration"},
{"QSO_DATE", "Date"},
{"QSO_DATE_OFF", "Date"},
{"QSO_RANDOM", "Boolean"},
{"QTH", "String"},
{"REGION", "Enumeration"},
{"RIG", "MultilineString"},
{"RST_RCVD", "String"},
{"RST_SENT", "String"},
{"RX_PWR", "Number"},
{"SAT_MODE", "String"},
{"SAT_NAME", "String"},
{"SFI", "Integer"},
{"SIG", "String"},
{"SIG_INFO", "String"},
{"SILENT_KEY", "Boolean"},
{"SKCC", "String"},
{"SOTA_REF", "SOTARef"},
{"SRX", "Integer"},
{"SRX_STRING", "String"},
{"STATE", "Enumeration"},
{"STATION_CALLSIGN", "String"},
{"STX", "Integer"},
{"STX_STRING", "String"},
{"SUBMODE", "String"},
{"SWL", "Boolean"},
{"TEN_TEN", "PositiveInteger"},
{"TIME_OFF", "Time"},
{"TIME_ON", "Time"},
{"TX_PWR", "Number"},
{"UKSMG", "PositiveInteger"},
{"USACA_COUNTIES", "SecondarySubdivisionList"},
{"VE_PROV", "String"},
{"VUCC_GRIDS", "GridSquareList"},
{"WEB", "String"},
{"WWFF_REF", "WWFFRef"},
{"APP_LOTW_RXQSL", "Date"},
{"APP_LOTW_RXQSO", "Date"},
{"APP_LOTW_QSO_TIMESTAMP", "Date"}
};
return;
}
void Adif::setLogLevel(DebugLogLevel _l)
{
logLevel = _l;
}
void Adif::setARRLSect()
{
QStringList pARRL_sects = {"AL", "AK", "AB", "AR", "AZ", "BC", "CO", "CT", "DE", "EB", "EMA", "ENY", "EPA", "EWA"
"GA", "GTA", "ID", "IL", "IN", "IA", "KS", "KY", "LAX", "LA",
"ME", "MB", "MAR", "MDC", "MI", "MN", "MS", "MO", "MT",
"NE", "NV", "NH", "NM", "NLI", "NL", "NC", "ND", "NTX",
"NFL", "NNJ", "NNY", "NT", "NWT", "OH", "OK", "ON",
"ONE", "ONN", "ONS", "ORG", "OR", "PAC", "PE", "PR", "QC",
"RI", "SV", "SDG", "SF", "SJV", "SB", "SCV", "SK", "SC", "SD",
"STX", "SFL", "SNJ", "TN", "VI", "UT", "VT", "VA",
"WCF", "WTX", "WV", "WMA", "WNY", "WPA", "WWA", "WI", "WY"};
ARRL_sects = pARRL_sects;
}
void Adif::setContinents()
{
QStringList pcontinents = {"NA", "SA", "EU", "AF", "OC", "AS", "AN"};
continents = pcontinents;
}
void Adif::setSponsorsList()
{
QStringList psponsorsList = {"ADIF_", "ARI_", "ARRL_", "CQ_", "DARC_", "EQSL_", "IARU_", "JARL_", "RSGB_", "TAG_", "WABAG_"};
sponsorsList = psponsorsList;
}
bool Adif::isValidMode (const QString &_s)
{
return modes.contains(_s);
}
void Adif::setModes(const QStringList &_modes)
{ // TODO: Add here the list/table of modes to feed DB creation and/or to prevent depending on external sources
// from this class
modes.clear();
modes << _modes;
}
bool Adif::isValidFreq(const QString &_b)
{
//qDebug() << Q_FUNC_INFO << ": freq: " << _b;
bool _ok;
double f = _b.toDouble(&_ok);
if ((_ok) && f>0)
{
//qDebug() << Q_FUNC_INFO << ": Freq OK" ;
return true;
}
/* if (!_ok)
//qDebug() << Q_FUNC_INFO << ": Freq NOK: NOK" ;
if (f<=0)
//qDebug() << Q_FUNC_INFO << ": Freq NOK: f=0" ;
else
//qDebug() << Q_FUNC_INFO << ": Freq NOK: NOT-KNOWN" ;*/
return false;
}
bool Adif::isValidPower(const QString &_b)
{
return (_b.toDouble()>0.0);
}
QString Adif::getADIFBoolFromBool(const bool _b)
{// Will produce the ADIF format if a bool is received
if (_b)
return "Y";
return "N";
}
bool Adif::isValidK_Index(const QString &_b)
{
return ((_b.toInt()>=0) && (_b.toInt()<=9));
}
bool Adif::isValidCQz(const QString &_b)
{
return ((_b.toInt()>=1) && (_b.toInt()<=40));
}
bool Adif::isValidITUz(const QString &_b)
{
return ((_b.toInt()>=1) && (_b.toInt()<=90));
}
bool Adif::isValidDXCC(const QString &_b)
{
return ((_b.toInt()>=0) && (_b.toInt()<=522));
}
bool Adif::isValidAge(const QString &_b)
{
return ((_b.toInt()>0) && (_b.toInt()<=120));
}
bool Adif::isValidAnt_EL(const QString &_b)
{
return ((_b.toInt()>=-90) && (_b.toInt()<=900));
}
bool Adif::isValidAnt_AZ(const QString &_b)
{
return ((_b.toInt()>=0) && (_b.toInt()<=360));
}
bool Adif::isValidA_Index(const QString &_b)
{
return ((_b.toInt()>=0) && (_b.toInt()<=400));
}
bool Adif::isValidDistance(const QString &_b)
{
return (_b.toDouble()>0);
}
bool Adif::isValidAltitude(const QString &_b)
{
return (_b.toDouble()>10000);
}
bool Adif::isValidIOTA_islandID(const QString &_b)
{
return ((_b.toInt()>=1) && (_b.toInt()<=90));
}
bool Adif::isValidNRBursts(const QString &_b)
{
return (_b.toInt()>0);
}
bool Adif::isValidPings(const QString &_b)
{
return (_b.toInt()>0);
}
bool Adif::isValidSFI(const QString &_b)
{
return ((_b.toInt()>=0) && (_b.toInt()<=300));
}
bool Adif::isValidSTX(const QString &_b)
{
return (_b.toInt()>=0);
}
bool Adif::isValidSRX(const QString &_b)
{
return (_b.toInt()>=0);
}
bool Adif::isValidFISTS(const QString &_b)
{
return (_b.toInt()>0);
}
bool Adif::isValidUKSMG(const QString &_b)
{
return (_b.toInt()>0);
}
bool Adif::isValidTenTen(const QString &_b)
{
return (_b.toInt()>0);
}
bool Adif::isValidLogId(const QString &_b)
{
return (_b.toInt()>0);
}
bool Adif::isValidAntPath(const QString &_s)
{
return ((_s == "G") || (_s == "O") || (_s == "S") || (_s == "L"));
}
bool Adif::isValidQSO_COMPLETE(const QString &_s)
{ // "Y", "N", "NIL", "?"
return ((_s == "Y") || (_s == "N") || (_s == "NIL") || (_s == "?"));
}
QString Adif::getQSO_COMPLETEFromDB(const QString &_s)
{// Returns the ADIF QSO_COMPLETE
//1=Y, 2=N, 3=NIL, 4=?
//qDebug() << Q_FUNC_INFO << ": " << _s;
int i = _s.toInt();
switch (i)
{
case 2:
{
return "N";
}
case 3:
{
return "NIL";
}
case 4:
{
return "?";
}
default:
{
return "Y";
}
}
}
bool Adif::isValidPOTA(const QString &_s)
{
if (_s.length()<1)
return false;
return true;
}
bool Adif::isValidWWFF_Ref(const QString &_s)
{
if (_s.length()<1)
return false;
return true;
}
/*
bool Utilities::isValidComment(const QString &_b)
{
return (_b.length()>0);
}
bool Utilities::isValidName(const QString &_b)
{
return (_b.length()>0);
}
bool Utilities::isValidADIFField(const QString &_b)
{
//qDebug() << "Utilities::isValidADIFField: " << _b ;
// This functions checks if the ADIF field has the proper format.
// Data
if (!((_b.startsWith('<')) && (_b.count('>')) == 1 ))
{
//qDebug() << "Utilities::isValidADIFField: BAD FORMAT: No < or > delimiters: " << _b ;
return false;
}
if (_b.simplified() == "")
{
return true;
}
QStringList validDataTypes = {"B", "N", "D", "T", "S", "I", "M", "G", "E", "L"};
QStringList qs;
qs.clear();
qs.append(_b.split('>'));
if (qs.size()!= 2)
{
//qDebug() << "Utilities::isValidADIFField-0 (not two): " << QString::number(qs.size()) ;
return false;
}
QString field = (qs.at(0)).right((qs.at(0)).length() - 1);
QString data = (qs.at(1)).simplified();
//data = data.simplified();
QString dataType = QString();
//qDebug() << "Utilities::isValidADIFField-Field: " << field ;
//qDebug() << "Utilities::isValidADIFField_Data: " << data ;
int length = data.length();
int separatorPosition = 0;
int i = (field).count(":"); //Check how many ":" do we have, to see if we have a data type or not
if (i == 2) // We have data type
{ // DATE:8:D / 20141020
separatorPosition = (field.section(':', 1, 1)).toInt();
dataType = field.section(':', 2, 2);
if (!validDataTypes.contains(dataType.toUpper()))
{
//qDebug() << "Utilities::isValidADIFField - FORMAT ERROR: Wrong data type: " << dataType ;
return false;
}
}
else if (i == 1)
{ // DATE:8 / 20141020
separatorPosition = (field.section(':', 1, 1)).toInt();
}
else
{
//qDebug() << "Utilities::isValidADIFField - FORMAT ERROR, more than 2 \":\" - " << field ;
return false;
}
if ( length != separatorPosition)
{
//qDebug() << "Utilities::isValidADIFField: Data Length problem: " << (field) << "/" << data << " - " << QString::number(length) << "/" << QString::number(separatorPosition) ;
return false;
}
if (separatorPosition <= 0)
{
//qDebug() << "Utilities::isValidADIFField: Length problem <= 0" ;
return false;
}
//qDebug() << "FileManager::checkADIFValidFormat: Return true" ;
return true;
}
bool Utilities::isValidQSL_Rcvd(const QString &c)
{
return ((c == "Y") || (c == "N") || (c == "R") || (c == "I") || (c == "V"));
}
bool Utilities::isValidQSL_Sent(const QString &c)
{
return ((c == "Y") || (c == "N") || (c == "R") || (c == "Q") || (c == "I"));
}
bool Utilities::isValidUpload_Status(const QString &c)
{
return ((c == "Y") || (c == "N") || (c == "M"));
}
bool Utilities::isValidFISTS(const QString &c)
{
return (c.toInt ()>0);
}
QStringList Utilities::getValidADIFFieldAndData(const QString &_b)
{
//qDebug() << "Utilities::getValidADIFFieldAndData: " << _b ;
// This functions checks if the ADIF field has the proper format.
// Data
QStringList result;
result.clear();
if (!(_b.startsWith('<')))
{
//qDebug() << "Utilities::getValidADIFFieldAndData: BAD FORMAT: No < or > delimiters: " << _b ;
return QStringList();
}
if (_b.simplified() == "")
{
//qDebug() << "Utilities::getValidADIFFieldAndData: EOR" ;
result << "EOR" << "EOR";
return result;
}
QString aux = _b;
QStringList qs;
qs.clear();
if ((aux.contains("APP_LOTW_")) && aux.contains("//"))
{ // Trying to fix a LoTW ADIF bug
qs.append(aux.split("//"));
aux = qs.at(0);
}
//qDebug() << "Utilities::getValidADIFFieldAndData: -20" ;
QStringList validDataTypes = {"B", "N", "D", "T", "S", "I", "M", "G", "E", "L"};
qs.clear();
qs.append(aux.split('>'));
if (qs.size()!= 2)
{
//qDebug() << "Utilities::getValidADIFFieldAndData-0 (not two): " << QString::number(qs.size()) ;
return result;
}
//qDebug() << "Utilities::getValidADIFFieldAndData: -30" ;
//QString field = (qs.at(0)).right((qs.at(0)).length() - 1);
QString field = (qs.at(0)).right((qs.at(0)).length() - 1);
QString data = (qs.at(1)).simplified();
//data = data.simplified();
QString dataType = QString();
//qDebug() << "Utilities::getValidADIFFieldAndData-Field: " << field ;
//qDebug() << "Utilities::getValidADIFFieldAndData_Data: " << data ;
int length = data.length();
int separatorPosition = 0;
int i = (field).count(":"); //Check how many ":" do we have, to see if we have a data type or not
if (i == 2) // We have data type
{ // DATE:8:D / 20141020
separatorPosition = (field.section(':', 1, 1)).toInt();
dataType = field.section(':', 2, 2);
//qDebug() << "Utilities::getValidADIFFieldAndData - DataType: -" << dataType << "-" ;
if (!validDataTypes.contains(dataType.toUpper()))
{
//qDebug() << "Utilities::getValidADIFFieldAndData - FORMAT ERROR: Wrong data type: " << dataType ;
return result;
}
}
else if (i == 1)
{ // DATE:8 / 20141020
separatorPosition = (field.section(':', 1, 1)).toInt();
}
else
{
//qDebug() << "Utilities::getValidADIFFieldAndData - FORMAT ERROR, more than 2 \":\" - " << field ;
return result;
}
//qDebug() << "Utilities::getValidADIFFieldAndData: -60" ;
if ( length != separatorPosition)
{
//qDebug() << "Utilities::getValidADIFFieldAndData: Data Length problem: " << (field) << "/" << data << " - " << QString::number(length) << "/" << QString::number(separatorPosition) ;
return result;
}
if (separatorPosition <= 0)
{
//qDebug() << "Utilities::getValidADIFFieldAndData: Length problem <= 0" ;
return result;
}
//qDebug() << "Utilities::getValidADIFFieldAndData: -90: f: " << field ;
//qDebug() << "Utilities::getValidADIFFieldAndData: -90: d: " << data;ield = field.section(':', 0, 0);
result.clear();
result << field.section(':', 0, 0) << data;
//qDebug() << "Utilities::checkADIFValidFormat: Return true: " << result.at(0) << "/" << result.at(1) ;
return result;
}
QString Utilities::getADIFField(const QString &_fieldName, const QString &_data)
{// Receives the ADIF field and the data and returns the ADIF field with a blank space at the end.
// Check if _fieldName is a valid ADIF
//
if (ADIFHash.empty()) {
InitializeHash();
}
if (!ADIFHash.contains(_fieldName)) {
//qDebug() << Q_FUNC_INFO << " - No valid ADIF: " << _fieldName;
return QString();
}
return QString ("<%1:%2>%3 ").arg(_fieldName).arg(_data.length ()).arg(_data);
}
bool Utilities::isValidARRLSect(const QString &_s)
{
return (ARRL_sects.contains (_s.toUpper ()));
}
bool Utilities::isValidContinent(const QString &_s)
{
return (continent.contains (_s.toUpper ()));
}
bool Utilities::isValidPropMode(const QString &_s)
{
QStringList propModes;
propModes.clear ();
propModes << "AS" << "AUE" << "AUR" << "BS" << "ECH" << "EME" << "ES"
<< "F2" << "FAI" << "GWAVE" << "INTERNET" << "ION" << "IRL"
<< "LOS" << "MS" << "RPT" << "RS" << "SAT" << "TEP" << "TR";
return propModes.contains (_s.toUpper ());
}
bool Utilities::isValidDistance(const double _d)
{
return (_d>=0);
}
bool Utilities::isValidSponsor(const QString &_s)
{
return (sponsorsList.contains (_s.toUpper ()));
}
*/
QString Adif::getADIFField(const QString &_fieldName, const QString &_data)
{// Receives the ADIF field and the data and returns the ADIF field with a blank space at the end.
// Check if _fieldName is a valid ADIF
//qDebug() << Q_FUNC_INFO << " - " << _fieldName << "/" << _data;
if ((_data.length()<=0) || (_data.isNull()))
{
//qDebug() << Q_FUNC_INFO << " - Not Valid";
return QString();
}
if (ADIFHash.empty()) {
InitializeHash();
}
QString fieldN = _fieldName.toUpper();
if (!ADIFHash.contains(fieldN)) {
//qDebug() << Q_FUNC_INFO << " - No valid ADIF: " << _fieldName;
return QString();
}
if (fieldN == "DISTANCE" )
if (_data.toDouble() <= 0.0)
return QString();
return QString ("<%1:%2>%3 ").arg(fieldN).arg(_data.length ()).arg(_data);
}
bool Adif::isValidCall(const QString &_c)
{
Callsign _callsign(_c);
return _callsign.isValid();
//if (_c.length ()>=3)
// return true;
//return false;
}
bool Adif::isValidQSLRCVD(const QString &_s, bool _importing)
{ // Y, I, or V) (V on import only)
return ((_s == "Y") || (_s == "I") || ((_s == "V") && _importing));
}
bool Adif::isValidQSLSENT(const QString &_s)
{// Y, Q, or I
return ((_s == "Y") || (_s == "Q") || (_s == "I"));
}
void Adif::logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level)
{
emit debugLog (_func, _msg, _level);
}
klog-2.4.1/fileawardmanager.h 0000644 0001750 0001750 00000004506 15003153303 015072 0 ustar devel devel #ifndef KLOG_FILEAWARDMANAGER_H
#define KLOG_FILEAWARDMANAGER_H
/***************************************************************************
fileawardmanager.h - description
-------------------
begin : oct 2020
copyright : (C) 2020 by Jaime Robles
user : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include
#include
#include
#include "utilities.h"
#include "dataproxy_sqlite.h"
#include "world.h"
class FileAwardManager : public QWidget
{
Q_OBJECT
public:
explicit FileAwardManager(DataProxy_SQLite *dp, const QString &_parentFunction);
~FileAwardManager();
bool importNewAwardFile();
signals:
public slots:
private:
void showError(const QString &_header, const QString &_msg, const QString &_detailedMsg);
DataProxy_SQLite *dataProxy;
Utilities *util;
World *world;
};
#endif // FILEAWARDMANAGER_H
klog-2.4.1/searchwindow.cpp 0000644 0001750 0001750 00000100032 15003153303 014620 0 ustar devel devel
/***************************************************************************
searchwindow.cpp - description
-------------------
begin : sept 2020
copyright : (C) 2020 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include "searchwindow.h"
SearchWindow::SearchWindow(Awards *awards, QWidget *parent) :
QWidget(parent),
awards(awards) // Initialize Awards reference
{
//qDebug() << "SearchWindow::SearchWindow: " ;
dataProxy = awards->dataProxy;
showStationCallsignInHeader = true;
//sortingThroughProxyModel = false;
searchModel = std::make_unique(awards, this);
//searchModel = new SearchModel(dataProxy, this);
util = new Utilities(Q_FUNC_INFO);
connect(searchModel.get(), SIGNAL(queryError(QString, QString, QString, QString)), this, SLOT(slotQueryErrorManagement(QString, QString, QString, QString)) );
//logView = new QTableView;
treeView = new QTreeView;
//dxccStatusWidget = new DXCCStatusWidget(dataProxy);
//elogClublog = new eLogClubLog();
currentLog = -1;
//proxyModel = new LogViewSortFilterProxyModel(this);
//awards = new Awards(dataProxy, Q_FUNC_INFO);
createUI();
createActions();
setDefaultData();
//qDebug() << "SearchWindow::SearchWindow: - END" ;
}
SearchWindow::~SearchWindow()
{
// emit clearError();
//delete(dataProxy);
delete(util);
//delete(awards);
}
void SearchWindow::sortColumn(const int _c)
{
//proxyModel->sort(_c);
searchModel->sort(_c, Qt::AscendingOrder);
}
void SearchWindow::clear()
{
//qDebug() << "SearchWindow::clear " ;
qslingNeeded = false;
}
void SearchWindow::createUI()
{
//qDebug() << "SearchWindow::createUI" ;
//logView->setContextMenuPolicy(Qt::CustomContextMenu);
//logView->setSortingEnabled(true);
QStringList labels;
if (showStationCallsignInHeader)
{
labels << tr("Call") << tr("Date/Time") << tr("Band") << tr("Mode") << tr("QSL Sent") << tr("QSL Rcvd") << tr("Station Callsign") << tr("ID") ;
//treeView->setColumnCount(8);
}
else
{
labels << tr("Call") << tr("Date/Time") << tr("Band") << tr("Mode") << tr("QSL Sent") << tr("QSL Rcvd") << tr("ID") ;
//treeView->setColumnCount(7);
}
//searchModel->setColumnsToDX();
/*
QStandardItemModel model;
model.setColumnCount (1);
model.setHeaderData (0, Qt::Horizontal, "Player");
*/
//treeView->setHeaderLabels(labels);
//QTreeWidgetItem *item = new QTreeWidgetItem(searchResultsTreeWidget);
(treeView->header())->resizeSections(QHeaderView::ResizeToContents);
//treeView->clear();
//searchResultsTreeWidget->collapseAll();
treeView->setSortingEnabled(true);
treeView->setContextMenuPolicy(Qt::CustomContextMenu);
treeView->setSortingEnabled(true);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(treeView);
//layout->addWidget(logView);
setLayout(layout);
}
void SearchWindow::setDefaultData()
{
//qDebug() << "SearchWindow::setDefaultData" ;
}
void SearchWindow::setStationCallsignInHeader(const bool _h)
{
showStationCallsignInHeader = _h;
setColumnsToDX();
}
void SearchWindow::createlogPanel(const int _currentLog)
{
//qDebug() << "SearchWindow::createlogPanel: " << QString::number(_currentLog);
currentLog = _currentLog;
searchModel->createSearchModel(currentLog);
treeView->setModel(searchModel.get());
treeView->setCurrentIndex(searchModel->index(0, 0));
//logView->setModel(searchModel);
//logView->setCurrentIndex(searchModel->index(0, 0));
//setProxyModel(false);
//QString contestMode = dataProxy->getLogTypeOfUserLog(currentLog);
setColumnsToDX();
sortColumn(1); //Initial sort by column 1 (date & time)
//qDebug() << "SearchWindow::createlogPanel " << searchModel->record(0).field(1).value().toString();
//logView->setSelectionMode(QAbstractItemView::ExtendedSelection);
//logView->setSelectionBehavior(QAbstractItemView::SelectRows);
//logView->resizeColumnsToContents();
//logView->horizontalHeader()->setStretchLastSection(true);
//logView->sortByColumn(1);
treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
//treeView->resizeColumnsToContents();
//treeView->horizontalHeader()->setStretchLastSection(true);
treeView->sortByColumn(1, Qt::AscendingOrder);
}
void SearchWindow::setColumnsToDX()
{
//qDebug() << "SearchWindow::setColumnsToDX" ;
QString stringQuery;
//stringQuery = QString("SELECT call, qso_date, bandid, modeid, qsl_sent, qsl_rcvd, station_callsign, id FROM log LIMIT 1");
stringQuery = QString("SELECT * FROM log LIMIT 1");
QSqlQuery query;
bool sqlOK = query.exec(stringQuery);
if (!sqlOK)
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
}
//qDebug() << "SearchWindow::setColumnsToDX - Query: " << query.lastQuery();
QSqlRecord rec;
rec = query.record(); // Number of columns
int columns = rec.count();
for (int i=0; i < columns; i++)
{
//logView->setColumnHidden(i, true);
treeView->setColumnHidden(i, true);
}
columns = rec.indexOf("qso_date");
treeView->setColumnHidden(columns, false);
searchModel->setHeaderData(columns, Qt::Horizontal,tr("Date/time"));
searchModel->setSort(columns, Qt::AscendingOrder);
columns = rec.indexOf("call");
treeView->setColumnHidden(columns, false);
searchModel->setHeaderData(columns, Qt::Horizontal,tr("Call"));
columns = rec.indexOf("bandid");
searchModel->setBandIdColumn(columns);
treeView->setColumnHidden(columns, false);
searchModel->setRelation(columns, QSqlRelation("band", "id", "name"));
searchModel->setHeaderData(columns, Qt::Horizontal,tr("Band"));
columns = rec.indexOf("modeid");
treeView->setColumnHidden(columns, false);
searchModel->setHeaderData(columns, Qt::Horizontal,tr("Mode"));
searchModel->setRelation(columns, QSqlRelation("mode", "id", "submode"));
searchModel->setModeIdColumn(columns);
columns = rec.indexOf("qsl_sent");
treeView->setColumnHidden(columns, false);
searchModel->setHeaderData(columns, Qt::Horizontal,tr("QSL Sent"));
columns = rec.indexOf("qsl_rcvd");
treeView->setColumnHidden(columns, false);
searchModel->setHeaderData(columns, Qt::Horizontal,tr("QSL Rcvd"));
if (showStationCallsignInHeader)
{
columns = rec.indexOf("station_callsign");
treeView->setColumnHidden(columns, false);
searchModel->setHeaderData(columns, Qt::Horizontal,tr("Station callsign"));
}
columns = rec.indexOf("dxcc");
searchModel->setDXCCColumn(columns);
columns = rec.indexOf("lognumber");
searchModel->setLogNColumn(columns);
//columns = rec.indexOf("id");
//treeView->setColumnHidden(columns, false);
}
void SearchWindow::refresh()
{
//qDebug() << "SearchWindow::refresh" ;
searchModel->select();
}
void SearchWindow::createActions()
{
createActionsCommon();
}
void SearchWindow::createActionsCommon()
{
//LOG VIEW
//connect(logView, SIGNAL(customContextMenuRequested( const QPoint& ) ), this, SLOT(slotRighButtonFromLog( const QPoint& ) ) );
//connect(logView, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickLog( const QModelIndex& ) ) );
connect(treeView, SIGNAL(customContextMenuRequested( const QPoint& ) ), this, SLOT(slotRighButtonFromLog( const QPoint& ) ) );
connect(treeView, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickLog( const QModelIndex& ) ) );
}
void SearchWindow::slotRighButtonFromLog(const QPoint& pos)
{
//qDebug() << "SearchWindow::slotshowRighButtonFromLog: " << QString::number((treeView->indexAt(pos)).row()) ;
//int row = (logView->indexAt(pos)).row();
int row = (treeView->indexAt(pos)).row();
//int _qsoID = ((searchModel->index(row, 0)).data(0)).toInt();
showMenuRightButtonFromLogCreateActions();
rightButtonFromLogMenu(row);
//TODO: To be added to the SearchWindow and create an action that emist the QSO id
}
void SearchWindow::rightButtonFromLogMenu(const int row)
{
//qDebug() << "SearchWindow::slotshowRighButtonFromLogMenu: QSO_id: " << QString::number(row);
int _qsoID = ((searchModel->index(row, 0)).data(0)).toInt();
//qDebug() << "SearchWindow::slotshowRighButtonFromLogMenu: QSOid: " << QString::number(_qsoID);
bool qslReceived = isQSLReceived(_qsoID);
bool qslSent = isQSLSent(_qsoID);
QMenu menu(this);
menu.addAction(delQSOFromLogAct);
delQSOFromLogAct->setData(row);
menu.addAction(qsoToEditFromLogAct);
qsoToEditFromLogAct->setData(row);
menu.addAction(checkQRZCOMFromLogAct);
checkQRZCOMFromLogAct->setData(row);
menu.addAction(checkDXHeatFromLogAct);
checkDXHeatFromLogAct->setData(row);
menu.addSeparator();
if (!qslSent)
{
QMenu *menuSentQsl = menu.addMenu(tr("QSL Send"));
menuSentQsl->addAction(qslSentViaBureauFromLogAct);
menuSentQsl->addAction(qslSentViaDirectFromLogAct);
menuSentQsl->addAction(qslSentRequestedAct);
if (!qslReceived)
{
menuSentQsl->addAction(qslSentViaBureauMarkRcvReqFromSearchAct);
menuSentQsl->addAction(qslSentViaDirectMarkRcvReqFromSearchAct);
qslSentViaBureauMarkRcvReqFromSearchAct->setData(row);
qslSentViaDirectMarkRcvReqFromSearchAct->setData(row);
}
qslSentViaBureauFromLogAct->setData(row);
qslSentViaDirectFromLogAct->setData(row);
qslSentRequestedAct->setData(row);
}
if (!qslReceived)
{
QMenu *menuRecQsl = menu.addMenu(tr("QSL Rcvd"));
menuRecQsl->addAction(qslRecViaBureauFromLogAct);
if (!qslSent)
{
menuRecQsl->addAction(qslRecViaBureauMarkReqFromSearchAct);
}
menuRecQsl->addAction(qslRecViaDirectFromLogAct);
if (!qslSent)
{
menuRecQsl->addAction(qslRecViaDirectMarkReqFromSearchAct);
}
menuRecQsl->addAction(qslRecRequestedAct);
qslRecViaBureauFromLogAct->setData(row);
qslRecViaBureauMarkReqFromSearchAct->setData(row);
qslRecViaDirectFromLogAct->setData(row);
qslRecViaDirectMarkReqFromSearchAct->setData(row);
qslRecRequestedAct->setData(row);
}
menu.exec(QCursor::pos());
}
void SearchWindow::slotDoubleClickLog(const QModelIndex & index)
{
//qDebug() << "SearchWindow::slotDoubleClickLog: Row: " << QString::number(index.row()) << "Column: " << QString::number(index.column());
int row = index.row();
//qsoToEdit((searchModel->index(row, 0)).data(0).toInt());
int qsoID = ((searchModel->index(row, Qt::DisplayRole)).data(0)).toInt();
//qDebug() << "SearchWindow::slotDoubleClickLog: n: " << QString::number (searchModel->data(index, Qt::DisplayRole).toInt());
//qDebug() << "SearchWindow::slotDoubleClickLog: emitted: " << QString::number (((searchModel->index(row, Qt::DisplayRole)).data(0)).toInt());
emit actionQSODoubleClicked(qsoID);
//qsoToEdit((searchModel->index(row, 0)).data(0).toInt());
//TODO: To be added to the SearchWindow and create an action that emist the QSO id to be edited
searchModel->select();
}
bool SearchWindow::isQSLReceived(const int _qsoId)
{
//qDebug() << "SearchWindow::isQSLReceived: " << QString::number(_qsoId);
return dataProxy->isQSOConfirmed(_qsoId, true, false); // We check just paper QSL
//return dataProxy->isQSLReceived(_qsoId);
}
bool SearchWindow::isQSLSent(const int _qsoId)
{
//qDebug() << "SearchWindow::isQSLSent: " << QString::number(_qsoId);
return dataProxy->isQSLSent(_qsoId);
}
void SearchWindow::showMenuRightButtonFromLogCreateActions()
{
//qDebug() << "SearchWindow::showMenuRightButtonFromLogCreateActions";
delQSOFromLogAct = new QAction(tr("&Delete"), this);
delQSOFromLogAct->setStatusTip(tr("Delete a QSO"));
connect(delQSOFromLogAct, SIGNAL(triggered()), this, SLOT(slotQsoDeleteFromLog()));
qsoToEditFromLogAct = new QAction(tr("&Edit QSO"), this);
qsoToEditFromLogAct->setStatusTip(tr("Edit this QSO"));
connect(qsoToEditFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSOToEditFromLog()));
qslSentViaBureauFromLogAct = new QAction(tr("Via &bureau"), this);
qslSentViaBureauFromLogAct->setStatusTip(tr("Send this QSL via bureau"));
connect(qslSentViaBureauFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaBureauFromLog() ));
qslSentViaDirectFromLogAct = new QAction(tr("D&irect"), this);
qslSentViaDirectFromLogAct->setStatusTip(tr("Send this QSL via direct"));
connect(qslSentViaDirectFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaDirectFromLog() ));
qslRecViaBureauFromLogAct = new QAction(tr("Via bureau"), this);
qslRecViaBureauFromLogAct->setStatusTip(tr("QSL &received via bureau"));
connect(qslRecViaBureauFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaBureauFromLog() ));
qslRecViaDirectFromLogAct = new QAction(tr("Direct"), this);
qslRecViaDirectFromLogAct->setStatusTip(tr("QSL received via direc&t"));
connect(qslRecViaDirectFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaDirectFromLog() ));
checkQRZCOMFromLogAct = new QAction(tr("Check in QRZ.com"), this);
checkQRZCOMFromLogAct->setStatusTip(tr("Check this callsign in QRZ.com"));
connect(checkQRZCOMFromLogAct, SIGNAL(triggered()), this, SLOT( slotCheckQRZCom() ));
checkDXHeatFromLogAct = new QAction(tr("Check in DXHeat.com"), this);
checkDXHeatFromLogAct->setStatusTip(tr("Check this callsign in DXHeat.com"));
connect(checkDXHeatFromLogAct, SIGNAL(triggered()), this, SLOT( slotCheckDXHeatCom() ));
qslSentRequestedAct = new QAction(tr("&Request my QSL"), this);
qslSentRequestedAct->setStatusTip(tr("Mark my QSL as requested"));
connect(qslSentRequestedAct, SIGNAL(triggered()), this, SLOT( slotQSLSentMarkAsRequested() ));
qslSentViaDirectMarkRcvReqFromSearchAct = new QAction(tr("Via Direct and mark DX QSL as requested"), this);
qslSentViaDirectMarkRcvReqFromSearchAct->setStatusTip(tr("Send this QSL via direct and mark DX QSL as requested"));
connect(qslSentViaDirectMarkRcvReqFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaDirectMarkDXReqFromSearch() ));
qslSentViaBureauMarkRcvReqFromSearchAct = new QAction(tr("Via Bureau and mark DX QSL as requested"), this);
qslSentViaBureauMarkRcvReqFromSearchAct->setStatusTip(tr("Send this QSL via bureau and mark DX QSL as requested"));
connect(qslSentViaBureauMarkRcvReqFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaBureauMarkDXReqFromSearch() ));
qslRecRequestedAct = new QAction(tr("&Request the QSL"), this);
qslRecRequestedAct->setStatusTip(tr("Mark the QSL as requested"));
connect(qslRecRequestedAct, SIGNAL(triggered()), this, SLOT( slotQSLRecMarkAsRequested() ));
qslRecViaBureauMarkReqFromSearchAct = new QAction(tr("Via bureau and mark my QSL as requested"), this);
qslRecViaBureauMarkReqFromSearchAct->setStatusTip(tr("QSL received via bureau and mark my QSL as requested"));
connect(qslRecViaBureauMarkReqFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaBureauMarkReqFromSearch() ));
qslRecViaDirectMarkReqFromSearchAct = new QAction(tr("Direc&t and mark as my QSL requested"), this);
qslRecViaDirectMarkReqFromSearchAct->setStatusTip(tr("QSL received via direct and mark my QSL as requested"));
connect(qslRecViaDirectMarkReqFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaDirectMarkReqFromSearch() ));
}
void SearchWindow::slotQSLSentViaBureauFromLog()
{
//qDebug() << "SearchWindow::slotQSLSentViaBureauFromLog: " << (qslSentViaBureauFromLogAct->data()).toString() << " - Id = " << QString::number( ((searchModel->index( ( (qslSentViaBureauFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) );
int _qsoId = ((searchModel->index( ( (qslSentViaBureauFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
qslSentViaBureau(_qsoId);
searchModel->select();
}
void SearchWindow::slotQSLSentViaDirectFromLog()
{
//qDebug() << "SearchWindow::slotQSLSentViaDirectFromLog: " << (qslSentViaDirectFromLogAct->data()).toString() << " - Id = " << QString::number( ((searchModel->index( ( (qslSentViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) );
int _qsoId = ((searchModel->index( ( (qslSentViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
//dataProxy->qslSentViaDirect(_qsoId, (QDateTime::currentDateTime()).toString("yyyy-MM-dd"));
dataProxy->qslSentViaDirect(_qsoId, QDate::currentDate());
searchModel->select();
}
void SearchWindow::slotQSLRecViaBureauFromLog()
{
//qDebug() << "SearchWindow::slotQSLRecViaBureauFromLog: ";
int _qsoId = ((searchModel->index( ( (qslRecViaBureauFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
qslRecViaBureau(_qsoId);
searchModel->select();
//TODO: To be added to the SearchWindow and create an action that emist the QSO id
}
void SearchWindow::slotQSLRecViaDirectFromLog()
{
//qDebug() << "SearchWindow::slotQSLRecViaDirectFromLog: " << (qslRecViaDirectFromLogAct->data()).toString() << " - Id = " << QString::number( ((searchModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) );
int _qsoId = ((searchModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
qslRecViaDirect(_qsoId);
searchModel->select();
// Mark Sent, Bureau, date, update log.
//TODO: To be added to the SearchWindow and create an action that emist the QSO id
}
void SearchWindow::slotQSOToEditFromLog()
{
//qDebug() << "slotQSOToEditFromLog: " << (qsoToEditFromLogAct->data()).toString();
int QSOid = ((searchModel->index((qsoToEditFromLogAct->data()).toInt(), 0)).data(0)).toInt();
//int QSOid = qsoToEditFromLogAct->data().toInt();
emit actionQSODoubleClicked(QSOid);
//TODO: To be added to the SearchWindow and create an action that emit the QSO id
}
/*
void SearchWindow::deleteQSO(const int _qsoID)
{
//qDebug() << "SearchWindow::deleteQSO: " << QString::number(_qsoID);
//int QSOid = (delQSOFromLogAct->data()).toInt();
emit actionDeleteQSO(_qsoID);
elogClublog->deleteQSO(dataProxy->getClubLogRealTimeFromId(_qsoID));
dataProxy->deleteQSO(_qsoID);
refresh();
searchModel->select();
emit updateAwards();
emit updateSearchText();
}
*/
void SearchWindow::slotQsoDeleteFromLog()
{
//qDebug() << "SearchWindow::slotQsoDeleteFromLog: qsoID1: " << QString::number((delQSOFromLogAct->data()).toInt());
int QSOid = ((searchModel->index((delQSOFromLogAct->data()).toInt(), 0)).data(0)).toInt();
//int QSOid = (delQSOFromLogAct->data()).toInt();
//qDebug() << "SearchWindow::slotQsoDeleteFromLog: qsoID1: " << QString::number(QSOid);
//qDebug() << "SearchWindow::slotQsoDeleteFromLog: qsoID2: " << QString::number((delQSOFromLogAct->data()).toInt());
emit actionDeleteQSO(QSOid);
searchModel->select();
}
void SearchWindow::qslSentViaBureau(const int _qsoId)
{
//qDebug() << "SearchWindow::qslSentViaBureau: " << QString::number(_qsoId)yyyy-MM-dd
dataProxy->qslSentViaBureau(_qsoId, QDate::currentDate());
searchModel->select();
}
void SearchWindow::qslRecViaBureau(const int _qsoId)
{
// //qDebug() << "LogWyyyy-MM-ddRecViaBureau: " << QString::number(_qsoIyyyy-MM-dd<< (dateTime->currentDateTime()).toString("yyyy/MM/dd");
dataProxy->qslRecViaBureau(_qsoId, QDate::currentDate(), false);
awards->setAwards(); //Update the Award status
searchModel->select();
//refresh();
emit updateAwards();
}
void SearchWindow::qslRecViaDirect(const int _qsoId)
{
//qDebug() << "SearchWindow::qslRecViaDirect: " << QString::number(_qsoId)yyyy-MM-dd
dataProxy->qslRecViaDirect(_qsoId, QDate::currentDate(), false);
awards->setAwards();
searchModel->select();
//refresh();
emit updateAwards();
}
void SearchWindow::slotQueryErrorManagement(QString functionFailed, QString errorCodeS, QString nativeError, QString failedQuery)
{
emit queryError(functionFailed, errorCodeS, nativeError, failedQuery);
}
void SearchWindow::slotCheckQRZCom()
{
QString _qrz = ((searchModel->index( ( (checkQRZCOMFromLogAct->data()).toInt() ) , 2)).data(Qt::DisplayRole).toString());
//qDebug() << "SearchWindow::sloTCheckQRZCom: " << _qrz;
QString url = "https://www.qrz.com/db/" + _qrz;
QDesktopServices::openUrl(QUrl(url));
}
void SearchWindow::slotCheckDXHeatCom()
{
//int _qsoId = ((searchModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
//QString _qrz = dataProxy->getCallFromId(_qsoId);
QString _qrz = ((searchModel->index( ( (checkDXHeatFromLogAct->data()).toInt() ) , 2)).data(Qt::DisplayRole).toString());
//qDebug() << "SearchWindow::slotCheckDXHeatCom(): " << _qrz;
QString url = "https://www.dxheat.com/db/" + _qrz;
QDesktopServices::openUrl(QUrl(url));
}
void SearchWindow::setFilterString(const QString &_st)
{
//qDebug() << "SearchWindow::setFilterString: " << _st;
searchModel->setFilterString(_st);
//qDebug() << "SearchWindow::setFilterString: - END " ;
}
void SearchWindow::selectAll()
{
//qDebug() << "SearchWindow::selectAll: " << QString::number(searchModel->rowCount());
int rowCount = searchModel->rowCount();
//logView->selectAll();
treeView->selectAll();
for (int i=0;iselectRow(i);
}
}
void SearchWindow::clearSelection()
{
//qDebug() << "SearchWindow::clearSelection";
//logView->clearSelection();
treeView->clearSelection();
}
QList SearchWindow::getSelectedQSOs()
{
//qDebug() << "SearchWindow::getSelectedQSOs: (Total: " << QString::number(searchModel->rowCount()) << ")"<< QT_ENDL;
QList selectedQSOs;
//QModelIndexList selection = //logView->selectionModel()->selectedRows();
QModelIndexList selection = treeView->selectionModel()->selectedRows();
foreach (QModelIndex index, selection)
{
int row, qsoID;
row = index.row();
qsoID = ((searchModel->index(row, 0)).data(0)).toInt();
selectedQSOs.append(qsoID);
}
//qDebug() << "SearchWindow::getSelectedQSOs: (Selected: (" << QString::number(selectedQSOs.count()) << ")";
return selectedQSOs;
}
void SearchWindow::slotQSLRecMarkAsRequested()
{
int _qsoId = ((searchModel->index((qslRecRequestedAct->data()).toInt(), 0)).data(0)).toInt();
dataProxy->qslRecAsRequested(_qsoId, QDate::currentDate());
if(qslingNeeded)
{
searchToolNeededQSLToSend();
}
else
{
emit updateSearchLineEdit();
}
searchModel->select();
}
void SearchWindow::setNeedingQSL(bool const _q)
{
qslingNeeded = _q;
}
void SearchWindow::slotToolSearchQSL(const int actionQSL)
{
//qDebug() << "SearchWidget::slotToolSearchQSL: " << QString::number(actionQSL) << " - LogNumber: " << QString::number(currentLog);
// 2 means QSL_RCVD = 'R'
QString stringQuery = QString();
QString message = QString();
QString aux = QString();
QString filter;
filter = QString();
//int i = -1;
switch (actionQSL)
{
case 0://void searchToolNeededQSLToSend();
//qDebug() << "SearchWidget::slotToolSearchQSL: CASE 0";
stringQuery = QString("SELECT call, qso_date,dxcc, bandid, modeid, qsl_sent, qsl_rcvd, lotw_qsl_rcvd, station_callsign, id FROM log WHERE (qsl_rcvd<>'Y' AND lotw_qsl_rcvd<>'Y') AND qsl_sent<>'Y' AND qsl_sent<>'Q' AND qsl_sent<>'R' AND lognumber='%1' AND (bandid, dxcc) NOT IN (SELECT distinct bandid, dxcc from log WHERE qsl_rcvd='Y' OR lotw_qsl_rcvd='Y')").arg(currentLog);
message = tr("Needed QSO to send the QSL");
setNeedingQSL(true);
//qslingNeeded = true;
emit requestFocus();
break;
case 1:
//qDebug() << "SearchWidget::slotToolSearchQSL: CASE 1";
filter = QString("qsl_sent=='R' AND lognumber='%1'").arg(currentLog);
message = tr("My QSL requested to be sent");
break;
case 2://void slotToolSearchNeededQSLPendingToReceive();
//qDebug() << "SearchWidget::slotToolSearchQSL: CASE 2";
filter = QString("lognumber='%1' AND ( (qsl_sent='Y' AND qsl_rcvd!='Y' AND qsl_rcvd!='I') OR qsl_rcvd='R')").arg(currentLog);
message = tr("DX QSL pending to be received");
break;
case 3://void slotToolSearchNeededQSLRequested()
//qDebug() << "SearchWidget::slotToolSearchQSL: CASE 3";
filter = QString("WHERE lognumber='%1' AND qsl_rcvd='R'").arg(currentLog);
message = tr("DX QSL pending to be received");
break;
default:
//qDebug() << "SearchWidget::slotToolSearchQSL: CASE DEFAULT";
// should never be reached
return;
// break;
}
clear();
setFilterString(filter);
}
void SearchWindow::searchToolNeededQSLToSend()
{
//qDebug() << "SearchWidget::slotToolSearchQSLToSend - TO PREPARE THE QUERY and optimize the function";
slotToolSearchQSL(0);
//qDebug() << "SearchWidget::slotToolSearchQSLToSend - END";
}
void SearchWindow::slotQSLSentMarkAsRequested()
{
//qDebug() << "SearchWindow::slotQSLSentMarkAsRequested: " << QString::number( (qslSentRequestedAct->data()).toInt() );
// bool qslSentAsRequested(const int _qsoId, const QString &_updateDate);
int _qsoId = ((searchModel->index((qslSentRequestedAct->data()).toInt(), 0)).data(0)).toInt();
dataProxy->qslSentAsRequested(_qsoId, QDate::currentDate());
if(qslingNeeded)
{
slotToolSearchQSL(0);
}
else
{
emit updateSearchText();
}
searchModel->select();
}
void SearchWindow::slotQSLSentViaDirectMarkDXReqFromSearch()
{
//qDebug() << "slotQSLSentViaDirectMarkDXReqFromSearch: ";
int _qsoId = ((searchModel->index((qslSentViaDirectMarkRcvReqFromSearchAct->data()).toInt(), 0)).data(0)).toInt();
//int _qsoId = (qslSentViaDirectMarkRcvReqFromSearchAct->data()).toInt();
dataProxy->qslSentViaDirect(_qsoId, QDate::currentDate());
dataProxy->qslRecAsRequested(_qsoId, QDate::currentDate());
if(qslingNeeded)
{
slotToolSearchQSL(0);
}
else
{
emit updateSearchText();
}
searchModel->select();
// Mark Sent, Bureau, date, update log.
}
void SearchWindow::slotQSLSentViaBureauMarkDXReqFromSearch()
{
//qDebug() << "slotQSLSentViaBureauMarkDXReqFromSearch: " << QString::number( (qslSentViaBureauMarkRcvReqFromSearchAct->data()).toInt() );
//int _qsoId = (qslSentViaBureauMarkRcvReqFromSearchAct->data()).toInt();
int _qsoId = ((searchModel->index((qslSentViaBureauMarkRcvReqFromSearchAct->data()).toInt(), 0)).data(0)).toInt();
dataProxy->qslSentViaBureau(_qsoId, QDate::currentDate());
dataProxy->qslRecAsRequested(_qsoId, QDate::currentDate());
if(qslingNeeded)
{
slotToolSearchQSL(0);
}
else
{
emit updateSearchText();
}
searchModel->select();
//qDebug() << "slotQSLSentViaBureauMarkDXReqFromSearch: - END ";
// Mark Sent, Bureau, date, update log.
}
void SearchWindow::slotQSLRecViaBureauMarkReqFromSearch()
{
//qDebug() << "SearchWidget::slotQSLRecViaBureauMarkReqFromLog - Start";
//int _qsoId = (qslRecViaBureauMarkReqFromSearchAct->data()).toInt();
int _qsoId = ((searchModel->index((qslRecViaBureauMarkReqFromSearchAct->data()).toInt(), 0)).data(0)).toInt();
//qDebug() << "SearchWidget::slotQSLRecViaBureauMarkReqFromLog: 01";
//qslRecViaBureauMarkReq(_qsoId);
dataProxy->qslRecViaBureau(_qsoId, QDate::currentDate(), true);
//qDebug() << "SearchWidget::slotQSLRecViaBureauMarkReqFromLog: 02: n: " << QString::number(_qsoId);
if(qslingNeeded)
{
//qDebug() << "SearchWidget::slotQSLRecViaBureauMarkReqFromLog: 03";
slotToolSearchQSL(0);
//qDebug() << "SearchWidget::slotQSLRecViaBureauMarkReqFromLog: 04";
}
else
{
//qDebug() << "SearchWidget::slotQSLRecViaBureauMarkReqFromLog: 05";
emit updateSearchText();
//qDebug() << "SearchWidget::slotQSLRecViaBureauMarkReqFromLog: 06";
}
searchModel->select();
//qDebug() << "SearchWidget::slotQSLRecViaBureauMarkReqFromLog: 07";
}
void SearchWindow::slotQSLRecViaDirectMarkReqFromSearch()
{
//qDebug() << "SearchWidget::slotQSLRecViaDirectFromLog: ";
//int _qsoId = (qslRecViaDirectMarkReqFromSearchAct->data()).toInt();
int _qsoId = ((searchModel->index((qslRecViaDirectMarkReqFromSearchAct->data()).toInt(), 0)).data(0)).toInt();
//qslRecViaDirectMarkReq(_qsoId);
dataProxy->qslRecViaDirect(_qsoId, QDate::currentDate(), true);
if(qslingNeeded)
{
slotToolSearchQSL(0);
}
else
{
emit updateSearchText();
}
searchModel->select();
// Mark Sent, Bureau, date, update log.
}
/*
void SearchWindow::qslRecViaBureauMarkReq(const int _qsoId)
{
//qDebug() << "SearchWidget::qslRecViaBureau: " << QString::number(_qsoId) << "/" << QDate::currentDate();
dataProxy->qslRecViaBureau(_qsoId, QDate::currentDate(), true);
//qDebug() << "SearchWidget::qslRecViaBureau: END";
}
*/
/*
void SearchWindow::qslRecViaDirectMarkReq(const int _qsoId)
{
//qDebug() << "SearchWidget::qslRecViaDirect: " << QString::number(_qsoId);
dataProxy->qslRecViaDirect(_qsoId, QDate::currentDate(), true);
}
*/
/*
void SearchWindow::colorTheList()
{
//qDebug() << "SearchWidget::colorTheList: " << QString::number(treeView->model()->rowCount());
for (int i = 0; i < treeView->model()->rowCount(); i++)
{
//QString _qrz = ((searchModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(1).toString());
QString _qrz = (searchModel->index(i, 2)).data(Qt::DisplayRole).toString();
//QColor getQRZDXStatusColor(const QStringList &_qs); // Receives Entity, band, mode & log
//QColor color = awards->getQRZDXStatusColor()
QColor color = QColor(Qt::blue);
//searchModel->setItemData(searchModel->index(i, 2), color);
//qDebug() << "SearchWidget::colorTheList: " << _qrz;
}
}
*/
void SearchWindow::setColors (const QColor &_newOne, const QColor &_needed, const QColor &_worked, const QColor &_confirmed, const QColor &_default)
{
//qDebug() << "DXClusterWidget::setColors: " << _newOne << "/" << _needed << "/" << _worked << "/" << _confirmed << "/" << _default;
// Just to pass the colors to the awards class
searchModel->setColors(_newOne, _needed, _worked, _confirmed, _default);
}
klog-2.4.1/awards.cpp 0000644 0001750 0001750 00000127766 15003153303 013433 0 ustar devel devel #include "awards.h"
/***************************************************************************
awards.cpp - description
-------------------
begin : nov 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
//#include
Awards::Awards(DataProxy_SQLite *dp, const QString &_parentFunction)
{
Q_UNUSED(_parentFunction);
//qDebug() << "Awards::Awards- from: " << _parentFunction;
dataProxy = dp;
//QSqlDatabase db = QSqlDatabase::database("QSQLITE");
world = new World(dataProxy, Q_FUNC_INFO);
//qDebug() << "Awards::Awards - Before DXMarathon" ;
dxMarathon = new DXMarathon(dataProxy);
//qDebug() << "Awards::Awards - After DXMarathon" ;
//world->create();
/*
newOneColor.setNamedColor("#ff0000");
neededColor.setNamedColor("#ff8c00");
workedColor.setNamedColor("#ffd700");
confirmedColor.setNamedColor("#32cd32");
defaultColor.setNamedColor("#00bfff");
*/
//"Awards::setColors: " << _newOne << "/" << _needed << "/" << _worked << "/" << _confirmed << "/" << _default;
//Awards::setColors: "#ff0000" / "#ff8c00" / "#ffd700" / "#32cd32" / "#00bfff"
newOneColor = Qt::black;
neededColor = Qt::black;
workedColor = Qt::black;
confirmedColor = Qt::black;
defaultColor = Qt::black;
dxccWorked.clear();
dxccConfirmed.clear();
wazWorked.clear();
wazConfirmed.clear();
manageModes = false;
//qDebug() << "Awards::Awards - END" ;
}
Awards::~Awards()
{
delete(world);
delete(dxMarathon);
}
QString Awards::getQSOofAward (const int _enti, const int _bandid, const int _log, const bool _confirmed)
{// Returns the QRZ that granted that status in the DXCC
//qDebug() << "Awards::getQSOofAward: " << QString::number(_enti) << "/" << QString::number(_bandid);
QSqlQuery query;
QString stringQuery = QString();
bool sqlOK = false;
//QString answer = QString();
if (_confirmed)
{
stringQuery = QString("SELECT call, qso_date from log where dxcc='%1' AND bandid='%2' AND lognumber='%3' AND (qsl_rcvd='Y' OR lotw_qsl_rcvd='Y')").arg(_enti).arg(_bandid).arg(_log);
}
else
{
stringQuery = QString("SELECT call, qso_date from log where dxcc='%1' AND bandid='%2' AND lognumber='%3'").arg(_enti).arg(_bandid).arg(_log);
}
sqlOK = query.exec(stringQuery);
//qDebug() << "Awards::getQSOofAward: stringQuery: " << stringQuery;
if (sqlOK)
{
query.next();
if (query.isValid())
{
QString answer = query.value(0).toString() + " / " + query.value(1).toString() ;
query.finish();
//qDebug() << "Awards::getQSOofAward: answer: " << answer;
return answer;
}
else
{
query.finish();
//qDebug() << "Awards::getQSOofAward: 0";
return QString();
}
}
else
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
//qDebug() << "Awards::getQSOofAward: Query error";
return QString();
}
}
int Awards::getQSOIdofAward (const int _enti, const int _bandid, const int _log, const bool _confirmed)
{// Returns the QSOid that granted that status in the DXCC
//qDebug() << "Awards::getQSOIdofAward: " << QString::number(_enti) << "/" << QString::number(_bandid);
QSqlQuery query;
QString stringQuery = QString();
bool sqlOK = false;
int answer = -1;
if (_confirmed)
{
stringQuery = QString("SELECT id from log where dxcc='%1' AND bandid='%2' AND lognumber='%3' AND (qsl_rcvd='Y' OR lotw_qsl_rcvd='Y')").arg(_enti).arg(_bandid).arg(_log);
}
else
{
stringQuery = QString("SELECT id from log where dxcc='%1' AND bandid='%2' AND lognumber='%3'").arg(_enti).arg(_bandid).arg(_log);
}
sqlOK = query.exec(stringQuery);
//qDebug() << "Awards::getQSOIdofAward: stringQuery: " << stringQuery;
if (sqlOK)
{
query.next();
if (query.isValid())
{
answer = query.value(0).toInt();
//qDebug() << "Awards::getQSOIdofAward: answer: " << QString::number(answer);
query.finish();
if (answer>=1)
{
return answer;
}
else
{
return -1;
}
}
else
{
query.finish();
//qDebug() << "Awards::getQSOIdofAward: 0";
return -2;
}
}
else
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
//qDebug() << "Awards::getQSOIdofAward: Query error";
return -3;
}
}
int Awards::getDXCCWorked(const int _logNumber)
{
//qDebug() << "Awards::getDXCCWorked (logNumber): " << QString::number(_logNumber);
QSqlQuery query;
QString stringQuery;
bool sqlOK;
if (dataProxy->doesThisLogExist(_logNumber))
{
stringQuery = QString("SELECT COUNT (DISTINCT dxcc) FROM log WHERE dxcc>'0' AND dxcc < '1000' AND lognumber='%1'").arg(_logNumber);
}
else
{
stringQuery = QString("SELECT COUNT (DISTINCT dxcc) FROM log WHERE dxcc>'0' AND dxcc < '1000' ");
}
sqlOK = query.exec(stringQuery);
//qDebug() << "Awards::getDXCCWorked: stringQuery: " << stringQuery;
if (sqlOK)
{
query.next();
if (query.isValid())
{
int v = (query.value(0)).toInt();
query.finish();
//qDebug() << "Awards::getDXCCWorked: " << QString::number((query.value(0)).toInt());
return v;
}
else
{
//qDebug() << "Awards::getDXCCWorked: 0";
query.finish();
return 0;
}
}
else
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
//qDebug() << "Awards::getDXCCWorked: Query error";
return 0;
}
}
int Awards::getDXCCConfirmed(const int _logNumber)
{
//qDebug() << "Awards::getDXCCConfirmed (logNumber): " << QString::number(_logNumber);
return dataProxy->getFieldInBand (DXCC, "ALL", true, "ALL", _logNumber);
}
int Awards::getWAZWorked(const int _logNumber)
{
//qDebug() << "Awards::getWAZWorked (logNumber): " << QString::number(_logNumber);
QSqlQuery query;
QString stringQuery;
if (dataProxy->doesThisLogExist(_logNumber))
{
stringQuery = QString("SELECT COUNT (cqz) FROM (SELECT DISTINCT cqz FROM log WHERE cqz!='' AND cqz>'0' AND cqz<'41' AND lognumber='%1')").arg(_logNumber);
}
else
{
stringQuery = QString("SELECT COUNT (cqz) FROM (SELECT DISTINCT cqz FROM log WHERE cqz!='' AND cqz>'0' AND cqz<'41')");
}
bool sqlOK = query.exec(stringQuery);
if (sqlOK)
{
query.next();
if (query.isValid())
{
int v = (query.value(0)).toInt();
query.finish();
return v;
}
else
{
query.finish();
return 0;
}
}
else
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
return 0;
}
}
int Awards::getWAZConfirmed(const int _logNumber)
{
//qDebug() << "Awards::getWAZConfirmed (logNumber): " << QString::number(_logNumber);
QSqlQuery query;
QString stringQuery;
//Usar la siguiente para el confirmed
if (dataProxy->doesThisLogExist(_logNumber))
{
stringQuery = QString("SELECT COUNT (cqz) FROM (SELECT DISTINCT cqz FROM log WHERE cqz!='' AND cqz>'0' AND cqz<'41' AND (qsl_rcvd='Y' OR lotw_qsl_rcvd='Y') AND lognumber='%1')").arg(_logNumber);
}
else
{
stringQuery = QString("SELECT COUNT (cqz) FROM (SELECT DISTINCT cqz FROM log WHERE cqz!='' AND cqz>'0' AND cqz<'41' AND (qsl_rcvd='Y' OR lotw_qsl_rcvd='Y'))");
}
bool sqlOK = query.exec(stringQuery);
if (sqlOK)
{
query.next();
if (query.isValid())
{
int v =(query.value(0)).toInt();
query.finish();
return v;
}
else
{
query.finish();
return 0;
}
}
else
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
return 0;
}
}
int Awards::getDXStatus (EntityStatus _entityStatus)
{
//qDebug() << Q_FUNC_INFO<< ": Entity: " << _qs.at(0) << "/ Band: " << _qs.at(1) << "/ Mode: " << _qs.at(2) << "/ Log: " << _qs.at(3) << QT_ENDL;
// Receives: QStringList _qs;
//_qs << Entity << BandId << << ModeId << lognumber;
// TODO: Maybe a status per band/mode... check how WSJTX is doing it
/* Not mode
-1 - Error. - ERROR - ERROR
0 - New one - New One - New One - 0
1 - Worked but not in this band nor this mode - Needed One - Needed One - 1
2 - Worked in this band, not this mode - Needed One - Worked One - 3
3 - Worked in this band and in this mode - Worked One - Worked One - 3
4 - Worked in this mode, not this band - Needed One - Needed One - 1
5 - Confirmed in another band/mode but not worked in this band nor this mode - Needed One - Needed One - 1
6 - Confirmed in another band/mode but just worked in this band and not in this mode - Needed One - Worked One - 3
7 - Confirmed in another band/mode but just worked in this mode and not in this band - Needed One - Needed One - 1
8 - Confirmed in another band/mode but just worked in this band and mode - Worked One - Worked One - 3
9 - Confirmed in this mode, but not worked this band - Needed One - Needed One - 1
10 - Confirmed in this mode, but worked this band - Worked One - Worked One - 3
11 - Confirmed in this band but not worked in this mode - Needed One - Confirmed One - 13
12 - Confirmed in this band but worked in this mode - Worked One - Confirmed One - 13
13 - Confirmed in this band and mode - Confirmed One - Confirmed One - 13
14 - New CQ Zone
15 - New CQ Zone on band
16 - New ITU Zone
17 - New ITU Zone on band
18 - New Grid
19 - New Grid on band
*/
/*
0 - New One - Never worked before - RED
1 - Needed - New one in this band - ORANGE
2 - Worked - Worked in this band but not confirmed - YELLOW
3 - Confirmed - Confirmed in this band - GREEN
*/
//qDebug() << Q_FUNC_INFO<< ": dxccEntity: " << QString::number(_entityStatus.dxcc);
if (_entityStatus.dxcc<=0)
{
//qDebug() << Q_FUNC_INFO<< ": dxccEntity <= 0, return -1";
return -1;
}
bool checkingMode = true;
if ( (_entityStatus.modeId==-1) || (manageModes==false))
{
checkingMode = false;
//qDebug() << Q_FUNC_INFO<< ": checkingMode = FALSE";
}
int wb = dxccStatusBand(_entityStatus.dxcc, _entityStatus.bandId, _entityStatus.logId); //-1 error / 0 Not worked / 1 worked / 2 confirmed
int wm = -1;
if (checkingMode)
{
wm = dxccStatusMode(_entityStatus.dxcc, _entityStatus.modeId, _entityStatus.logId); //-1 error / 0 Not worked / 1 worked / 2 confirmed
}
// int wm = dxccStatusMode(dxccEntity, _mode, _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed
if (wm==-1)
{
checkingMode = false;
}
//qDebug() << Q_FUNC_INFO<< ": wb=" << QString::number(wb) << " - wm=" << QString::number(wm);
//qDebug() << Q_FUNC_INFO<< ": dxccStatus: " << QString::number(dxccStatus(dxccEntity, _logNumber));
switch(dxccStatus(_entityStatus.dxcc, _entityStatus.logId))
{
case 0:
//qDebug() << Q_FUNC_INFO<< ": return 0";
return 0; // ATNO
//break;
case 1: // Worked, not confirmed
switch (wb)
{
case 0: // Not worked in this band but in another band
if (checkingMode)
{
if (wm==1)
{
//qDebug() << Q_FUNC_INFO<< ": return 4";
return 4;
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return 1";
return 1;
}
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return 4 nc";
return 4;
}
case 1: // Worked in this band
if (checkingMode)
{
if (wm==1)
{
//qDebug() << Q_FUNC_INFO<< ": return 3";
return 3;
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return 2";
return 2;
}
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return 3 nc";
return 3;
}
default: // ERROR
//qDebug() << Q_FUNC_INFO<< ": default return -1 - 1";
return -1;
}
case 2: // Confirmed
if (wb==2)
{
if (checkingMode)
{
if (wm==2)
{
//qDebug() << Q_FUNC_INFO<< ": return 13";
return 13;
}
else if (wm==1)
{
//qDebug() << Q_FUNC_INFO<< ": return 12";
return 12;
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return 11";
return 11;
}
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return 13 nc";
return 13;
}
}
else if ((wb ==1) || (wb == 0))
{
if (checkingMode)
{
if (wb==1)
{
if (wm==1)
{
//qDebug() << Q_FUNC_INFO<< ": return 8";
return 8;
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return 6";
return 6;
}
}
else
{
if (wm==1)
{
//qDebug() << Q_FUNC_INFO<< ": return 7";
return 7;
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return 5";
return 5;
}
}
}
else
{
if (wb==0)
{
//qDebug() << Q_FUNC_INFO<< ": return 7 nc";
return 7;
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return 8 nc";
return 8;
}
}
}
else
{
//qDebug() << Q_FUNC_INFO<< ": return -1 - 2";
return -1;
}
default:
//qDebug() << Q_FUNC_INFO<< ": return -1 default2";
return -1;
} // END OF SWITCH
//qDebug() << Q_FUNC_INFO<< ": END, return -1";
//return -1;
}
int Awards::dxccStatusBandMode(const int _ent, const int _band, const int _mode, const int _logNumber, bool _checkingMode)
{//-1 error / 0 Not worked / 1 worked / 2 confirmed
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_ent) << "/" << QString::number(_band) << "/" << QString::number(_mode);
QSqlQuery query = QSqlQuery();
QString queryString = QString();
if (_checkingMode)
{
//qDebug() << Q_FUNC_INFO << ": Checking Mode TRUE";
queryString = QString("SELECT DISTINCT qsl_rcvd, lotw_qsl_rcvd FROM log WHERE dxcc='%1' AND bandid='%2' AND modeid='%3' AND lognumber='%4' ").arg(QString::number(_ent)).arg(QString::number(_band)).arg(QString::number(_mode)).arg(QString::number(_logNumber));
}
else
{
//qDebug() << Q_FUNC_INFO << ": Checking Mode FALSE";
queryString = QString("SELECT DISTINCT qsl_rcvd, lotw_qsl_rcvd FROM log WHERE dxcc='%1' AND bandid='%2' AND lognumber='%3'").arg(QString::number(_ent)).arg(QString::number(_band)).arg(QString::number(_logNumber));
}
int status = 0;
if (query.exec(queryString))
{
while (query.next())
{
if ( query.isValid() )
{
if((query.value(0).toString() == "Y") || (query.value(1).toString() == "Y"))
{
//qDebug() << Q_FUNC_INFO << ": return - 2";
query.finish();
return 2;
}
status = 1;
}
}
query.finish();
}
else
{ // The query fails...
//qDebug() << Q_FUNC_INFO << ": return - -1";
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
return -1;
}
//qDebug() << Q_FUNC_INFO << ": return - 0-4";
return status;
}
int Awards::dxccStatus(const int _ent, const int _logNumber)
{//-1 error / 0 Not worked / 1 worked / 2 confirmed
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_ent);
QSqlQuery query = QSqlQuery();
QString queryString = QString();
int worked = 0;
queryString = QString("SELECT DISTINCT qsl_rcvd, lotw_qsl_rcvd FROM log WHERE dxcc='%1' AND lognumber='%2' ").arg(QString::number(_ent)).arg(QString::number(_logNumber));
if (query.exec(queryString))
{
//qDebug() << Q_FUNC_INFO << ": query exec OK: " << query.lastQuery();
while (query.next())
{
//qDebug() << Q_FUNC_INFO << ": query VALUE: " << (query.value(0)).toString();
if ( query.isValid() )
{
//qDebug() << Q_FUNC_INFO << ": query valid OK";
if(((query.value(0)).toString() == "Y") || ((query.value(1)).toString() == "Y"))
{
//qDebug() << Q_FUNC_INFO << ": value = 1 - return 2";
query.finish();
return 2;
}
worked = 1;
}
}
//qDebug() << Q_FUNC_INFO << ": return "<< QString::number(worked) ;
query.finish();
//qDebug() << Q_FUNC_INFO << ": END: " << QString::number(worked);
return worked;
}
else
{ // The query fails...
//qDebug() << Q_FUNC_INFO << ": return -1" ;
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
return -1;
}
//qDebug() << Q_FUNC_INFO << ": return 0" ;
//return worked;
}
QColor Awards::getQRZDXStatusColor(EntityStatus _entitystatus)
{
//qDebug() << Q_FUNC_INFO << " - Start: " ;
//qDebug() << Q_FUNC_INFO << " - Entityd: " << _entitystatus.dxcc;
//qDebug() << Q_FUNC_INFO << " - BandId: " << _entitystatus.bandId;
//qDebug() << Q_FUNC_INFO << " - ModeId: " << _entitystatus.modeId;
//qDebug() << Q_FUNC_INFO << " - Log: " << _entitystatus.logId;
/*
0 - New One
1 - Needed
2 - Worked
3 - Confirmed
*/
QColor returnedColor;
int status = getDXStatus(_entitystatus);
//qDebug() << Q_FUNC_INFO<< ": status: " << QString::number(status) << "/" << getDXStatusString(status);
//qDebug() << Q_FUNC_INFO<< ": status: " << QString::number(status);
switch (status) {
case 0:
//qDebug() << Q_FUNC_INFO<< ": returning newOneColor";
returnedColor = newOneColor;
break;
case 1:
//qDebug() << Q_FUNC_INFO<< ": returning neededColor";
returnedColor = neededColor;
break;
case 2:
//qDebug() << Q_FUNC_INFO<< ": returning neededColor";
returnedColor = neededColor;
break;
case 3:
//qDebug() << Q_FUNC_INFO<< ": returning workedColor";
returnedColor = workedColor;
break;
case 4:
//qDebug() << Q_FUNC_INFO<< ": returning neededColor";
returnedColor = neededColor;
break;
case 5:
//qDebug() << Q_FUNC_INFO<< ": returning neededColor";
returnedColor = neededColor;
break;
case 6:
//qDebug() << Q_FUNC_INFO<< ": returning neededColor";
returnedColor = neededColor;
break;
case 7:
//qDebug() << Q_FUNC_INFO<< ": returning neededColor";
returnedColor = neededColor;
break;
case 8:
//qDebug() << Q_FUNC_INFO<< ": returning workedColor";
returnedColor = workedColor;
break;
case 9:
//qDebug() << Q_FUNC_INFO<< ": returning neededColor";
returnedColor = neededColor;
break;
case 10:
//qDebug() << Q_FUNC_INFO<< ": returning workedColor";
returnedColor = workedColor;
break;
case 11:
//qDebug() << Q_FUNC_INFO<< ": returning neededColor";
returnedColor = neededColor;
break;
case 12:
//qDebug() << Q_FUNC_INFO<< ": returning workedColor";
returnedColor = workedColor;
break;
case 13:
//qDebug() << Q_FUNC_INFO<< ": returning confirmedColor";
returnedColor = confirmedColor;
break;
//break;
default:
//qDebug() << Q_FUNC_INFO<< ": returning defaultColor";
returnedColor = defaultColor;
break;
}
return returnedColor;
}
QSOStatus Awards::getQSOStatus(const int &_status)
{
switch (_status) {
case 0:
return ATNO;
break;
case 1:
return needed;
break;
case 2:
return needed;
break;
case 3:
return worked;
break;
case 4:
return needed;
break;
case 5:
return needed;
break;
case 6:
return needed;
break;
case 7:
return needed;
break;
case 8:
return worked;
break;
case 9:
return needed;
break;
case 10:
return worked;
break;
case 11:
return needed;
break;
case 12:
return worked;
break;
case 13:
return confirmed;
break;
//break;
default:
return unknown;
break;
}
}
QString Awards::getDXStatusString (const int &_status)
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_status);
QString message = QString();
switch (_status) {
case 0:
message = QObject::tr("New One, work it!");
//message = QObject::tr("0-new One");
break;
case 1:
message = QObject::tr("Needed, work it!");
//message = QObject::tr("1-Needed, work it!");
break;
case 2:
message = QObject::tr("Needed, work it!");
break;
case 3:
message = QObject::tr("Worked but not confirmed");
break;
case 4:
message = QObject::tr("Needed, work it!");
break;
case 5:
message = QObject::tr("Needed, work it!");
break;
case 6:
message = QObject::tr("Needed, work it!");
break;
case 7:
message = QObject::tr("Needed, work it!");
break;
case 8:
message = QObject::tr("Worked but not confirmed");
break;
case 9:
message = QObject::tr("Needed, work it!");
break;
case 10:
message = QObject::tr("Worked but not confirmed");
break;
case 11:
message = QObject::tr("Needed, work it!");
break;
case 12:
message = QObject::tr("Worked but not confirmed");
break;
case 13:
message = QObject::tr("Confirmed");
break;
//break;
default:
message = QObject::tr("Not identified");
break;
}
return message;
}
QSOStatus Awards::getDXCCStatusBand(const int _dxcc, const int _band)
{
// Returns -, W or C (Not worked, worked, Confirmed)
//qDebug() << Q_FUNC_INFO << "DXCC/Band: " << QString::number(_dxcc) << "/" << QString::number(_band);
//qDebug() << Q_FUNC_INFO << "dxccStatusList: " << QString::number(dxccStatusList.length ());
EntityStatus indexEntityStatus;
QSOStatus status = QSOStatus::needed;
// bool worked = false;
foreach (indexEntityStatus, dxccStatusList)
{
//qDebug() << Q_FUNC_INFO << " DXCC: " << QString::number(indexEntityStatus.dxcc);
//qDebug() << Q_FUNC_INFO << " Band: " << QString::number(indexEntityStatus.bandId);
if (indexEntityStatus.dxcc == _dxcc)
{
if (indexEntityStatus.bandId == _band)
{
if (indexEntityStatus.status == QSOStatus::confirmed )
{
//qDebug() << Q_FUNC_INFO << " Confirmed " ;
return QSOStatus::confirmed;
}
else
{ // This is important because it may happoen that the entity/bandId is confirmed in some modes but not in others
status = QSOStatus::worked;
//worked = true;
}
}
}
}
//qDebug() << Q_FUNC_INFO << " Returning -" ;
//if (worked)
// return QSOStatus::worked;
return status;
}
QString Awards::checkIfValidIOTA(const QString &_tiota)
{
/**********************************
IOTA should be always with this format: CC-NNN
being:
- CC the shortname of the continent
- NNN Number of the reference.
NNN has ALWAYS to include THREE(3) characters.
ADIF Specs says:
CC is the continent designator {NA, SA, EU , AF, OC, AS, AN}
XXX is the island designator, where 0 <= XXX ,<= 999 [use leading zeroes]
Returns a valid format IOTA if possible and "" in other cases.
************************************/
//qDebug() << "Awards::checkIfValidIOTA: " << _tiota;
//bool _valid = false;
QString _continent;
QString _number;
if (_tiota.count("-") == 1)
{
QStringList _values = _tiota.split("-", QT_SKIP);
if (_values.size() != 2)
{
return "";
}
if (dataProxy->isValidContinentShortName(_values.at(0)))
{
_continent = _values.at(0);
}
else
{
return "";
}
if ((_values.at(1)).toInt() > 0)
{
_number = _values.at(1);
}
else
{
return "";
}
}
else
{
return "";
}
//qDebug() << "Awards::checkIfValidIOTA (cont) " << _continent;
//qDebug() << "Awards::checkIfValidIOTA (numb): " << _number;
// Check if continent is valid
if (dataProxy->isValidContinentShortName(_continent))
{
if ( (_number.toInt() >0 ) && ((_number.toInt()) < 1000 ))
{
if ((_number.length()) == 3)
{
return _continent + "-" + _number ;
}
else if ((_number.length()) == 2)
{
return _continent + "-0" + QString::number((_number).toInt());
}
else if ((_number.length()) == 1)
{
return _continent + "-00" + QString::number((_number).toInt());
}
else
{
return "";
}
}
else
{
return "";
}
}
else
{
return QString();
}
}
void Awards::setColors (const QColor &_newOne, const QColor &_needed, const QColor &_worked, const QColor &_confirmed, const QColor &_default)
{
//qDebug() << Q_FUNC_INFO << ": " << _newOne << "/" << _needed << "/" << _worked << "/" << _confirmed << "/" << _default;
defaultColor = _default;
neededColor = _needed;
workedColor = _worked;
confirmedColor = _confirmed;
newOneColor = _newOne;
}
QColor Awards::getDefaultColor(){return defaultColor;}
void Awards::recalculateAwards()
{
//qDebug() << Q_FUNC_INFO;
if (updateDXCCStatus())
emit awardDXCCUpdated();
//dataProxy->updateAwardWAZ();
//qDebug() << Q_FUNC_INFO << " - END";
}
int Awards::getQSOsInLog(const int _logNumber)
{
//qDebug() << "Awards::getQSOsInLog: " << QString::number(_logNumber);
QSqlQuery query;
QString queryString;
int v;
queryString = QString("SELECT COUNT (id) FROM log WHERE lognumber='%1'").arg(_logNumber) ;
if( !query.exec(queryString) )
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
return -1;
}
else
{
query.next();
if (query.isValid())
{
v = query.value(0).toInt();
query.finish();
return v;
}
else
{
query.finish();
return -2;
}
}
}
void Awards::setAwards()
{
//qDebug() << Q_FUNC_INFO << " - " << QString::number(_qsoId);
//dataProxy->setDXCCAwardStatus(_qsoId);
//ataProxy->setWAZAwardStatus(_qsoId);
recalculateAwards();
}
int Awards::setDXCCToQSO(const int _dxcc, const int _qsoid) // Defines the DXCC in a QSO
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_dxcc) << "/" << QString::number(_qsoid);
//int errorCode = -1;
QString queryString = QString("UPDATE log SET dxcc='%1' WHERE id='%2'").arg(_dxcc).arg(_qsoid);
QSqlQuery query = QSqlQuery();
bool sqlOK = query.exec(queryString);
if (sqlOK)
{
query.finish();
return 1;
}
else
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
//qDebug() << Q_FUNC_INFO << ": DXCC Updated in Log but failed....";
int errorCode = query.lastError().text().toInt();
query.finish();
//qDebug() << Q_FUNC_INFO << ": LastQuery: " << query.lastQuery() ;
//qDebug() << Q_FUNC_INFO << ": LastError-data: " << query.lastError().databaseText() ;
//qDebug() << Q_FUNC_INFO << ": LastError-driver: " << query.lastError().driverText() ;
//qDebug() << Q_FUNC_INFO << ": LastError-n: " << QString::number(query.lastError().text() );
return errorCode;
}
}
int Awards::setCQToQSO(const int _cqz, const int _qsoid) // Defines the CQ in a QSO
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_cqz) << "/" << QString::number(_qsoid);
//int errorCode = -1;
QString queryString = QString("UPDATE log SET cqz='%1' WHERE id='%2'").arg(_cqz).arg(_qsoid);
QSqlQuery query = QSqlQuery();
bool sqlOK = query.exec(queryString);
if (sqlOK)
{
query.finish();
return 1;
}
else
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
//qDebug() << Q_FUNC_INFO << ": DXCC Updated in Log but failed....";
int errorCode = query.lastError().text().toInt();
query.finish();
//qDebug() << Q_FUNC_INFO << ": LastQuery: " << query.lastQuery() ;
//qDebug() << Q_FUNC_INFO << ": LastError-data: " << query.lastError().databaseText() ;
//qDebug() << Q_FUNC_INFO << ": LastError-driver: " << query.lastError().driverText() ;
//qDebug() << Q_FUNC_INFO << ": LastError-n: " << QString::number(query.lastError().text() );
return errorCode;
}
}
bool Awards::getIsDXCCConfirmed(const int _dxcc, const int _logNumber)
{
//qDebug() << Q_FUNC_INFO << " - " << _dxcc;
for (const auto& indexEntityStatus : dxccStatusList)
{
if (indexEntityStatus.dxcc == _dxcc &&
indexEntityStatus.status == QSOStatus::confirmed &&
(_logNumber <= 0 || indexEntityStatus.logId == _logNumber))
{
return true;
}
}
return false;
}
int Awards::getDXMarathonQSO(const int _year, const int _logNumber)
{
//qDebug() << "Awards::getDXMarathonQSO: " << QString::number(_year);
return dxMarathon->getDXMarathonQSO(_year, _logNumber);
}
int Awards::getDXMarathonDXCC(const int _year, const int _logNumber)
{
//qDebug() << "Awards::getDXMarathonDXCC: " << QString::number(_year);
return dxMarathon->getDXMarathonDXCC(_year, _logNumber);
}
int Awards::getDXMarathonCQ(const int _year, const int _logNumber)
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_year);
return dxMarathon->getDXMarathonCQ(_year, _logNumber);
}
int Awards::getDXMarathonScore(const int _year, const int _logNumber)
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_year);
return dxMarathon->getDXMarathonScore(_year, _logNumber);
}
bool Awards::isDXMarathonNeed(const int _dxcc, const int _cq, const int _year, const int _logNumber)
{
return dxMarathon->neededForDXMarathon(_dxcc, _cq, _year, _logNumber);
}
int Awards::dxccStatusBand(const int _ent, const int _band, const int _logNumber) //-1 error / 0 Not worked / 1 worked / 2 confirmed
{
//-1 error / 0 Not worked / 1 worked / 2 confirmed
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_ent) << "/" << QString::number(_band);
QSqlQuery query = QSqlQuery();
QString queryString = QString("SELECT DISTINCT qsl_rcvd, lotw_qsl_rcvd FROM log WHERE dxcc='%1' AND bandid='%2' AND lognumber='%4' ").arg(QString::number(_ent)).arg(QString::number(_band)).arg(QString::number(_logNumber));
int status = 0;
//qDebug() << Q_FUNC_INFO << ": " << queryString;
if (query.exec(queryString))
{
while (query.next())
{
if ( query.isValid() )
{
if((query.value(0).toString() == "Y") || (query.value(1).toString() == "Y")) // Confirmed
{
query.finish();
return 2;
}
status = 1;
} // Not present => Not worked
}
query.finish();
}
else
{
//TODO: Manage the query error
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
return -1;
}
//qDebug() << Q_FUNC_INFO << ": return - 0.3";
return status; // if arrives to here decision => not worked
}
int Awards::dxccStatusMode(const int _ent, const int _mode, const int _logNumber) //-1 error / 0 Not worked / 1 worked / 2 confirmed
{
//-1 error / 0 Not worked / 1 worked / 2 confirmed
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_ent) << "/" << QString::number(_mode);
QSqlQuery query = QSqlQuery();
QString queryString = QString();
if (_mode == -1)
{
return -1;
}
int status = 0;
queryString = QString("SELECT DISTINCT qsl_rcvd, lotw_qsl_rcvd FROM log WHERE dxcc='%1' AND modeid='%2' AND lognumber='%4' ").arg(QString::number(_ent)).arg(QString::number(_mode)).arg(QString::number(_logNumber));
if (query.exec(queryString))
{
while (query.next())
{
if ( query.isValid() )
{
if((query.value(0).toString() == "Y") || (query.value(1).toString() == "Y")) // Confirmed
{
query.finish();
return 2;
}
status = 1;
} // Not present => Not worked
}
query.finish();
}
else
{ // The query fails...
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
//TODO: Manage the query error
return -1;
}
return status; // if arrives to here decision => not worked
}
void Awards::setManageModes(const bool _manageModes)
{
manageModes = _manageModes;
}
bool Awards::updateDXCCStatus(const int _logNumber)
{
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_logNumber);
QSqlQuery query;
QString stringQuery = QString();
if (_logNumber>0)
{
stringQuery = QString("SELECT dxcc, bandid, modeid, qsl_rcvd, lotw_qsl_rcvd, lognumber, MIN(id) as id FROM log WHERE lognumber = :lognumber GROUP BY dxcc, bandid, modeid, qsl_rcvd, lotw_qsl_rcvd ORDER BY dxcc;");
}
else
{
stringQuery = QString("SELECT dxcc, bandid, modeid, qsl_rcvd, lotw_qsl_rcvd, lognumber, MIN(id) as id FROM log GROUP BY dxcc, bandid, modeid, qsl_rcvd, lotw_qsl_rcvd ORDER BY dxcc;");
}
if (_logNumber>0)
{
if (!query.prepare(stringQuery))
return false;
query.bindValue(":lognumber", _logNumber);
}
if (!executeQuery(query, stringQuery))
{
return false;
}
int qsos = processQueryResults(query);
populateDXCCStatusMap(); // Populate the multi-hash map
query.finish();
return !(dxccStatusList.isEmpty() && qsos > 0);
}
void Awards::populateDXCCStatusMap()
{
//qDebug() << Q_FUNC_INFO << " - Start";
dxccStatusMap.clear(); // Clear the multi-hash map
for (const EntityStatus &status : dxccStatusList)
{
dxccStatusMap.insert(status.dxcc, status);
}
}
QList Awards::findEntityStatusByDXCC(int dxcc) const
{
return dxccStatusMap.values(dxcc); // Return all EntityStatus instances for the given dxcc
}
QSOStatus Awards::getStatus(const QSqlQuery &query, const QSqlRecord &rec)
{
if ((query.value(rec.indexOf("qsl_rcvd")).toString() == "Y") ||
(query.value(rec.indexOf("lotw_qsl_rcvd")).toString() == "Y"))
{
return QSOStatus::confirmed;
}
else
{
return QSOStatus::worked;
}
}
int Awards::processQueryResults(QSqlQuery &query)
{
//qDebug()() << Q_FUNC_INFO << " - Start ";
int qsos = 0;
dxccStatusList.clear();
while (query.next()) {
if (!query.isValid()) {
emit queryError(Q_FUNC_INFO, "Invalid query result", "", query.lastQuery());
return qsos;
}
qsos++;
EntityStatus ent = extractEntityStatus(query);
if (updateOrAddEntityStatus(ent)) {
dxccStatusList.append(ent);
}
}
return qsos;
}
EntityStatus Awards::extractEntityStatus(QSqlQuery &query) {
QSqlRecord rec = query.record();
EntityStatus ent;
ent.dxcc = query.value(rec.indexOf("dxcc")).toInt();
ent.bandId = query.value(rec.indexOf("bandid")).toInt();
ent.modeId = query.value(rec.indexOf("modeid")).toInt();
ent.status = getStatus(query, rec);
ent.qsoId = query.value(rec.indexOf("id")).toInt();
ent.logId = query.value(rec.indexOf("lognumber")).toInt();
return ent;
}
bool Awards::updateOrAddEntityStatus(const EntityStatus &ent) {
for (qsizetype i = 0; i < dxccStatusList.count(); ++i) {
if (dxccStatusList[i].dxcc == ent.dxcc &&
dxccStatusList[i].bandId == ent.bandId &&
dxccStatusList[i].modeId == ent.modeId) {
if (ent.status == confirmed && dxccStatusList[i].status != confirmed) {
dxccStatusList[i].status = ent.status;
dxccStatusList[i].qsoId = ent.qsoId;
dxccStatusList[i].logId = ent.logId;
return false; // Entity was updated
}
return false; // Entity was not added or updated
}
}
return true; // Entity is new and will be added
}
bool Awards::executeQuery(QSqlQuery &query, const QString &stringQuery)
{
if (!query.exec(stringQuery)) {
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
return false;
}
return true;
}
QString Awards::status2String(const QSOStatus &_status, bool shortString)
{
switch (_status)
{
case QSOStatus::ATNO:
if (shortString)
return tr("A", "Do not translate");
return tr("ATNO", "All Time New One, Do not translate");
case QSOStatus::needed:
if (shortString)
return tr("N", "Needed, please try to keep the N");
return tr("Needed");
case QSOStatus::worked:
if (shortString)
return tr("W", "Worked, please try to keep the W");
return tr("Worked");
case QSOStatus::confirmed:
if (shortString)
return tr("C", "Confirmed, please try to keep the C");
return tr("Confirmed");
default:
if (shortString)
if (shortString)
return tr("U", "Unknown");
return tr("Unknown");
}
}
void Awards::printEntityStatus(const QString &_callingFunction, const EntityStatus &ent)
{ // This is a debug function
Q_UNUSED(_callingFunction);
Q_UNUSED(ent);
//qDebug() << Q_FUNC_INFO << " ------------------------------------------------------------------------------------";
//qDebug() << Q_FUNC_INFO << " - " << _callingFunction << " - DXCC : " << ent.dxcc;
//qDebug() << Q_FUNC_INFO << " - " << _callingFunction << " - Band : " << ent.bandId;
//qDebug() << Q_FUNC_INFO << " - " << _callingFunction << " - Mode : " << ent.modeId;
//qDebug() << Q_FUNC_INFO << " - " << _callingFunction << " - QSOid : " << ent.qsoId;
//qDebug() << Q_FUNC_INFO << " - " << _callingFunction << " - LogId : " << ent.logId;
//qDebug() << Q_FUNC_INFO << " - " << _callingFunction << " - Status : " << status2String(ent.status);
//qDebug() << Q_FUNC_INFO << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
}
klog-2.4.1/INSTALL.txt 0000644 0001750 0001750 00000000312 15003153303 013266 0 ustar devel devel This file is about the installation process of KLog.
Please read:
INSTALL-linux.txt for linux installations.
INSTALL-macOS.txt for macOS installations.
INSTALL-win.txt for Windows installations.
klog-2.4.1/statisticswidget.cpp 0000644 0001750 0001750 00000024600 15003153303 015527 0 ustar devel devel /***************************************************************************
statisticswidget.cpp - description
-------------------
begin : oct 2020
copyright : (C) 2020 by Jaime Robles
user : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include "statisticswidget.h"
StatisticsWidget::StatisticsWidget(DataProxy_SQLite *dp, QWidget *parent): QWidget(parent)
{
//qDebug() << Q_FUNC_INFO << "Start";
dataProxy = dp;
statisticToShowComboBox = new QComboBox();
logComboBox = new QComboBox();
stackedWidget = new QStackedWidget ;
w1 = new StatsQSOsPerYearBarChartWidget(dataProxy, this);
w2 = new StatsEntitiesPerYearBarChartWidget(dataProxy, this);
w3 = new StatsCQZPerYearBarChartWidget(dataProxy, this);
w4 = new StatsQSOsPerBandBarChartWidget(dataProxy, nullptr);
w5 = new StatsQSOsPerModeBarChartWidget(dataProxy, nullptr);
w6 = new StatsQSOsPerDXCCBarChartWidget(dataProxy, nullptr);
w7 = new StatsQSOsPerContinentBarChartWidget(dataProxy, nullptr);
w8 = new StatsQSOsPerHourBarChartWidget(dataProxy, nullptr);
w9 = new StatsQSOsPerMonthBarChartWidget(dataProxy, nullptr);
w10 = new StatsWorkedConfirmedPieChartWidget(dataProxy, nullptr);
w11 = new StatsWorkedSentPieChartWidget(dataProxy, nullptr);
w12 = new StatsSentConfirmedPieChartWidget(dataProxy, nullptr);
w13 = new StatsGridsOnSatsWidget(dataProxy, nullptr);
w14 = new StatsDXCCOnSatsWidget(dataProxy, nullptr);
w15= new StatsFieldPerBandWidget(dataProxy, GridSquare, nullptr);
w16 = new StatsFieldPerBandWidget(dataProxy, DXCC, nullptr);;
statisticsToShowList.clear();
createUI();
connect(statisticToShowComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChartComboBoxChanged() ) ) ;
connect(logComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotLogComboBoxChanged() ) ) ;
//qDebug() << Q_FUNC_INFO << "END";
}
StatisticsWidget::~StatisticsWidget()
{
//qDebug() << Q_FUNC_INFO << "Start-END";
}
void StatisticsWidget::clear()
{
//qDebug() << Q_FUNC_INFO << "Start-END";
//qDebug() << "StatisticsWidget::clear()";
}
void StatisticsWidget::closeEvent(QCloseEvent *event)
{
//qDebug() << "StatisticsWidget::closeEvent";
//barChartStats->clear();
//qDebug() << Q_FUNC_INFO << "Start-END";
event->accept();
//qDebug() << Q_FUNC_INFO << "END";
}
void StatisticsWidget::showEvent(QShowEvent *event)
{
//qDebug() << "StatisticsWidget::showEvent";
//qDebug() << Q_FUNC_INFO << "Start";
fillLogCombo();
event->accept();
//qDebug() << Q_FUNC_INFO << "END";
}
void StatisticsWidget::slotChartComboBoxChanged()
{
//qDebug() << "StatisticsWidget::slotChartComboBoxChanged: " << statisticToShowComboBox->currentText() ;
//qDebug() << Q_FUNC_INFO << "Start";
updateChart();
statisticToShowComboBox->setFocus();
//qDebug() << Q_FUNC_INFO << "END";
}
void StatisticsWidget::slotLogComboBoxChanged()
{
//qDebug() << Q_FUNC_INFO << "Start";
updateChart();
logComboBox->setFocus();
//qDebug() << Q_FUNC_INFO << "END";
}
void StatisticsWidget::updateChart()
{
//qDebug() << Q_FUNC_INFO << "Start";
QString text = statisticToShowComboBox->currentText();
text.truncate(2);
//qDebug() << Q_FUNC_INFO << " - 010";
int log = ((logComboBox->currentText()).section('-', 0, 0)).toInt();
//qDebug() << Q_FUNC_INFO << " - 011";
//qDebug() << Q_FUNC_INFO << " Text : " << logComboBox->currentText();
//qDebug() << Q_FUNC_INFO << " Log : " << QString::number(log);
//barChartStats->prepareChart(text.toInt(), log);
switch (text.toInt())
{
case 1:
{
//qDebug() << Q_FUNC_INFO << "10";
w1->prepareChart (log);
//qDebug() << Q_FUNC_INFO << "11";
stackedWidget->setCurrentWidget (w1);
//qDebug() << Q_FUNC_INFO << "12";
}
break;
case 2:
{
//qDebug() << Q_FUNC_INFO << "20";
w2->prepareChart (log);
stackedWidget->setCurrentWidget (w2);
}
break;
case 3:
{
//qDebug() << Q_FUNC_INFO << "30";
w3->prepareChart (log);
stackedWidget->setCurrentWidget (w3);
}
break;
case 4:
{
//qDebug() << Q_FUNC_INFO << "40";
w4->prepareChart (log);
stackedWidget->setCurrentWidget (w4);
}
break;
case 5:
{
//qDebug() << Q_FUNC_INFO << "50";
w5->prepareChart (log);
stackedWidget->setCurrentWidget (w5);
}
break;
case 6:
{
//qDebug() << Q_FUNC_INFO << "60";
w6->prepareChart (log);
stackedWidget->setCurrentWidget (w6);
}
break;
case 7:
{ // How many QSO per Continent
//qDebug() << Q_FUNC_INFO << "70";
w7->prepareChart (log);
stackedWidget->setCurrentWidget (w7);
}
break;
case 8:
{
//qDebug() << Q_FUNC_INFO << "80";
w8->prepareChart (log);
stackedWidget->setCurrentWidget (w8);
}
break;
case 9:
{
//qDebug() << Q_FUNC_INFO << "90";
w9->prepareChart (log);
stackedWidget->setCurrentWidget (w9);
}
break;
case 10:
{
//qDebug() << Q_FUNC_INFO << "100";
w10->prepareChart (log);
stackedWidget->setCurrentWidget (w10);
}
break;
case 11:
{
//qDebug() << Q_FUNC_INFO << "110";
w11->prepareChart (log);
stackedWidget->setCurrentWidget (w11);
}
break;
case 12:
{
//qDebug() << Q_FUNC_INFO << "120";
w12->prepareChart (log);
stackedWidget->setCurrentWidget (w12);
}
break;
case 13:
{
//qDebug() << Q_FUNC_INFO << "130";
w13->prepareChart (log);
stackedWidget->setCurrentWidget (w13);
}
break;
case 14:
{
//qDebug() << Q_FUNC_INFO << "140";
w14->prepareChart (log);
stackedWidget->setCurrentWidget (w14);
}
break;
case 15:
{
//qDebug() << Q_FUNC_INFO << "150";
w15->prepareChart (log);
stackedWidget->setCurrentWidget (w15);
//genchart = new StatsFieldPerBandWidget(dataProxy, GridSquare, nullptr);
}
break;
case 16:
{
//qDebug() << Q_FUNC_INFO << "160";
w16->prepareChart (log);
stackedWidget->setCurrentWidget (w16);
//genchart = new StatsFieldPerBandWidget(dataProxy, DXCC, nullptr);
}
break;
}
//qDebug() << Q_FUNC_INFO << "END";
}
void StatisticsWidget::createUI()
{
//qDebug() << Q_FUNC_INFO << "Start";
stackedWidget->addWidget(w1);
stackedWidget->addWidget(w2);
stackedWidget->addWidget(w3);
stackedWidget->addWidget(w4);
stackedWidget->addWidget(w5);
stackedWidget->addWidget(w6);
stackedWidget->addWidget(w7);
stackedWidget->addWidget(w8);
stackedWidget->addWidget(w9);
stackedWidget->addWidget(w10);
stackedWidget->addWidget(w11);
stackedWidget->addWidget(w12);
stackedWidget->addWidget(w13);
stackedWidget->addWidget(w14);
stackedWidget->addWidget(w15);
stackedWidget->addWidget(w16);
statisticsToShowList << "01-" + tr("QSO per year");
statisticsToShowList << "02-" + tr("DXCC per year");
statisticsToShowList << "03-" + tr("CQ zones per year");
statisticsToShowList << "04-" + tr("QSO per band");
statisticsToShowList << "05-" + tr("QSO per mode");
statisticsToShowList << "06-" + tr("QSO per DXCC");
statisticsToShowList << "07-" + tr("QSO per Continent");
statisticsToShowList << "08-" + tr("QSO per hour");
statisticsToShowList << "09-" + tr("QSO per month");
statisticsToShowList << "10-" + tr("Worked / Confirmed status");
statisticsToShowList << "11-" + tr("Worked / Sent status");
statisticsToShowList << "12-" + tr("Sent / Confirmed status");
statisticsToShowList << "13-" + tr("Satellite grid status");
statisticsToShowList << "14-" + tr("Satellite DXCC status");
statisticsToShowList << "15-" + tr("Grids per band status");
statisticsToShowList << "16-" + tr("DXCC per band status");
statisticToShowComboBox->addItems(statisticsToShowList);
fillLogCombo();
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->addWidget(statisticToShowComboBox);
hLayout->addWidget(logComboBox);
QVBoxLayout *layout = new QVBoxLayout;
layout->addLayout(hLayout);
layout->addWidget(stackedWidget);
setLayout(layout);
resize(420,300);
//qDebug() << Q_FUNC_INFO << "END";
}
void StatisticsWidget::fillLogCombo()
{
//qDebug() << Q_FUNC_INFO << "Start";
QStringList ids;
ids.clear();
ids << dataProxy->getListOfManagedLogs();
QStringList logs;
logs.clear();
for (int i = 0; i < ids.size(); ++i)
{
//cout << fonts.at(i).toLocal8Bit().constData();
logs<< ids.at(i) + "-" + dataProxy->getLogDateFromLog((ids.at(i)).toInt()) + "-" + dataProxy->getStationCallSignFromLog((ids.at(i)).toInt());
}
logComboBox->clear();
logComboBox->addItems(logs);
//qDebug() << Q_FUNC_INFO << "END";
}
klog-2.4.1/awardswidget.h 0000644 0001750 0001750 00000007202 15003153303 014262 0 ustar devel devel #ifndef KLOG_AWARDSWIDGET_H
#define KLOG_AWARDSWIDGET_H
/***************************************************************************
awardswidget.h - description
-------------------
begin : nov 2019
copyright : (C) 2019 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
//
// This class implement the tab of the search widget
//
#include
#include
#include "dataproxy_sqlite.h"
#include "awards.h"
//#include "world.h"
//#include "utilities.h"
//#include "filemanager.h"
class AwardsWidget : public QWidget
{
Q_OBJECT
public:
explicit AwardsWidget(DataProxy_SQLite *dp, QWidget *parent = nullptr);
~AwardsWidget();
void setManageDXMarathon(const bool _dx);
void setLog(const int _log);
void setYear(const int _year);
void fillOperatingYears();
void showAwards();
void clear();
private slots:
void slotRecalculateAwardsButtonClicked();
void slotOperatingYearComboBoxChanged();
signals:
//void actionQSODoubleClicked(const int _qsoid);
void debugLog (QString _func, QString _msg, DebugLogLevel _level);
void queryError(QString functionFailed, QString errorCodeS, QString nativeError, QString failedQuery); // To alert about any failed query execution
//void recalculateAwardsSignal();
void requireCurrentLogSignal();
void requireCurrentYearSignal();
private:
void createUI();
void setToolTips();
void showDXMarathon(const int _year);
void checkIfValidLog();
void reconfigureDXMarathonUI(const bool _dxM);
QLCDNumber *dxccConfirmedQLCDNumber, *dxccWorkedQLCDNumber,
*wazConfirmedQLCDNumber, *wazWorkedQLCDNumber,
*localConfirmedQLCDNumber, *localWorkedQLCDNumber,
*qsoConfirmedQLCDNumber, *qsoWorkedQLCDNumber,
*yearlyQSOLCDNumber, *yearlyDXCCQLCDNumber, *yearlyCQQLCDNumber, *yearlyScoreQLCDNumber;
QLabel *yearlyLabelN, *yearlyScoreLabelN;
QPushButton *recalculateAwardsButton;
QComboBox *operatingYearsComboBox;
DataProxy_SQLite *dataProxy;
bool manageDXMarathon;
int selectedYear;
int currentLog;
DebugLogLevel logLevel;
Awards *awards;
};
#endif // AWARDSWIDGET_H
klog-2.4.1/setupdialog.cpp 0000644 0001750 0001750 00000066325 15003153303 014463 0 ustar devel devel /***************************************************************************
setupdialog.cpp - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include "setupdialog.h"
#include "callsign.h"
//#include
/*
This class calls all the othet "Setup..." to manage the configuration
*/
SetupDialog::SetupDialog(DataProxy_SQLite *dp, QWidget *parent)
{
//qDebug() << Q_FUNC_INFO ;
Q_UNUSED(parent);
//contentsWidget->update();
//pagesWidget->update();
dataProxy = dp;
util = new Utilities(Q_FUNC_INFO);
//qDebug() << Q_FUNC_INFO << ": 01";
locator = new Locator();
tabWidget = new QTabWidget;
//qDebug() << Q_FUNC_INFO << ": 01.0";
userDataPage = new SetupPageUserDataPage(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 01.10";
bandModePage = new SetupPageBandMode(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 01.20";
dxClusterPage = new SetupPageDxCluster(this);
//qDebug() << Q_FUNC_INFO << ": 01.30";
colorsPage = new SetupPageColors(this);
//qDebug() << Q_FUNC_INFO << ": 01.40";
miscPage = new SetupPageMisc(this);
//qDebug() << Q_FUNC_INFO << ": 01.50";
worldEditorPage = new SetupPageWorldEditor (dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 01.60";
logsPage = new SetupPageLogs(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 01.70";
eLogPage = new SetupPageELog(this);
//qDebug() << Q_FUNC_INFO << ": 01.80";
UDPPage = new SetupPageUDP(this);
//qDebug() << Q_FUNC_INFO << ": 01.90";
satsPage = new SetupPageSats(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 01.100";
hamlibPage = new SetupPageHamLib(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 01.101";
logViewPage = new SetupPageLogView(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 02";
tabWidget->addTab(userDataPage, tr("User data"));
tabWidget->addTab(bandModePage, tr("Bands/Modes"));
tabWidget->addTab(logViewPage, tr("Log widget"));
tabWidget->addTab(dxClusterPage, tr("D&X-Cluster"));
tabWidget->addTab(colorsPage, tr("Colors"));
tabWidget->addTab(miscPage, tr("Misc"));
tabWidget->addTab(worldEditorPage, tr("World Editor"));
logsPageTabN = tabWidget->addTab(logsPage, tr("Logs"));
tabWidget->addTab(eLogPage, tr("eLog"));
tabWidget->addTab(UDPPage, tr("WSJT-X"));
tabWidget->addTab(satsPage , tr("Satellites"));
//qDebug() << Q_FUNC_INFO << ": 02.100";
tabWidget->addTab(hamlibPage, tr ("HamLib"));
//qDebug() << "SetupDialog::SetupDialog 03";
closeButton = new QPushButton(tr("Cancel"));
okButton = new QPushButton(tr("OK"));
QHBoxLayout *horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget(tabWidget);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch(1);
buttonsLayout->addWidget(okButton);
buttonsLayout->addWidget(closeButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(horizontalLayout);
mainLayout->addLayout(buttonsLayout);
//qDebug() << Q_FUNC_INFO << ": 04";
setLayout(mainLayout);
setWindowTitle(tr("Settings"));
//qDebug() << Q_FUNC_INFO << " - END";
}
void SetupDialog::init(const QString &_softwareVersion, const int _page, const bool _alreadyConfigured)
{
//qDebug() << Q_FUNC_INFO;
logLevel = None;
constrid = 2;
nolog = true;
firstTime = true;
version = QString();
pageRequested = 0;
//qDebug() << Q_FUNC_INFO << "00";
//util->setLongPrefixes(dataProxy->getLongPrefixes());
//util->setSpecialCalls(dataProxy->getSpecialCallsigns());
userDataPage->setPrefixes ();
//qDebug() << Q_FUNC_INFO << "000";
firstTime = !_alreadyConfigured;
if (firstTime)
{
//qDebug() << Q_FUNC_INFO << " - Running for the FIRST TIME";
}
version = _softwareVersion;
pageRequested = _page;
logViewPage->init();
slotReadConfigData();
if ((pageRequested==6) && (logsPageTabN>0))// The user is opening a new log
{
//qDebug() << Q_FUNC_INFO << ": 5.2";
tabWidget->setCurrentIndex(logsPageTabN);
}
//qDebug() << Q_FUNC_INFO << ": 5.3";
nolog = !(haveAtleastOneLog());
connectActions();
//qDebug() << Q_FUNC_INFO << " - END";
}
SetupDialog::~SetupDialog()
{
//qDebug() << Q_FUNC_INFO ;
delete(locator);
delete(userDataPage);
delete(bandModePage);
delete(dxClusterPage);
delete(miscPage);
delete(worldEditorPage);
delete(logsPage);
delete(eLogPage);
delete(colorsPage);
delete(UDPPage);
delete(satsPage);
delete(hamlibPage);
delete(logViewPage);
delete(util);
}
void SetupDialog::connectActions()
{
//qDebug() << Q_FUNC_INFO;
logEvent(Q_FUNC_INFO, "Start", Debug);
connect(closeButton, SIGNAL(clicked()), this, SLOT(slotCancelButtonClicked()));
connect(okButton, SIGNAL(clicked()), this, SLOT(slotOkButtonClicked()));
connect (logsPage, SIGNAL(newLogData(QStringList)), this, SLOT(slotAnalyzeNewLogData(QStringList)));
connect(logsPage, SIGNAL(focusOK()), this, SLOT(slotFocusOK()) );
connect (userDataPage, SIGNAL(mainCallsignSignal(QString)), this, SLOT(slotSetStationCallSign(QString)));
connect (userDataPage, SIGNAL(operatorsSignal(QString)), this, SLOT(slotSetOperators(QString)));
connect (userDataPage, SIGNAL(enterKey()), this, SLOT(slotOkButtonClicked()));
connect (eLogPage, SIGNAL(enterKey()), this, SLOT(slotOkButtonClicked()));
connect (colorsPage, SIGNAL(darkModeChanged(bool)), this, SLOT(slotDarkModeChanged(bool)));
logEvent(Q_FUNC_INFO, "END", Debug);
}
//void SetupDialog::slotQRZCOMAuto(const bool _b)
//{
//emit qrzcomAuto(_b);
//}
void SetupDialog::slotDarkModeChanged(const bool _dm)
{
emit darkModeChanged(_dm);
}
void SetupDialog::setData(const QString &_softwareVersion, const int _page, const bool _alreadyConfigured)
{
//qDebug() << Q_FUNC_INFO << " - " << _softwareVersion << "/" << QString::number(_page);
logEvent(Q_FUNC_INFO, "Start", Debug);
nolog = !(haveAtleastOneLog());
firstTime = !_alreadyConfigured;
if (firstTime)
{
//qDebug() << Q_FUNC_INFO << " - Running for the FIRST time";
}
else
{
//qDebug() << Q_FUNC_INFO << " - Running NOT for the FIRST time";
miscPage->setUseDefaultDBPath(miscPage->getDefaultDBPath());
}
//qDebug() << Q_FUNC_INFO << " - 10";
setSoftVersion(_softwareVersion);
//qDebug() << Q_FUNC_INFO << " - 20";
slotReadConfigData ();
//qDebug() << Q_FUNC_INFO << " - 30";
setPage(_page);
//qDebug() << Q_FUNC_INFO << " - 40";
logEvent(Q_FUNC_INFO, "END", Debug);
//qDebug() << Q_FUNC_INFO << " - END";
}
void SetupDialog::setSoftVersion(const QString &_softwareVersion)
{
//qDebug() << "SetupDialog::setSoftVersion";
logEvent(Q_FUNC_INFO, "Start", Debug);
version = _softwareVersion;
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::setPage(const int _page)
{
//qDebug() << "SetupDialog::setPage("<0))// The user is opening a new log
{
tabWidget->setCurrentIndex(pageRequested);
}
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::slotCancelButtonClicked()
{
//qDebug() << "SetupDialog::slotCancelButtonClicked";
logEvent(Q_FUNC_INFO, "Start", Debug);
if (firstTime || nolog)
{
if (nolog)
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
msgBox.setText(tr("You need to enter at least one log in the Logs tab."));
msgBox.setInformativeText(tr("Do you want to add one log in the Logs tab or exit KLog?\n(Click Yes to add a log or No to exit KLog)"));
int ret = msgBox.exec();
if (ret == QMessageBox::No)
{
emit debugLog (Q_FUNC_INFO, "END-1", logLevel);
emit exitSignal(2);
return;
}
else
{
emit debugLog (Q_FUNC_INFO, "END-2", logLevel);
return;
}
}
}
hamlibPage->stopHamlib();
QDialog::reject ();
close();
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::createIcons()
{
//qDebug() << "SetupDialog::createIcons";
logEvent(Q_FUNC_INFO, "Start", Debug);
QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
configButton->setIcon(QIcon(":/images/config.png"));
configButton->setText(tr("User data"));
configButton->setTextAlignment(Qt::AlignHCenter);
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *logsButton = new QListWidgetItem(contentsWidget);
logsButton->setIcon(QIcon(":/images/config.png"));
logsButton->setText(tr("Logs"));
logsButton->setTextAlignment(Qt::AlignHCenter);
logsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *bandsButton = new QListWidgetItem(contentsWidget);
bandsButton->setIcon(QIcon(":/images/query.png"));
bandsButton->setText(tr("Bands/Modes"));
bandsButton->setTextAlignment(Qt::AlignHCenter);
bandsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *dxClusterButton = new QListWidgetItem(contentsWidget);
dxClusterButton->setIcon(QIcon(":/images/query.png"));
dxClusterButton->setText(tr("DX-Cluster"));
dxClusterButton->setTextAlignment(Qt::AlignHCenter);
dxClusterButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *colorsButton = new QListWidgetItem(contentsWidget);
colorsButton->setIcon(QIcon(":/images/query.png"));
colorsButton->setText(tr("Colors"));
colorsButton->setTextAlignment(Qt::AlignHCenter);
colorsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *miscButton = new QListWidgetItem(contentsWidget);
miscButton->setIcon(QIcon(":/images/query.png"));
miscButton->setText(tr("Misc"));
miscButton->setTextAlignment(Qt::AlignHCenter);
miscButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *worldButton = new QListWidgetItem(contentsWidget);
worldButton->setIcon(QIcon(":/images/query.png"));
worldButton->setText(tr("World"));
worldButton->setTextAlignment(Qt::AlignHCenter);
worldButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
connect(contentsWidget,
SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
{
//qDebug() << "SetupDialog::changePage";
logEvent(Q_FUNC_INFO, "Start", Debug);
if (!current)
current = previous;
pagesWidget->setCurrentIndex(contentsWidget->row(current));
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::loadDarkMode()
{// Reads the config to setup the DarkMode
//qDebug() << Q_FUNC_INFO;
colorsPage->loadDarkMode ();
}
bool SetupDialog::loadSettings()
{
//qDebug() << Q_FUNC_INFO << " - Start";
if (!QFile::exists(util->getCfgFile ()))
{
//qDebug() << Q_FUNC_INFO << " - Nothing to load";
return false;
}
QSettings settings(util->getCfgFile (), QSettings::IniFormat);
//qDebug() << Q_FUNC_INFO << " - 10 - General";
version = settings.value ("Version").toString();
//latestBackup = settings.value ("LatestBackup").toString ();
//qDebug() << Q_FUNC_INFO << " - 20 - user";
userDataPage->loadSettings();
//qDebug() << Q_FUNC_INFO << " - 30 - bands";
settings.beginGroup ("BandMode");
QStringList listAux;
listAux.clear();
listAux << "SSB" << "CW";
readActiveModes (settings.value("Modes", listAux).toStringList ());
listAux.clear();
listAux << "10M" << "15M" << "20M" << "40M" << "80M" << "160M";
readActiveBands (settings.value("Bands", listAux).toStringList ());
modes.removeDuplicates();
bandModePage->setActiveModes(modes);
bands.removeDuplicates();
bandModePage->setActiveBands (bands);
settings.endGroup ();
//qDebug() << Q_FUNC_INFO << " - 40 - logview";
logViewPage->loadSettings ();
//qDebug() << Q_FUNC_INFO << " - 50 - dxcluster";
dxClusterPage->loadSettings ();
//qDebug() << Q_FUNC_INFO << " - 60 - colors";
colorsPage->loadSettings ();
//qDebug() << Q_FUNC_INFO << " - 70 - misc";
miscPage->loadSettings ();
//qDebug() << Q_FUNC_INFO << " - 80 - logs";
logsPage->loadSettings();
//qDebug() << Q_FUNC_INFO << " - 90 - elog";
eLogPage->loadSettings ();
//qDebug() << Q_FUNC_INFO << " - 100 - UDP";
UDPPage->loadSettings ();
//qDebug() << Q_FUNC_INFO << " - 110 - Sats";
hamlibPage->loadSettings ();
//qDebug() << Q_FUNC_INFO << " - 120 - END";
return true;
}
void SetupDialog::saveSettings()
{
//qDebug() << Q_FUNC_INFO << " - Start";
//QSettings settings(util->getCfgFile (), QSettings::IniFormat);
userDataPage->saveSettings(); // Groups done
bandModePage->saveSettings (); // Groups done
logViewPage->saveSettings ();
dxClusterPage->saveSettings ();
miscPage->saveSettings ();
colorsPage->saveSettings ();
logsPage->saveSettings();
eLogPage->saveSettings ();
UDPPage->saveSettings ();
hamlibPage->saveSettings ();
//qDebug() << Q_FUNC_INFO << " - END";
}
void SetupDialog::slotOkButtonClicked()
{
//qDebug() << Q_FUNC_INFO ;
logEvent(Q_FUNC_INFO, "Start", Debug);
if (!miscPage->areDBPathChangesApplied())
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(tr("DB has not been moved to new path."));
msgBox.setInformativeText(tr("Go to the Misc tab and click on Move DB\n or the DB will not be moved to the new location."));
msgBox.exec();
emit debugLog (Q_FUNC_INFO, "END-1", logLevel);
return;
}
Callsign callsign(userDataPage->getMainCallsign());
if (!callsign.isValid())
{
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
msgBox.setText(tr("You need to enter at least a valid callsign."));
msgBox.setInformativeText(tr("Go to the User tab and enter valid callsign."));
msgBox.exec();
emit debugLog (Q_FUNC_INFO, "END-2", logLevel);
return;
}
if (!haveAtleastOneLog())
{
//qDebug() << "SetupDialog::slotOkButtonClicked - NO LOG!";
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
msgBox.setText(tr("You have not selected the kind of log you want."));
msgBox.setInformativeText(tr("You will be redirected to the Log tab.\nPlease add and select the kind of log you want to use."));
msgBox.exec();
tabWidget->setCurrentIndex(tabWidget->indexOf(logsPage));
logsPage->createNewLog();
//emit newLogRequested(true); // Signal to be catched by logsPage true show new log
//qDebug() << Q_FUNC_INFO << "END-3" ;
emit debugLog (Q_FUNC_INFO, "END-3", logLevel);
return;
}
//qDebug() << "SetupDialog::slotOkButtonClicked - 10";
saveSettings();
hamlibPage->stopHamlib();
//qDebug() << "SetupDialog::slotOkButtonClicked - just before leaving";
QDialog::accept();
logEvent(Q_FUNC_INFO, "END", Debug);
//qDebug() << "SetupDialog::slotOkButtonClicked - END";
close();
}
void SetupDialog::slotReadConfigData()
{
//qDebug() << Q_FUNC_INFO << " - Start";
logEvent(Q_FUNC_INFO, "Start", Debug);
if (firstTime)
//if (!QFile::exists (util->getCfgFile ()))
{
//qDebug() << Q_FUNC_INFO << " - FirstTime";
setDefaults();
bands.removeDuplicates();
modes.removeDuplicates();
//logViewFields.removeDuplicates();
bandModePage->setActiveModes(modes);
bandModePage->setActiveBands(bands);
//logViewPage->setActiveFields(logViewFields);
}
//qDebug() << Q_FUNC_INFO << " - 30";
loadSettings();
//qDebug() << Q_FUNC_INFO << " - 40";
//dxClusterPage->setDxclusterServersComboBox(dxClusterServers);
//dxClusterPage->setSelectedDxClusterServer(dxClusterServerToUse);
if (modes.isEmpty())
{
modes << "SSB" << "CW";
}
if (bands.isEmpty())
{
bands << "10M" << "12M" << "15M" << "17M" << "20M" << "40M" << "80M" << "160M";
}
modes.removeDuplicates();
bandModePage->setActiveModes(modes);
bands.removeDuplicates();
bandModePage->setActiveBands(bands);
//logViewPage->setActiveFields(logViewFields);
//qDebug() << Q_FUNC_INFO << " - END";
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::readActiveBands (const QStringList &actives)
{ // Checks a "10m, 12m" QString, checks if they are valid bands and import to the
// bands used in the program
//qDebug() << "SetupDialog::readActiveBands: " << actives << QT_ENDL;
logEvent(Q_FUNC_INFO, "Start", Debug);
bool atLeastOne = false;
QStringList values = actives;
QStringList _abands;
for (int i = 0; i < values.size() ; i++)
{
if (isValidBand(values.at(i)))
{
if (!atLeastOne)
{
atLeastOne = true;
_abands.clear();
}
_abands << values.at(i);
}
}
bands.clear();
bands << dataProxy->getBandsInLog(-1);
bands << _abands;
bands.removeDuplicates();
//qDebug() << Q_FUNC_INFO << " - END";
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::readActiveModes (const QStringList &actives)
{
//qDebug() << "SetupDialog::readActiveModes: " << actives;
logEvent(Q_FUNC_INFO, "Start", Debug);
bool atLeastOne = false;
QStringList _amodes;
QStringList values = actives;
values.removeDuplicates();
for (int i = 0; i < values.size() ; i++)
{
if (isValidMode(values.at(i)))
{
if (!atLeastOne)
{
atLeastOne = true;
_amodes.clear();
}
_amodes << values.at(i);
}
}
modes.clear();
modes = dataProxy->getModesInLog(-1);
modes << _amodes;
modes.removeDuplicates();
logEvent(Q_FUNC_INFO, "END", Debug);
//qDebug() << "SetupDialog::readActiveModes: " << modes.join(" / ");
}
bool SetupDialog::isValidBand (const QString &b)
{
//qDebug() << "SetupDialog::isValidBand: "<< b;
logEvent(Q_FUNC_INFO, "Start", Debug);
QString stringQuery = QString("SELECT id FROM band WHERE name='%1'").arg(b);
QSqlQuery query(stringQuery);
query.next();
logEvent(Q_FUNC_INFO, "END", Debug);
return query.isValid();
}
bool SetupDialog::isValidMode (const QString &b)
{
//qDebug() << "SetupDialog::isValidMode: " << b;
logEvent(Q_FUNC_INFO, "Start", Debug);
QString stringQuery = QString("SELECT id FROM mode WHERE name='%1'").arg(b);
QSqlQuery query(stringQuery);
query.next();
logEvent(Q_FUNC_INFO, "END", Debug);
return query.isValid();
}
void SetupDialog::setDefaults()
{
//qDebug() << Q_FUNC_INFO << " - Start";
logEvent(Q_FUNC_INFO, "Start", Debug);
miscPage->setRealTime("TRUE");
miscPage->setUTCTime("TRUE");
miscPage->setImperial("FALSE"); //Metric system is the default
miscPage->setAlwaysADIF("FALSE");
miscPage->setSendQSLWhenRec("TRUE");
miscPage->setShowStationCallSignInSearch("TRUE");
miscPage->setCheckNewVersions("TRUE");
//miscPage->setReportInfo("FALSE");
miscPage->setDXMarathon("FALSE");
miscPage->setDebugLogLevel(util->getDebugLevels().at(0));
//miscPage->setLogSort("FALSE");
miscPage->setSetEQSLByDefault("TRUE");
miscPage->setCheckCalls (true);
UDPPage->setUDPServer(false);
UDPPage->setUDPServerPort(2237);
UDPPage->setTimeout(2000);
UDPPage->setLogFromWSJTx(false);
UDPPage->setReaDataFromWSJTx(false);
UDPPage->setAutoLogFromWSJTx(false);
//interfacesWindowsPage->setSendToPSTRotator("FALSE");
//interfacesWindowsPage->setPSTRotatorUDPServer("locahost");
//interfacesWindowsPage->setPSTRotatorUDPServerPort("12040");
dxClusterPage->init ();
logViewPage->init();
//dxClusterServers.clear();
//dxClusterServers.append("dxfun.com:8000");
//dxClusterServerToUse = "dxfun.com:8000";
if (modes.isEmpty())
{
modes << "SSB" << "CW";
modes.removeDuplicates();
}
if (bands.isEmpty())
{
bands << "10M" << "12M" << "15M" << "17M" << "20M" << "40M" << "80M" << "160M";
bands.removeDuplicates();
}
//qDebug() << Q_FUNC_INFO << " - END";
logEvent(Q_FUNC_INFO, "END", Debug);
}
QString SetupDialog::checkAndFixASCIIinADIF(const QString &_data)
{
//qDebug() << "SetupDialog::checkAndFixASCIIinADIF " << _data;
//TODO: this function is also in the FileManager class. Maybe I should call that one and keep just one copy
logEvent(Q_FUNC_INFO, "Start", Debug);
ushort unicodeVal;
QString st = _data;
QString newString;
newString.clear();
for(int i=0; i < st.length(); i++)
{
// Get unicode VALUE into unicodeVal
unicodeVal = (st.at(i)).unicode();
if ((20 <= unicodeVal ) && (unicodeVal <= 126))
{
newString.append(st.at(i));
}
//qDebug() << "SetupDialog::checkAndFixunicodeinADIF: " << st.at(i) <<" = " << QString::number(unicodeVal);
}
// Show into another lineEdit
logEvent(Q_FUNC_INFO, "END", Debug);
return newString;
}
bool SetupDialog::haveAtleastOneLog()
{
logEvent(Q_FUNC_INFO, "Start", Debug);
emit debugLog (Q_FUNC_INFO, "END-1", logLevel);
return dataProxy->haveAtLeastOneLog();
//logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::setClubLogActive(const bool _b)
{
logEvent(Q_FUNC_INFO, "Start", Debug);
eLogPage->setClubLogActive(_b);
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::checkIfNewBandOrMode()
{
//qDebug() << "SetupDialog::checkIfNewBandOrMode: logLevel: " << QString::number(logLevel);
logEvent(Q_FUNC_INFO, "Start", Debug);
QStringList _items;
_items.clear();
//qDebug() << "SetupDialog::checkIfNewBandOrMode -1";
_items << dataProxy->getBandsInLog(-1);
//qDebug() << "SetupDialog::checkIfNewBandOrMode -2";
_items << bandModePage->getBands();
//qDebug() << "SetupDialog::checkIfNewBandOrMode -3";
_items.removeDuplicates();
//qDebug() << "SetupDialog::checkIfNewBandOrMode -4";
bandModePage->setActiveBands(_items);
//qDebug() << "SetupDialog::checkIfNewBandOrMode -5";
_items.clear();
_items << dataProxy->getModesInLog(-1);
_items << bandModePage->getModes();
_items.removeDuplicates();
bandModePage->setActiveModes(_items);
logEvent(Q_FUNC_INFO, "END", Debug);
//qDebug() << "SetupDialog::checkIfNewBandOrMode END";
}
void SetupDialog::slotAnalyzeNewLogData(const QStringList _qs)
{
//qDebug() << "SetupDialog::slotAnalyzeNewLogData (length=" << QString::number(_qs.length()) << ")";
//qDebug() << "SetupDialog::slotAnalyzeNewLogData";
// We receive the station callsign and operators from the logs tab
logEvent(Q_FUNC_INFO, "Start", Debug);
if (_qs.length()!=2)
{
emit debugLog (Q_FUNC_INFO, "END-1", logLevel);
return;
}
userDataPage->setMainCallsign(_qs.at(0));
userDataPage->setOperators(_qs.at(1));
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::slotSetStationCallSign(const QString &_p)
{
//qDebug() << "SetupDialog::slotSetStationCallSign: " << _p;
logEvent(Q_FUNC_INFO, "Start", Debug);
logsPage->setDefaultStationCallsign(_p);
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::slotSetOperators(const QString &_p)
{
//qDebug() << "SetupDialog::slotSetOperators: " << _p;
logEvent(Q_FUNC_INFO, "Start", Debug);
logsPage->setDefaultOperators(_p);
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::setLogLevel(const DebugLogLevel _sev)
{
logLevel = _sev;
miscPage->setDebugLogLevel(util->debugLevelToString(_sev));
}
void SetupDialog::slotQueryErrorManagement(QString functionFailed, QString errorCodeS, QString nativeError, QString failedQuery)
{ logEvent(Q_FUNC_INFO, "Start", Debug);
emit queryError(functionFailed, errorCodeS, nativeError, failedQuery);
logEvent(Q_FUNC_INFO, "END", Debug);
}
void SetupDialog::slotFocusOK()
{
okButton->setFocus(Qt::OtherFocusReason);
}
void SetupDialog::showEvent(QShowEvent *event)
{
//qDebug() << Q_FUNC_INFO;
//qDebug() << Q_FUNC_INFO << " - selectedLog: " << QString::number(logsPage->getSelectedLog());
QWidget::showEvent(event);
eLogPage->loadSettings ();
miscPage->loadSettings ();
userDataPage->setStationFocus();
}
void SetupDialog::logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level)
{
if (logLevel<=_level)
emit debugLog (_func, _msg, _level);
}
klog-2.4.1/INSTALL-win.txt 0000644 0001750 0001750 00000000147 15003153303 014067 0 ustar devel devel Installing KLog on a Windows system is easy.
Just double-click on the installer and follow the steps.
klog-2.4.1/qml/ 0000755 0001750 0001750 00000000000 15003153303 012214 5 ustar devel devel klog-2.4.1/qml/marker.qml 0000644 0001750 0001750 00000005017 15003153303 014213 0 ustar devel devel /***************************************************************************
mapqmlfile.qml - description
-------------------
begin : May 2021
copyright : (C) 2021 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
import QtQuick
import QtLocation
MapQuickItem{
id: marker
anchorPoint.x: marker.width / 4
anchorPoint.y: marker.height
property alias text: locatorText.text
//sourceItem: Image{
// id: icon
// source: "../img/marker.png"
// sourceSize.width: 40
// sourceSize.height: 40
//}
sourceItem: Rectangle{
id: rectaMap
Image{
id: icon
//source: "../img/marker.png"
source: "qrc:/img/marker.png"
sourceSize.width: 40
sourceSize.height: 40
}
Text{
id: locatorText
//text: 'IN80'
//width: rectaMap.width
color: focus?"red":"black"
anchors.top: icon.bottom
anchors.horizontalCenter: icon.horizontalCenter
horizontalAlignment: icon.AlignHCenter
}
}
}
klog-2.4.1/qml/mapqmlfile.qml 0000644 0001750 0001750 00000017433 15003153303 015066 0 ustar devel devel /***************************************************************************
mapqmlfile.qml - description
-------------------
begin : May 2021
copyright : (C) 2021 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
import QtQuick
import QtQuick.Window
import QtLocation
import QtPositioning
import QtQuick.Controls
Rectangle {
width: 640
height: 480
visible: true
property alias zoom: map.zoomLevel
property alias lat: map.center.latitude
property alias lon: map.center.longitude
property double oldZoom
//property alias mapLocale: map.plugin.locales
Location {
// Define location that will be "center" of map
id: mapCenter
}
//function addMarker(latitude: double, longitude: double, locatorText: String)
function addMarker(latitude: double, longitude: double)
{
var Component = Qt.createComponent("qrc:qml/marker.qml")
//var item = Component.createObject(Rectangle, {
// coordinate: QtPositioning.coordinate(latitude, longitude), text: locatorText
// })
var item = Component.createObject(Rectangle, {
coordinate: QtPositioning.coordinate(latitude, longitude)
})
//if (zoom>5)
//{
// console.log("Zoom>5: ", zoom);
//}
map.addMapItem(item)
}
FocusScope
{
anchors.fill: parent
}
Plugin {
id: mapPlugin
name: "osm" // Names in local language
//name: "esri" // Names not in local language but english
//name: "googleMap"
//name: "mapboxgl"
PluginParameter
{
name: "osm.mapping.custom.host"
value: "https://tile.openstreetmap.org/"
}
}
Map {
id: map
anchors.fill: parent
plugin: mapPlugin
center: mapCenter.coordinate
Plugin {
name: "osm"
//locales: "en_US"
}
//Component.onCompleted:addMarker(40.18, -3.649, "OOO")
//onCenterChanged:
//{
// console.log("Map Center X: ", lat, " - Map Center Y: ", lon);
//}
zoomLevel: 14
activeMapType: supportedMapTypes[supportedMapTypes.length - 1]
MouseArea
{
hoverEnabled: true
anchors.fill: parent
//acceptedButtons: Qt.LeftButton
//onClicked:
//{
// console.log("left button clicked!")
//}
//onPositionChanged:
//{
// Qt.point(mouseX, mouseY)
// var coordinate = map.toCoordinate(Qt.point(mouse.x,mouse.y))
// console.log("Mouse Position (", mouseX, ", ", mouseY, ")");
// console.log("Mouse GeoPosition (", coordinate.latitude, ", ", coordinate.longitude, ")");
//}
}
MouseArea
{
hoverEnabled: true
anchors.fill: parent
//acceptedButtons: Qt.RightButton
//onClicked:
//{
// console.log("right button clicked!")
// contextMenu.popup()
//}
//Menu {
// id: contextMenu
// MenuItem {text: "Show QSOs"}
//}
}
Rectangle {
id: buttonout
width: 30
height: 30
border.color: "red"
radius: 5 // Let's round the rectangle's corner a bit, so it resembles more a button
//anchors.centerIn: parent
anchors.right: parent.right; anchors.bottom: parent.bottom
Text {
id: buttonText
text: "-"
color: "black"
anchors.centerIn: parent
}
MouseArea {
// We make the MouseArea as big as its parent, i.e. the rectangle. So pressing anywhere on the button will trigger the event
anchors.fill: parent
// Exploit the built-in "clicked" signal of the MouseArea component to do something when the MouseArea is clicked.
// Note that the code associated to the signal is plain JavaScript. We can reference any QML objects by using their IDs
onClicked: {
oldZoom = zoom
zoom = oldZoom - 1
}
}
}
Rectangle {
id: buttonin
width: 30
height: 30
border.color: "red"
radius: 5 // Let's round the rectangle's corner a bit, so it resembles more a button
anchors.bottom: buttonout.top; anchors.right: buttonout.right
//anchors.right: parent.right; anchors.bottom: parent.bottom
Text {
id: buttonTextout
text: "+"
color: "black"
anchors.centerIn: parent
}
MouseArea {
// We make the MouseArea as big as its parent, i.e. the rectangle. So pressing anywhere on the button will trigger the event
anchors.fill: parent
// Exploit the built-in "clicked" signal of the MouseArea component to do something when the MouseArea is clicked.
// Note that the code associated to the signal is plain JavaScript. We can reference any QML objects by using their IDs
onClicked: {
oldZoom = zoom
zoom = oldZoom + 1
//buttonText.text = qsTr("Clicked");
//buttonText.color = "black";
}
}
}
MapItemView
{
model: rectangle_model
delegate: MapRectangle
{
border.width: 2
topLeft : model.north
bottomRight : model.south
color : model.color
//opacity : 0.5
}
}
MapItemView
{
model: circle_model
delegate: MapCircle{
center: model.coordinate
radius: 5000.0
color: 'green'
border.width: 10
}
}
}
}
klog-2.4.1/updatesatsdata.cpp 0000644 0001750 0001750 00000024453 15003153303 015146 0 ustar devel devel /***************************************************************************
updatesatsdata.cpp - description
-------------------
begin : sep 2018
copyright : (C) 2018 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include "updatesatsdata.h"
UpdateSatsData::UpdateSatsData(DataProxy_SQLite *dp, QObject *parent) : QObject(parent)
{
util = new Utilities(Q_FUNC_INFO);
dataProxy = dp;
}
UpdateSatsData::~UpdateSatsData()
{
delete(util);
}
bool UpdateSatsData::satDataFileRead(const QString& tfileName)
{
//qDebug() << "UpdateSatsData::satDataFileRead: " << tfileName;
QString fileName = tfileName;
bool errorFound = true;
QFile file( fileName );
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) /* Flawfinder: ignore */
{
//qDebug() << "UpdateSatsData::satDataFileRead File not found" << fileName;
return false;
}
if (dataProxy->clearSatList())
{
//qDebug() << "UpdateSatsData::satDataFileRead Sats YES deleted" ;
}
else
{
//qDebug() << "UpdateSatsData::satDataFileRead Sats NOT deleted" ;
return false;
}
int numberOfSats = 0;
bool hasEOH = false;
//bool inHeader = true;
QString line = QString();
bool noMoreRegisters = false;
qint64 pos; //Position in the file
bool haveId = false;
bool haveName = false;
//bool haveUpLink = false;
//bool haveDownLink = false;
//bool haveMode = false;
pos = file.pos();
while ( !file.atEnd() && !hasEOH)
{
line = (file.readLine()).toUpper();
numberOfSats = numberOfSats + line.count("EOR>");
if ((line.count("")>0) && (!hasEOH))
{
errorFound = false;
hasEOH = true;
pos = file.pos();
}
}
file.seek(pos);
QProgressDialog progress(tr("Reading Satellites data file..."), tr("Abort reading"), 0, numberOfSats, nullptr);
progress.setWindowModality(Qt::ApplicationModal);
progress.setVisible(true);
progress.setValue(0);
progress.setMaximum(numberOfSats);
//qDebug() << "UpdateSatsData::satDataFileRead: END OF HEADER" ;
//file.seek(pos);
//START reading SAT data...
//qDebug() << "UpdateSatsData::satDataFileRead: Start reading data" ;
QStringList fields, fieldToAnalyze;//, qsToPass;
fields.clear();
fieldToAnalyze.clear();
QString aux = QString();
QString field, data;
//int tagLength = 0;
//int dataLength = 0;
QString satID = QString();
QString satName = QString();
QString satUpLink = QString();
QString satDownLink = QString();
QString satMode = QString();
while (!noMoreRegisters)
{
//qDebug() << "UpdateSatsData::satDataFileRead: While Start" ;
if (!file.atEnd())
{
line.clear();
line.append(file.readLine().trimmed().toUpper());
fields.clear();
//qDebug() << "UpdateSatsData::satDataFileRead-line:" << line;
fields << line.split("<", QT_SKIP);
foreach (aux, fields)
{
aux = aux.simplified();
//qDebug() << "UpdateSatsData::satDataFileRead-aux:" << aux;
fieldToAnalyze = util->getValidADIFFieldAndData("<" + aux);
if (fieldToAnalyze.size() == 2)
{
field = fieldToAnalyze.at(0);
data = fieldToAnalyze.at(1);
//qDebug() << "UpdateSatsData::satDataFileRead-Field:" << field;
//qDebug() << "UpdateSatsData::satDataFileRead-Data:" << data;
if (field == "EOR")
{
//qDebug() << "UpdateSatsData::satDataFileRead - EOR DETECTED!";
if (haveId && haveName)
{
//qDebug() << "UpdateSatsData::satDataFileRead - EOR DETECTED and have it all!";
haveId = false;
haveName = false;
//haveUpLink = false;
//haveDownLink = false;
//haveMode = false;
if (!dataProxy->addSatellite(satID, satName, satDownLink,satUpLink, satMode))
{
//errorFound = true;
return false;
}
//qDebug() << "UpdateSatsData::satDataFileRead - Satellite added: " << satID;
satID = QString();
satName = QString();
satUpLink = QString();
satDownLink = QString();
satMode = QString();
}
else
{
haveId = false;
haveName = false;
//haveUpLink = false;
//haveDownLink = false;
//haveMode = false;
satID = QString();
satName = QString();
satUpLink = QString();
satDownLink = QString();
satMode = QString();
}
}
else
{
if (field == "APP_KLOG_SATS_ARRLID")
{
satID = data;
haveId = true;
//qDebug() << "UpdateSatsData::satDataFileRead - Detected: " << "APP_KLOG_SATS_ARRLID";
}
else if (field == "APP_KLOG_SATS_NAME")
{
satName = data;
haveName = true;
//qDebug() << "UpdateSatsData::satDataFileRead - Detected: " << "APP_KLOG_SATS_NAME";
}
else if (field == "APP_KLOG_SATS_UPLINK")
{
satUpLink = data;
//haveUpLink = true;
//qDebug() << "UpdateSatsData::satDataFileRead - Detected: " << "APP_KLOG_SATS_UPLINK";
}
else if (field == "APP_KLOG_SATS_DOWNLINK")
{
satDownLink = data;
//haveDownLink = true;
//qDebug() << "UpdateSatsData::satDataFileRead - Detected: " << "APP_KLOG_SATS_DOWNLINK";
}
else if (field == "APP_KLOG_SATS_MODE")
{
satMode = data;
//haveMode = true;
//qDebug() << "UpdateSatsData::satDataFileRead - Detected: " << "APP_KLOG_SATS_MODE";
}
else if (field == "APP_KLOG_DATA")
{
//qDebug() << "UpdateSatsData::satDataFileRead - Detected: " << "APP_KLOG_DATA";
if (data != "SATS")
{
return false;
}
}
}
}
//qDebug() << "UpdateSatsData::satDataFileRead: foreach end" ;
}
//qDebug() << "UpdateSatsData::satDataFileRead: out of foreach" ;
}
else
{
noMoreRegisters = true;
}
//qDebug() << "UpdateSatsData::satDataFileRead: While END" ;
}
if (errorFound)
{
//qDebug() << "UpdateSatsData::satDataFileRead: errorFound = true" ;
return false;
}
else
{
//qDebug() << "UpdateSatsData::satDataFileRead: END" ;
emit satsUpdatedSignal(true);
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
msgBox.setText(tr("The Satellites information has been updated."));
msgBox.exec();
}
//qDebug() << "UpdateSatsData::satDataFileRead: END " ;
return true;
}
bool UpdateSatsData::readSatDataFile()
{
//qDebug() << Q_FUNC_INFO << " - Start";
//QString fileName = QFileDialog::getOpenFileName(0, tr("Open File"), "/home", "Sat data (*.dat)");
QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Open File"),
util->getHomeDir(),
tr("Sat Data") + "(*.dat)");
if (fileName.isNull())
{
return false;
}
else
{
return satDataFileRead(fileName);
}
//qDebug() << Q_FUNC_INFO << " - END";
}
klog-2.4.1/softwareupdatedialog.cpp 0000644 0001750 0001750 00000010504 15003153303 016344 0 ustar devel devel /***************************************************************************
softwareupdatedialog.cpp - description
-------------------
begin : feb 2017
copyright : (C) 2017 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include "softwareupdatedialog.h"
//#include
SoftwareUpdateDialog::SoftwareUpdateDialog()
{
//qDebug() << "SoftwareUpdateDialog::SoftwareUpdateDialog" ;
textBrowser = new QTextBrowser;
textBrowser->setOpenLinks(true);
textBrowser->setOpenExternalLinks(true);
//textBrowser->setFrameShadow(QFrame::Raised);
//textBrowser->setFrameStyle(QFrame::StyledPanel);
QPushButton *acceptButton = new QPushButton(tr("Ok"));
textBrowser->setOpenExternalLinks(true);
//textBrowser->setHTML(url);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addWidget(acceptButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(textBrowser);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("KLog update"));
connect(acceptButton, SIGNAL(clicked()), this, SLOT(slotAcceptButtonClicked()));
//qDebug() << "SoftwareUpdateDialog::SoftwareUpdateDialog - END" ;
}
void SoftwareUpdateDialog::setVersion(const QString tversion, const bool updateNeeded)
{
//qDebug() << "SoftwareUpdateDialog::setVersion: " << tversion;
_version = tversion;
if (updateNeeded)
{
//text = "KLog new version ("+ tversion + ") is available!
There is a new version of KLog available.
You can get the new version from:
https://www.klog.xyz";
text = tr("KLog new version (%1) is available!
There is a new version of KLog available.
You can get the new version from:
https://www.klog.xyz").arg(tversion);
}
else
{
text = "" + tr("Congratulations!") + "
" + tr("Your KLog has been updated.") + "
" + tr("You already have the latest version.") + "
("+ tversion + ")";
}
textBrowser->setHtml(text);
//qDebug() << "SoftwareUpdateDialog::setVersion: END"<< QT_ENDL;
}
SoftwareUpdateDialog::~SoftwareUpdateDialog()
{
//qDebug() << "SoftwareUpdateDialog::~SoftwareUpdateDialog" ;
}
void SoftwareUpdateDialog::slotAcceptButtonClicked()
{
//qDebug() << "SoftwareUpdateDialog::slotAcceptButtonClicked" ;
accept();
//qDebug() << "SoftwareUpdateDialog::slotAcceptButtonClicked END" ;
}
void SoftwareUpdateDialog::keyPressEvent(QKeyEvent *event)
{
//qDebug() << "SoftwareUpdateDialog::keyPressEvent" ;
if (event->key()>=0)
{
slotAcceptButtonClicked();
}
//qDebug() << "SoftwareUpdateDialog::keyPressEvent END" ;
}
klog-2.4.1/startwizard.h 0000644 0001750 0001750 00000011364 15003153303 014157 0 ustar devel devel #ifndef KLOG_STARTWIZARD_H
#define KLOG_STARTWIZARD_H
/***************************************************************************
startwizard.h - description
-------------------
begin : feb 2015
copyright : (C) 2015 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include
#include
#include
//#include
#include
#include
#include
#include
#include "downloadcty.h"
class FileOrMemoryPage;
class CTYPage;
class StartWizard : public QWizard
{
Q_OBJECT
public:
enum { Page_Intro, Page_Lic, Page_Mem, Page_CTY };
StartWizard(const QString &_klogDir, const QString &_softVersion, QWidget *parent = nullptr);
void setVersion(const QString &tversion);
//~StartWizard();
protected:
private slots:
void slotCancelWizard();
//void slotRunInMemory(bool checked);
void slotButtonFinishedClicked();
private:
//FileOrMemoryPage *fileOrMemoryPage;
CTYPage *ctyPage;
QString version;
//bool inMemory;
QString klogDir;
};
class IntroPage : public QWizardPage
{
Q_OBJECT
public:
IntroPage(QWidget *parent = nullptr);
int nextId() const;
private:
QLabel *topLabel;
QTextEdit *welcomeBrowser;
};
class LicPage : public QWizardPage
{
Q_OBJECT
public:
LicPage(QWidget *parent = nullptr);
//void setNextButtonActive(const bool _active);
int nextId() const;
private:
QLabel *topLabel;
QTextEdit *licenseBrowser;
QCheckBox *aceptLicCheckBox;
};
/*
class FileOrMemoryPage : public QWizardPage
{
Q_OBJECT
public:
FileOrMemoryPage(QWidget *parent = 0);
int nextId() const;
//int nextId() const;
private slots:
void slotRunningModeSelectedFile(bool checked);
void slotRunningModeSelectedMemory(bool checked);
signals:
void exeInMemory(const bool mem);
private:
bool downloadCTYFile();
QLabel *topLabel;
QCheckBox *memoryQCheckbox;
QCheckBox *fileQCheckbox;
bool runInMemory;
};
*/
class CTYPage : public QWizardPage
{
Q_OBJECT
public:
CTYPage(const QString &_klogDir, const QString &_version, QWidget *parent = nullptr);
void updateProgress (qint64 v,qint64 t);
private slots:
/*
void slotCTYCheckButtonTogled(int state);
void slotDownloadCTY(bool checked);
void slotDownloadFinished();
void slotValueReturnedFromDownload(int value);
void slotDownloadButtonClicked();
*/
void slotUpdateDownloadProgress(qint64 received, qint64 total);
void slotDownloadButtonClicked();
void slotIgnoreDownloadButtonClicked();
void slotDownloadFinished(const int ret);
void slotDownloadError(const int ret);
void slotStopProgressBar();
signals:
void downloadTheFileSignal(const bool mem);
private:
//bool prepareTheDownload();
//bool doTheDownload();
//bool isComplete();
//bool CTYFileDownloaded;
//int downloadValueResult;
//QString klogDir;
//int total;
//bool completed;
DownLoadCTY *dl;
QLabel *topLabel;
QTextEdit *ctyBrowser;
//QCheckBox *downloadCTYCheckBox;
QProgressBar *progressBar;
QPushButton *downloadButton, *ignoreDownloadButton;
QCheckBox *hiddenCheckBox;
};
#endif // STARTWIZARD_H
klog-2.4.1/tipsdialog.cpp 0000644 0001750 0001750 00000030055 15003153303 014271 0 ustar devel devel /***************************************************************************
tipsdialog.cpp - description
-------------------
begin : sept 2019
copyright : (C) 2019 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include "tipsdialog.h"
#include
#include
#include
#include
#include
#include
TipsDialog::TipsDialog(QWidget *parent): QDialog(parent)
{
//qDebug() << "TipsDialog::TipsDialog";
logLevel = Info; //7 Debug /0=emergency or no debug
logEvent(Q_FUNC_INFO, "Start", Debug);
tipTextQLabel = new QLabel;
tipId = 1;
tipMax = 19;
setWindowTitle(tr("KLog tips"));
setWindowFlags(windowFlags() & Qt::WindowContextHelpButtonHint);
tipTextQLabel->setWordWrap(true);
tipTextQLabel->setOpenExternalLinks(false);
tipTextQLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
tipTextQLabel->setTextFormat(Qt::RichText);
setTip(1);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
QPushButton *nextButton = new QPushButton;
QPushButton *prevButton = new QPushButton;
nextButton->setText(tr("Next"));
prevButton->setText(tr("Previous"));
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
buttonBox->addButton(prevButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::ActionRole));
buttonBox->addButton(nextButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::ActionRole));
//connect(buttonBox , &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())) ;
connect(prevButton, SIGNAL(clicked()), this, SLOT(slotPrevButtonClicked() ) );
connect(nextButton, SIGNAL(clicked()), this, SLOT(slotNextButtonClicked() ) );
connect(tipTextQLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotLinkActivated(QString)));
tip = new QWidget;
QGridLayout *layout1 = new QGridLayout;
layout1->addWidget(tipTextQLabel, 0, 1, 4, 4);
tip->setLayout(layout1);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(tip);
layout->addWidget(buttonBox);
setLayout(layout);
logEvent(Q_FUNC_INFO, "END", Debug);
}
TipsDialog::~TipsDialog(){}
void TipsDialog::slotPrevButtonClicked()
{
logEvent(Q_FUNC_INFO, "Start", Debug);
if (tipId>1)
{
tipId--;
}
else
{
tipId = tipMax;
}
setTip(tipId);
logEvent(Q_FUNC_INFO, "END", Debug);
}
void TipsDialog::slotNextButtonClicked()
{
logEvent(Q_FUNC_INFO, "Start", Debug);
if (tipIdFill in QSO data
description = tr("Tip #1:
Do you know...
You can use Tools->Fill in QSO data to automatically read the full log to fill the DXCC, CQ, ITU zones and continent?");
break;
case 2:
//: Translator: Please make sure that the name of the link is coherent with the menu Tools->Fill in DXCC data
description = tr("Tip #2:
Do you know...
You can find the QSLs that you still need to send with Tools->QSL tools...->Find My-QSLs pending to send.
This tool will list you in the search box all the QSOs with the QSL-Sent marked as Requested.");
break;
case 3:
//: Translator: Please make sure that the name of the link is coherent with the menu Tools->QSL tools...->Find QSO to QSL
description = tr("Tip #3:
Do you know...
You can use Tools->QSL tools...->Find QSO to QSL to look for all those QSO that you should send your QSL because you still need to confirm that DXCC and you have still not send your QSL card?");
break;
case 4:
//: Translator: Please make sure that the name of the link is coherent with the menu File->Export Requested QSL to ADIF...
description = tr("Tip #4:
Do you know...
You can enter a '*' in the search box, in the search window to search for all the QSOs done with one specific station callsign?");
break;
case 5:
description = tr("Tip #5:
Do you know...
You can find the file containing all your log and other information in the logbook.dat "
"file and the klogrc file, containing the KLog config file in the KLog folder by opening the"
" File->KLog folder menu?");
break;
case 6:
//: Translator: Please make sure that the name of the link is coherent with the menu File->KLog folder
description = tr("Tip #6:
Do you know...
You can upload your QSO marked as queued to LoTW via TQSL with Tools->LoTW tools ...->Sends the log to LoTW calling TQSL. ?
You have to configure TQSL in the preferences to be able to use this functionality.");
break;
case 7:
//: Translator: Please make sure that the name of the link is coherent with the menu QSL tools...->Find My-QSLs pending to send
description = tr("Tip #7:
Do you know...
You can see the QSO that confirms one specific DXCC entity in one specific band by poiting your mouse over that band in the DXCC widget?");
break;
case 8:
//: Translator: Please make sure that the name of the link is coherent with the menu QSL tools...->Find DX-QSLs pending to receive
description = tr("Tip #8:
Do you know...
You can find the QSLs that you are still waiting for with Tools->QSL tools...->Find DX-QSLs pending to receive.
This tool will list you in the search box all the QSOs with the QSL-Sent marked as Sent but you have still not received the QSL card from the DX.");
break;
case 9:
//: Translator: Please make sure that the name of the link is coherent with the menu QSL tools...->Find requested pending to receive
description = tr("Tip #9:
Do you know...
You can find the QSLs that you are still waiting for with Tools->QSL tools...->Find requested pending to receive.
This tool will list you in the search box all the QSOs with the QSL-Rec marked as Requested but you have still not received the QSL card from the DX.");
break;
case 10:
description = tr("Tip #10:
Do you know...
You can subscribe to the English KLog Telegram group to discuss about KLog in English?");
break;
case 11:
description = tr("Tip #11:
Do you know...
You can subscribe to the Spanish Telegram group to discuss about KLog in Spanish?");
break;
case 12:
description = tr("Tip #12:
Do you know...
You can subscribe to KLog mailing list to discuss via email about KLog in English?");
break;
case 13:
description = tr("Tip #13:
Do you know...
You can follow EA4K on twitter to get updates about KLog?");
break;
case 14:
description = tr("Tip #14:
Do you know...
You can write your own review in eHam.net about KLog to help other users to decide to use KLog?");
break;
case 15:
description = tr("Tip #15:
Do you know...
You can join the development team by simply Contacting us?");
break;
case 16:
description = tr("Tip #16:
Do you know...
That there are many ways to contribute to KLog and some of them are listed in the KLog Contribute page?");
break;
case 17:
description = tr("Tip #17:
Do you know...
You can support translating KLog into your language? Please check KLog Translations page.");
break;
case 18:
description = tr("Tip #18:
Do you know...
You can double-click on an entity name in the DXCC table and all the QSOs with that DXCC Entity will be shown in the search box?");
break;
case 19:
description = tr("Tip #19:
Do you know...
You can right-click on a QSO and select Check in QRZ.com to check that callsign in QRZ.com?");
break;
default:
//description = tr("TIP-Default: Text");
description = "";
break;
}
//tipTextEdit->setHtml(description);
tipTextQLabel->setText(description);
logEvent(Q_FUNC_INFO, "END", Debug);
//qDebug() << "TipsDialog::setTip: END" ;
}
void TipsDialog::slotLinkActivated(const QString &_link)
{
logEvent(Q_FUNC_INFO, "Start", Debug);
//qDebug() << "TipsDialog::slotLinkActivated: " << _link;
//Comprobar el enalce y activar el menu correspondiente
if (_link == "#ToolsFillInQSO")
{
emit fillInQSOSignal();
}
else if (_link == "#ToolsFindQSO2QSL")
{
emit fillInDXCCSignal();
}
else if (_link == "#ToolsFillInDXCC")
{
emit findQSL2QSOSignal();
}
else if (_link == "#FileExportQSLADIFToPrint")
{
emit fileExportToPrintSignal();
}
else if (_link == "#FileExportLoTWADIF")
{
//emit fileExportForLoTWSignal();
}
else if (_link == "#FileOpenKLogFolder")
{
emit fileOpenKLogFolderSignal();
}
else if (_link == "#ToolsSendPendingQSL")
{
emit toolSendPendingQSLSignal();
}
else if (_link == "#ToolsReceivePendingQSL")
{
emit toolRecPendingQSLSignal();
}
else if (_link == "#ToolsReceiveRecPendingQSL")
{
emit toolRecRecPendingQSLSignal();
}
else if (_link == "#ToolsUploadLoTW")
{
emit toolsUploadLoTWSignal();
}
logEvent(Q_FUNC_INFO, "END", Debug);
}
void TipsDialog::logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level)
{
if (logLevel<=_level)
emit debugLog (_func, _msg, _level);
}
klog-2.4.1/logwindow.cpp 0000644 0001750 0001750 00000072654 15003153303 014156 0 ustar devel devel /***************************************************************************
logwindow.cpp - description
-------------------
begin : sept 2011
copyright : (C) 2011 by Jaime Robles
email : jaime@robles.es
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* KLog is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with KLog. If not, see . *
* *
*****************************************************************************/
#include "logwindow.h"
LogWindow::LogWindow(Awards *awards, QWidget *parent)
: QWidget(parent),
awards(awards)
{
//qDebug() << Q_FUNC_INFO << " - Start";
dataProxy = awards->dataProxy;
logModel = new LogModel(dataProxy, this);
util = new Utilities(Q_FUNC_INFO);
connect(logModel, SIGNAL(queryError(QString, QString, QString, QString)), this, SLOT(slotQueryErrorManagement(QString, QString, QString, QString)) );
logView = new QTableView;
columns.clear();
currentLog = -1;
//awards = new Awards(dataProxy, Q_FUNC_INFO);
createUI();
createActions();
setDefaultData();
//qDebug() << "LogWindow::LogWindow: - END" ;
}
LogWindow::~LogWindow()
{
//qDebug() << Q_FUNC_INFO << " - Start";
delete(util);
//delete(awards);
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::setColumns(const QStringList &_columns)
{
//qDebug() << Q_FUNC_INFO << " - Start";
columns.clear();
//qDebug() << Q_FUNC_INFO << "llamando a filterValidFields";
columns << dataProxy->filterValidFields(_columns);
logModel->setColumns(columns);
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::sortColumn(const int _c)
{
//qDebug() << Q_FUNC_INFO << " - Start";
logModel->sort(_c, Qt::AscendingOrder);
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::clear()
{
//qDebug() << Q_FUNC_INFO << " - Start/END";
}
void LogWindow::createUI()
{
//qDebug() << Q_FUNC_INFO << " - Start";
logView->setContextMenuPolicy(Qt::CustomContextMenu);
logView->setSortingEnabled(true);
logView->horizontalHeader ()->setSectionsMovable (true);
//logView->setDragDropMode (QAbstractItemView::InternalMove);
//logView->setDropIndicatorShown (true);
//retoreColumsOrder();
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(logView);
setLayout(layout);
}
void LogWindow::retoreColumsOrder()
{
// Restore the column order from the settings
QSettings settings(util->getCfgFile (), QSettings::IniFormat);
settings.beginGroup("LogWindow");
QList columnOrder = settings.value("columnOrder").value>();
settings.endGroup();
if (!columnOrder.isEmpty()) {
for (int i = 0; i < columnOrder.size(); ++i) {
logView->horizontalHeader()->moveSection(logView->horizontalHeader()->visualIndex(columnOrder[i]), i);
}
}
}
void LogWindow::setDefaultData()
{
//qDebug() << Q_FUNC_INFO << " - Start";
columns.clear();
//qDebug() << Q_FUNC_INFO << "llamando a filterValidFields";
columns << dataProxy->filterValidFields(util->getDefaultLogFields());
//qDebug() << "LogWindow::setDefaultData" ;
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::createlogPanel(const int _currentLog)
{
//qDebug() << Q_FUNC_INFO << " - Start : " << QString::number(_currentLog);
currentLog = _currentLog;
if (!logModel->createlogModel(currentLog))
{
//qDebug() << Q_FUNC_INFO << " - ERROR creating model";
}
logView->setModel(logModel);
logView->setCurrentIndex(logModel->index(0, 0));
setColumnsOfLog(columns);
sortColumn(1); //Initial sort by column 1 (date & time)
logView->setSelectionMode(QAbstractItemView::ExtendedSelection);
logView->setSelectionBehavior(QAbstractItemView::SelectRows);
logView->resizeColumnsToContents();
logView->horizontalHeader()->setStretchLastSection(true);
logView->sortByColumn(1, Qt::DescendingOrder);
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::setColumnsOfLog(const QStringList &_columns)
{
//qDebug() << Q_FUNC_INFO << " - Start: Length: " << QString::number(_columns.length());
QString stringQuery;
stringQuery = QString("SELECT * FROM log LIMIT 1");
QSqlQuery query;
bool sqlOK = query.exec(stringQuery);
if (!sqlOK)
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
}
QSqlRecord rec;
rec = query.record(); // Number of columns
int ncolumns = rec.count();
for (int i=0; i < ncolumns; i++)
{
logView->setColumnHidden(i, true);
}
QString aux;
//foreach(aux, columns)
//{
//qDebug() << Q_FUNC_INFO << ": columns-1: " << aux;
//}
//foreach(aux, _columns)
//{
//qDebug() << Q_FUNC_INFO << ": _columns-1: " << aux;
//}
QStringList temPColumns;
temPColumns.clear();
temPColumns << _columns;
columns.clear();
//qDebug() << Q_FUNC_INFO << "calling filterValidFields";
columns << dataProxy->filterValidFields(temPColumns);
//foreach(aux, columns)
//{
//qDebug() << Q_FUNC_INFO << ":-2: " << aux;
//}
foreach(aux, columns)
{
//qDebug() << Q_FUNC_INFO << ": " << aux;
showColumn(aux);
}
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::showColumn(const QString &_columnName)
{
//qDebug() << Q_FUNC_INFO << " - Start";
QString stringQuery;
stringQuery = QString("SELECT * FROM log LIMIT 1");
QSqlQuery query;
bool sqlOK = query.exec(stringQuery);
if (!sqlOK)
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
}
QSqlRecord rec;
rec = query.record(); // Number of columns
int columns = rec.indexOf(_columnName);
logView->setColumnHidden(columns, false);
}
void LogWindow::refresh()
{
//qDebug() << Q_FUNC_INFO << " - Start";
if (!logModel->select())
{
//qDebug() << Q_FUNC_INFO << " - ERROR on select()";
//qDebug() << Q_FUNC_INFO << " - Error refreshing log:" << logModel->lastError().text();
QMessageBox msgBox;
msgBox.setText(tr("There was a problem with the log, please restart KLog and contact the development team if the error persist."));
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec();
}
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::createActions()
{
//qDebug() << Q_FUNC_INFO << " - Start";
createActionsCommon();
showMenuRightButtonFromLogCreateActions();
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::createActionsCommon()
{
//qDebug() << Q_FUNC_INFO << " - Start";
//LOG VIEW
connect(logView, SIGNAL(customContextMenuRequested( const QPoint& ) ), this, SLOT(slotRighButtonFromLog( const QPoint& ) ) );
connect(logView, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickLog( const QModelIndex& ) ) );
connect(logView->horizontalHeader(), &QHeaderView::sectionMoved, this, &LogWindow::slotOnSectionMoved);
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotRighButtonFromLog(const QPoint& pos)
{
//qDebug() << Q_FUNC_INFO << " - Start";
int row = (logView->indexAt(pos)).row();
QItemSelectionModel *select = logView->selectionModel();
QModelIndexList list = select->selectedRows();
if (select->hasSelection() && (list.length()>1) )
{
rightButtonMultipleFromLogMenu();
}
else
{
rightButtonFromLogMenu(row);
}
//qDebug() << Q_FUNC_INFO << " - END";
//TODO: To be added to the logWindow and create an action that emist the QSO id
}
void LogWindow::rightButtonMultipleFromLogMenu()
{
//qDebug() << Q_FUNC_INFO << " - Start";
QMenu menu(this);
menu.addAction(multipleDelQSOsFromLogAct);
//menu.addSeparator();
menu.addAction(multipleExportToADIFFromLogAct);
/*
menu.addSeparator();
QMenu *menuEQsl = menu.addMenu(tr("eQSL"));
menuEQsl->addAction(multipleQueueForLoTWFromLogAct);
menuEQsl->addAction(multipleQueueForClubLogFromLogAct);
menuEQsl->addAction(multipleQueueForEQSLFromLogAct);
menu.addMenu(menuEQsl);
QMenu *menuQslS = menu.addMenu(tr("QSL"));
QMenu *menuSentQsl = menuQslS->addMenu(tr("QSLs Send"));
menuSentQsl->addAction(multipleQslSentViaBureauFromLogAct);
menuSentQsl->addAction(multipleQslSentViaDirectFromLogAct);
QMenu *menuRcvdQsl = menuQslS->addMenu(tr("QSLs Rcvd"));
menuRcvdQsl->addAction(multipleQslRecViaBureauFromLogAct);
menuRcvdQsl->addAction(multipleQslRecViaDirectFromLogAct);
*/
menu.addSeparator();
menu.addAction(multipleSelectAll);
menu.addAction(multipleDeselectAll);
menu.exec(QCursor::pos());
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::rightButtonFromLogMenu(const int trow)
{
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(trow);
//qDebug() << Q_FUNC_INFO;
int _qsoID = ((logModel->index(trow, 0)).data(0)).toInt();
//qDebug() << "LogWindow::slotshowRighButtonFromLogMenu: QSOid: " << QString::number(_qsoID);
bool qslReceived = isQSLReceived(_qsoID);
bool qslSent = isQSLSent(_qsoID);
QMenu menu(this);
//menu.addAction(multipleQueueForQRZCOMFromLogAct);
menu.addAction(multipleExportToADIFFromLogAct);
menu.addAction(delQSOFromLogAct);
delQSOFromLogAct->setData(trow);
menu.addAction(qsoToEditFromLogAct);
qsoToEditFromLogAct->setData(trow);
menu.addAction(checkQRZCOMFromLogAct);
checkQRZCOMFromLogAct->setData(trow);
menu.addAction(checkDXHeatFromLogAct);
checkDXHeatFromLogAct->setData(trow);
menu.addSeparator();
if (!qslSent)
{
QMenu *menuSentQsl = menu.addMenu(tr("QSL Send"));
menuSentQsl->addAction(qslSentViaBureauFromLogAct);
menuSentQsl->addAction(qslSentViaDirectFromLogAct);
qslSentViaBureauFromLogAct->setData(trow);
qslSentViaDirectFromLogAct->setData(trow);
}
if (!qslReceived)
{
QMenu *menuRecQsl = menu.addMenu(tr("QSL Rcvd"));
menuRecQsl->addAction(qslRecViaBureauFromLogAct);
menuRecQsl->addAction(qslRecViaDirectFromLogAct);
qslRecViaBureauFromLogAct->setData(trow);
qslRecViaDirectFromLogAct->setData(trow);
}
menu.addSeparator();
menu.addAction(multipleSelectAll);
menu.addAction(multipleDeselectAll);
menu.exec(QCursor::pos());
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotDoubleClickLog(const QModelIndex & index)
{
//qDebug() << Q_FUNC_INFO << " - Start Row: " << QString::number(index.row()) << "Column: " << QString::number(index.column());
int row = index.row();
//qsoToEdit((logModel->index(row, 0)).data(0).toInt());
int qsoID = ((logModel->index(row, Qt::DisplayRole)).data(0)).toInt();
//qDebug() << "LogWindow::slotDoubleClickLog: n: " << QString::number (logModel->data(index, Qt::DisplayRole).toInt());
//qDebug() << "LogWindow::slotDoubleClickLog: emitted: " << QString::number (((logModel->index(row, Qt::DisplayRole)).data(0)).toInt());
emit actionQSODoubleClicked(qsoID);
//qsoToEdit((logModel->index(row, 0)).data(0).toInt());
//TODO: To be added to the logWindow and create an action that emist the QSO id to be edited
logModel->select();
//qDebug() << Q_FUNC_INFO << " - END";
}
bool LogWindow::isQSLReceived(const int _qsoId)
{
//qDebug() << Q_FUNC_INFO << " - Start " << QString::number(_qsoId);
return dataProxy->isQSOConfirmed(_qsoId, true, false); // We check just paper QSL
//return dataProxy->isQSLReceived(_qsoId);
}
bool LogWindow::isQSLSent(const int _qsoId)
{
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_qsoId);
return dataProxy->isQSLSent(_qsoId);
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::showMenuRightButtonFromLogCreateActions()
{
//qDebug() << Q_FUNC_INFO << " - Start";
delQSOFromLogAct = new QAction(tr("&Delete"), this);
delQSOFromLogAct->setShortcut(Qt::CTRL | Qt::Key_D);
delQSOFromLogAct->setStatusTip(tr("Delete a QSO"));
connect(delQSOFromLogAct, SIGNAL(triggered()), this, SLOT(slotQsoDeleteFromLog()));
qsoToEditFromLogAct = new QAction(tr("&Edit QSO"), this);
qsoToEditFromLogAct->setShortcut(Qt::CTRL | Qt::Key_E);
qsoToEditFromLogAct->setStatusTip(tr("Edit this QSO"));
connect(qsoToEditFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSOToEditFromLog()));
qslSentViaBureauFromLogAct = new QAction(tr("Via &bureau"), this);
qslSentViaBureauFromLogAct->setShortcut(Qt::CTRL | Qt::Key_B);
qslSentViaBureauFromLogAct->setStatusTip(tr("Send this QSL via bureau"));
connect(qslSentViaBureauFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaBureauFromLog() ));
qslSentViaDirectFromLogAct = new QAction(tr("D&irect"), this);
qslSentViaDirectFromLogAct->setShortcut(Qt::CTRL | Qt::Key_I);
qslSentViaDirectFromLogAct->setStatusTip(tr("Send this QSL via direct"));
connect(qslSentViaDirectFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaDirectFromLog() ));
qslRecViaBureauFromLogAct = new QAction(tr("Via bureau"), this);
qslRecViaBureauFromLogAct->setShortcut(Qt::CTRL | Qt::Key_R);
qslRecViaBureauFromLogAct->setStatusTip(tr("QSL &received via bureau"));
connect(qslRecViaBureauFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaBureauFromLog() ));
qslRecViaDirectFromLogAct = new QAction(tr("Direct"), this);
qslRecViaDirectFromLogAct->setShortcut(Qt::CTRL | Qt::Key_T);
qslRecViaDirectFromLogAct->setStatusTip(tr("QSL received via direc&t"));
connect(qslRecViaDirectFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaDirectFromLog() ));
checkQRZCOMFromLogAct = new QAction(tr("Check in QRZ.com"), this);
checkQRZCOMFromLogAct->setShortcut(Qt::CTRL | Qt::Key_Q);
checkQRZCOMFromLogAct->setStatusTip(tr("Check this callsign in QRZ.com"));
connect(checkQRZCOMFromLogAct, SIGNAL(triggered()), this, SLOT( slotCheckQRZCom() ));
checkDXHeatFromLogAct = new QAction(tr("Check in DXHeat.com"), this);
checkDXHeatFromLogAct->setShortcut(Qt::CTRL | Qt::Key_Q);
checkDXHeatFromLogAct->setStatusTip(tr("Check this callsign in DXHeat.com"));
connect(checkDXHeatFromLogAct, SIGNAL(triggered()), this, SLOT( slotCheckDXHeatCom() ));
multipleDelQSOsFromLogAct = new QAction(tr("Delete selected QSOs"), this);
//multipleDelQSOsFromLogAct->setShortcut(Qt::CTRL | Qt::Key_D);
multipleDelQSOsFromLogAct->setStatusTip(tr("Delete the selected QSOs"));
connect(multipleDelQSOsFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSOsDeleteFromLog()));
multipleExportToADIFFromLogAct = new QAction(tr("Export to ADIF"), this);
multipleExportToADIFFromLogAct->setStatusTip(tr("Export the selected QSOs to an ADIF file."));
connect(multipleExportToADIFFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSOsExportFromLog()));
//multipleQueueForQRZCOMFromLogAct = new QAction(tr("Upload to QRZ.com"), this);
//multipleQueueForQRZCOMFromLogAct->setStatusTip(tr("Send the selected QSOs to QRZ.com."));
//connect(multipleQueueForQRZCOMFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSOsQRZUploadFromLog()));
multipleQueueForLoTWFromLogAct = new QAction(tr("Upload to LoTW"), this);
multipleQueueForLoTWFromLogAct->setStatusTip(tr("Upload the selected QSOs to LoTW"));
connect(multipleQueueForLoTWFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSOsUploadToLoTWFromLog()));
multipleQueueForClubLogFromLogAct = new QAction(tr("Upload to ClubLog"), this);
multipleQueueForClubLogFromLogAct->setStatusTip(tr("Upload the selected QSOs to ClubLog"));
connect(multipleQueueForClubLogFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSOsUploadToClubLogFromLog()));
multipleQueueForEQSLFromLogAct = new QAction(tr("Upload to eQSL.cc"), this);
multipleQueueForEQSLFromLogAct->setStatusTip(tr("Upload the selected QSOs to eQSL.cc"));
connect(multipleQueueForEQSLFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSOsUploadToEQSLFromLog()));
multipleQslSentViaBureauFromLogAct = new QAction(tr("Via bureau"), this);
multipleQslSentViaBureauFromLogAct->setStatusTip(tr("Send these QSLs via bureau"));
connect(multipleQslSentViaBureauFromLogAct, SIGNAL(triggered()), this, SLOT( slotMultipleQSLSentViaBureauFromLog() ));
multipleQslSentViaDirectFromLogAct = new QAction(tr("Direct"), this);
multipleQslSentViaDirectFromLogAct->setStatusTip(tr("Send these QSLs via direct"));
connect(multipleQslSentViaDirectFromLogAct, SIGNAL(triggered()), this, SLOT( slotMultipleQSLSentViaDirectFromLog() ));
multipleQslRecViaBureauFromLogAct = new QAction(tr("Via bureau"), this);
multipleQslRecViaBureauFromLogAct->setStatusTip(tr("QSLs received via bureau"));
connect(multipleQslRecViaBureauFromLogAct, SIGNAL(triggered()), this, SLOT( slotMultipleQSLRecViaBureauFromLog() ));
multipleQslRecViaDirectFromLogAct = new QAction(tr("Direct"), this);
multipleQslRecViaDirectFromLogAct->setStatusTip(tr("QSLs received via direc&t"));
connect(multipleQslRecViaDirectFromLogAct, SIGNAL(triggered()), this, SLOT( slotMultipleQSLRecViaDirectFromLog() ));
multipleDeselectAll = new QAction(tr("Select none"), this);
multipleDeselectAll->setStatusTip(tr("Remove all selections"));
connect(multipleDeselectAll, SIGNAL(triggered()), this, SLOT( slotQSOsDeselectAll() ));
multipleSelectAll = new QAction(tr("Select all"), this);
multipleSelectAll->setStatusTip(tr("Select all the QSOs"));
connect(multipleSelectAll, SIGNAL(triggered()), this, SLOT( slotQSOsSelectAll() ));
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotQSOsSelectAll()
{
//qDebug() << Q_FUNC_INFO << " - Start";
logView->selectAll();
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotQSOsDeselectAll()
{
//qDebug() << Q_FUNC_INFO << " - Start";
logView->selectionModel()->clearSelection();
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotQSLSentViaBureauFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start: " << (qslSentViaBureauFromLogAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslSentViaBureauFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) );
int _qsoId = ((logModel->index( ( (qslSentViaBureauFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
qslSentViaBureau(_qsoId);
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotQSLSentViaDirectFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start: " << (qslSentViaDirectFromLogAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslSentViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) );
int _qsoId = ((logModel->index( ( (qslSentViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
//dataProxy->qslSentViaDirect(_qsoId, (QDateTime::currentDateTime()).toString("yyyy-MM-dd"));
dataProxy->qslSentViaDirect(_qsoId, QDate::currentDate());
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotQSLRecViaBureauFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start";
int _qsoId = ((logModel->index( ( (qslRecViaBureauFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
qslRecViaBureau(_qsoId);
//qDebug() << Q_FUNC_INFO << " - END";
//TODO: To be added to the logWindow and create an action that emist the QSO id
}
void LogWindow::slotQSLRecViaDirectFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start: " << (qslRecViaDirectFromLogAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) );
int _qsoId = ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
qslRecViaDirect(_qsoId);
// Mark Sent, Bureau, date, update log.
//TODO: To be added to the logWindow and create an action that emist the QSO id
}
void LogWindow::slotQSOToEditFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start: " << (qsoToEditFromLogAct->data()).toString();
//qsoToEdit((logModel->index((qsoToEditFromLogAct->data()).toInt(), 0)).data(0).toInt());
int QSOid = ((logModel->index((qsoToEditFromLogAct->data()).toInt(), 0)).data(0)).toInt();
/*
int row = index.row();
int qsoID = ((logModel->index(row, Qt::DisplayRole)).data(0)).toInt();
emit actionQSODoubleClicked(qsoID);
*/
//int row = index.row();
//qsoToEdit((logModel->index(row, 0)).data(0).toInt());
emit actionQSODoubleClicked(QSOid);
//qDebug() << Q_FUNC_INFO << " - END";
//TODO: To be added to the logWindow and create an action that emit the QSO id
}
void LogWindow::deleteQSO(const int _qsoId)
{
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_qsoId);
emit actionDeleteQSO(_qsoId);
//qDebug() << Q_FUNC_INFO << " - END";
}
/*
void LogWindow::deleteQSO(const int _qsoID)
{
//qDebug() << "LogWindow::deleteQSO: " << QString::number(_qsoID);
emit actionDeleteQSO(_qsoID);
//elogClublog->deleteQSO(dataProxy->getClubLogRealTimeFromId(_qsoID));
dataProxy->deleteQSO(_qsoID);
//logModel->removeRow((delQSOFromLogAct->data()).toInt()); //TODO: This has been replaced by the previous line
//awards->recalculateAwards();
refresh();
//dxccStatusWidget->refresh();
emit updateAwards();
emit updateSearchText();
}
*/
void LogWindow::slotQsoDeleteFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start: " << (delQSOFromLogAct->data()).toString();
//TODO: To be added to the logWindow and create an action that emist the QSO id
int QSOid = ((logModel->index((delQSOFromLogAct->data()).toInt(), 0)).data(0)).toInt();
deleteQSO(QSOid);
//qDebug() << "LogWindow::slotQsoDeleteFromLog (id): " << QString::number(QSOid);
/*
switch (ret) {
case QMessageBox::Yes:
//qDebug() << "LogWindow::slotQsoDeleteFromLog (id): -1";
deleteQSO(QSOid);
break;
case QMessageBox::No:
// No was clicked
break;
default:
// should never be reached
break;
}
*/
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotQSOsDeleteFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start";
QItemSelectionModel *select = logView->selectionModel();
QList qsos;
qsos.clear();
if (select->hasSelection())
{
QModelIndexList list = select->selectedRows();
foreach (QModelIndex index, list)
{
qsos.append(index.data(0).toInt());
//qDebug() << "LogWindow::slotshowRighButtonFromLog: " << QString::number(index.row()) ;
//qDebug() << "LogWindow::slotshowRighButtonFromLog: " << QString::number(index.data(0).toInt()) ;
}
}
if (qsos.length()>0)
{
emit deleteTheseQSOs(qsos);
}
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotQSOsExportFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start";
QItemSelectionModel *select = logView->selectionModel();
QList qsos;
qsos.clear();
if (select->hasSelection())
{
QModelIndexList list = select->selectedRows();
foreach (QModelIndex index, list)
{
qsos.append(index.data(0).toInt());
//qDebug() << "LogWindow::slotQSOsExportFromLog: " << QString::number(index.row()) ;
//qDebug() << "LogWindow::slotQSOsExportFromLog: " << QString::number(index.data(0).toInt()) ;
}
}
if (qsos.length()>0)
{
emit exportToADIFTheseQSOs(qsos);
}
//qDebug() << "LogWindow::slotQSOsExportFromLog - END - " << QString::number(qsos.length());
}
void LogWindow::slotQSOsUploadToLoTWFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start - TO BE IMPLEMENTED";
}
void LogWindow::slotQSOsUploadToClubLogFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start - TO BE IMPLEMENTED";
}
void LogWindow::slotQSOsQRZUploadFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start - TO BE IMPLEMENTED";
QItemSelectionModel *select = logView->selectionModel();
QList qsos;
qsos.clear();
if (select->hasSelection())
{
QModelIndexList list = select->selectedRows();
foreach (QModelIndex index, list)
{
qsos.append(index.data(0).toInt());
//qDebug() << Q_FUNC_INFO << " : " << QString::number(index.row()) ;
//qDebug() << Q_FUNC_INFO << " : " << QString::number(index.data(0).toInt()) ;
}
}
if (qsos.length()>0)
{
emit uploadToQRZcomTheseQSOs(qsos);
}
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotQSOsUploadToEQSLFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start - TO BE IMPLEMENTED";
}
void LogWindow::slotMultipleQSLSentViaBureauFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start - TO BE IMPLEMENTED";
}
void LogWindow::slotMultipleQSLSentViaDirectFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start - TO BE IMPLEMENTED";
}
void LogWindow::slotMultipleQSLRecViaBureauFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start - TO BE IMPLEMENTED";
}
void LogWindow::slotMultipleQSLRecViaDirectFromLog()
{
//qDebug() << Q_FUNC_INFO << " - Start - TO BE IMPLEMENTED";
}
void LogWindow::qslSentViaBureau(const int _qsoId)
{
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_qsoId);
dataProxy->qslSentViaBureau(_qsoId, QDate::currentDate());
}
void LogWindow::qslRecViaBureau(const int _qsoId)
{
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_qsoId);
dataProxy->qslRecViaBureau(_qsoId, QDate::currentDate(), false);
awards->setAwards(); //Update the Award status
refresh();
emit updateAwards();
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::qslRecViaDirect(const int _qsoId)
{
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_qsoId);
dataProxy->qslRecViaDirect(_qsoId, QDate::currentDate(), false);
awards->setAwards();
refresh();
emit updateAwards();
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotQueryErrorManagement(QString functionFailed, QString errorCodeS, QString nativeError, QString failedQuery)
{
emit queryError(functionFailed, errorCodeS, nativeError, failedQuery);
}
void LogWindow::slotCheckQRZCom()
{
//qDebug() << Q_FUNC_INFO << " - Start";
QString _qrz = ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 2)).data(Qt::DisplayRole).toString());
//int _qsoId = ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
//QString _qrz = dataProxy->getCallFromId(_qsoId);
//qDebug() << Q_FUNC_INFO << " : " << _qrz;
util->openQrzcom (_qrz);
//QString url = "https://www.qrz.com/db/" + _qrz;
//QDesktopServices::openUrl(QUrl(url));
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotCheckDXHeatCom()
{
//qDebug() << Q_FUNC_INFO << " - Start";
QString _qrz = ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 2)).data(Qt::DisplayRole).toString());
//int _qsoId = ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt());
//QString _qrz = dataProxy->getCallFromId(_qsoId);
//qDebug() << Q_FUNC_INFO << " : " << _qrz;
QString url = "https://www.dxheat.com/db/" + _qrz;
QDesktopServices::openUrl(QUrl(url));
//qDebug() << Q_FUNC_INFO << " - END";
}
void LogWindow::slotOnSectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex)
{
Q_UNUSED(logicalIndex);
Q_UNUSED(oldVisualIndex);
Q_UNUSED(newVisualIndex);
// Get the current column order
QStringList header = getOrderedVisibleHeaders();
QSettings settings(util->getCfgFile (), QSettings::IniFormat);
settings.beginGroup("LogWindow");
settings.setValue("ColumnOrder", QVariant::fromValue(header));
settings.endGroup();
}
QStringList LogWindow::getOrderedVisibleHeaders() const
{
QStringList orderedHeaders;
QHeaderView* headerView = logView->horizontalHeader();
for (int i = 0; i < headerView->count(); ++i)
{
int logicalIndex = headerView->logicalIndex(i);
if (!logView->isColumnHidden(logicalIndex))
{
QString header = logModel->headerData(logicalIndex, Qt::Horizontal).toString();
orderedHeaders.append(util->getLogColumnDBName(header));
}
}
return orderedHeaders;
}
klog-2.4.1/INSTALL-es.txt 0000644 0001750 0001750 00000000340 15003153303 013674 0 ustar devel devel Este fichero es sobre el proceso de instalación de KLog:
Por favor, lea::
INSTALL-linux.txt para instrucciones de linux.
INSTALL-macOS.txt para instrucciones en macOS.
INSTALL-win.txt para instrucciones en Windowns..
klog-2.4.1/flags/ 0000755 0001750 0001750 00000000000 15003153303 012517 5 ustar devel devel klog-2.4.1/flags/in.png 0000644 0001750 0001750 00000000767 15003153303 013645 0 ustar devel devel PNG
IHDR n gAMA 7 tEXtSoftware Adobe ImageReadyqe<