Getting closer to 0.9.2

This commit is contained in:
jaime 2015-08-17 15:54:45 +00:00
parent c0b9ea36f5
commit 0b49df33e6
30 changed files with 4234 additions and 2078 deletions

View File

@ -7,21 +7,24 @@
- BugFix: Improved the color & status shown of a QSO on the DXCC.
- BugFix: DXCluster: Fixed a bug that caused the colors to appear always as new one.
- BugFix: DXCluster: The option to show only not confirmed was not working correcty.
- Added the 630M & 13CM bands.
- Updated Mode & submode definition up to ADIF 3.0.4.
- KLog is able to import QSOs with no BAND field if FREQ field is present.
- KLog offers the user a default value if RST_TX or RST_RX field is not present when importing.
- BugFix: IOTA reference was not saved when entering a QSO.
- GUI: Added some shortcuts in the preference widget.
- GUI: DXCluster: Add a suggestion to hit enter if no password is expected for the cluster. (tnx AA5VI)
- GUI: DXCluster: Warns you if the spot is needed for the current year DX-Marathon
- Support of realtime upload, modification & removal of a single QSO to/from ClubLog.org.
- Updated the DB with the PROP_MODE options.
- Improved the way KLog manages & shows the bands & modes.
- GUI: Added a Propagation Mode Combobox.
- GUI: Prop_Mode combobox automatically goes to SAT if sat name or sat mode are defined.
- GUI: Added a Find DX-QSL requested option.
- Added the 630M & 13CM bands.
- Updated Mode & submode definition up to ADIF 3.0.4.
- Special CQ & ITU zones in some calls are now identified.
- KLog is able to import QSOs with no BAND field if FREQ field is present.
- KLog offers the user a default value if RST_TX or RST_RX field is not present when importing.
- Support of realtime upload, modification & removal of a single QSO to/from ClubLog.org.
- Updated the DB with the PROP_MODE options.
- Improved the way KLog manages & shows the bands & modes.
- Removed the option to choose to run in memory or file in the start wizard. KLog will run always using a file for the DB.
- Added an auto complete option to auto-complete info (QTH, Locator, Name, QSL Manager & IOTA) from previously worked QSO.
- Cleared the world.cpp file.
- Some minor performance improvements.
April-2015 - 0.9.1.1

37
TODO
View File

@ -1,3 +1,5 @@
QUitar de la configutación que pueda ejecutar en memoria
This is a kind of roadmap for KLog development.
It is not fixed... new features may be prioritized or not added without any notice ;-)
Feel free to request any roadmap change if you have any suggestion.
@ -5,11 +7,9 @@ Feel free to request any roadmap change if you have any suggestion.
BUG: Check the options that are marked in QSL when rightbutton.
i.e.: Is myQSL sent marked as requested when it should be the DX-QSL?
BUG: QSL Status is not OK. Data is OK, need to read properly.
Message is not OK
Shows 5 - needed should be confirmed (green) but color is ok
BUG: CTY:CSV is not properly updated
BUG: slotQRZTextChanged: If a string with spaces is copied in the QRZLineEdit, KLog crashes due to the cursorP variable
TODO GUI: To add the CQ/ITU box or make them editable
@ -20,8 +20,6 @@ _x = elogClublog->deleteQSO(clublogPrevQSO);
_x = elogClublog->sendQSO(dataProxy->getClubLogRealTimeFromId(modifyingQSO))
It runs so fast and not serialized that at the end sometimes the QSO is deleted but not created afterwards
BUG:
<CLUBLOG>
TODO: Add the possibility to the user to select from the setup a call to be used in clublog or use the one comming from the station callsign lineedit
@ -42,12 +40,10 @@ TODO: Define a maximum QSO upload rate to clublog to avoid excesive API usage.
</CLUBLOG>
KLog 0.9.2
TODO: When importing an ADIF file with several logs, create automatically the logs as detected.
TODO: Remove all not needed fields from SetupPageLogNew::gatherAndSend() the type is enough
TODO: Keep adapting to ADIF 3.0.4
NEXT:
TODO: Some Entities have more than one CQ zone. Create a way to manage it and allow the user to select (combobox?)
TODO: Some Entities are not recognized by ARRL (I, IG9, IT9 are the same ARRL id entities but different ones). Maybe I should not be working
with ARRLid or maybe I should detect special ones and "id+10000" so >10000 ids are special ones.
TODO: Add a Default band & mode in the setup dialog (MainWindow::slotClearButtonClicked, ...)
@ -69,8 +65,6 @@ TODO: Support CQ WPX CW (Including Cabrillo Import/Export)
KLog 0.9.6
WORLDEDITOR Dialog
TODO: WorldEditor is not updated when the CTY.CSV file is updated
TODO: Create a function to check if the ADIF DXCC corresponds with the prefix.
TODO: Add a ComboBox to change and define a DXCC for each QSO.
TODO: World Editor: Create a way to add an entity.
TODO: World Editor: Create a way to remove an entity.
TODO: World Editor: Create a way to edit an entity.
@ -95,6 +89,7 @@ TODO: DXCluster: Add flags to the DXCluster widget
TODO: DXCluster: UI: Modify the DX-Cluster tab to show the data in a table?: DX de/Freq/DX/Comment/Time/Loc
TODO: DXCluster: Add the DXMarathon information to the spots
TODO: DXCLuster: Create a band map
TODO: Working on the dxCluster: Tool to save the DXCluster in a file (for further analysis).
KLog 0.9.12
TODO: Add the awards functionality (to manage awa files, TPEA, WAS, ...)
@ -103,9 +98,9 @@ TODO: Add the awards functionality (to manage awa files, TPEA, WAS, ...)
TODO: Check if the data has been modified (only memory) and save the data!
TODO BUG: When modifying allow deleting data (as in KLog 0.5.8)
DONE BUG: Worked DXCC and WAZ are not updated until confirmed :-?
DONE BUG: When toEdit, the IOTA field is not copied to the UI; IOTA needs to be added always with "6" chars in the BD (AF-001 and not "AF-1" or "AF-001")
</BUGS>
TODO: When importing an ADIF file with several logs, create automatically the logs as detected.
TODO: HelpHelpDialog
TODO: HelpAboutDialog
@ -118,7 +113,7 @@ TODO: Add a default DX Cluster server
TODO: Make a tool to mark and export QSO from the right button. (i.e. To mark several QSO to print and export the ADIF file with just those QSO)
TODO: Add all the Entity Info to the slotClear to clear everything.
TODO: Add a list of previous QSO with the same station, if any.
TODO: Add a list of previous QSO with the same station, if any. (Done in the search box)
TODO: Create something like a void Awards::setAwardsOfAllQSO to read ALL QSO and set the Awards at once instead of adding one QSO per QSO
@ -149,7 +144,6 @@ TODO: DXCLuster: Double click on a spot, add it to log
TODO: DXCLuster: Add Cluster servers
DONE: TODO: Colors: Confirmed, Worked, Needed band, New, Default
TODO: Complete with previous QSO (Name, ...)
TODO: Require mandatory fields in all QSO
TODO: Awards: Add Award
@ -193,10 +187,8 @@ The following fields may add information, even if the qsl has not been rcvd/sent
<QSL_RCVD_VIA:1>B <QSL_SENT_VIA:1>B
TODO: showStatusOfDXCC should be executed when band change.
TODO: bandComboBox is populated with TOO much modes (repeated!).
TODO: Add color support: messages for slotQRZTextChanged
TODO: Add color support: log?
TODO: SetupPageColors: Check the style in the buttons as the rounds are lost when I change the color!!
@ -205,8 +197,6 @@ TODO: Check when to connect the DXCluster and when no, it tries twice or more...
TODO: Awards: make a function to calculate the total.
TODO: Working on the dxCluster: Tool to save the DXCluster in a file (for further analysis).
TODO: Color support: Add needed, worked, confirmed, neutral colors to the configuration dialog.
TODO: Color support: Support the bar when a QRZ is entered.
TODO: Color support: Calculate a color for the log.
@ -221,7 +211,7 @@ TODO: The confirmed WAZ number is not properly calculated.
TODO: GUI: Add in the input box a combobox to change the CQZ
TODO: GUI: Add in the input box a combobox to change the ITUZ
TODO: GUI: Add in the input box a combobox to change the DXCC
TODO: In CQWWSSB, when editing QSO the SRX, Points, multiplier, ... are not sent to the edit so after "OK", those data are lost.
@ -229,21 +219,14 @@ TODO: MainWindow::slotQsoDeleteFromLog: Add the CALL to the message before detel
TODO: Search GUI: add multi-selection QSO to do the same actions inmultiple QSO.
TODO: When importing ADIF, update the logview sometimes... just to show the progress.
TODO: When importing ADIF: Only shows the ProgresDialog when the number is low >1000 <14000 investigate
TODO: Import Cabrillo
TODO: Add the Find QSOs to QSL.
TODO: Code the DX-Cluster connection.
TODO: To check how can I order the columns in the log or in the search QTableView. Now the order depends only on the order of the SQL table.
TODO: When mofiying a cell directly in the log, it is possible to select a mode/band that is not actually active in the configuration.
TODO: When modifying a cell directly in the log, it is possible to select a mode/band that is not actually active in the configuration.
TODO: Slot: If (only)eqsl/lotw is sent/rec, the QSL_RCVD_VIA should be E
@ -252,8 +235,6 @@ TODO: Code a Tool to get statistcs for the contests, some kind of post contest t
TODO: Be able to send scores to: http://www.cqcontest.ru/help/developers.jsp
TODO: Read the IOTA information in the qsoToEdit
TODO: Create an update CTY.DAT without overwriting the current data. Just Adding and correcting (asking) if data is already there but different.
TODO: Create an export CTY.DAT file to create a CTY.DAT file with ALL the data in the current "world".
@ -304,5 +285,5 @@ DONE: TODO: When a DX-Spot is selected, the DX-Entity and status should be shown
DONE: TODO: DXCluster: Connect, disconnect and connect again does not work
DONE: TODO: Add a field in Mainwindow to manage RX_PWR
DONE: TODO: slotclearbuttons->Colors to default
DONE: GUI: Add in the input box a combobox to change the DXCC
TODO: Recalculate DXCC Status when deleting/modiying QSO - void Awards::recalculateAwards()

View File

@ -30,10 +30,11 @@
Awards::Awards()
{
//qDebug() << "Awards::Awards" << endl;
//qDebug() << "Awards::Awards" << endl;
world = new World();
dataProxy = new DataProxy_SQLite();
dxMarathon = new DXMarathon();
util = new Utilities();
//world->create();
//newOneColor = Qt::green;
@ -703,46 +704,48 @@ QString message = QString();
switch (_status) {
case 0:
message = QObject::tr("0-new One");
message = QObject::tr("nNew One, work it!");
//message = QObject::tr("0-new One");
break;
case 1:
message = QObject::tr("1-Needed, work it!");
message = QObject::tr("Needed, work it!");
//message = QObject::tr("1-Needed, work it!");
break;
case 2:
message = QObject::tr("2-Needed, work it!");
message = QObject::tr("Needed, work it!");
break;
case 3:
message = QObject::tr("3-Worked but not confirmed");
message = QObject::tr("Worked but not confirmed");
break;
case 4:
message = QObject::tr("4-Needed, work it!");
message = QObject::tr("Needed, work it!");
break;
case 5:
message = QObject::tr("5-Needed, work it!");
message = QObject::tr("Needed, work it!");
break;
case 6:
message = QObject::tr("6-Needed, work it!");
message = QObject::tr("Needed, work it!");
break;
case 7:
message = QObject::tr("7-Needed, work it!");
message = QObject::tr("Needed, work it!");
break;
case 8:
message = QObject::tr("8-Worked but not confirmed");
message = QObject::tr("Worked but not confirmed");
break;
case 9:
message = QObject::tr("9-Needed, work it!");
message = QObject::tr("Needed, work it!");
break;
case 10:
message = QObject::tr("10-Worked but not confirmed");
message = QObject::tr("Worked but not confirmed");
break;
case 11:
message = QObject::tr("11-Needed, work it!");
message = QObject::tr("Needed, work it!");
break;
case 12:
message = QObject::tr("12-Worked but not confirmed");
message = QObject::tr("Worked but not confirmed");
break;
case 13:
message = QObject::tr("13-Confirmed");
message = QObject::tr("Confirmed");
break;
break;
default:
@ -923,7 +926,7 @@ void Awards::recalculateAwards()
query.next();
numberOfQsos = query.value(0).toInt();
//qDebug() << "Awards::recalculateAwards: MAX = " << QString::number(numberOfQsos) << endl;
step = getProgresStepForDialog(numberOfQsos);
step = util->getProgresStepForDialog(numberOfQsos);
}
else
@ -1545,7 +1548,7 @@ bool Awards::setAwardWAZ(const int _cqz, const int _band, const int _mode, const
}
/*
int Awards::getProgresStepForDialog(int totalSteps){
//qDebug() << "FileManager::getProgresStepForDialog";
if (totalSteps <=100)
@ -1563,7 +1566,7 @@ int Awards::getProgresStepForDialog(int totalSteps){
else
return 50;
}
*/
int Awards::setAwardDXCCst(const int _dxcc, const int _band, const int _mode, const bool _confirmed, const int _logNumber, const int _qsoId)
{

View File

@ -41,6 +41,7 @@
#include "awarddxmarathon.h"
#include "dataproxy.h"
#include "dataproxy_sqlite.h"
#include "utilities.h"
class QProgressDialog;
@ -130,7 +131,7 @@ private:
_confirmed = 0 Set as Worked
_confirmed = 1 Set as Confirmed
*/
int getProgresStepForDialog(int totalSteps);
//int getProgresStepForDialog(int totalSteps);
QColor newOneColor; //
QColor neededColor; //
@ -141,6 +142,7 @@ private:
World *world;
DataProxy *dataProxy;
DXMarathon *dxMarathon;
Utilities *util;
typedef QMultiHash<int, int> DXStatus;

View File

@ -824,8 +824,6 @@ int DataBase::getBandIdFromFreq(const QString fr)
//qDebug() << "DataBase::getBandIdFromFreq: Query NOK" << endl;
return -1;
}
return -1;
}

View File

@ -113,7 +113,7 @@ private:
bool populatePropagationModes();
bool howManyQSOsInLog(const int i);
void showError(const QString _errorC);
//void showError(const QString _errorC);
bool moveFromModeIdToSubmodeId();
bool updateModeIdFromSubModeId();

View File

@ -103,7 +103,6 @@ double DataProxy::getFreqFromBandId(const int _id)
return -1.0;
}
int DataProxy::getBandIdFromFreq(const double _n)
{
return -1;
@ -244,6 +243,12 @@ int DataProxy::isWorkedB4(const QString _qrz, const int _currentLog)
return -1;
}
bool DataProxy::isThisQSODuplicated(const QString _qrz, const QString _date, const QString _time, const int _band, const int _mode)
{
return false;
}
bool DataProxy::isDXCCConfirmed(const int _dxcc, const int _currentLog)
{
return false;
@ -320,6 +325,14 @@ int DataProxy::getNumberOfManagedLogs()
{
return -1;
}
int DataProxy::getMaxLogNumber()
{
return -1;
}
QStringList DataProxy::getListOfManagedLogs()
{
return QStringList();
}
QString DataProxy::getStationCallSignFromLog(const int _log)
{
@ -339,3 +352,93 @@ int DataProxy::getHowManyQSOInLog(const int _log)
{
return 0;
}
bool DataProxy::addNewLog (const QStringList _qs)
{
return false;
}
bool DataProxy::doesThisLogExist(const int _log)
{
return false;
}
int DataProxy::getContinentIdFromContinentShortName(const QString _n)
{
return -1;
}
QString DataProxy::getContinentShortNameFromEntity(const int _n)
{
return QString();
}
int DataProxy::getContinentIdFromEntity(const int _n)
{
return -1;
}
int DataProxy::getCQzFromPrefix(const QString _p)
{
return -1;
}
int DataProxy::getITUzFromPrefix(const QString _p)
{
return -1;
}
int DataProxy::getCQzFromEntity(const int _n)
{
return -1;
}
int DataProxy::getITUzFromEntity(const int _n)
{
return -1;
}
QString DataProxy::getEntityNameFromId(const int _n)
{
return QString();
}
QString DataProxy::getEntityMainPrefix(const int _entityN)
{
return QString();
}
int DataProxy::getDXCCFromPrefix(const QString _p)
{
return -1;
}
bool DataProxy::isNewCQz(int _c)
{
return false;
}
bool DataProxy::isNewEntity(int _e)
{
return false;
}
double DataProxy::getLongitudeFromEntity(const int _e)
{
return 0.0;
}
double DataProxy::getLatitudeFromEntity(const int _e)
{
return 0.0;
}
QString DataProxy::getEntityPrefixes(const int _enti)
{
return QString();
}
QStringList DataProxy::getEntitiesNames()
{
return QStringList();
}

View File

@ -41,6 +41,7 @@ public:
virtual bool deleteQSO(const int _qsoId);
virtual int isWorkedB4(const QString _qrz, const int _currentLog);
virtual bool isThisQSODuplicated(const QString _qrz, const QString _date, const QString _time, const int _band, const int _mode);
virtual bool isDXCCConfirmed(const int _dxcc, const int _currentLog);
virtual bool isQSLReceived(const int _qsoId);
virtual bool isQSLSent(const int _qsoId);
@ -70,6 +71,24 @@ public:
virtual QString getQSLViaFromQRZ(const QString _call);
// /Complete with previous
virtual int getContinentIdFromContinentShortName(const QString _n);
virtual QString getContinentShortNameFromEntity(const int _n);
virtual int getContinentIdFromEntity(const int _n);
virtual int getCQzFromPrefix(const QString _p);
virtual int getCQzFromEntity(const int _n);
virtual int getITUzFromEntity(const int _n);
virtual int getITUzFromPrefix(const QString _p);
virtual QString getEntityNameFromId(const int _n);
virtual QString getEntityMainPrefix(const int _entityN);
virtual bool isNewCQz(int _c);
virtual bool isNewEntity(int _e);
virtual double getLongitudeFromEntity(const int _e);
virtual double getLatitudeFromEntity(const int _e);
virtual int getDXCCFromPrefix(const QString _p);
virtual QString getEntityPrefixes(const int _enti);
virtual QStringList getEntitiesNames();
virtual QStringList getOperatingYears(const int _currentLog);
virtual void compressDB();
@ -90,7 +109,12 @@ public:
virtual int getHowManyQSOInLog(const int _log);
virtual int getNumberOfManagedLogs();
virtual int getMaxLogNumber();
virtual QStringList getListOfManagedLogs();
virtual QString getStationCallSignFromLog(const int _log);
virtual bool addNewLog (const QStringList _qs);
virtual bool doesThisLogExist(const int _log);

View File

@ -29,10 +29,10 @@
DataProxy_SQLite::DataProxy_SQLite()
{
//qDebug() << "DataProxy_SQLite::DataProxy_SQLite " << endl;
//qDebug() << "DataProxy_SQLite::DataProxy_SQLite" << endl;
db = new DataBase(0);
dbCreated = db->createBandModeMaps();
//dbCreated = db->createBandModeMaps();
}
DataProxy_SQLite::~DataProxy_SQLite(){
@ -159,8 +159,6 @@ int DataProxy_SQLite::getIdFromBandName(const QString& _bandName)
return -3;
}
return db->getBandIDFromName2(_bandName);
}
QString DataProxy_SQLite::getNameFromBandId (const int _id)
@ -200,6 +198,7 @@ QString DataProxy_SQLite::getNameFromSubModeId (const int _id)
QString DataProxy_SQLite::getSubModeFromId (const int _id)
{
//qDebug() << "DataProxy_SQLite::getSubModeFromId: " << QString::number(_id) << endl;
QSqlQuery query;
QString stringQuery = QString("SELECT submode FROM mode WHERE id='%1'").arg(_id);
query.exec(stringQuery);
@ -213,6 +212,7 @@ QString DataProxy_SQLite::getSubModeFromId (const int _id)
return "";
}
return "";
}
QString DataProxy_SQLite::getNameFromSubMode (const QString _sm)
@ -236,6 +236,7 @@ QString DataProxy_SQLite::getNameFromSubMode (const QString _sm)
{
return "";
}
return "";
}
double DataProxy_SQLite::getFreqFromBandId(const int _id)
@ -245,7 +246,35 @@ double DataProxy_SQLite::getFreqFromBandId(const int _id)
int DataProxy_SQLite::getBandIdFromFreq(const double _n)
{
return db->getBandIdFromFreq(QString::number(_n));
//qDebug() << "DataProxy_SQLite::getBandIdFromFreq: " << fr << endl;
//Freq should be in MHz
bool sqlOk = false;
QString queryString = QString("SELECT id FROM band WHERE lower <= '%1' and upper >= '%2'").arg(_n).arg(_n);
QSqlQuery query(queryString);
sqlOk = query.exec();
//qDebug() << "DataProxy_SQLite::getBandIdFromFreq: Query: " << query.lastQuery() << endl;
if (sqlOk)
{
//qDebug() << "DataProxy_SQLite::getBandIdFromFreq: Query OK" << endl;
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
//qDebug() << "DataProxy_SQLite::getBandIdFromFreq: Query NOK" << endl;
return -1;
}
return -1;
}
QStringList DataProxy_SQLite::getBands()
@ -997,7 +1026,7 @@ QString DataProxy_SQLite::getNameFromQRZ(const QString _call)
{
if (_call.length() <= 0)
{
qDebug() << "DataProxy_SQLite::getNameFromQRZ return 0" << endl;
//qDebug() << "DataProxy_SQLite::getNameFromQRZ return 0" << endl;
return QString();
}
@ -1013,20 +1042,17 @@ QString DataProxy_SQLite::getNameFromQRZ(const QString _call)
{
if (((query.value(0)).toString()).length()>0)
{
qDebug() << "DataProxy_SQLite::getNameFromQRZ: " << (query.value(0)).toString() << endl;
//qDebug() << "DataProxy_SQLite::getNameFromQRZ: " << (query.value(0)).toString() << endl;
return (query.value(0)).toString();
}
}
}
qDebug() << "DataProxy_SQLite::getNameFromQRZ return 1" << endl;
return QString();
}
else
{
qDebug() << "DataProxy_SQLite::getNameFromQRZ return 2" << endl;
return QString();
}
qDebug() << "DataProxy_SQLite::getNameFromQRZ return 3" << endl;
}
QString DataProxy_SQLite::getQTHFromQRZ(const QString _call)
@ -1177,8 +1203,6 @@ int DataProxy_SQLite::isWorkedB4(const QString _qrz, const int _currentLog)
queryString = QString("SELECT id FROM log WHERE call='%1' AND lognumber='%2'").arg(_qrz).arg(_currentLog);
}
//queryString = "SELECT id FROM log WHERE call='" + _qrz +"'";
//qDebug() << "World::checkIfWorkedB4: " << queryString << endl;
query.exec(queryString);
query.next();
if (query.isValid())
@ -1191,6 +1215,42 @@ int DataProxy_SQLite::isWorkedB4(const QString _qrz, const int _currentLog)
}
}
bool DataProxy_SQLite::isThisQSODuplicated(const QString _qrz, const QString _date, const QString _time, const int _band, const int _mode)
{
//qDebug() << "DataProxy_SQLite::isThisQSODuplicated" << endl;
QSqlQuery query;
QString queryString;
queryString = QString("SELECT id FROM log WHERE call='%1' AND qso_date='%2' AND time_on='%3' AND bandid='%4' AND modeid='%5'").arg(_qrz).arg(_date).arg(_time).arg(_band).arg(_mode);
bool sqlOK = query.exec(queryString);
if (sqlOK)
{
query.next();
if (query.isValid())
{
if ((query.value(0)).toInt()>0)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
return false;
}
return false;
}
bool DataProxy_SQLite::isDXCCConfirmed(const int _dxcc, const int _currentLog)
{
//qDebug() << "DataProxy_SQLite::isDXCCConfirmed: " << QString::number(_dxcc) << "/" << QString::number(_currentLog) << endl;
@ -1733,11 +1793,58 @@ int DataProxy_SQLite::getNumberOfManagedLogs()
{
return -1;
}
return -1;
}
int DataProxy_SQLite::getMaxLogNumber()
{
QSqlQuery query;
QString st = QString("SELECT MAX(id) FROM logs");
if (query.exec(st))
{
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
return -1;
}
return -1;
}
QStringList DataProxy_SQLite::getListOfManagedLogs()
{
//This function returns the list of log IDs that are being managed
//qDebug() << "DataProxy_SQLite::getListOfManagedLogs" << endl;
QSqlQuery query;
QStringList qs;
qs.clear();
if (query.exec("SELECT id FROM logs"))
{
while (query.next())
{
if (query.isValid())
{
qs << (query.value(0)).toString();
//qDebug() << "DataProxy_SQLite::getListOfManagedLogs: " << (query.value(0)).toString() << endl;
}
}
}
else
{
qs.clear();
}
return qs;
}
QString DataProxy_SQLite::getStationCallSignFromLog(const int _log)
{
//qDebug() << "DataProxy_SQLite::getStationCallSignFromLog: " << QString::number(_log)<< endl;
@ -1893,6 +2000,527 @@ int DataProxy_SQLite::getHowManyQSOInLog(const int _log)
{
return 0;
}
}
bool DataProxy_SQLite::addNewLog (const QStringList _qs)
{
//qDebug() << "SetupPageLogs::addNewLog: " << _qs.at(2) << endl;
//_qs << dateString << stationCallsign << _qs.at(4) << comment << _qs.at(12);
//qDebug() << "SetupPageLogs::slotAnalyzeNewLogData: " << _qs.at(4) << "/" << _qs.at(12) << endl;
// Date/Call/"DX"/comment/"1"
if (_qs.size()!=5)
{
return false;
}
QString aux = QString();
int nameCol = -1;
QString _dateString = _qs.at(0);
QString _stationCallsign = _qs.at(1);
QString _typeContest = _qs.at(2);
QString _comment = _qs.at(3);
QString _typeContestN = _qs.at(4);
QString queryString = QString("SELECT * FROM logs WHERE logdate='%1' AND stationcall='%2' AND logtype='%3' AND logtypen='%4'").arg(_dateString).arg(_stationCallsign).arg(_typeContest).arg(_typeContestN);
//"logs"
//"id, logdate, stationcall, comment, logtype"
//qDebug() << "SetupPageLogs::addNewLog query1: " << queryString << endl;
QSqlQuery query;
bool sqlOK = query.exec(queryString);
QSqlRecord rec = query.record(); // Number of columns
while ( (query.next()) && (query.isValid()) )
{
nameCol = rec.indexOf("id");
aux = (query.value(nameCol)).toString();
//qDebug() << "SetupPageLogs::addNewLog: id = " << aux << endl;
return false;
}
queryString = QString("INSERT INTO logs (logdate, stationcall, comment, logtype, logtypen) values('%1','%2','%3','%4', '%5')").arg(_dateString).arg(_stationCallsign).arg(_comment).arg(_typeContest).arg(_typeContestN);
//qDebug() << "SetupPageLogs::addNewLog query1: " << queryString << endl;
sqlOK = query.exec(queryString);
if (sqlOK)
{
return true;
}
else
{
return false;
}
return false;
}
bool DataProxy_SQLite::doesThisLogExist(const int _log)
{
QSqlQuery query;
QString aux;
aux = QString("SELECT count(id) FROM logs WHERE id='%1'").arg(_log);
if (query.exec(aux))
{
query.next();
if (query.isValid())
{
if ( query.value(0).toInt()>0)
{
return true;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
int DataProxy_SQLite::getContinentIdFromContinentShortName(const QString _n)
{
if (_n.length()!=2)
{
return -3;
}
QSqlQuery query;
QString stQuery = QString("SELECT id FROM continent WHERE shortname=='%1'").arg(_n);
if (query.exec(stQuery))
{
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
return -2;
}
}
QString DataProxy_SQLite::getContinentShortNameFromEntity(const int _n)
{
QSqlQuery query;
QString aux;
aux = QString("SELECT continent.shortname FROM entity JOIN continent ON entity.continent=continent.shortname WHERE (mainprefix NOT LIKE '*%') AND dxcc='%1'").arg(_n);
if (query.exec(aux))
{
query.next();
if (query.isValid())
{
return (query.value(0)).toString();
}
else
{
return QString();
}
}
else
{
return QString();
}
}
int DataProxy_SQLite::getContinentIdFromEntity(const int _n)
{
QSqlQuery query;
QString aux;
aux = QString("SELECT continent.id FROM entity JOIN continent ON entity.continent=continent.shortname WHERE (mainprefix NOT LIKE '*%') AND dxcc='%1'").arg(_n);
if (query.exec(aux))
{
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
return -2;
}
}
int DataProxy_SQLite::getITUzFromPrefix(const QString _p)
{
QSqlQuery query;
QString aux;
aux = QString("SELECT ituz FROM prefixesofentity WHERE prefix LIKE '%1'").arg(_p);
if (query.exec(aux))
{
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
return -2;
}
}
int DataProxy_SQLite::getCQzFromPrefix(const QString _p)
{
QSqlQuery query;
QString aux;
aux = QString("SELECT cqz FROM prefixesofentity WHERE prefix LIKE '%1'").arg(_p);
if (query.exec(aux))
{
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
return -2;
}
}
int DataProxy_SQLite::getCQzFromEntity(const int _n)
{
QSqlQuery query;
QString aux;
aux = QString("SELECT cqz FROM entity WHERE dxcc='%1'").arg(_n);
if (query.exec(aux))
{
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
return -2;
}
}
int DataProxy_SQLite::getITUzFromEntity(const int _n)
{
QSqlQuery query;
QString aux;
aux = QString("SELECT ituz FROM entity WHERE dxcc='%1'").arg(_n);
if (query.exec(aux))
{
query.next();
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
return -2;
}
}
QString DataProxy_SQLite::getEntityNameFromId(const int _n)
{
//qDebug() << "DataProxy_SQLite::getEntityNameFromId:" << endl;
QSqlQuery query;
QString stQuery = QString("SELECT name FROM entity WHERE (mainprefix NOT LIKE '*%') AND dxcc='%1'").arg(_n);
if (query.exec(stQuery))
{
if (query.next())
{
if (query.isValid())
{
return (query.value(0)).toString();
}
else
{
return QString();
}
}
else
{
return QString();
}
}
else
{
return QString();
}
return QString();
}
QString DataProxy_SQLite::getEntityMainPrefix(const int _entityN)
{
if (_entityN <= 0 )
{
return QString();
}
QString queryString;
QSqlQuery query;
queryString = QString("SELECT mainprefix FROM entity WHERE (mainprefix NOT LIKE '*%') AND dxcc='%1'").arg(_entityN);
//queryString = "SELECT prefix FROM prefixesofentity WHERE dxcc=='" + QString::number(i) +"'";
if (!query.exec(queryString))
{
return QString();
}
else
{
query.next();
if (query.isValid()){
return (query.value(0)).toString();
}else
{
return QString();
}
}
return QString();
}
int DataProxy_SQLite::getDXCCFromPrefix(const QString _p)
{
//qDebug() << "DataProxy_SQLite::getDXCCFromPrefix(: -" << _p << "-" << endl;
QSqlQuery query;
QString stQuery = QString("SELECT dxcc FROM prefixesofentity WHERE prefix='%1'").arg(_p);
if (query.exec(stQuery))
{
if (query.next())
{
if (query.isValid())
{
return (query.value(0)).toInt();
}
else
{
return -1;
}
}
else
{
return -2;
}
}
else
{
return -3;
}
return -4;
}
bool DataProxy_SQLite::isNewCQz(int _c)
{
QSqlQuery query;
QString queryString = QString("SELECT id FROM log WHERE cqz='%1'").arg(_c);
//queryString = "SELECT id FROM log WHERE cqz=='" + QString::number(_cqz) +"'";
if (!query.exec(queryString))
{
return false;
}
else
{
query.next();
if (query.isValid()){
return true;
}else{
return false;
}
}
return false;
}
bool DataProxy_SQLite::isNewEntity(int _e)
{
if (_e <= 0)
{
return false;
}
//QString queryString;
QSqlQuery query;
QString queryString = QString("SELECT id FROM log WHERE dxcc='%1'").arg(_e);
//queryString = "SELECT id FROM log WHERE dxcc=='" + QString::number(_entityN) +"'";
if (!query.exec(queryString))
{
return false;
}
else
{
query.next();
if (query.isValid()){
return true;
}else{
return false;
}
}
return false;
}
double DataProxy_SQLite::getLongitudeFromEntity(const int _e)
{
QString queryString = QString("SELECT longitude FROM entity WHERE dxcc='%1'").arg(_e);
QSqlQuery query;
if (!query.exec(queryString))
{
return 0.0;
}
else
{
query.next();
if ( !(query.isValid()) ) {
return 0.0;
}else{
return (query.value(0)).toDouble();
}
}
return 0.0;
}
double DataProxy_SQLite::getLatitudeFromEntity(const int _e)
{
QString queryString = QString("SELECT latitude FROM entity WHERE dxcc='%1'").arg(_e);
QSqlQuery query;
if (!query.exec(queryString))
{
return 0.0;
}
else
{
query.next();
if ( !(query.isValid()) ) {
return 0.0;
}else{
return (query.value(0)).toDouble();
}
}
return 0.0;
}
QString DataProxy_SQLite::getEntityPrefixes(const int _enti)
{
if (_enti<=0)
{
return QString();
}
QString result;
result = "";
QString queryString;
QSqlQuery query;
int i = _enti;
queryString = "SELECT prefix FROM prefixesofentity WHERE dxcc=='" + QString::number(i) +"'";
if (!query.exec(queryString))
{
return QString();
}
else
{
while ( (query.next())) {
if (query.isValid())
{
result = result + ", " + (query.value(0)).toString();
}
else
{
}
}
if (result.length() < 1)
{
return result;
}
else
{
result = result.remove(0,2);
return result;
}
}
return QString();
}
QStringList DataProxy_SQLite::getEntitiesNames()
{
//qDebug() << "DataProxy_SQLite::getEntitiesNames" << endl;
QString aux = QString();
QStringList qs;
qs.clear();
QString stringQuery = QString("SELECT mainprefix, name, dxcc FROM entity");
QSqlQuery query;
if (query.exec(stringQuery))
{
while ( (query.next())) {
if (query.isValid())
{
aux.clear();
aux = (query.value(0)).toString() + "-" + (query.value(1)).toString()+" ("+(query.value(2)).toString()+")";
//result = result + ", " + (query.value(0)).toString();
qs << aux;
}
else
{
}
}
}
else
{
}
return qs;
}

View File

@ -41,6 +41,7 @@ public:
bool deleteQSO(const int _qsoId);
int isWorkedB4(const QString _qrz, const int _currentLog);
bool isThisQSODuplicated(const QString _qrz, const QString _date, const QString _time, const int _band, const int _mode);
bool isDXCCConfirmed(const int _dxcc, const int _currentLog);
bool isQSLReceived(const int _qsoId);
bool isQSLSent(const int _qsoId);
@ -69,6 +70,22 @@ public:
QString getQSLViaFromQRZ(const QString _call);
// /Complete with previous
int getContinentIdFromContinentShortName(const QString _n);
QString getContinentShortNameFromEntity(const int _n);
int getContinentIdFromEntity(const int _n);
int getCQzFromPrefix(const QString _p);
int getCQzFromEntity(const int _n);
int getITUzFromEntity(const int _n);
int getITUzFromPrefix(const QString _p);
QString getEntityNameFromId(const int _n);
QString getEntityMainPrefix(const int _entityN);
bool isNewCQz(int _c);
bool isNewEntity(int _e);
double getLongitudeFromEntity(const int _e);
double getLatitudeFromEntity(const int _e);
int getDXCCFromPrefix(const QString _p);
QString getEntityPrefixes(const int _enti);
QStringList getEntitiesNames();
QStringList getOperatingYears(const int _currentLog);
void compressDB();
@ -92,7 +109,11 @@ public:
int getHowManyQSOInLog(const int _log);
int getNumberOfManagedLogs();
QStringList getListOfManagedLogs();
int getMaxLogNumber();
QString getStationCallSignFromLog(const int _log);
bool addNewLog (const QStringList _qs);
bool doesThisLogExist(const int _log);
private:
bool dbCreated;

View File

@ -54,7 +54,7 @@ void DXClusterWidget::initClass()
DXClusterWidget::DXClusterWidget(const QString &clusterToConnect, const int portToConnect, QWidget *parent)
: QWidget(parent)
{
//qDebug() << "DXClusterWidget::DXClusterWidget" << clusterToConnect << QString::number(portToConnect) << endl;
//qDebug() << "DXClusterWidget::DXClusterWidget" << clusterToConnect << QString::number(portToConnect) << endl;
initClass();
server = clusterToConnect;
@ -319,11 +319,11 @@ void DXClusterWidget::slotClusterDataArrived()
dxFrequency = QString::number( (dxFrequency.toFloat())/1000);
//
spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) );
dxCall = tokens[4];
spotBand = QString::number(dataProxy->getBandIdFromFreq( dxFrequency.toDouble() ) );
dxCall = tokens[4];
qs.clear();
spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) );
//spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) );
qs << dxCall << spotBand << "-1" << QString::number(currentLog) ;
dxSpotColor = awards->getQRZDXStatusColor(qs);
@ -353,7 +353,7 @@ void DXClusterWidget::slotClusterDataArrived()
dxFrequency = QString::number( (dxFrequency.toFloat())/1000);
qs.clear();
spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) );
spotBand = QString::number(dataProxy->getBandIdFromFreq( dxFrequency.toDouble() ) );
qs << dxCall << spotBand << "-1" << QString::number(currentLog) ;

View File

@ -68,7 +68,7 @@ eLogClubLog::~eLogClubLog()
//qDebug() << "eLogClubLog::slotQsoUploadFinished - Result = Password Error! = " << QString::number(result) << endl;
text = "ClubLog: " + tr("It seems to be a PASSWORD ERROR, check your password");
int ret = QMessageBox::warning(0, tr("KLog - clublog"),
int ret = QMessageBox::warning(0, tr("KLog - ClubLog"),
tr("It seems that your Clublog's password is not correct\n"
"Please check your password in the setup. Clublog uploads will be disabled."),
QMessageBox::Ok);
@ -374,9 +374,9 @@ QString eLogClubLog::prepareToTranslate(const QString _m)
{
return tr("Skipping SWL callsign");
}
else if (_m == "Callsign is your ow call")
else if (_m == "Callsign is your own call")
{
return tr("Callsign is your ow call");
return tr("Callsign is your own call");
}
else if (_m == "Invalid callsign with no DXCC mapping")
{

View File

@ -29,7 +29,7 @@
FileManager::FileManager()
{
//qDebug() << "FileManager::FileManager()" << endl;
//qDebug() << "FileManager::FileManager()" << endl;
ignoreUnknownAlways = false;
world = new World();
awards = new Awards();
@ -39,13 +39,14 @@ FileManager::FileManager()
noMoreQso = false;
dataProxy = new DataProxy_SQLite();
util = new Utilities();
hashLogs.clear();
// preparedQuery = new QSqlQuery;
}
FileManager::FileManager(const QString _kontestDir)
{
//qDebug() << "FileManager::FileManager(): Dir" << _kontestDir << endl;
//qDebug() << "FileManager::FileManager(): Dir" << _kontestDir << endl;
kontestDir = _kontestDir;
ignoreUnknownAlways = false;
world = new World(kontestDir);
@ -56,12 +57,14 @@ FileManager::FileManager(const QString _kontestDir)
dataProxy = new DataProxy_SQLite();
noMoreQso = false;
util = new Utilities();
hashLogs.clear();
//preparedQuery = new QSqlQuery;
}
FileManager::FileManager(const QString _kontestDir, const QString _softVersion, DataBase _db)
{
//qDebug() << "FileManager::FileManager(): Dir(2)" << _kontestDir << endl;
kontestDir = _kontestDir;
ignoreUnknownAlways = false;
world = new World(kontestDir);
@ -72,6 +75,7 @@ FileManager::FileManager(const QString _kontestDir, const QString _softVersion,
dataProxy = new DataProxy_SQLite();
noMoreQso = false;
util = new Utilities();
hashLogs.clear();
//preparedQuery = new QSqlQuery;
}
@ -85,7 +89,7 @@ bool FileManager::checkADIFValidFormat(const QStringList _qs)
QStringList qs = _qs;
if (qs.count()!= 2)
if (qs.size()!= 2)
{
//qDebug() << "FileManager::checkADIFValidFormat-0 (not two) " << endl;
return false;
@ -2090,16 +2094,20 @@ bool FileManager::adifLogExportMarked(const QString& _fileName)
return adifLogExportToFile(_fileName, true, false);
}
/*
bool FileManager::adifCheckMoreThanOneLog(QFile& _f)
{
//qDebug() << "FileManager::adifCheckMoreThanOneLog:" << endl;
QFile &file = _f;
qint64 pos; //Position in the file
QString line = QString();
QStringList fields;
QString aux = QString();
QString lastAux = QString();
QStringList data = QStringList();
int log1 = -1;
int log2 = -2;
bool firstLog = true;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
@ -2120,24 +2128,31 @@ bool FileManager::adifCheckMoreThanOneLog(QFile& _f)
{ fields.clear();
fields << line.split("<", QString::SkipEmptyParts);
//qsToPass.clear();
//auxString.clear();
foreach (aux, fields)
{
aux = aux.trimmed();
if (aux.contains("APP_KLOG_LOGN"))
{
//qDebug() << "FileManager::adifCheckMoreThanOneLog: " << aux << endl;
if (aux != lastAux)
data.clear();
data << aux.split('>');
qDebug() << "FileManager::adifCheckMoreThanOneLog: data.0: " << data.at(0) << endl;
qDebug() << "FileManager::adifCheckMoreThanOneLog: data.1: " << data.at(1) << endl;
if (firstLog)
{
//qDebug() << "FileManager::adifCheckMoreThanOneLog: MORE THAN ONE!" << aux << endl;
file.close();
return true;
log1 = (data.at(1)).toInt();
firstLog = false;
}
else
{
if (log1 == (data.at(1)).toInt())
{}
else
{
file.close();
return true;
}
}
lastAux = aux;
}
}
}
}
@ -2145,6 +2160,7 @@ bool FileManager::adifCheckMoreThanOneLog(QFile& _f)
file.close();
return false;
}
*/
bool FileManager::adifReadLog(const QString& tfileName, const int logN)
{
@ -2153,7 +2169,7 @@ bool FileManager::adifReadLog(const QString& tfileName, const int logN)
//int n = 0;
QSqlDatabase db = QSqlDatabase::database();
int maxLogs = dataProxy->getNumberOfManagedLogs(); // To manage several logs
QHash<int, int> hashLogs;
bool sqlOK = true;
QStringList queries = QStringList();
@ -2187,7 +2203,46 @@ bool FileManager::adifReadLog(const QString& tfileName, const int logN)
QFile file( fileName );
bool moreThanOneLog = adifCheckMoreThanOneLog(file);
//bool moreThanOneLog = adifCheckMoreThanOneLog(file);
int howManyLogs = howManyLogsInFile(file);
fillHashLog(file);
//Estoy creado varios logscuando importo u fichero
//Tengo que rellenar el hashLog para luego procesarlo en el processLog lo que sea
bool keepLogsInFile = false;
//qDebug() << "FileManager::adifReadLog: Logs: " << QString::number(howManyLogs) << endl;
if (howManyLogs>1)
{
QMessageBox msgBox;
aux = QString(tr("There are more than one log in this logfile.\nAll logs will be imported in the current log.\nDo you want to continue?"));
msgBox.setText(aux);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
int ret = msgBox.exec();
switch (ret) {
case QMessageBox::Yes:
// Yes was clicked
//qDebug() << "FileManager::adifReadLog: clicked YES" << endl;
keepLogsInFile = true;
break;
case QMessageBox::No:
// No Save was clicked
//qDebug() << "FileManager::adifReadLog: clicked NO" << endl;
keepLogsInFile = false;
return false;
break;
default:
// should never be reached
keepLogsInFile = false;
return false;
//qDebug() << "FileManager::adifReadLog: default" << endl;
break;
}
}
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
@ -2218,7 +2273,6 @@ bool FileManager::adifReadLog(const QString& tfileName, const int logN)
progress.setMaximum(numberOfQsos);
step = util->getProgresStepForDialog(numberOfQsos);
qDebug() << "FileManager::adifReadLog: -2" << endl;
//step = getProgresStepForDialog(numberOfQsos);
//qDebug() << "FileManager::adifReadLog (STEP)/Number: " << QString::number(step) << "/" << QString::number(numberOfQsos) << endl;
@ -2368,7 +2422,7 @@ bool FileManager::adifReadLog(const QString& tfileName, const int logN)
{
//qDebug() << "FileManager::adifReadLog-W-2.1" << endl;
currentQSOfields << fieldToAnalyze;
preparedQBool = processQsoReadingADIF(currentQSOfields, logN, maxLogs, hashLogs);
preparedQBool = processQsoReadingADIF(currentQSOfields, logN, keepLogsInFile, hashLogs);
if (preparedQBool)
{
//qDebug() << "FileManager::adifReadLog: preparedQBool = true" << endl;
@ -2465,7 +2519,7 @@ bool FileManager::adifReadLog(const QString& tfileName, const int logN)
if ((errorCode == 19) && (!ignoreErrorCode19))
{ // There are some repeated QSO
QMessageBox msgBox;
aux = tr("There are some QSO duplicated in the ADIF file you are importing. Do you want to continue? (Duped QSO will not be imported)");
aux = tr("It seems that there are some QSO duplicated in the ADIF file you are importing. Do you want to continue? (Duped QSO will not be imported)");
msgBox.setText(aux);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
@ -2682,13 +2736,13 @@ bool FileManager::adifReadLog(const QString& tfileName, const int logN)
}
bool FileManager::processQsoReadingADIF(const QStringList _line, const int logNumber, const int _maxLog, QHash<int, int> &_logs)
bool FileManager::processQsoReadingADIF(const QStringList _line, const int logNumber, const bool _keepLogsInFile, QHash<int, int> &_logs)
{
//qDebug() << "FileManager::processQsoReadingADIF: log: " << QString::number(logNumber) << endl;
//qDebug() << "FileManager::processQsoReadingADIF: log: " << _line.at(0) << endl;
//qDebug() << "FileManager::processQsoReadingADIF: " << _line.join("/") << endl;
int maxLogs = _maxLog; // To manage several logs
QHash<int, int> &hashLogs = _logs;
//QFile &file = _f;
@ -3406,39 +3460,23 @@ bool FileManager::processQsoReadingADIF(const QStringList _line, const int logNu
}
else if (field == "APP_KLOG_LOGN") //Lognumber in a multiple-log file
{
//TODO: Think about how to import a file with different logs
//isThisQSODuplicated(const QString _qrz, const QString _date, const QString _time, const int _band, const int _mode)
/*
int currentL = data.toInt();
//qDebug() << "FileManager::processQsoReadingADIF: APP_KLOG_LOGN " << QString::number(currentL) << endl;
//TODO: Calculate the lognumber and set the lognumber
//TODO: Working to create the lognumber automatically
//int maxLogs = _maxLog; // To manage several logs
//QHash<int, int> &hashLogs = _logs;
//int currentL = data.toInt();
//QHash<QString, int>::const_iterator i = hashLogs.find(currentL);
//logNumber = hashLogs.value(hashLogs.find(currentL));
QHash<int, int>::const_iterator in = hashLogs.constBegin();
while (in != hashLogs.constEnd()) {
if (in.value() == currentL)
{
//qDebug() << "FileManager::processQsoReadingADIF No new log " << QString::number(currentL) << endl;
i = logNumber;
}
else
{
hashLogs.insert(maxLogs+1, (hashLogs.end()).value() +1 );
//qDebug() << "FileManager::processQsoReadingADIF New LogN added: " << QString::number( (hashLogs.end()).key()) << "/" << QString::number( (hashLogs.end()).value()) << endl;
i = (hashLogs.end()).value();
}
++in;
if (dataProxy->doesThisLogExist(data.toInt()))
{
qDebug() << "FileManager::processQsoReadingADIF - The Log exist (" << data <<")" << endl;
}
else
{
qDebug() << "FileManager::processQsoReadingADIF - The Log does NOT exist (" << data <<")" << endl;
}
*/
}
else if (field == "APP_N1MM_POINTS") //Importing from N1MM
{
@ -3814,18 +3852,18 @@ bool FileManager::adifReqQSLExport(const QString& _fileName)
bool FileManager::modifySetupFile(const QString& _filename, QString _field, const QString _value)
{
qDebug() << "FileManager::modifySetupFile" << endl;
//qDebug() << "FileManager::modifySetupFile" << endl;
QFile file(_filename);
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)){
qDebug() << "FileManager::modifySetupFile File not found" << _filename << endl;
//qDebug() << "FileManager::modifySetupFile File not found" << _filename << endl;
return false;
}
QTemporaryFile tmp;
if (!tmp.open()) {
qDebug() << "FileManager::modifySetupFile- Temp file not opened" << endl;
//qDebug() << "FileManager::modifySetupFile- Temp file not opened" << endl;
return false;
}
@ -3841,12 +3879,10 @@ bool FileManager::modifySetupFile(const QString& _filename, QString _field, cons
out.seek(pos2);
qDebug() << "FileManager::modifySetupFile- Copiado... empezamos a leer" << endl;
while (!out.atEnd())
{
line = out.readLine();
qDebug() << "FileManager::modifySetupFile- Temp file: " << line << endl;
//qDebug() << "FileManager::modifySetupFile- Temp file: " << line << endl;
if (line.startsWith(_field))
{
in << _field << "=" << _value << ";" << endl;
@ -3856,5 +3892,182 @@ bool FileManager::modifySetupFile(const QString& _filename, QString _field, cons
in << line << endl;
}
}
qDebug() << "FileManager::modifySetupFile- Leído y fin!" << endl;
}
int FileManager::howManyLogsInFile(QFile& _f)
{
//qDebug() << "FileManager::howManyLogsInFile:" << endl;
QFile &file = _f;
qint64 pos; //Position in the file
QString line = QString();
QStringList fields = QStringList();
QStringList logs = QStringList();
QString aux = QString();
QStringList data = QStringList();
bool atLeastOneLog = false;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
//qDebug() << "FileManager::howManyLogsInFile File not found" << endl;
return false;
}
pos = file.pos();
while ( !file.atEnd() )
{
//line = file.readLine();
line.clear();
line.append(file.readLine().trimmed().toUpper());
if (line.contains("APP_KLOG_LOGN"))
{ fields.clear();
fields << line.split("<", QString::SkipEmptyParts);
foreach (aux, fields)
{
aux = aux.trimmed();
if (aux.contains("APP_KLOG_LOGN"))
{
data.clear();
data << aux.split('>');
//qDebug() << "FileManager::howManyLogsInFile: data.0: " << data.at(0) << endl;
//qDebug() << "FileManager::howManyLogsInFile: data.1: " << data.at(1) << endl;
if (logs.contains(data.at(1)))
{
}
else
{
logs.append(data.at(1));
}
}
}
}
else if (line.contains("EOR"))
{
atLeastOneLog = true;
}
else
{
}
}
//qDebug() << "FileManager::howManyLogsInFile: JUST ONE!" << aux << endl;
file.close();
if ( (logs.size()<2) && atLeastOneLog )
{
return 1;
}
return logs.size();
}
bool FileManager::fillHashLog(QFile &_f)
{
//qDebug() << "FileManager::fillHashLog:" << endl;
//hashLogs
//1.- Run the log and fill hashLogs
//2.- Run the file and continue the log series to be able to translate the files log into our own log
hashLogs.clear();
QStringList qs;
qs.clear();
qs << dataProxy->getListOfManagedLogs();
int i = 0;
for (i=0;i<qs.size();i++)
{
//qDebug() << "FileManager::fillHashLog: - log: " << QString::number(qs.at(i).toInt()) << endl;
hashLogs.insert(i+1, (qs.at(i)).toInt() );
}
for (i = 0; i < hashLogs.size(); ++i)
{
//qDebug() << "FileManager::fillHashLog: - hashLogs: " << QString::number(hashLogs[i]) << endl;
}
qs.clear();
qs << getListOfLogsInFile(_f);
int j = i;
for (int i=0; i<qs.size();i++)
{
hashLogs.insert(j+i, (qs.at(i)).toInt());
}
for (i=0; i<hashLogs.size();i++)
{
//qDebug() << "FileManager::fillHashLog: (" << QString::number(hashLogs.value(i)) << "/" << QString::number(i) << ")" << endl;
}
}
QStringList FileManager::getListOfLogsInFile(QFile& _f)
{
// Returns the logs of the file + 10.000 (So, log 1 is returned as 10001, 2 as 10.002 and so on)
//qDebug() << "FileManager::getListOfLogsInFile:" << endl;
QFile &file = _f;
qint64 pos; //Position in the file
QString line = QString();
QStringList fields = QStringList();
QStringList logs = QStringList();
QString aux = QString();
QStringList data = QStringList();
bool atLeastOneLog = false;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
//qDebug() << "FileManager::howManyLogsInFile File not found" << endl;
return QStringList();
}
pos = file.pos();
while ( !file.atEnd() )
{
//line = file.readLine();
line.clear();
line.append(file.readLine().trimmed().toUpper());
if (line.contains("APP_KLOG_LOGN"))
{ fields.clear();
fields << line.split("<", QString::SkipEmptyParts);
foreach (aux, fields)
{
aux = aux.trimmed();
if (aux.contains("APP_KLOG_LOGN"))
{
data.clear();
data << aux.split('>');
//qDebug() << "FileManager::howManyLogsInFile: data.0: " << data.at(0) << endl;
//qDebug() << "FileManager::howManyLogsInFile: data.1: " << data.at(1) << endl;
if (logs.contains(QString::number(data.at(1).toInt()+10000)))
{
}
else
{
logs.append(QString::number(data.at(1).toInt()+10000));
}
}
}
}
else if (line.contains("EOR"))
{
atLeastOneLog = true;
}
else
{
}
}
file.close();
return logs;
}

View File

@ -68,18 +68,20 @@ public:
bool cabrilloLogExport(const QString& _fileName, const int _contestType, const int logNconst);
bool modifySetupFile(const QString& _filename, QString _field, const QString _value);
private:
bool adifLogExportToFile(const QString& _fileName, const int _logN, bool justMarked = false, bool _qslRequested = false);
bool cabrilloLogExportToFile(const QString& _fileName, const int logNconst);
bool cabrilloLogExportCQWWToFile(const QString& _fileName, const int logNconst);
bool adifCheckMoreThanOneLog(QFile &_f);
//bool adifCheckMoreThanOneLog(QFile &_f);
int howManyLogsInFile(QFile & _f);
bool fillHashLog(QFile & _f);
QStringList getListOfLogsInFile(QFile & _f);
QString checkAndFixASCIIinADIF(const QString _data);
bool processQsoReadingADIF(const QStringList _line, const int logNumber, const int _maxLog, QHash <int, int> &_logs);
//int getProgresStepForDialog(int totalSteps);
bool processQsoReadingADIF(const QStringList _line, const int logNumber, const bool _keepLogsInFile, QHash <int, int> &_logs);
void queryPreparation(const int _logN);
bool checkADIFValidFormat(const QStringList _qs);
@ -105,6 +107,7 @@ private:
Awards *awards;
QSqlQuery preparedQuery;
QHash<int, int> hashLogs; // to create different logs when importing a ADIF file
};
#endif // FILEMANAGER_H

2
klog.1
View File

@ -1,4 +1,4 @@
.TH KLog 1 "version 0.9.1" "Jaime Robles, EA4TV" "Hamradio"
.TH KLog 1 "version 0.9.2" "Jaime Robles, EA4TV" "Hamradio"
.SH "NAME"
klog \- The Ham Radio Logging program

2030
klog_es.ts

File diff suppressed because it is too large Load Diff

2197
klog_fr.ts

File diff suppressed because it is too large Load Diff

View File

@ -95,21 +95,21 @@ int main(int argc, char *argv[])
if (inMemory == 1)
{
qDebug() << "MAIN: Wizard accepted " << QString::number(inMemory) << " ... Will run in Memory " << endl;
//qDebug() << "MAIN: Wizard accepted " << QString::number(inMemory) << " ... Will run in Memory " << endl;
MainWindow mw(kontestDir, version);
mw.show();
return app.exec();
}
else if (inMemory == 2)
{
qDebug() << "MAIN: Wizard accepted " << QString::number(inMemory) << " ... Will run in file " << endl;
//qDebug() << "MAIN: Wizard accepted " << QString::number(inMemory) << " ... Will run in file " << endl;
MainWindow mw(kontestDir, version);
mw.show();
return app.exec();
}
else
{
qDebug() << "MAIN: Wizard cancelled " << QString::number(inMemory) << " ... should close " << endl;
//qDebug() << "MAIN: Wizard cancelled " << QString::number(inMemory) << " ... should close " << endl;
QMessageBox msgBox;
msgBox.setText("Install wizard was cancelled before completing...");

View File

@ -43,7 +43,7 @@ MainWindow::MainWindow(const QString _kontestDir, const QString tversion)
// <ui>
doc = new QTextDocument;
util = new Utilities;
needToEnd = false;
cleaning = false;
@ -205,16 +205,8 @@ MainWindow::MainWindow(const QString _kontestDir, const QString tversion)
DBinMemory = false;
db = new DataBase(softwareVersion, DBinMemory);
//qDebug() << "MainWindow::MainWindow: 1 " << endl;
world = new World(kontestDir, softwareVersion);
//qDebug() << "MainWindow::MainWindow: 2" << endl;
//readConfigData();
//qDebug() << "MainWindow::MainWindow: 3" << endl;
if (!db->createConnection())
{
//qDebug() << "MainWindow::MainWindow: 4" << endl;
@ -223,11 +215,9 @@ MainWindow::MainWindow(const QString _kontestDir, const QString tversion)
else
{
db->updateIfNeeded(); // Check if we need to update the DB
//qDebug() << "MainWindow::MainWindow: 5" << endl;
if (!existingData)
{
//qDebug() << "MainWindow::MainWindow: !existingData" << endl;
//qDebug() << "MainWindow::MainWindow: !existingData" << endl;
world->create(kontestDir);
entitiesList = world->getEntitiesNames();
@ -244,11 +234,7 @@ MainWindow::MainWindow(const QString _kontestDir, const QString tversion)
dataProxy = new DataProxy_SQLite();
propModeList = dataProxy->getPropModeList();
setupDialog = new SetupDialog(!configured);
satTabWidget = new MainWindowSatTab();
//qDebug() << "MainWindow::MainWindow: 7" << endl;
filemanager = new FileManager(kontestDir, softwareVersion, *db);
@ -505,6 +491,7 @@ MainWindow::MainWindow(const QString _kontestDir, const QString tversion)
else
{
operatingYearsComboBox->addItems(dataProxy->getOperatingYears(currentLog));
operatingYearsComboBox->setCurrentIndex(operatingYearsComboBox->findText((dataProxy->getOperatingYears(currentLog)).last()));
}
updateQSLRecAndSent();
@ -1019,13 +1006,18 @@ QString MainWindow::readDataFromUIDX()
{
aux2 = iotaContinentComboBox->currentText() + "-" + aux1;
aux1 = awards->checkIfValidIOTA(aux2);
//qDebug() << "MainWindow::qsoToEdit: IOTA-CheckIfValidIOTA-1 " << aux2 << endl;
//qDebug() << "MainWindow::qsoToEdit: IOTA-CheckIfValidIOTA-2 " << aux1 << endl;
if (aux1.length() != 6) // EU-001
//qDebug() << "MainWindow::readDataFromUIDX: pre-IOTA-CheckIfValidIOTA-1: " << aux2 << endl;
//qDebug() << "MainWindow::readDataFromUIDX: post-IOTA-CheckIfValidIOTA-2: " << aux1 << endl;
if (aux1.length() == 6) // EU-001
{
//qDebug() << "MainWindow::readDataFromUIDX: IOTA to be saved!" << endl;
stringFields = stringFields + ", iota";
stringData = stringData + ", '" + aux1 + "'";
}
else
{
//qDebug() << "MainWindow::readDataFromUIDX: IOTA NOT to be saved! Lenght="<<QString::number(aux1.length()) << endl;
}
}
// EQSL-SENT
@ -1717,15 +1709,21 @@ WHERE [condition];
}
aux1 = iotaNumberLineEdit->text();
//qDebug() << "MainWindow::readDataFromUIDX: Modifityng IOTA: aux1: " << aux1 << endl;
if ( (aux1.toInt()) > 0 )
{
//qDebug() << "MainWindow::readDataFromUIDX: Modifityng IOTA: aux1toInt >0 " << endl;
aux2 = iotaContinentComboBox->currentText() + "-" + aux1;
aux1 = awards->checkIfValidIOTA(aux2);
if (aux1.length() != 6) // EU-001
if (aux1.length() == 6) // EU-001
{
updateString = updateString + "iota = '";
updateString = updateString + aux1 + "', ";
}
else
{
//qDebug() << "MainWindow::readDataFromUIDX: Modifyng IOTA NOT to be saved! Lenght="<<QString::number(aux1.length()) << endl;
}
}
aux1 = satTabWidget->getSatName();
@ -2789,7 +2787,7 @@ bool MainWindow::validCharactersInCall(const QString _qrz)
{
for (int i = 0; i<_qrz.size();i++)
{
if (!( ((_qrz.at(i)).isLetterOrNumber()) || (_qrz.at(i)=='\\') || (_qrz.at(i)=='/') ))
if (!( ((_qrz.at(i)).isLetterOrNumber()) || (_qrz.at(i)=='\\') || (_qrz.at(i)=='/') ))
{
return false;
}
@ -2797,11 +2795,11 @@ bool MainWindow::validCharactersInCall(const QString _qrz)
}
return true;
}
void MainWindow::slotQRZTextChanged()
{
//qDebug()<< "MainWindow::slotQRZTextChanged: " << qrzLineEdit->text() << " / Length: " << QString::number((qrzLineEdit->text()).size()) << endl;
//qDebug()<< "MainWindow::slotQRZTextChanged: " << qrzLineEdit->text() << " / Length: " << QString::number((qrzLineEdit->text()).size()) << "###### START ######" << endl;
if (cleaning)
{
return;
@ -2812,24 +2810,25 @@ void MainWindow::slotQRZTextChanged()
return;
}
int cursorP = qrzLineEdit->cursorPosition();
//infoLabel1->clear();
qrzAutoChanging = true;
int cursorP = qrzLineEdit->cursorPosition();
if ( (qrzLineEdit->text()).endsWith(' ') )
{/*Remove the space and moves the focus to SRX to write the RX exchange*/
previousQrz = (qrzLineEdit->text()).simplified();
qrzLineEdit->setText(previousQrz);
SRXLineEdit->setFocus();
}
qrzLineEdit->setText(((qrzLineEdit->text())).simplified());
qrzLineEdit->setText((qrzLineEdit->text()).toUpper());
if (!validCharactersInCall(qrzLineEdit->text()))
{
infoLabel1->setText(tr("Not valid characters in the QRZ box"));
InValidCharsInPrevCall = true;
return;
}
//if (!world->checkQRZValidFormat(qrzLineEdit->text()))
//{
//qDebug() << "MainWindow::slotQRZTextChanged: NOT valid QRZ Format" << endl;
// return;
//}
if (((qrzLineEdit->text()).length() < 1))
{ // If QRZ box is blank, Information labels should be cleared.
infoLabel1->clear();
@ -2837,6 +2836,7 @@ void MainWindow::slotQRZTextChanged()
slotClearButtonClicked();
return;
}
if ((modify) || ((qrzLineEdit->text()).length() < 1) || (qrzSmallModDontCalculate))
{
//qDebug() << "MainWindow::slotQRZTextChanged: MODIFY or Lenght < 1" << endl;
@ -2847,33 +2847,33 @@ void MainWindow::slotQRZTextChanged()
qrzSmallModDontCalculate = true; // A kind of flag to prevent multiple calls to this method.
int i;
int dx_CQz = -1;
int dxE_CQz = -1;
int dx_ITUz = -1;
int dxE_ITUz = -1;
currentQrz = qrzLineEdit->text();
//TODO: <DELETE>
// QString aaaa;
//aaaa = world->getQRZEntityPrefixes(currentQrz);
//qDebug() << "MainWindow::slotQRZTextChanged: - ALL PREFIXES" << aaaa << endl;
//TODO: </DELETE>
if ((currentQrz).count('\\')){ // Replaces \ by / to ease operation.
currentQrz.replace(QChar('\\'), QChar('/'));
qrzLineEdit->setText(currentQrz);
}
qDebug()<< "MainWindow::slotQRZTextChanged: 14-" << qrzLineEdit->text() << "- " << QString::number(qrzLineEdit->cursorPosition()) << endl;
currentQrz = qrzLineEdit->text();
qDebug()<< "MainWindow::slotQRZTextChanged: 14.1-" << qrzLineEdit->text() << "- " << QString::number(cursorP) << endl;
if ((currentQrz.at(cursorP-1)).isSpace())
{
qDebug()<< "MainWindow::slotQRZTextChanged: 14.2-" << qrzLineEdit->text() << "- " << QString::number(qrzLineEdit->cursorPosition()) << endl;
previousQrz = currentQrz.remove(cursorP-1, 1);
cursorP--;
qrzLineEdit->setText(previousQrz);
}
qDebug()<< "MainWindow::slotQRZTextChanged: 15-" << qrzLineEdit->text() << "- " << QString::number(qrzLineEdit->cursorPosition()) << endl;
if ( currentQrz.endsWith(' ') )
{/*Remove the space and moves the focus to SRX to write the RX exchange*/
previousQrz = currentQrz.simplified();
qrzLineEdit->setText(previousQrz);
SRXLineEdit->setFocus();
@ -2883,18 +2883,28 @@ void MainWindow::slotQRZTextChanged()
currentEntity = world->getQRZARRLId(currentQrz);
selectCorrectComboBoxEntity(currentEntity);
//qDebug() << "MainWindow::slotQRZTextChanged: Entity: " << QString::number(currentEntity) << endl;
//qDebug() << "MainWindow::slotQRZTextChanged: Entity: " << QString::number(currentEntity) << endl;
dx_CQz = world->getEntityCqz(currentEntity);
dx_ITUz = world->getEntityItuz(currentEntity);
dxE_CQz = world->getEntityCqz(currentEntity);
dx_CQz = world->getQRZCqz(currentQrz);
dx_ITUz = world->getQRZItuz(currentQrz);
dxE_ITUz = world->getEntityItuz(currentEntity);
//qDebug()<< "MainWindow::slotQRZTextChanged: CQ: " << QString::number(dx_CQz) << endl;
//qDebug()<< "MainWindow::slotQRZTextChanged: CQe: " << QString::number(dxE_CQz) << endl;
//qDebug()<< "MainWindow::slotQRZTextChanged: ITU: " << QString::number(dx_ITUz) << endl;
//qDebug()<< "MainWindow::slotQRZTextChanged: ITUe: " << QString::number(dxE_ITUz) << endl;
if (my_CQz <= 0)
if (dx_CQz == dxE_CQz)
{
my_CQz = world->getEntityCqz(currentEntity);
STXLineEdit->setText(QString::number(my_CQz)); // My Own CQZ
dx_CQz = dxE_CQz;
}
if (dx_ITUz == dxE_ITUz)
{
dx_ITUz = dxE_ITUz;
}
QStringList _qs; //for the showStatusOfDXCC(const QStringList _qs)
_qs.clear();
if (manageMode)
@ -2906,18 +2916,14 @@ void MainWindow::slotQRZTextChanged()
_qs << currentQrz << QString::number(currentBand) << "-1" << QString::number(currentLog);
}
// NOW ONLY SPECIFIC ACTIONS DEPENDING ON THE RUNNING MODE
switch (contestMode) {
case CQ_WW_SSB:
//qDebug() << "MainWindow::slotQRZTextChanged: CQ-WW-SSB:" << endl;
STXLineEdit->setText(QString::number(my_CQz)); // My Own CQZ
if (dx_CQz > 0)
{
//if(QString::number(world->getQRZCqz(qrzLineEdit->text())) > 0 ){
@ -2925,24 +2931,15 @@ void MainWindow::slotQRZTextChanged()
}else{
//qDebug() << "MainWindow::checkContest CQZ < 0"<< endl;
}
//i = currentEntity;
if (currentEntity>0){
updateStatusBar(world->getEntityName(currentEntity) + " - CQ: " + QString::number(dx_CQz) + " - ITU: " + QString::number(dx_ITUz));
//statusBar()->showMessage();
//updateStatusBar(world->getEntityName(currentEntity) + " - CQ: " + QString::number(dx_CQz) + " - ITU: " + QString::number(dx_ITUz));
updateStatusBar(world->getEntityName(currentEntity) + " - CQ: " + QString::number(dx_CQz) + " - ITU: " + QString::number(dx_ITUz));
}
else
{
updateStatusBar(tr("Ready..."));
//statusBar()->showMessage();
//updateStatusBar(tr("Ready..."));
}
i = checkIfWorkedB4(currentQrz);
checkContest();
break;
case CQ_WW_CW:
//qDebug() << "MainWindow::slotQRZTextChanged: CQ-WW-CW:" << endl;
@ -2950,21 +2947,16 @@ void MainWindow::slotQRZTextChanged()
default:
//qDebug() << "MainWindow::slotQRZTextChanged: Default:" << endl;
//qDebug() << "MainWindow::slotQRZTextChanged: - current/previous" << QString::number(currentEntity) << "/" << QString::number(previousEntity) << endl;
if ( (currentEntity != previousEntity) || ((infoLabel2->text()).length() < 1) || (InValidCharsInPrevCall) )
{
if ( (currentEntity != previousEntity) || ((infoLabel2->text()).length() < 1) || (InValidCharsInPrevCall) || (dx_CQz != dxE_CQz) || (dx_ITUz != dxE_ITUz))
{
//qDebug() << "MainWindow::slotQRZTextChanged: currentEntity=" << QString::number(currentEntity) << "/previousEntity=" << QString::number(previousEntity) << endl;
previousEntity = currentEntity;
InValidCharsInPrevCall = false;
showEntityInfo(currentEntity);
showEntityInfo(currentEntity, dx_CQz, dx_ITUz);
showStatusOfDXCC(_qs);
showDXMarathonNeeded(currentEntity, dx_CQz, dateEdit->date().year(), currentLog);
i = (world->getContinentNumber(currentEntity));
if ( i > 0 )
{
iotaContinentComboBox->setCurrentIndex( i - 1 );
}
@ -2972,10 +2964,14 @@ void MainWindow::slotQRZTextChanged()
{
iotaContinentComboBox->setCurrentIndex( 0 );
}
}
}
else if ((dx_CQz == dxE_CQz) || (dx_ITUz = dxE_ITUz))
{
showEntityInfo(currentEntity, dx_CQz, dx_ITUz);
}
else
{
//qDebug() << "MainWindow::slotQRZTextChanged: Default: else" << endl;
//qDebug() << "MainWindow::slotQRZTextChanged: Default: else" << endl;
}
break;
@ -3192,7 +3188,8 @@ void MainWindow::slotSearchBoxTextChanged()
//nameCol = rec.indexOf("bandid");
//_freq = (query.value(nameCol)).toString();
_freq = (query.value(3)).toString();
_band = db->getBandNameFromID2( _freq.toInt() );
//_band = db->getBandNameFromID2( _freq.toInt() );
_band = dataProxy->getNameFromBandId((query.value(3)).toInt());
_mode = query.value(4).toString();
//qDebug() << "MainWindow::slotSearchBoxTextChanged: mode: : " << _mode << endl;
@ -3302,7 +3299,7 @@ void MainWindow::slotSearchBoxSelectionChanged()
// The button to clear selection
//qDebug() << "MainWindow::slotSearchBoxSelectionChanged: " << endl;
if ((searchResultsTreeWidget->selectedItems()).count() > 0 )
if ((searchResultsTreeWidget->selectedItems()).size() > 0 )
{
searchBoxSelectAllButton->setText(tr("&Clear selection"));
searchSelectAllClicked = true;
@ -4946,14 +4943,14 @@ bool MainWindow::processConfigLine(const QString _line){
}else if (field=="REALTIME"){
//qDebug() << "MainWindow::processConfigLine: REALTIME: " << value.toUpper() << endl;
realTime = trueOrFalse(value);
realTime = util->trueOrFalse(value);
}
else if (field=="INMEMORY")
{
//qDebug() << "MainWindow::processConfigLine: INMEMORY: " << value.toUpper() << endl;
DBinMemory = trueOrFalse(value);
DBinMemory = util->trueOrFalse(value);
}
else if (field =="DXCLUSTERSERVERTOUSE"){
@ -4984,80 +4981,80 @@ bool MainWindow::processConfigLine(const QString _line){
}
else if (field=="USEDEFAULTNAME")
{
useDefaultLogFileName = trueOrFalse(value);
useDefaultLogFileName = util->trueOrFalse(value);
}
else if (field=="IMPERIALSYSTEM")
{
imperialSystem = trueOrFalse(value);
imperialSystem = util->trueOrFalse(value);
}
else if (field=="SENDQSLWHENREC")
{
sendQSLWhenRec = trueOrFalse(value);
sendQSLWhenRec = util->trueOrFalse(value);
}
else if (field=="SHOWCALLSIGNINSEARCH")
{
stationCallSignShownInSearch = trueOrFalse(value);
stationCallSignShownInSearch = util->trueOrFalse(value);
}
else if (field=="ALWAYSADIF")
{
alwaysADIF = trueOrFalse(value);
alwaysADIF = util->trueOrFalse(value);
}
else if (field=="UTCTIME")
{
//qDebug() << "MainWindow::processConfigLine: UTCTIME: " << value.toUpper() <<endl;
UTCTime = trueOrFalse(value);
UTCTime = util->trueOrFalse(value);
}
else if (field=="KEEPMYDATA")
{
keepMyData = trueOrFalse(value);
keepMyData = util->trueOrFalse(value);
}
else if (field=="COMPLETEWITHPREVIOUS")
{
completeWithPrevious = trueOrFalse(value);
completeWithPrevious = util->trueOrFalse(value);
}
else if (field=="DXCLUSTERSHOWHF")
{
dxClusterShowHF = trueOrFalse(value);
dxClusterShowHF = util->trueOrFalse(value);
}
else if (field=="DXCLUSTERSHOWVHF")
{
dxClusterShowVHF = trueOrFalse(value);
dxClusterShowVHF = util->trueOrFalse(value);
}
else if (field=="DXCLUSTERSHOWWARC")
{
dxClusterShowWARC = trueOrFalse(value);
dxClusterShowWARC = util->trueOrFalse(value);
}
else if (field=="DXCLUSTERSHOWWORKED")
{
dxClusterShowWorked = trueOrFalse(value);
dxClusterShowWorked = util->trueOrFalse(value);
}
else if (field=="DXCLUSTERSHOWCONFIRMED")
{
dxClusterShowConfirmed = trueOrFalse(value);
dxClusterShowConfirmed = util->trueOrFalse(value);
}
else if (field=="DXCLUSTERSHOWANN")
{
dxClusterShowAnn = trueOrFalse(value);
dxClusterShowAnn = util->trueOrFalse(value);
}
else if (field=="DXCLUSTERSHOWWWV")
{
dxClusterShowWWV = trueOrFalse(value);
dxClusterShowWWV = util->trueOrFalse(value);
}
else if (field=="DXCLUSTERSHOWWCY")
{
dxClusterShowWCY = trueOrFalse(value);
dxClusterShowWCY = util->trueOrFalse(value);
}
else if (field=="DEFAULTADIFFILE")
@ -5100,12 +5097,12 @@ bool MainWindow::processConfigLine(const QString _line){
}else if(field=="CLUBLOGACTIVE")
{
//qDebug() << "MainWindow::processConfigLine: clublogActive: " << value << endl;
clublogActive = trueOrFalse(value);
clublogActive = util->trueOrFalse(value);
}
else if(field=="CLUBLOGREALTIME")
{
//qDebug() << "MainWindow::processConfigLine: clublogRealTime: " << value << endl;
clublogRealTime = trueOrFalse(value);
clublogRealTime = util->trueOrFalse(value);
}
else if(field=="CLUBLOGCALL")
{
@ -5162,7 +5159,6 @@ void MainWindow::checkIfNewBandOrMode()
bands.clear();
bands << set.toList();
qDebug() << "MainWindow::checkIfNewBandOrMode: Modes1: " << modes.join(" - ") << endl;
set.clear();
modes << modesInLog;
set = modes.toSet();
@ -5171,15 +5167,12 @@ qDebug() << "MainWindow::checkIfNewBandOrMode: Modes1: " << modes.join(" - ") <<
modes.clear();
modes << set.toList();
modes.sort();
qDebug() << "MainWindow::checkIfNewBandOrMode: Modes2: " << modes.join(" - ") << endl;
bandComboBox->clear();
bandComboBox->addItems(bands);
modeComboBox->clear();
modeComboBox->addItems(modes);
qDebug() << "MainWindow::checkIfNewBandOrMode: Bands: " << bands.join(" - ") << endl;
qDebug() << "MainWindow::checkIfNewBandOrMode: Modes: " << modes.join(" - ") << endl;
//qDebug() << "MainWindow::checkIfNewBandOrMode-END" << endl;
}
/*********************************************************************
@ -5200,7 +5193,7 @@ void MainWindow::readActiveBands (const QStringList actives)
//QStringList values = actives;
//QStringList values = actives.split(", ", QString::SkipEmptyParts);
for (int i = 0; i < actives.count() ; i++)
for (int i = 0; i < actives.size() ; i++)
{
if (db->isValidBand(actives.at(i)))
{
@ -5233,7 +5226,7 @@ void MainWindow::readActiveModes (const QStringList actives)
//QStringList values = actives.split(", ", QString::SkipEmptyParts);
for (int i = 0; i < actives.count() ; i++)
for (int i = 0; i < actives.size() ; i++)
{
if (db->isValidMode(actives.at(i)))
{
@ -5512,13 +5505,13 @@ void MainWindow::createUIDX()
QSLViaLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight);
//entityNameComboBox = new QComboBox;entitiesList
if (entitiesList.count()>1)
if (entitiesList.size()>1)
{
entitiesList.prepend("00-Not Identified (000)");
entityNameComboBox->addItems(entitiesList);
}
if (propModeList.count()>1)
if (propModeList.size()>1)
{
propModeList.prepend("00 - Not - Not Identified");
propModeComboBox->addItems(propModeList);
@ -6421,7 +6414,9 @@ void MainWindow::slotADIFImport(){
case CQ_WW_CW:
break;
default:
operatingYearsComboBox->addItems(dataProxy->getOperatingYears(currentLog));
operatingYearsComboBox->addItems(dataProxy->getOperatingYears(currentLog));
//bandComboBox->setCurrentIndex(bandComboBox->findText(aux1));
awards->recalculateAwards();
showAwards();
break;
@ -6437,7 +6432,7 @@ void MainWindow::slotADIFImport(){
void MainWindow::initialContestModeConfiguration()
{
//qDebug() << "MainWindow::initialContestModeConfiguration: - 0" << endl;
//qDebug() << "MainWindow::initialContestModeConfiguration: - 0" << endl;
if (!configured){
//qDebug() << "MainWindow::initialContestModeConfiguration: - 01" << endl;
@ -7508,7 +7503,7 @@ void MainWindow::clearInfoFromLocators()
distLongLabel->setText( "0" );
}
void MainWindow::showEntityInfo(const int _enti)
void MainWindow::showEntityInfo(const int _enti, int _cq, int _itu)
{
//qDebug()() << "MainWindow::showEntityInfo" << QString::number(_enti) << endl;
@ -7532,27 +7527,46 @@ void MainWindow::showEntityInfo(const int _enti)
showInfoFromLocators (myLocator, dxLocator);
int i = world->getEntityCqz(_enti);
int i = -1;
if( i > 0 )
if ((_cq>0) && (_cq<41))
{
cqzLabel->setText( QString::number(i) );
cqzLabel->setText( QString::number(_cq) );
}
else
{
cqzLabel->setText("0");
i = world->getEntityCqz(_enti);
if( i > 0 )
{
cqzLabel->setText( QString::number(i) );
}
else
{
cqzLabel->setText("0");
}
}
i = world->getEntityItuz(_enti);
if ( i > 0 )
if (_itu>0)
{
ituzLabel->setText( QString::number(i) );
ituzLabel->setText( QString::number(_itu) );
}
else
{
ituzLabel->setText("0");
i = world->getEntityItuz(_enti);
if ( i > 0 )
{
ituzLabel->setText( QString::number(i) );
}
else
{
ituzLabel->setText("0");
}
}
}
void MainWindow::showStatusOfDXCC(const QStringList _qs)
@ -7699,7 +7713,7 @@ void MainWindow::showDXMarathon(const int _year)
}
void MainWindow::fillQSOData()
{ // Updates all QSO with the dxcc, CQZ, ... if empty.
//qDebug() << "MainWindow::fillQSOData" << endl;
//qDebug() << "MainWindow::fillQSOData" << endl;
QString stringQuery = QString("SELECT call, bandid, modeid, qso_date, time_on, lognumber, confirmed, id, cqz, ituz, dxcc FROM log WHERE lognumber='%1'").arg(currentLog);
@ -8087,14 +8101,14 @@ bool MainWindow::downloadCtyDatFile()
request.setUrl(url);
QNetworkReply *reply= manager.get(request);
qDebug() << "MainWindow::downloadCtyDatFile - END" << endl;
//qDebug() << "MainWindow::downloadCtyDatFile - END" << endl;
return true;
}
void MainWindow::slotDownloadFinished(QNetworkReply *reply)
{
qDebug() << "MainWindow::downloadFinished" << endl;
//qDebug() << "MainWindow::downloadFinished" << endl;
QMessageBox::StandardButton ret;
//QMessageBox msgBox;
@ -8214,7 +8228,7 @@ QString MainWindow::saveFileName(const QUrl &url)
void MainWindow::slotToolSearchNeededQSLToSend()
{
//qDebug() << "MainWindow::slotToolSearchQSLToSend - TO PREPARE THE QUERY and optimize the function" << endl;
//qDebug() << "MainWindow::slotToolSearchQSLToSend - TO PREPARE THE QUERY and optimize the function" << endl;
slotToolSearchQSL(0);
/*
return;
@ -8346,7 +8360,7 @@ void MainWindow::slotToolSearchNeededQSLRequested()
void MainWindow::slotToolSearchQSL(const int actionQSL)
{
//qDebug() << "MainWindow::slotToolSearchQSL: " << QString::number(actionQSL) << endl;
//qDebug() << "MainWindow::slotToolSearchQSL: " << QString::number(actionQSL) << " - LogNumber: " << QString::number(currentLog) << endl;
// 2 means QSL_RCVD = 'R'
QString stringQuery = QString();
QString message = QString();
@ -8358,24 +8372,29 @@ void MainWindow::slotToolSearchQSL(const int actionQSL)
{
case 0://void slotToolSearchNeededQSLToSend();
//aux = QString("SELECT count(id) FROM log WHERE lognumber='%1'").arg(currentLog);
stringQuery = QString("SELECT call, qso_date, time_on, bandid, modeid, qsl_sent, qsl_rcvd, station_callsign, log.id FROM log JOIN awarddxcc ON awarddxcc.qsoid=log.id WHERE awarddxcc.confirmed='0' AND log.qsl_sent!='Y' AND log.qsl_sent!='Q' AND log.qsl_sent!='R' AND log.lognumber='%1');").arg(currentLog);
//qDebug() << "MainWindow::slotToolSearchQSL: CASE 0" << endl;
stringQuery = QString("SELECT call, qso_date, time_on, bandid, modeid, qsl_sent, qsl_rcvd, station_callsign, log.id FROM log JOIN awarddxcc ON awarddxcc.qsoid=log.id WHERE awarddxcc.confirmed='0' AND log.qsl_sent!='Y' AND log.qsl_sent!='Q' AND log.qsl_sent!='R' AND log.lognumber='%1'").arg(currentLog);
message = tr("Needed QSO to send the QSL");
qslingNeeded = true;
dxUpRightTab->setCurrentIndex(2);
break;
case 1://void slotToolSearchRequestedQSLToSend();
//qDebug() << "MainWindow::slotToolSearchQSL: CASE 1" << endl;
stringQuery = QString("SELECT call, qso_date, time_on, bandid, modeid, qsl_sent, qsl_rcvd, station_callsign, id FROM log WHERE qsl_sent=='R' AND lognumber='%1'").arg(currentLog);
message = tr("My QSL requested to be sent");
break;
case 2://void slotToolSearchNeededQSLPendingToReceive();
//qDebug() << "MainWindow::slotToolSearchQSL: CASE 2" << endl;
stringQuery = QString("SELECT call, qso_date, time_on, bandid, modeid, qsl_sent, qsl_rcvd, station_callsign, log.id FROM log WHERE 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()
stringQuery = QString("SELECT call, qso_date, time_on, bandid, modeid, qsl_sent, qsl_rcvd, station_callsign, log.id FROM log WHERE lognumber='%1' AND qsl_rcvd='R'").arg(currentLog);
//qDebug() << "MainWindow::slotToolSearchQSL: CASE 3" << endl;
stringQuery = QString("SELECT call, qso_date, time_on, bandid, modeid, qsl_sent, qsl_rcvd, station_callsign, log.id FROM log WHERE lognumber='%1' AND qsl_rcvd='R'").arg(currentLog);
message = tr("DX QSL pending to be received");
break;
default:
//qDebug() << "MainWindow::slotToolSearchQSL: CASE DEFAULT" << endl;
// should never be reached
return;
break;
@ -8394,6 +8413,7 @@ void MainWindow::slotToolSearchQSL(const int actionQSL)
if (!query.exec())
{
//qDebug() << "MainWindow::slotToolSearchQSL: Query ERROR" << endl;
//TODO: Control the error!!
}
else
@ -8429,10 +8449,7 @@ void MainWindow::slotToolSearchQSL(const int actionQSL)
nameCol = rec.indexOf("modeid");
_mode = dataProxy->getSubModeFromId((query.value(nameCol)).toInt());
//nameCol = rec.indexOf("modeid");
//_mode = db->getModeNameFromNumber( (query.value(nameCol)).toInt() );
//qDebug() << "MainWindow::slotToolSearchQSL: Mode: " << _mode << endl;
//qDebug() << "MainWindow::slotToolSearchQSL: mode " << QString::number((query.value(nameCol)).toInt()) << endl;
nameCol = rec.indexOf("qsl_sent");
@ -8463,10 +8480,6 @@ void MainWindow::slotToolSearchQSL(const int actionQSL)
_stationcallsign.clear();
}
//if (_stationcallsign.length()<3)
//{
// _stationcallsign = stationQRZ;
//}
}
nameCol = rec.indexOf("id");
@ -8475,10 +8488,14 @@ void MainWindow::slotToolSearchQSL(const int actionQSL)
q.clear();
if (!manageMode)
{
_mode = "-1";
q << _call << _freq << "-1" << QString::number(currentLog);
}
else
{
q << _call << _freq << _mode << QString::number(currentLog);
}
q << _call << _freq << _mode << QString::number(currentLog);
color = awards->getQRZDXStatusColor(q);
@ -8541,7 +8558,7 @@ void MainWindow::slotAnalyzeDxClusterSignal(QStringList ql)
// db.getBandFromFreq expects a MHz!
//(ql.at(1)).toDouble()
qls << ql.at(0) << QString::number(db->getBandIdFromFreq(QString::number((ql.at(1).toDouble()/1000)))) << _mode << QString::number(currentLog);
qls << ql.at(0) << QString::number(dataProxy->getBandIdFromFreq((ql.at(1).toDouble()/1000))) << _mode << QString::number(currentLog);
// We use a mode = -1 because we don't know the mode info from the DXCluster spot
// TODO: Check if we can know the mode and replace the "-1" in previous sentence
@ -8590,7 +8607,7 @@ void MainWindow::clusterSpotToLog(const QString _call, const QString _freq)
//qDebug() << "MainWindow::clusterSpotToLog - Freq: " << _aux << endl;
int _bandi = db->getBandIdFromFreq(_aux);
int _bandi = dataProxy->getBandIdFromFreq(_aux.toDouble());
//qDebug() << "MainWindow::clusterSpotToLog - Bandi: " << QString::number(_bandi) << endl;
_aux = QString::number(_bandi);
_aux = QString("SELECT name FROM band WHERE id ='%1'").arg(_aux);
@ -8717,10 +8734,10 @@ void MainWindow::slotOperatingYearComboBoxChanged()
void MainWindow::defineStationCallsign()
{
//qDebug() << "MainWindow::defineStationCallsign (currentLog): " << QString::number(currentLog) << endl;
//qDebug() << "MainWindow::defineStationCallsign (currentLog): " << QString::number(currentLog) << endl;
QString logQRZ;
logQRZ = dataProxy->getStationCallSignFromLog(currentLog);
//qDebug() << "MainWindow::defineStationCallsign (logQrz): " << logQRZ << endl;
//qDebug() << "MainWindow::defineStationCallsign (logQrz): " << logQRZ << endl;
if (world->checkQRZValidFormat(logQRZ))
{
@ -8735,7 +8752,7 @@ void MainWindow::defineStationCallsign()
//qDebug() << "MainWindow::defineStationCallsign: " << stationQRZ << endl;
}
/*
bool MainWindow::trueOrFalse(const QString _s)
{// reads a String and return true if s.upper()== TRUE :-)
//qDebug() << "MainWindow::trueOrFalse: " << _s << endl;
@ -8750,7 +8767,7 @@ bool MainWindow::trueOrFalse(const QString _s)
}
return false;
}
*/
void MainWindow::slotSetPropMode(const QString _p)
{
//qDebug() << "MainWindow::slotSetPropMode: " << _p << endl;

View File

@ -50,6 +50,7 @@
#include "awards.h"
#include "mainwindowsattab.h"
#include "elogclublog.h"
#include "utilities.h"
class QTimer;
class QDateTime;
@ -301,8 +302,7 @@ private:
bool createConnection();
void createData();
bool processConfigLine(const QString _line);
void readConfigData();
bool trueOrFalse(const QString _s); // reads a String and return true if s.upper()== TRUE :-)
void readConfigData();
void defineStationCallsign();
void checkIfNewBandOrMode();
@ -316,7 +316,7 @@ private:
void completeWithPreviousQSO(const QString _call);
//void showQRZEntityInfo(const QString _qrz);
void showEntityInfo(const int _enti);
void showEntityInfo(const int _enti, int _cq=-1, int _itu=-1);
QString getStyleColorToLabelFromBand(const QString _b, const QString _q);
void showAwards();
void showDXMarathon(const int _year);
@ -342,6 +342,7 @@ private:
FileManager *filemanager;
Locator *locator;
Awards *awards;
Utilities *util;
//WorldEditorWidget *worldEditor;
HelpHelpDialog *helpHelpDialog;

View File

@ -463,9 +463,9 @@ void SetupDialog::slotOkButtonClicked()
stringList.clear();
stringList << dxClusterPage->getDxclusterServersComboBox();
if (stringList.count()>0)
if (stringList.size()>0)
{
for (int i = 0; i < stringList.count(); i++)
for (int i = 0; i < stringList.size(); i++)
{
stream << "DXClusterServerPort="<< stringList.at(i) << ";" << endl;
}
@ -751,7 +751,7 @@ void SetupDialog::readActiveBands (const QString actives)
QStringList values = actives.split(", ", QString::SkipEmptyParts);
QStringList _abands;
for (int i = 0; i < values.count() ; i++)
for (int i = 0; i < values.size() ; i++)
{
if (isValidBand(values.at(i)))
{
@ -781,7 +781,7 @@ void SetupDialog::readActiveModes (const QString actives)
QStringList _amodes;
QStringList values = actives.split(", ", QString::SkipEmptyParts);
for (int i = 0; i < values.count() ; i++)
for (int i = 0; i < values.size() ; i++)
{
if (isValidMode(values.at(i)))
{

View File

@ -31,7 +31,7 @@
SetupPageColors::SetupPageColors(QWidget *parent) : QWidget(parent)
{
//Debug() << "SetupPageColors::SetupPageColors" << endl;
//qDebug() << "SetupPageColors::SetupPageColors" << endl;
newOneColorButton = new QPushButton;
neededColorButton = new QPushButton;

View File

@ -89,12 +89,16 @@ SetupPageLogs::SetupPageLogs(QWidget *parent) : QWidget(parent){
setLayout(widgetLayout);
dataProxy = new DataProxy_SQLite();
//connect(newLogPushButton, SIGNAL(clicked ( )), this, SLOT(slotNewButtonClicked() ) );
createActions();
updateSelectedLogs();
}
SetupPageLogs::~SetupPageLogs(){
@ -420,10 +424,14 @@ void SetupPageLogs::slotAnalyzeNewLogData(const QStringList _qs)
QStringList newLogq;
newLogq.clear();
newLogq << dateString << stationCallsign << _qs.at(4) << comment << _qs.at(12);
addNewLog(newLogq);
if (dataProxy->addNewLog(newLogq))
{
logsModel->select();
updateSelectedLogs();
}
}
/*
bool SetupPageLogs::addNewLog(const QStringList _qs)
{
//qDebug() << "SetupPageLogs::addNewLog: " << _qs.at(2) << endl;
@ -470,7 +478,7 @@ bool SetupPageLogs::addNewLog(const QStringList _qs)
}
return false;
}
*/
void SetupPageLogs::updateSelectedLogs()
{
//qDebug() << "SetupPageLogs::updateSelectedLogs" << endl;

View File

@ -29,6 +29,9 @@
//#include <QtWidgets>
#include <QtGui>
#include <QtSql>
#include "dataproxy.h"
#include "dataproxy_sqlite.h"
#include "setuppagelogsnew.h"
@ -83,7 +86,7 @@ private:
void createLogsPanel();
void createLogsModel();
void createActions();
bool addNewLog(const QStringList _qs);
//bool addNewLog(const QStringList _qs);
void updateSelectedLogs();
void readSelectedLog(const int _i);
void showError(const QString _errorC);
@ -120,6 +123,7 @@ private:
QString stationCallsign, operators, comment, dateString, typeContest;
int contestCatMode, contestCatOperators, contestCatAssisted, contestCatPower, contestCatBands, contestBands, typeContestN;
DataProxy *dataProxy;
};

View File

@ -277,7 +277,7 @@ QString SetupPageUserDataPage::getStationQrz()
void SetupPageUserDataPage::slotQRZTextChanged()
{
//qDebug() << "SetupPageUserDataPage::slotQRZTextChanged: " << qrzLineEdit->text() << " / Length: " << QString::number((qrzLineEdit->text()).size()) << endl;
//qDebug() << "SetupPageUserDataPage::slotQRZTextChanged: " << qrzLineEdit->text() << " / Length: " << QString::number((qrzLineEdit->text()).size()) << endl;
int i = qrzLineEdit->cursorPosition();
QString _a = qrzLineEdit->text();
if ((_a.at(i-1)).isSpace())

View File

@ -4,7 +4,7 @@
SetupPageWorldEditor::SetupPageWorldEditor(QWidget *parent) : QWidget(parent)
{
//qDebug() << "SetupPageWorldEditor::SetupPageWorldEditor" << endl;
//qDebug() << "SetupPageWorldEditor::SetupPageWorldEditor" << endl;
//worldPanel = new QWidget;
world = new World();

View File

@ -21,3 +21,18 @@ int Utilities::getProgresStepForDialog(int totalSteps){
else
return 50;
}
bool Utilities::trueOrFalse(const QString _s)
{// reads a String and return true if s.upper()== TRUE :-)
//qDebug() << "Utilities::trueOrFalse: " << _s << endl;
if ( (_s.toUpper()) == "TRUE")
{
return true;
}
else
{
return false;
}
return false;
}

View File

@ -9,28 +9,37 @@
***************************************************************************/
/*****************************************************************************
* This file is part of KLog. *
* This file is part of KLog. *
* *
* KLog is free software: you can redistribute it and/or modify *
* 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, *
* 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 <http://www.gnu.org/licenses/>. *
* along with KLog. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
/*
This class implements general use utilities that can be used from any other class
Anything that is not directly related with a class itself and could be used from different
classes should be here
*/
#include <QString>
class Utilities
{
public:
Utilities();
int getProgresStepForDialog(int totalSteps);
bool trueOrFalse(const QString _s); // reads a String and return true if s.upper()== TRUE :-)
};

439
world.cpp
View File

@ -37,7 +37,7 @@ To insert a (key, value) pair into the hash, you can use operator[]():
*/
World::World()
{
//qDebug() << "World::World(0)" << endl;
//qDebug() << "World::World(0)" << endl;
worldModel = new QSqlRelationalTableModel(this);
numberOfEntities = 0;
@ -46,6 +46,7 @@ World::World()
kontestVersion = "";
locator = new Locator();
created = false;
dataProxy = new DataProxy_SQLite();
//awards = new Awards();
}
@ -53,7 +54,7 @@ World::World()
World::World(const QString _kontestDir)
{
//qDebug() << "World::World(1): Dir" << _kontestDir << endl;
//qDebug() << "World::World(1): Dir" << _kontestDir << endl;
kontestDir = _kontestDir;
kontestVersion = "";
worldModel = new QSqlRelationalTableModel(this);
@ -61,13 +62,14 @@ World::World(const QString _kontestDir)
progressBarPosition = 0;
created = false;
locator = new Locator();
dataProxy = new DataProxy_SQLite();
//awards = new Awards();
}
World::World(const QString _kontestDir, const QString _kontestVer)
{
//qDebug() << "World::World(2): Dir" << _kontestDir << endl;
//qDebug() << "World::World(2): Dir" << _kontestDir << endl;
kontestDir = _kontestDir;
kontestVersion = _kontestVer;
worldModel = new QSqlRelationalTableModel(this);
@ -75,13 +77,14 @@ World::World(const QString _kontestDir, const QString _kontestVer)
progressBarPosition = 0;
created = false;
locator = new Locator();
dataProxy = new DataProxy_SQLite();
//awards = new Awards();
}
World::~World()
{
//qDebug() << "World::~World" << endl;
//qDebug() << "World::~World" << endl;
}
bool World::recreate(const QString _kontestDir)
@ -144,7 +147,7 @@ QStringList World::processLine(const QString _line)
{
//qDebug() << "World::processLine: received: " << _line << endl;
QString queryString;
//QString queryString;
QStringList aa;
QString line;
line = (_line).simplified();
@ -154,15 +157,10 @@ QStringList World::processLine(const QString _line)
line.replace(QChar('\''), QChar('_'));
}
//qDebug() << "World::processLine: Received: " << line << endl;
QSqlQuery query1;
//QSqlQuery query1;
nullValue=-1;
//queryString = QString("SELECT id FROM entity WHERE dxcc='%1'").arg(numberOfEntities);
//ret = query.exec(queryString);
//query.next();
//currentEntity = (query.value(0)).toInt();
if ( (line.count(':') == 8 ) ) // First line of an Entity
{ //United States: 05: 08: NA: 43.00: 87.90: 5.0: K:
@ -182,21 +180,23 @@ QStringList World::processLine(const QString _line)
prefix = list[7];
currentPrefix = prefix;
queryString = "SELECT id FROM continent WHERE shortname=='" + continentName + "'";
query1.exec(queryString);
query1.next();
if (query1.isValid())
{
continentId = (query1.value(0)).toInt();
}
//qDebug() << "World::processLine Query: " << queryString << endl;
continentId = dataProxy->getContinentIdFromContinentShortName(continentName);
//queryString = "SELECT id FROM continent WHERE shortname=='" + continentName + "'";
//query1.exec(queryString);
//query1.next();
//if (query1.isValid())
//{
// continentId = (query1.value(0)).toInt();
//}
//qDebug() << "World::processLine Query: " << queryString << endl;
//qDebug() << "World::processLine Query - Read/continenId: " << continentName << "/" << QString::number(continentId) << endl;
//qDebug() << "World::processLine Query - Read/continenId: " << continentName << "/" << QString::number(continentId) << endl;
//queryString = QString("INSERT INTO entity (id, name, cqz, ituz, continent, latitude, longitude, utc, dxcc, mainprefix) VALUES (NULL,'%1','%2','%3','%4','%5','%6','%7','%8','%9');\n").arg(entityName).arg(cqz).arg(ituz).arg(QString::number(continentId)).arg(lat).arg(lon).arg(utc).arg(numberOfEntities).arg(prefix);
aa << entityName << QString::number(cqz) << QString::number(ituz) <<QString::number(continentId) << QString::number(lat) << QString::number(lon) << QString::number(utc) << QString::number(numberOfEntities) << prefix;
//qDebug() << "World::processLine Query: " << queryString << endl;
//qDebug() << "World::processLine Query: " << queryString << endl;
return aa;
//ret = query.exec(queryString);
@ -213,7 +213,7 @@ QStringList World::processLineP(const QString _line, const int _processingEntity
//Returns QStringList: prefix << dxcc << cqz << ituz OR CurrentEntity as a number
//qDebug() << "World::processLineP: Entity/received: " << QString::number(_processingEntity) << "/" << _line << endl;
QString queryString;
//QString queryString;
QString line;
int currentEntity = _processingEntity;
int _cqz, _ituz;
@ -229,7 +229,7 @@ QStringList World::processLineP(const QString _line, const int _processingEntity
}
//qDebug() << "World::processLineP: Received: " << line << endl;
QSqlQuery _queryp;
//QSqlQuery _queryp;
QStringList aa, _list;
aa.clear();
@ -243,22 +243,8 @@ QStringList World::processLineP(const QString _line, const int _processingEntity
else if ( line.endsWith(';') ) // Last line of the Entity
{ // =WX4TM(4),=WX5S(3)[6],=WY5I(5)[8],=WY7I(4)[7],=WY7LL(4)[7],=WZ4F(4);
//qDebug() << "World::processLineP last line (; detected): " << line << endl;
queryString = QString("SELECT cqz FROM entity WHERE dxcc='%1'").arg(currentEntity);
ret = _queryp.exec(queryString);
_queryp.next();
if (_queryp.isValid())
{
_cqz = (_queryp.value(0)).toInt();
}
queryString = QString("SELECT ituz FROM entity WHERE dxcc='%1'").arg(currentEntity);
ret = _queryp.exec(queryString);
_queryp.next();
if (_queryp.isValid())
{
_ituz = (_queryp.value(0)).toInt();
}
_cqz = dataProxy->getCQzFromEntity(currentEntity);
_ituz = dataProxy->getITUzFromEntity(currentEntity);
line = line.remove(';');
@ -268,7 +254,7 @@ QStringList World::processLineP(const QString _line, const int _processingEntity
//aa.clear();
aa << prefixAndZones.at(0) << QString::number(currentEntity) << prefixAndZones.at(1) << prefixAndZones.at(2);
//qDebug() << "World::processLineP Query (only one final): " << queryString << endl;
//qDebug() << "World::processLineP Query (only one final): " << queryString << endl;
//readZones returns a QStringList: prefix, CQz, ITUz
//Returns QStringList: prefix << dxcc << cqz << ituz OR CurrentEntity as a number
return aa;
@ -302,20 +288,9 @@ QStringList World::processLineP(const QString _line, const int _processingEntity
{ // =W4KW(4),=W4LC(4),=W4LSC(3)[6],=W4LWW(4),=W4NBS(4),=W4NI(4),=W4NTI(4),
//qDebug() << "World::processLine middle (no ; detected): " << line << endl;
queryString = QString("SELECT cqz FROM entity WHERE dxcc='%1'").arg(currentEntity);
ret = _queryp.exec(queryString);
_queryp.next();
if (_queryp.isValid())
{
_cqz = (_queryp.value(0)).toInt();
}
queryString = QString("SELECT ituz FROM entity WHERE dxcc='%1'").arg(currentEntity);
ret = _queryp.exec(queryString);
_queryp.next();
if (_queryp.isValid())
{
_ituz = (_queryp.value(0)).toInt();
}
_cqz = dataProxy->getCQzFromEntity(currentEntity);
_ituz = dataProxy->getITUzFromEntity(currentEntity);
if (line.endsWith(','))
{
line.chop(1);
@ -328,7 +303,7 @@ QStringList World::processLineP(const QString _line, const int _processingEntity
prefixAndZones = readZones(line, _cqz, _ituz);
aa.clear();
aa << prefixAndZones.at(0) << QString::number(currentEntity) << prefixAndZones.at(1) << prefixAndZones.at(2);
//qDebug() << "World::processLine Query (only one final): " << queryString << endl;
//qDebug() << "World::processLine Query (only one final): " << queryString << endl;
return aa;
}
@ -345,15 +320,11 @@ QStringList World::processLineP(const QString _line, const int _processingEntity
// PROCESS THE LINE
prefixAndZones = readZones(list[i], _cqz, _ituz);
//queryString = queryString + QString("INSERT INTO prefixesofentity (prefix, dxcc, cqz, ituz) VALUES ('%1','%2','%3','%4');\n").arg(prefixAndZones.at(0)).arg(currentEntity).arg((prefixAndZones.at(1)).toInt()).arg((prefixAndZones.at(2)).toInt());
aa << prefixAndZones.at(0) << QString::number(currentEntity) << prefixAndZones.at(1) << prefixAndZones.at(2);
//ret = query.exec(queryString);
}
//qDebug() << "World::processLine Query: " << queryString << endl;
//qDebug() << "World::processLine Query: " << queryString << endl;
}
}
//aa.clear();
@ -364,7 +335,7 @@ QStringList World::processLineP(const QString _line, const int _processingEntity
QStringList World::readZones (const QString &pref, const int _cq, const int _itu)
{
//Returns a QStringList: prefix, CQz, ITUz
//qDebug() << "World::readZones: (" << pref << "/" << QString::number(_cq) <<"/" << QString::number(_itu)<< ")" << endl;
//qDebug() << "World::readZones: (" << pref << "/" << QString::number(_cq) <<"/" << QString::number(_itu)<< ")" << endl;
QStringList result;
int cq = _cq;
@ -376,8 +347,10 @@ QStringList World::readZones (const QString &pref, const int _cq, const int _itu
aux = aux.remove(0,1);
}
if(aux.count('[')==1) // Check if has special CQz
{
//qDebug() << "World::readZones DETECTED [ !!!!" << endl;
azone = (aux.midRef(aux.indexOf('[')+1)).toString();
//qDebug() << "World::readZones (ITU)-1: " << aux << " right of " << QString::number(aux.indexOf('[')) << " = " << azone << endl;
itu = (azone.left(azone.indexOf(']'))).toInt();
@ -388,14 +361,16 @@ QStringList World::readZones (const QString &pref, const int _cq, const int _itu
if(aux.count('(')==1) // Check if has special CQz
{
//qDebug() << "World::readZones DETECTED ( !!!!" << endl;
azone = (aux.midRef(aux.indexOf('(')+1)).toString();
cq = (azone.left(azone.indexOf(')'))).toInt();
aux = aux.left(aux.indexOf('('));
//qDebug() << "World::readZones (CQ): " << pref << "/" << QString::number(cq) << "/" << aux << endl;
}
//qDebug() << "World::readZones (Pref/CQ/ITU): " << pref << "= " << aux <<"/" << QString::number(cq) << "/" << QString::number(itu) << endl;
result << aux << QString::number(cq) << QString::number(itu);
//qDebug() << "World::readZones (Pref/CQ/ITU): " << result << endl;
//qDebug() << "World::readZones (Pref/CQ/ITU): " << result << endl;
return result;
@ -403,82 +378,55 @@ QStringList World::readZones (const QString &pref, const int _cq, const int _itu
int World::getPrefixId(const QString _qrz)
{
//qDebug() << "World::getPrefixId: " << _qrz << endl;
//qDebug() << "World::getPrefixId: -" << _qrz <<"-" << endl;
//TODO: Instead of going from long to short, identify prefixes from the begining:
// character(may be number) + number
int errorCode;
//int errorCode;
if (_qrz.length() < 1)
{
return -1;
}
int entityID = 0;
int iaux1, iaux2;
//int iaux1, iaux2;
QString prefixl, prefixr;
QString queryString;
QSqlQuery query;
//QString prefixl, prefixr;
//QString queryString;
//QSqlQuery query;
QString aux = changeSlashAndFindPrefix((_qrz).toUpper());
query.prepare("SELECT dxcc FROM prefixesofentity WHERE prefix==:prefix");
//query.prepare("SELECT dxcc FROM prefixesofentity WHERE prefix==:prefix");
QSqlDatabase::database().transaction();
//QSqlDatabase::database().transaction();
while ((entityID <= 0) && (aux.length()>=1) )
{
//qDebug() << "World::getPrefixId: Looking for the prefix in (aux): " << aux << endl;
entityID = dataProxy->getDXCCFromPrefix(aux);
//qDebug() << "World::getPrefixId: in the while" << aux << " = " << QString::number(entityID) << endl;
if (entityID<=0)
{
aux.chop(1);
}
query.bindValue(":prefix", aux);
if (query.exec())
{}
else
{
errorCode = query.lastError().number();
//qDebug() << "World::getPrefixId - query error: " << QString::number(errorCode) << endl;
}
query.next();
if (query.isValid())
{
entityID = (query.value(0)).toInt();
//qDebug() << "World::getPrefixId - Found Entity: " << QString::number(entityID) << endl;
}
else
{
/*
//qDebug() << "FileManager::adifReadLog: LastQuery: " << preparedQuery.lastQuery() << endl;
//qDebug() << "FileManager::adifReadLog: LastError-data: " << preparedQuery.lastError().databaseText() << endl;
//qDebug() << "FileManager::adifReadLog: LastError-driver: " << preparedQuery.lastError().driverText() << endl;
//qDebug() << "FileManager::adifReadLog: LastError-n: " << QString::number(preparedQuery.lastError().number() ) << endl;
//qDebug() << "World::getPrefixId - value on query not valid" << endl;
*/
entityID = -1;
aux.chop(1);
}
//qDebug() << "World::getPrefixId: in the while" << aux << " = " << QString::number(entityID) << endl;
}
QSqlDatabase::database().commit();
//qDebug() << "World::getPrefixId: " << _qrz << QString::number(entityID) << endl;
//QSqlDatabase::database().commit();
//qDebug() << "World::getPrefixId: " << _qrz << QString::number(entityID) << endl;
return entityID;
}
QString World::getQRZEntityName(const QString _qrz)
{
//qDebug() << "World::getQRZEntityName: " << _qrz << endl;
//qDebug() << "World::getQRZEntityName: " << _qrz << endl;
if (_qrz.length() < 1 )
{
return "";
}
QString queryString;
QSqlQuery query;
//QString queryString;
//QSqlQuery query;
int prefixIDNumber = getPrefixId(_qrz);
return getEntityName(prefixIDNumber);
/*
@ -520,7 +468,8 @@ QString World::getEntityName(const int _entityN)
{
return "";
}
return dataProxy->getEntityNameFromId(prefixIDNumber);
/*
QString queryString;
QSqlQuery query;
@ -530,7 +479,7 @@ QString World::getEntityName(const int _entityN)
//qDebug() << "World::getEntityName: queryString-2: " << queryString << endl;
query.exec(queryString);
query.next();
//qDebug() << "World::getEntityName end: " << _qrz << " = " << (query.value(0)).toString() << endl;
if (query.isValid()){
return (query.value(0)).toString();
@ -539,19 +488,35 @@ QString World::getEntityName(const int _entityN)
}
return "";
*/
}
int World::getQRZCqz(const QString _qrz)
{
//qDebug() << "World::getQRZCqz: " << _qrz << endl;
if (_qrz.length() < 1 )
{
return -1;
}
//qDebug() << "World::getQRZCqz: " << _qrz << endl;
int prefixIdNumber = getPrefixId(_qrz);
return getEntityCqz(prefixIdNumber);
if (_qrz.length() < 1 )
{
return -1;
}
int i = -1;
QString aux = _qrz;
while ((i <= 0) && (aux.length()>=1) )
{
i = dataProxy->getCQzFromPrefix(aux);
if (i<=0)
{
aux.chop(1);
}
}
return i;
//int prefixIdNumber = getPrefixId(_qrz);
//return getEntityCqz(prefixIdNumber);
}
@ -563,11 +528,22 @@ int World::getQRZItuz(const QString _qrz)
return -1;
}
int prefixIdNumber = getPrefixId(_qrz);
return getEntityItuz(prefixIdNumber);
int i = -1;
QString aux = _qrz;
while ((i <= 0) && (aux.length()>=1) )
{
i = dataProxy->getITUzFromPrefix(aux);
if (i<=0)
{
aux.chop(1);
}
}
return i;
}
int World::getEntityCqz(const int _enti)
{
if (_enti < 1 )
@ -575,6 +551,8 @@ int World::getEntityCqz(const int _enti)
return -1;
}
return dataProxy->getCQzFromEntity(_enti);
/*
QSqlQuery query;
QString queryString;
@ -591,16 +569,18 @@ int World::getEntityCqz(const int _enti)
}
return -1;
*/
}
int World::getEntityItuz(const int _enti)
{
if (_enti < 1 )
{
return -1;
}
return dataProxy->getITUzFromEntity(_enti);
/*
QSqlQuery query;
QString queryString;
@ -616,19 +596,20 @@ int World::getEntityItuz(const int _enti)
}
return -1;
*/
}
int World::getQRZARRLId(const QString _qrz)
{
//qDebug() << "World::getQRZARRLId" << _qrz << endl;
//qDebug() << "World::getQRZARRLId" << _qrz << endl;
if (_qrz.length() < 1 )
{
return -1;
}
QSqlQuery query;
QString queryString;
//QSqlQuery query;
//QString queryString;
int prefixIdNumber = getPrefixId(_qrz);
return prefixIdNumber;
@ -641,12 +622,13 @@ QString World::getQRZEntityMainPrefix(const QString _qrz)
{
return "";
}
QString queryString;
QSqlQuery query;
int i = getQRZARRLId(_qrz);
return getEntityMainPrefix(i);
//QString queryString;
//QSqlQuery query;
/*
queryString = "SELECT mainprefix FROM entity WHERE dxcc=='" + QString::number(i) +"'";
@ -684,7 +666,8 @@ QString World::getEntityMainPrefix(const int _entityN)
{
return "";
}
return dataProxy->getEntityMainPrefix(_entityN);
/*
QString queryString;
QSqlQuery query;
@ -699,7 +682,6 @@ QString World::getEntityMainPrefix(const int _entityN)
else
{
query.next();
//qDebug() << "World::getQRZEntityMainPrefix(int): " <<_qrz << " = " << (query.value(0)).toInt() << endl;
if (query.isValid()){
return (query.value(0)).toString();
@ -708,11 +690,14 @@ QString World::getEntityMainPrefix(const int _entityN)
}
}
return "";
*/
}
bool World::isNewCQz(const int _cqz)
{
return dataProxy->isNewCQz(_cqz);
/*
QString queryString;
QSqlQuery query;
queryString = "SELECT id FROM log WHERE cqz=='" + QString::number(_cqz) +"'";
@ -730,10 +715,9 @@ bool World::isNewCQz(const int _cqz)
}else{
return false;
}
}
return false;
*/
}
bool World::isNewEntity(const int _entityN)
@ -742,7 +726,8 @@ bool World::isNewEntity(const int _entityN)
{
return false;
}
return dataProxy->isNewEntity(_entityN);
/*
QString queryString;
QSqlQuery query;
queryString = "SELECT id FROM log WHERE dxcc=='" + QString::number(_entityN) +"'";
@ -761,14 +746,13 @@ bool World::isNewEntity(const int _entityN)
return false;
}
}
return false;
*/
}
QString World::getQRZContinentShortName(const QString _qrz)
{
//qDebug() << "World::getQRZContinentShortName: " << _qrz << endl;
//qDebug() << "World::getQRZContinentShortName: " << _qrz << endl;
//QString continentNumber = getQRZContinentNumber (_qrz);
return getContinentShortName (getQRZARRLId(_qrz));
@ -777,7 +761,7 @@ QString World::getQRZContinentShortName(const QString _qrz)
QString World::getContinentShortName(const int _enti)
{
//qDebug() << "World::getQRZContinentShortName: " << _qrz << endl;
//qDebug() << "World::getQRZContinentShortName: " << QString::number(_enti) << endl;
//QString continentNumber = QString::number(_enti);
@ -785,7 +769,17 @@ QString World::getContinentShortName(const int _enti)
{
return "--";
}
QString a = dataProxy->getContinentShortNameFromEntity(_enti);
if (a.length()!=2)
{
return "--";
}
else
{
return a;
}
/*
QString queryString;
QSqlQuery query;
queryString = QString("SELECT continent FROM entity WHERE (mainprefix NOT LIKE '*%') AND dxcc='%1'").arg(_enti);
@ -809,19 +803,20 @@ QString World::getContinentShortName(const int _enti)
}
return "--";
*/
}
QString World::getQRZContinentNumber(const QString _qrz)
{
//qDebug() << "World::getQRZContinentNumber: " << _qrz << endl;
QString a;
QString queryString;
QSqlQuery query;
int i = getQRZARRLId(_qrz);
return QString::number(getContinentNumber(i));
/*
QString a;
QString queryString;
QSqlQuery query;
queryString = QString("SELECT continent FROM entity WHERE (mainprefix NOT LIKE '*%') AND dxcc='%1'").arg(i);
//queryString = "SELECT continent FROM entity WHERE dxcc=='" + QString::number(i) +"'";
@ -857,6 +852,8 @@ int World::getContinentNumber(const int _enti)
{
return -1;
}
return dataProxy->getContinentIdFromEntity(_enti);
/*
int a = -1;
QString queryString;
@ -873,7 +870,8 @@ int World::getContinentNumber(const int _enti)
else
{
query.next();
if ( !(query.isValid()) ) {
if ( !(query.isValid()) )
{
return -1;
}else{
a = (query.value(0)).toInt();
@ -899,14 +897,17 @@ int World::getContinentNumber(const int _enti)
return a;
}
return -1;
*/
}
double World::getQRZLongitude(const QString _qrz)
{
int i = getQRZARRLId(_qrz);
return dataProxy->getLongitudeFromEntity(i);
/*
QString queryString;
QSqlQuery query;
int i = getQRZARRLId(_qrz);
queryString = "SELECT longitude FROM entity WHERE dxcc=='" + QString::number(i) +"'";
@ -928,6 +929,7 @@ double World::getQRZLongitude(const QString _qrz)
}
return 0.0;
*/
}
double World::getLongitude(const int _enti)
@ -936,10 +938,15 @@ double World::getLongitude(const int _enti)
{
return 0.0;
}
return dataProxy->getLongitudeFromEntity(_enti);
/*
QString queryString;
QSqlQuery query;
int i = _enti;
queryString = "SELECT longitude FROM entity WHERE dxcc=='" + QString::number(i) +"'";
@ -962,15 +969,17 @@ double World::getLongitude(const int _enti)
}
return 0.0;
*/
}
double World::getQRZLatitude(const QString _qrz)
{
int i = getQRZARRLId(_qrz);
return dataProxy->getLatitudeFromEntity(i);
/*
QString queryString;
QSqlQuery query;
int i = getQRZARRLId(_qrz);
queryString = "SELECT latitude FROM entity WHERE dxcc=='" + QString::number(i) +"'";
@ -992,7 +1001,7 @@ double World::getQRZLatitude(const QString _qrz)
}
return 0.0;
*/
}
double World::getLatitude(const int _enti)
@ -1001,7 +1010,9 @@ double World::getLatitude(const int _enti)
{
return 0.0;
}
return dataProxy->getLatitudeFromEntity(_enti);
/*
QString queryString;
QSqlQuery query;
int i = _enti;
@ -1026,7 +1037,7 @@ double World::getLatitude(const int _enti)
}
return 0.0;
*/
}
QString World::getQRZLocator(const QString _qrz)
@ -1047,7 +1058,7 @@ QString World::getLocator(const int _enti)
return locator->getLocator(getLongitude(_enti), getLatitude(_enti));
}
/*
int World::getBandIdFromFreq(const QString fr)
{
//qDebug() << "World::getBandIdFromFreq: " << fr << endl;
@ -1082,61 +1093,20 @@ int World::getBandIdFromFreq(const QString fr)
return -1;
}
*/
QString World::getQRZEntityPrefixes(const QString _qrz)
{
QString result;
result = "";
QString queryString;
QSqlQuery query;
int i = getQRZARRLId(_qrz);
queryString = "SELECT prefix FROM prefixesofentity WHERE dxcc=='" + QString::number(i) +"'";
if (!query.exec(queryString))
{
return "";
}
else
{
while ( (query.next())) {
if (query.isValid())
{
result = result + ", " + (query.value(0)).toString();
}
else
{
}
}
if (result.length() < 1)
{
return result;
}
else
{
result = result.remove(0,2);
return result;
}
}
return "";
}
QString World::getEntityPrefixes(const int _enti)
{
if (_enti<=0)
{
return "";
}
return dataProxy->getEntityMainPrefix(i);
/*
QString result;
result = "";
QString queryString;
QSqlQuery query;
int i = _enti;
queryString = "SELECT prefix FROM prefixesofentity WHERE dxcc=='" + QString::number(i) +"'";
@ -1168,9 +1138,12 @@ QString World::getEntityPrefixes(const int _enti)
}
return "";
*/
}
bool World::readCTYDAT()
{
//qDebug() << "World::readCTYDAT(): " << kontestDir << endl;
@ -1241,7 +1214,7 @@ bool World::readCTYDAT()
stringList.clear();
stringList << processLine(file.readLine());
if (stringList.count()==9 )
if (stringList.size()==9 )
{
query.addBindValue(QVariant(QVariant::Int));
@ -1387,7 +1360,7 @@ bool World::readCTYCSV()
}
else
{
// //qDebug() << "World::readCTYCSV() File found: " << fileName << endl;
//qDebug() << "World::readCTYCSV() File found: " << fileName << endl;
}
beginingOfFile = file.pos();
@ -1422,7 +1395,7 @@ bool World::readCTYCSV()
QSqlDatabase::database().transaction();
QStringList stringList, stringListPrefixes;
QStringList stringList, stringListPrefixes, stringListProcessedPrefix;
@ -1445,7 +1418,7 @@ bool World::readCTYCSV()
stringList << tq.split(',');
if (stringList.count()>=8 )
if (stringList.size()>=8 )
{
//(id, name, cqz, ituz, continent, latitude, longitude, utc, dxcc, mainprefix)
@ -1491,7 +1464,7 @@ bool World::readCTYCSV()
}
if (stringList.count()>8)
if (stringList.size()>8)
{
tq = stringList.at(9);
stringListPrefixes << tq.split(' ');
@ -1501,21 +1474,32 @@ bool World::readCTYCSV()
for (int i = 0; i < stringListPrefixes.size(); ++i)
{
prefAux = stringListPrefixes.at(i);
//queryP.prepare("INSERT INTO prefixesofentity (id, prefix, dxcc, cqz, ituz) VALUES (?, ?, ?, ?, ?)");
// 0 1 2 3 4
//queryP.prepare("INSERT INTO prefixesofentity (id, prefix, dxcc, cqz, ituz) VALUES (?, ?, ?, ?, ?)");
// 0 1 2 3 4
// (id, prefix, dxcc, cqz, ituz)
//qDebug() << "World::readCTYCSV(): Prefix: " << stringListPrefixes.at(i) << endl;
//qDebug() << "World::readCTYCSV(): Prefix: " << stringListPrefixes.at(i) << endl;
queryP.addBindValue(QVariant(QVariant::Int));
//readZones (const QString &pref, const int _cq, const int _itu)
//Returns a QStringList: prefix, CQz, ITUz
stringListProcessedPrefix.clear();
stringListProcessedPrefix << readZones(prefAux, (stringList.at(4)).toInt(), (stringList.at(5)).toInt());
if (prefAux.at(0)=='=')
{ //TODO: Maybe there is a better way to identify exact calls instead of prefixes , identified with a = before he call.
prefAux.remove(0,1);
}
queryP.addBindValue(prefAux);
//queryP.addBindValue(prefAux);
queryP.addBindValue(stringListProcessedPrefix.at(0));
//queryP.addBindValue(stringList.at(2));
//queryP.addBindValue(stringList.at(4));
//queryP.addBindValue(stringList.at(5));
queryP.addBindValue(stringList.at(2));
queryP.addBindValue(stringList.at(4));
queryP.addBindValue(stringList.at(5));
queryP.addBindValue(stringListProcessedPrefix.at(1));
queryP.addBindValue(stringListProcessedPrefix.at(2));
if (queryP.exec())
{
@ -1554,6 +1538,7 @@ bool World::readCTYCSV()
QString World::changeSlashAndFindPrefix(const QString _qrz)
{
//qDebug() << "World::changeSlashAndFindPrefix: -" << _qrz <<"-" << endl;
int iaux1, iaux2;
QString aux = _qrz.toUpper();
@ -1575,7 +1560,7 @@ QString World::changeSlashAndFindPrefix(const QString _qrz)
aux.remove(aux.length()-1,1);
}
iaux1 = aux.indexOf('/');
//qDebug() << "World::changeSlashAndFindPrefix: Slash found at: " << QString::number(iaux1) << endl;
//qDebug() << "World::changeSlashAndFindPrefix: Slash found at: " << QString::number(iaux1) << endl;
iaux2 = (aux.length())- iaux1; // iaux2 is the length of the second part
if (iaux2 < 0){
@ -1596,7 +1581,7 @@ QString World::changeSlashAndFindPrefix(const QString _qrz)
bool World::checkQRZValidFormat(const QString _qrz)
{
//qDebug() << "World::checkQRZValidFormat: " << _qrz << endl;
//qDebug() << "World::checkQRZValidFormat: -" << _qrz <<"-" << endl;
QString aux = changeSlashAndFindPrefix(_qrz.toUpper());
@ -1685,42 +1670,16 @@ bool World::checkQRZValidFormat(const QString _qrz)
{
suffix = suffix + aux.at(i);
}
//qDebug() << "World::checkQRZValidFormat: Prefix = " << prefix << endl;
//qDebug() << "World::checkQRZValidFormat: Separator = " << separator << endl;
//qDebug() << "World::checkQRZValidFormat: Suffix = " << suffix << endl;
//qDebug() << "World::checkQRZValidFormat: Call = " << prefix+separator+suffix << endl;
//qDebug() << "World::checkQRZValidFormat: Prefix = " << prefix << endl;
//qDebug() << "World::checkQRZValidFormat: Separator = " << separator << endl;
//qDebug() << "World::checkQRZValidFormat: Suffix = " << suffix << endl;
//qDebug() << "World::checkQRZValidFormat: Call = " << prefix+separator+suffix << endl;
return true;
}
QStringList World::getEntitiesNames()
{
//qDebug() << "World::getEntitiesNames" << endl;
QString aux = QString();
QStringList qs;
qs.clear();
QString stringQuery = QString("SELECT mainprefix, name, dxcc FROM entity");
QSqlQuery query;
if (query.exec(stringQuery))
{
while ( (query.next())) {
if (query.isValid())
{
aux.clear();
aux = (query.value(0)).toString() + "-" + (query.value(1)).toString()+" ("+(query.value(2)).toString()+")";
//result = result + ", " + (query.value(0)).toString();
qs << aux;
}
else
{
}
}
}
else
{
}
return qs;
return dataProxy->getEntitiesNames();
}

View File

@ -39,6 +39,8 @@
#include <QtDebug>
#include "locator.h"
#include "dataproxy.h"
#include "dataproxy_sqlite.h"
//#include "awards.h"
@ -84,8 +86,10 @@ public:
double getQRZLatitude(const QString _qrz); // Returns the latitude of the Entity
double getLatitude(const int _enti); // Returns the latitude of the Entity
int getQRZCqz(const QString _qrz);
int getEntityCqz(const int _enti);
int getQRZCqz(const QString _qrz);
//int getPrefixCQz(const QString _p);
int getQRZItuz(const QString _qrz);
int getEntityItuz(const int _enti);
@ -93,7 +97,7 @@ public:
int getQRZARRLId(const QString _qrz); //Returns the ARRL id of the Entity from a QRZ & Returns -1 if not found.
bool isNewCQz(const int _cqz);
bool isNewEntity(const int _entityN);
int getBandIdFromFreq(const QString fr);
//int getBandIdFromFreq(const QString fr);
QString getQRZEntityPrefixes(const QString _qrz);
QString getEntityPrefixes(const int _enti);
@ -136,6 +140,7 @@ private:
//QProgressBar *progressBar;
Locator *locator;
DataProxy *dataProxy;
//Awards *awards;
};