3
/***************************************************************************
7
copyright : (C) 2011 by Jaime Robles
8
email : jaime@robles.es
9
***************************************************************************/
11
/*****************************************************************************
12
* This file is part of KLog. *
14
* KLog is free software: you can redistribute it and/or modify *
15
* it under the terms of the GNU General Public License as published by *
16
* the Free Software Foundation, either version 3 of the License, or *
17
* (at your option) any later version. *
19
* KLog is distributed in the hope that it will be useful, *
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22
* GNU General Public License for more details. *
24
* You should have received a copy of the GNU General Public License *
25
* along with KLog. If not, see <https://www.gnu.org/licenses/>. *
27
*****************************************************************************/
29
//#include <QObject> // For the "tr" function
36
#include <QStringList>
37
#include <QProgressDialog>
43
#include "awarddxmarathon.h"
44
#include "dataproxy_sqlite.h"
45
#include "utilities.h"
47
class QProgressDialog;
50
class Awards : public QObject {
55
Awards(DataProxy_SQLite *dp, const QString &_parentFunction);
57
void setAwards(const int _qsoId);
58
void setAwards(const int _dxcc, const int _waz, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId);
60
_workedOrConfirmed = 0 Set as Worked
61
_workedOrConfirmed = 1 Set as Confirmed
63
void setManageModes(const bool _manageModes=false); // Defines if the mode is to be taken into account when calculating an award
65
void recalculateAwards();
66
//void recalculateDXCC(const int _logNumber);
67
//void setAwards(const int _qsoId, bool modify);
68
int getDXCCWorked(const int _logNumber);
69
int getDXCCConfirmed(const int _logNumber);
70
int getWAZWorked(const int _logNumber);
71
int getWAZConfirmed(const int _logNumber);
75
int getQSOsInLog(const int _logNumber);
77
bool getIsDXCCConfirmed(const int _dxcc, const int _logNumber);
78
bool isThisSpotConfirmed(const QStringList &_qs);
80
QString checkIfValidIOTA(const QString &_tiota); //TODO: There is an equivalent function in the MainWindowInputOthers class. I should use only one!
82
int getEntityDXStatus (const int _enti, const int _bandid, int _modeid = -1, int _log = -1);
83
QString getQSOofAward (const int _enti, const int _bandid);
84
int getQSOIdofAward (const int _enti, const int _bandid);
86
int getDXStatus (const QStringList &_qs);
87
QString getDXStatusString (const int &_status); // Needs to be called with the output of getDXStatus
88
QString getDXCCStatusBand(const int _dxcc, const int _band, const int _logNumber=0); // Returns -, W or C (Not worked, worked, Confirmed)
90
void setColors (const QString &_newOne, const QString &_needed, const QString &_worked, const QString &_confirmed, const QString &_default);
91
QColor getQRZDXStatusColor(const QStringList &_qs); // Receives Entity, band, mode & log
92
QColor getDefaultColor();
94
int getDXMarathonQSO(const int _year, const int _logNumber);
95
int getDXMarathonDXCC(const int _year, const int _logNumber);
96
int getDXMarathonCQ(const int _year, const int _logNumber);
97
int getDXMarathonScore(const int _year, const int _logNumber);
98
bool isDXMarathonNeed(const int _dxcc, const int _cq, const int _year, const int _logNumber);
100
// Receives: QStringList _qs;
101
//_qs << QRZ << BandId << lognumber;
104
1 - Worked but not confirmed: New one in this band.
105
2 - Worked but not confirmed: Worked in this band.
106
3 - Confirmed: New one in this band.
107
4 - Confirmed: Worked in this band.
108
5 - Confirmed: Confirmed in this band.
109
6 - Default: Not applicable
115
void setAwardDXCC(const int _qsoId);
116
//bool setAwardDXCC(const int _dxcc, const int _band, const int _mode, const QString _workedOrConfirmed, const int _logNumber, const int _qsoId);
117
int setAwardDXCCst(const int _dxcc, const int _band, const int _mode, const bool _confirmed, const int _logNumber, const int _qsoId);
119
int setAwardDXCCConfirmed(const int _band, const int _mode, const int _dxcc, const int _newQSOid); // Changes the status of a DXCC from worked to confirmed
120
int setDXCCToQSO(const int _dxcc, const int _qsoid); // Defines the DXCC in a QSO
121
int setCQToQSO(const int _cqz, const int _qsoid); // Defines the CQ zone in a QSO
123
int dxccStatusBandMode(const int _ent, const int _band, const int _mode, const int _logNumber, bool _checkingMode); //-1 error / 0 Not worked / 1 worked / 2 confirmed
124
int dxccStatus(const int _ent, const int _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed
127
_confirmed = 0 Set as Worked
128
_cConfirmed = 1 Set as Confirmed
133
int dxccStatusBand(const int _ent, const int band, const int _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed
134
int dxccStatusMode(const int _ent, const int band, const int _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed
137
void setAwardWAZ(const int _qsoId);
138
//bool setAwardWAZ(const int _cqz, const int _band, const int _mode, const QString _workedOrConfirmed, const int _logNumber, const int _qsoId);
139
int setAwardWAZst(const int _cqz, const int _band, const int _mode, const bool _confirmed, const int _logNumber, const int _qsoId);
141
_confirmed = 0 Set as Worked
142
_confirmed = 1 Set as Confirmed
144
//int getProgresStepForDialog(int totalSteps);
146
QColor newOneColor; //
147
QColor neededColor; //
148
QColor workedColor; //
149
QColor confirmedColor; //
153
DataProxy_SQLite *dataProxy;
154
DXMarathon *dxMarathon;
158
typedef QMultiHash<int, int> DXStatus;
160
DXStatus dxccWorked, dxccConfirmed, wazWorked, wazConfirmed;
164
void queryError(QString functionFailed, QString errorCodeS, int errorCodeN, QString failedQuery); // To alert about any failed query execution
165
void awardDXCCUpdated();