klog-0.9.2.2/0000755000076700000620000000000012627374344010600 5ustar staffklog-0.9.2.2/awards.h0000644000076700000620000001434312627126144012230 0ustar staff#ifndef AWARDS_H #define AWARDS_H /*************************************************************************** awards.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include // For the "tr" function #include #include #include #include #include #include #include #include #include "world.h" #include "awarddxmarathon.h" #include "dataproxy.h" #include "dataproxy_sqlite.h" #include "utilities.h" class QProgressDialog; class Awards { //Q_OBJECT //friend class World; public: Awards(); ~Awards(); void setAwards(const int _qsoId); void setAwards(const int _dxcc, const int _waz, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId); /* _workedOrConfirmed = 0 Set as Worked _workedOrConfirmed = 1 Set as Confirmed */ void recalculateAwards(); //void setAwards(const int _qsoId, bool modify); int getDXCCWorked(const int _logNumber); int getDXCCConfirmed(const int _logNumber); int getWAZWorked(const int _logNumber); int getWAZConfirmed(const int _logNumber); int getQSOsInLog(const int _logNumber); bool getIsDXCCConfirmed(const int _dxcc, const int _logNumber); bool isThisSpotConfirmed(const QStringList _qs); QString checkIfValidIOTA(const QString _tiota); int getDXStatus (const QStringList _qs); QString getDXStatusString (const int _status); // Needs to be called with the output of getDXStatus void setColors (const QString _newOne, const QString _needed, const QString _worked, const QString _confirmed, const QString _default); QColor getQRZDXStatusColor(const QStringList _qs); QColor getDefaultColor(); int getDXMarathonDXCC(const int _year, const int _logNumber); int getDXMarathonCQ(const int _year, const int _logNumber); int getDXMarathonScore(const int _year, const int _logNumber); bool isDXMarathonNeed(const int _dxcc, const int _cq, const int _year, const int _logNumber); // Receives: QStringList _qs; //_qs << QRZ << BandId << lognumber; /* 0 - New one. 1 - Worked but not confirmed: New one in this band. 2 - Worked but not confirmed: Worked in this band. 3 - Confirmed: New one in this band. 4 - Confirmed: Worked in this band. 5 - Confirmed: Confirmed in this band. 6 - Default: Not applicable */ private: void setAwardDXCC(const int _qsoId); bool setAwardDXCC(const int _dxcc, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId); int setAwardDXCCst(const int _dxcc, const int _band, const int _mode, const bool _confirmed, const int _logNumber, const int _qsoId); int setAwardDXCCConfirmed(const int _band, const int _mode, const int _dxcc, const int _newQSOid); // Changes the status of a DXCC from worked to confirmed int setDXCCToQSO(const int _dxcc, const int _qsoid); // Defines the DXCC in a QSO int setCQToQSO(const int _cqz, const int _qsoid); // Defines the CQ zone in a QSO int dxccStatusBandMode(const int _ent, const int _band, const int _mode, const int _logNumber, bool _checkingMode); //-1 error / 0 Not worked / 1 worked / 2 confirmed int dxccStatus(const int _ent, const int _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed /* _confirmed = 0 Set as Worked _cConfirmed = 1 Set as Confirmed */ /**/ int dxccStatusBand(const int _ent, const int band, const int _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed int dxccStatusMode(const int _ent, const int band, const int _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed /**/ void setAwardWAZ(const int _qsoId); bool setAwardWAZ(const int _cqz, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId); int setAwardWAZst(const int _cqz, const int _band, const int _mode, const bool _confirmed, const int _logNumber, const int _qsoId); /* _confirmed = 0 Set as Worked _confirmed = 1 Set as Confirmed */ //int getProgresStepForDialog(int totalSteps); QColor newOneColor; // QColor neededColor; // QColor workedColor; // QColor confirmedColor; // QColor defaultColor; World *world; DataProxy *dataProxy; DXMarathon *dxMarathon; Utilities *util; typedef QMultiHash DXStatus; DXStatus dxccWorked, dxccConfirmed, wazWorked, wazConfirmed; }; #endif // AWARDS_H klog-0.9.2.2/setupentitydialog.h0000644000076700000620000000671212627126144014525 0ustar staff#ifndef SETUPENTITYDIALOG_H #define SETUPENTITYDIALOG_H /*************************************************************************** SetupEntityDialog.h - description ------------------- begin : sept 2012 copyright : (C) 2012 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include #include #include class SetupEntityDialog : public QDialog { Q_OBJECT public: SetupEntityDialog(); ~SetupEntityDialog(); public slots: private slots: void slotOkButtonClicked(); void slotCancelButtonClicked(); void slotCheckEntity(); void slotCheckMainprefix(); void slotCheckCQz(); void slotCheckITUz(); void slotCheckContinent(); void slotCheckLatitude(); void slotCheckLongitude(); void slotCheckUTC(); void slotCheckARRLid(); void slotCheckDeleted(); void slotCheckDeletedDate(); void slotCheckPrefixes(); signals: void entityAdded(const QStringList _qs); // entity private: QString checkEntity(); QString checkMainprefix(); QString checkCQz(); QString checkITUz(); QString checkContinent(); QString checkLatitude(); QString checkLongitude(); QString checkUTC(); QString checkARRLid(); QString checkDeleted(); QString checkDeletedDate(); QString checkPrefixes(); bool entityBool, mainPrefixBool, cqBool, ituBool, contBool; bool latBool, lonBool, utcBool, arrlidBool, delBool, delDateBool, prefBool; QLineEdit *entityLineEdit, *cqLineEdit, *ituLineEdit; QLineEdit *contLineEdit, *latLineEdit, *lonLineEdit; QLineEdit *utcLineEdit, *mprefLineEdit, *arrlidLineEdit; QLineEdit *deletedLineEdit, *prefLineEdit; QDateEdit *delQDateEdit; QRadioButton *delRbutton; QStringList entityData; //QPalette *paletteOrig, *paletteWrong; //QColor color; QPalette pal, palw; }; #endif // SetupEntityDialog_H klog-0.9.2.2/setuppagecolors.h0000644000076700000620000000641012627126144014162 0ustar staff#ifndef SETUPPAGECOLORS_H #define SETUPPAGECOLORS_H /*************************************************************************** setuppagecolors.h - description ------------------- begin : nov 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include //#include #include class SetupPageColors : public QWidget { Q_OBJECT public: SetupPageColors(QWidget *parent=0); ~SetupPageColors(); QString getNewOneColor(); QString getNeededColor(); QString getWorkedColor(); QString getConfirmedColor(); QString getDefaultColor(); void setNewOneColor(const QString c); void setNeededColor(const QString c); void setWorkedColor(const QString c); void setConfirmedColor(const QString c); void setDefaultColor(const QString c); private slots: void slotNewOneColorButtonClicked(); void slotConfirmedColorButtonClicked(); void slotWorkedColorButtonClicked(); void slotNeededColorButtonClicked(); void slotDefaultColorButtonClicked(); private: QColor giveColor (QColor c); QPalette palette; QPushButton *newOneColorButton; // In ANY band QPushButton *neededColorButton; // In this band QPushButton *workedColorButton; // In this band QPushButton *confirmedColorButton; // In this band QPushButton *defaultColorButton; // In this band QColor color; /* 0 - New one. 1 - Worked but not confirmed: New one in this band. 2 - Worked but not confirmed: Worked in this band. 3 - Confirmed: New one in this band. 4 - Confirmed: Worked in this band. 5 - Confirmed: Confirmed in this band. */ }; #endif // SETUPPAGECOLORS_H klog-0.9.2.2/setuppagedxcluster.cpp0000644000076700000620000003363412627126144015241 0ustar staff/*************************************************************************** setuppagedxcluster.cpp - description ------------------- begin : nov 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include "setuppagedxcluster.h" SetupPageDxCluster::SetupPageDxCluster(QWidget *parent) : QWidget(parent) { //qDebug() << "SetupPageDxCluster::SetupPageDxCluster" << endl; //xClusterServers = new QStringList; //dxClusterServers << "dxfun.com:8000"; dxclusterServersComboBox = new QComboBox; dxclusterServersComboBox->addItem("dxfun.com:8000"); addClusterButton = new QPushButton; deleteClusterButton = new QPushButton; showHFRadiobutton = new QRadioButton; showVHFRadiobutton = new QRadioButton; showWARCRadiobutton = new QRadioButton; showWorkedRadiobutton = new QRadioButton; showConfirmedRadiobutton = new QRadioButton; showANNRadiobutton = new QRadioButton; showWWVRadiobutton = new QRadioButton; showWCYRadiobutton = new QRadioButton; saveAllDXClusterDataRadiobutton = new QRadioButton; showHFRadiobutton->setAutoExclusive(false); showVHFRadiobutton->setAutoExclusive(false); showWARCRadiobutton->setAutoExclusive(false); showWorkedRadiobutton->setAutoExclusive(false); showConfirmedRadiobutton->setAutoExclusive(false); showANNRadiobutton->setAutoExclusive(false); showWWVRadiobutton->setAutoExclusive(false); showWCYRadiobutton->setAutoExclusive(false); showHFRadiobutton->setChecked(true); showVHFRadiobutton->setChecked(true); showWARCRadiobutton->setChecked(true); showWorkedRadiobutton->setChecked(true); showConfirmedRadiobutton->setChecked(true); showANNRadiobutton->setChecked(true); showWWVRadiobutton->setChecked(true); showWCYRadiobutton->setChecked(true); addClusterButton->setText(tr("Add")); deleteClusterButton->setText(tr("Delete")); showHFRadiobutton->setText(tr("Show &HF spots")); showVHFRadiobutton->setText(tr("Show V/&UHF spots")); showWARCRadiobutton->setText(tr("Show W&ARC spots")); showWorkedRadiobutton->setText(tr("Show &worked spots")); showConfirmedRadiobutton->setText(tr("Show &confirmed spots")); showANNRadiobutton->setText(tr("Show ANN/&FULL messages")); showWWVRadiobutton->setText(tr("Show WW&V messages")); showWCYRadiobutton->setText(tr("Show WC&Y messages")); QGroupBox *spotsGroupBox = new QGroupBox(tr("DX Spots")); QVBoxLayout *spotsVBoxLayout = new QVBoxLayout; spotsVBoxLayout->addWidget(showHFRadiobutton); spotsVBoxLayout->addWidget(showVHFRadiobutton); spotsVBoxLayout->addWidget(showWARCRadiobutton); spotsVBoxLayout->addWidget(showWorkedRadiobutton); spotsVBoxLayout->addWidget(showConfirmedRadiobutton); spotsVBoxLayout->addStretch(1); spotsGroupBox->setLayout(spotsVBoxLayout); QGroupBox *messagesGroupBox = new QGroupBox(tr("Messages")); QVBoxLayout *messagesVBoxLayout = new QVBoxLayout; messagesVBoxLayout->addWidget(showANNRadiobutton); messagesVBoxLayout->addWidget(showWWVRadiobutton); messagesVBoxLayout->addWidget(showWCYRadiobutton); messagesVBoxLayout->addStretch(1); messagesGroupBox->setLayout(messagesVBoxLayout); // ( QWidget * widget, int fromRow, int fromColumn, int rowSpan, //int columnSpan, Qt::Alignment alignment = 0 ) QHBoxLayout *serversButtonsLayout = new QHBoxLayout; serversButtonsLayout->addSpacerItem(new QSpacerItem(10,0,QSizePolicy::Expanding,QSizePolicy::Maximum)); serversButtonsLayout->addWidget(addClusterButton); serversButtonsLayout->addWidget(deleteClusterButton); QVBoxLayout *serversLayout = new QVBoxLayout; serversLayout->addWidget(dxclusterServersComboBox); serversLayout->addLayout(serversButtonsLayout); QGridLayout *mainLayout = new QGridLayout; mainLayout->addLayout(serversLayout, 0, 0); mainLayout->addWidget(spotsGroupBox, 1, 0); mainLayout->addWidget(messagesGroupBox, 1, 1); setLayout(mainLayout); createActions(); } SetupPageDxCluster::~SetupPageDxCluster() { //qDebug() << "SetupPageDxCluster::~SetupPageDxCluster" << endl; } void SetupPageDxCluster::createActions() { //qDebug() << "SetupPageDxCluster::createActions" << endl; connect(addClusterButton, SIGNAL(clicked()), this, SLOT(slotAddButtonClicked()) ); connect(deleteClusterButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked()) ); } void SetupPageDxCluster::slotAddButtonClicked() { //qDebug() << "SetupPageDxCluster::slotAddButtonClicked" << endl; bool ok; ok = false; while (!ok) { QString text = QInputDialog::getText (this, tr("KLog: Add a DXCluster server"), tr("Add the address followed by the :port\nExample: dxfun.com:8000\nIf no port is specified, 41112 will be used by default:"), QLineEdit::Normal, QString::null, &ok); if (ok && !text.isEmpty ()) { if (checkIfValidDXCluster (text)) { if (checkIfNewDXCluster (text)) { ok = true; if ((text.contains (":")) == 0) { text = text + ":41112"; } dxclusterServersComboBox->insertItem (0, text); } else { ok = false; } } else { ok = false; } } else { // user entered nothing or pressed Cancel ok = true; } } } void SetupPageDxCluster::slotDeleteButtonClicked() { //qDebug() << "SetupPageDxCluster::slotDeleteButtonClicked" << endl; dxclusterServersComboBox->removeItem (dxclusterServersComboBox->currentIndex ()); } bool SetupPageDxCluster::checkIfValidDXCluster (const QString & tdxcluster) { QUrl url ("http://" + tdxcluster); if ((!url.host ().isEmpty ()) || (url.port () != -1)) { return true; } else { return false; } } bool SetupPageDxCluster::checkIfNewDXCluster (const QString & tdxcluster) { //qDebug() << "checkIfNewDXCluster: -" << tdxcluster << "-"<< endl; int numberOfDXClusterServers = dxclusterServersComboBox->count (); for (int i = 0; i <= numberOfDXClusterServers - 1; i++) { if ((dxclusterServersComboBox->currentText ()) == (tdxcluster)) { return false; } else { return true; } dxclusterServersComboBox->setCurrentIndex(i); } return true; } QStringList SetupPageDxCluster::getDxclusterServersComboBox() { //qDebug() << "SetupPageDxCluster::getDxclusterServersComboBox" << endl; QStringList servers; int numberOfDXClusterServers = dxclusterServersComboBox->count (); servers.clear(); if(numberOfDXClusterServers>=1) { //stream << "DXClusterServerToUse=" << dxclusterServersComboBox->currentText () << endl; //servers << dxclusterServersComboBox->currentText (); for (int i = 0; i <= numberOfDXClusterServers - 1; i++) { dxclusterServersComboBox->setCurrentIndex (i); servers << dxclusterServersComboBox->currentText (); //stream << "DXClusterServerPort=" << dxclusterServersComboBox->currentText () << endl; } } return servers; } void SetupPageDxCluster::setDxclusterServersComboBox(const QStringList t) { //qDebug() << "SetupPageDxCluster::setDxclusterServersComboBox" << endl; if (t.count()>0) { QString text; for (int i=0; i < t.count(); i++) { text.clear(); text = t.at(i); if (checkIfValidDXCluster (text)) { if (checkIfNewDXCluster (text)) { if ((text.contains (":")) == 0) { text = text + ":41112"; } dxclusterServersComboBox->insertItem (0, text); } else { // Not added } } } } } QString SetupPageDxCluster::getShowHFRadiobutton() { if (showHFRadiobutton->isChecked()) { return "True"; } else { return "False"; } } QString SetupPageDxCluster::getShowVHFRadiobutton() { if (showVHFRadiobutton->isChecked()) { return "True"; } else { return "False"; } } QString SetupPageDxCluster::getShowWARCRadiobutton() { if (showWARCRadiobutton->isChecked()) { return "True"; } else { return "False"; } } QString SetupPageDxCluster::getShowWorkedRadiobutton() { if (showWorkedRadiobutton->isChecked()) { return "True"; } else { return "False"; } } QString SetupPageDxCluster::getShowConfirmedRadiobutton() { if (showConfirmedRadiobutton->isChecked()) { return "True"; } else { return "False"; } } QString SetupPageDxCluster::getShowANNRadiobutton() { if (showANNRadiobutton->isChecked()) { return "True"; } else { return "False"; } } QString SetupPageDxCluster::getShowWWVRadiobutton() { if (showWWVRadiobutton->isChecked()) { return "True"; } else { return "False"; } } QString SetupPageDxCluster::getShowWCYRadiobutton() { if (showWCYRadiobutton->isChecked()) { return "True"; } else { return "False"; } } void SetupPageDxCluster::setShowHFRadiobutton(const QString t) { if ( (t.toUpper()) == "FALSE") { showHFRadiobutton->setChecked(false); } else { showHFRadiobutton->setChecked(true); } } void SetupPageDxCluster::setShowVHFRadiobutton(const QString t) { if ( (t.toUpper()) == "FALSE") { showVHFRadiobutton->setChecked(false); } else { showVHFRadiobutton->setChecked(true); } } void SetupPageDxCluster::setShowWARCRadiobutton(const QString t) { if ( (t.toUpper()) == "FALSE") { showWARCRadiobutton->setChecked(false); } else { showWARCRadiobutton->setChecked(true); } } void SetupPageDxCluster::setShowWorkedRadiobutton(const QString t) { if ( (t.toUpper()) == "FALSE") { showWorkedRadiobutton->setChecked(false); } else { showWorkedRadiobutton->setChecked(true); } } void SetupPageDxCluster::setShowConfirmedRadiobutton(const QString t) { if ( (t.toUpper()) == "FALSE") { showConfirmedRadiobutton->setChecked(false); } else { showConfirmedRadiobutton->setChecked(true); } } void SetupPageDxCluster::setShowANNRadiobutton(const QString t) { if ( (t.toUpper()) == "FALSE") { showANNRadiobutton->setChecked(false); } else { showANNRadiobutton->setChecked(true); } } void SetupPageDxCluster::setShowWWVRadiobutton(const QString t) { if ( (t.toUpper()) == "FALSE") { showWWVRadiobutton->setChecked(false); } else { showWWVRadiobutton->setChecked(true); } } void SetupPageDxCluster::setShowWCYRadiobutton(const QString t) { if ( (t.toUpper()) == "FALSE") { showWCYRadiobutton->setChecked(false); } else { showWCYRadiobutton->setChecked(true); } } QString SetupPageDxCluster::getSelectedDxClusterServer() { //return dxclusterServersComboBox->currentText(); int dxclusterServerListItems = dxclusterServersComboBox->count (); if (dxclusterServerListItems >= 1) { return dxclusterServersComboBox->currentText (); } else { return QString::null; } return QString::null; } void SetupPageDxCluster::setSelectedDxClusterServer(const QString t) { dxclusterServersComboBox->setCurrentIndex(dxclusterServersComboBox->findText(t)); } klog-0.9.2.2/logwindow.cpp0000644000076700000620000000354312627126144013313 0ustar staff/*************************************************************************** logwindow.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "logwindow.h" LogWindow::LogWindow() { } LogWindow::~LogWindow() { } void LogWindow::createlogPanel() { } klog-0.9.2.2/AUTHORS0000644000076700000620000000023112627126144011635 0ustar staffJaime Robles, EA4TV (2002-today) Andrew Goldie, ZL2ACG (2009-2010) Translators: Catalan - Luis, EA3NM klog-0.9.2.2/dxcluster.h0000644000076700000620000001101712627126144012757 0ustar staff#ifndef DXCLUSTER_H #define DXCLUSTER_H /*************************************************************************** dxcluster.h - description ------------------- begin : oct 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include //#include #include #include #include #include "awards.h" #include "world.h" #include "dataproxy.h" #include "dataproxy_sqlite.h" class QWidget; class QTcpSocket; class DXClusterWidget : public QWidget { Q_OBJECT public: DXClusterWidget(QWidget *parent ); //DXClusterWidget(QWidget *parent); DXClusterWidget(const QString &clusterToConnect, const int portToConnect, QWidget *parent ); void setColors (const QString _newOne, const QString _needed, const QString _worked, const QString _confirmed, const QString _default); void setDXClusterSpotConfig(bool _showhf, bool _showvhf, bool _showwarc, bool _showworked, bool _showconfirmed, bool _showann, bool _showwwv, bool _showwcy ); void setDXClusterServer(const QString &clusterToConnect, const int portToConnect); void setCurrentLog(const int _log); bool isConnected(); //void sendSpotToCluster(const QString _dx, const QString _freq); ~DXClusterWidget(); private slots: void slotClusterDisplayError(QAbstractSocket::SocketError socketError); void slotClusterDataArrived(); void slotClusterSocketConnected(); void slotClusterSocketConnectionClosed(); void slotClusterSendToServer(); void slotClusterClearLineInput(); void slotClusterInputTextChanged(); void slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetItem * item ); void slotClusterDXClusterWidgetItemEntered( QListWidgetItem * item); void slotClusterDXClusterWidgetItemSelected(); signals: void dxspotclicked(const QStringList _qs); // DXSpotCall, DX-Freq, doubleClicked private: void initClass(); void connectToDXCluster(); QStringList readItem(QListWidgetItem * item); bool checkIfNeedsToBePrinted(const QString _dxCall, const int _band, const int _mode); void addData(); //TO BE DELETED, JUST FOR TESTING PURPOSES QTcpSocket *tcpSocket; QListWidget *dxClusterListWidget; QLineEdit *inputCommand; QPushButton *sendButton; QPushButton *clearButton; bool dxClusterConnected; bool dxClusterAlreadyConnected; QString server; quint16 port; quint16 blockSize; QColor dxSpotColor; World *world; Awards *awards; DataProxy *dataProxy; bool showhf, showvhf, showwarc, showworked, showconfirmed, showann, showwwv, showwcy; bool dxClusterShowHF, dxClusterShowVHF, dxClusterShowWARC, dxClusterShowWorked, dxClusterShowConfirmed, dxClusterShowAnn, dxClusterShowWWV, dxClusterShowWCY; int currentLog; }; class dxClusterSpotItem : public QListWidgetItem { public: dxClusterSpotItem( QListWidget* parent, const QString& spot, const QColor& color ); ~dxClusterSpotItem(); protected: QColor spotColor; }; #endif // DXCLUSTER_H klog-0.9.2.2/Changelog0000644000076700000620000007014512627126144012412 0ustar staffNovember-2015 - 0.9.2.2 - Translations are now working properly in Windows & OSX. - New translation: Catalan by EA3NM (Thank you!). - Ported from Qt4 to Qt5. - BugFix: Aether ADIF files could not be properly imported. (TNX AA5VU). - BugFix: QSOs where not properly shown in the search box. - BugFix: When started for the first time, no modes were shown as default. - BugFix: CTY.CSV was not properly updated. - BugFix: When upgrading the mode information in database some modes where not properly updated. - GUI: Changed the year to show the full number to avoid problems with old QSO. - Import ADIF functionality is improved to support importing of logs with some missing data. - Removed the Spot button until its functionality is implemented. September-2015 - 0.9.2.1 -BugFix: Band & Mode information was not properly stored. August-2015 - 0.9.2 - Bugfix: An ADIF file with one blank line and one QSO used to froze KLog. - Bugfix: Minor bugfix in the definition of propagation modes. - BugFix: When editing a QSO the name was not shown. - BugFix: STX_String field was not always imported properly. - BugFix: Fixed a minor bug in log table regarding the prop_mode foreign key. - 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. - BugFix: IOTA reference was not saved when entering a QSO. - BugFix: BIGCTY.DAT was not properly download in KLog first start. - 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 - 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 - Bugfix: Editing a QSO with satellite data was not properly done and caused some errors. April-2015 - 0.9.1 - Bugfix: Fixed DataBase::getBandIdFromFreq it was not ansswering properly. - Now checks if band & frequency are coherent before adding a QSO. Band wins. - All Satellite QSO include the PROP_MODE ADIF tag to make it compatible with LOTW. - Improved the DXMarathon code. - GUI: Added basic Satellite support. - GUI: It is possible to mark a QSL sent via bureau/direct & DX QSL as requested with one action from Search box. - GUI: KLog request a valid QRZ and at least one first logtype to start using it. - KLog supports the management of several logs, being possible to edit, remove and select the one to use. January-2015 - 0.9.0.3 - Bugfix: ADIF was not properly imported when Fields where using the Type of data optional field preventing logs from Logger32 being imported. (TNX EB1TR) - Bugfix: QSL Sent/Received status in the search box were switched. - Bugfix: CTY.CSV was not updated if the file was already existing. - Bugfix: Entity DB was not updated when CTY.CSV was updated. - Bugfix: Search results showed the default Station Callsign if non was in the QSO. This lead to errors if QRZ was not the default. - KLog recognizes now .ADIF files (instead of only .ADI). - KLog shows now the WAZ status. - Added a very basic support of DX Marathon (http://www.dxmarathon.com/). - DXCluster filters are now working. - The user can manually assign the DXCC entity for a DX. - Improved the function to update the DB from one release to the following. - DB file is compressed everytime KLog finishes. - It is possible to find QSL pending to receive. - It is possible to modify entities data in the World Editor in preferences. - It is possible to choose in preferences whether to keep my Data Tab from one QSO to the next or not. - GUI: A tooltip is shown in the search results showing the DXCC name / CQ zone. - GUI: Added a button to rescore awards. - GUI: Added a button to update the search Box without modifying the text. - GUI: Updates Bearing/distance/... when changing Locator. - GUI: When the QRZ lineedit is blank or the clear button is clicked, entity info is deleted (beam, distance, ...). - GUI: The IOTA continent is updated when the QRZ is modified. - GUI: DXCluster input is disabled when not connected. - GUI: Corrected the behaviour of the status bar. - GUI: Added primary & secondary subdivisions in the Others Tab. - Some other minor fixes. November-2014 - 0.9.0.2 - Bugfix: Right-click on search result sometimes caused KLog to crash. November-2014 - 0.9.0.1 - Bugfix: Selected DX-Cluster servers were not used to connect. (TNX DL6FBS) November-2014 - 0.9.0 - Ensures the ASCII requirement of ADIF. - Updated the Preferences dialog. - Added the About Qt help menu. - Bugfix: Selected DX-Cluster servers were not used to connect. - Bugfix: When selecting QSL received/sent with right click, date was not updated. - Bugfix: Fixed the FileManager::adifReadLog to be able to read logs with several lines per QSO. - Some other minor bugfixes. - New feature: It is possible to show Imperial System (Miles instead of Km) data. (TNX - KF5JNU) - New feature: It is possible to mark/look for & export requested QSL. - New feature: It is possible to automatically mark(or not) a QSL as requested by the DX when the DX's card is received. - New feature: It is possible to show (or not) the callsign used in the search box. - New feature: KLog uses bigcty.csv for normal DX & will use cty.csv for contesting. April-2014 - 0.7.1 - Backport to Qt 4.8. - Download the http://www.country-files.com/cty/cty.csv instead of cty.dat (with no ARRL id). - Capable to read cty.csv to get the info of the ARRL id. April-2014 - 0.7.0 - Full rewritten software based only in Qt. NO KDE dependency. - KLog can now run on Linux, OSX and Windows. November-2013 - 0.6.2 - Bug fixed: Under some conditions, KLog crashes when entering a new QRZ. (TNX LW1EQI). - Bug fixed: IOTA data was not properly cleared when clicking the Cancel button. - Bug fixed: QSL combobox content was not properly managed. (TNX DF4FH). - Bug (gui) fixed: IOTA continent is now "automagically" detected... again (a bug prevented this functionality). - GUI updated: You can click on RX or TX Frequency buttons to copy the frequency to the other one. - GUI updated: You can select eQSL in the QSL combobox as an option to mark the QSL information of a QSO. - GUI updated: Two new shortcuts: CTRL+W: deletes the current QSO. CTRL+Q: to (quick)edit the last QSO added. - GUI updated: Minor tab reorder. June-2013 - 0.6.1 - Bug fixed: Locator was not properly calculated due to a sign difference management from KLog and CTY.DAT. - GUI updated: The cursor position management of the QRZ box has been improved to ease the operation. January-2013 - 0.6.0 - Bug fixed: Typo "Frecuency" changed to "Frequency" in a tooltip. (Debian bug: #654328) (TNX Jonas Stein) - Bug fixed: Typo/wishlist "Numb" changed to "Number" in main table. (Debian bug: #654331) (TNX Jonas Stein) - Bug fixed: Typo/wishlist "UTC" changed to "Time" in main table. (Debian bug: #654331) (TNX Jonas Stein) - Removal of several not needed #includes. - Removed some warnings on compilation. - GUI improved: The information boxes are now independant from the top right tab widget to improve usability. - GUI updated: Disabled the Setup tab of Hamlib until hamlib is properly working. January-2012 - 0.5.9 - Bug fixed: When starting for the first time, the CTY.DAT file downloaded had a loop that was not properly managed. (Debian bug: #653697) (TNX Jonas Stein) - Fixed some typo: "Km" changed to "km". (Debian bug: #6536978) (TNX Jonas Stein) December-2011 - 0.5.8 - Bug fixed: Right button in the search result did not "sent" the QSL card. - Bug fixed: Closing the window did not ask to save data before exit. (TNX EA7HEG). - Bug fixed: Beam was not properly calculated. (TNX DL6FBS). - Bug fixed: Minor problem of APP_KLOG_NUMBER ADIF header fixed. - Bug fixed: When modifying, some fields did not accepted empty fields (deleting). (TNX VK4JAZ). - GUI updated: Remove the map tab in the main GUI as it is still not implemented. - GUI updated: Ordered the tab-switching to make it more usable. (TNX Cedric). - Added the support for QRP. Power has two decimals. (TNX VK4JAZ). November-2010 - 0.5.7 - New feature: Added the Export needed QSL that allows to create an ADIF file with all the QSO with new ones and new bands still not confirmed that has not been QSLed. The objective is to export it to a QSL or label printing software (until KLog implements that feature). - Updated translations: SV by SM4ABE. - GUI improved: Added sliders to be able to move panels. - GUI improved: Changing the band combobox changes the TX Freq box and viceversa. - Minor fix: The PROGRAMVERSION tag in log was not properly formated. July-2010 - 0.5.6 - Fixed the hamlib compilation scripts (CMakeLists.txt, FindHamlib.cmake). (TNX AB4BD). - Fixed one bug that causes some architectures not to compile. - Fixed some permisions and other warnings for Fedora packaging. (TNX N3LRX). - BUG fixed: Setting QSL from the log with right button was not working. May-2010 - 0.5.5 - New feature: If cty.dat file is not found, KLog offers to download from the web. - New feature: New tool to update the update the cty.dat file from the web. - New feature: QRZ font color changes to red if has been worked previously. (Proposed by KE7TDY) March-2010 - 0.5.4 - Small fix to initialize a variable before using it.(realTimeLog in klog.cpp) - Fixed a bug that caused KLog to crash of no cty.dat file was found (bug #016917)(TNX KA6MAL) February-2010 - 0.5.3 - Fixed a bug that caused modified QSO not being updated. - Fixed a bug in the way the band & mode combobox managed the data. February-2010 - 0.5.2 - Fixed a bug that causes a crash when connectiong to DXCluster. (bug #016653) - Added a very basic Satellite support. - Removed the Freq LCD and added two new editable widgets: Freq TX and Freq RX. (bug #016609) - Added again the entity count of /M stations. January-2010 - 0.5.1 - Fixed a bug with the display of the Date. December-2009 - 0.5.0 - Migrated to Qt4. - Updated translations: SV by SM4ABE, DE by DL5PD, ES by EA4TV. - ZL2ACG joined the KLog team. Welcome and thank you Andrew! April-2009 0.4.7 - New feature: Import cabrillo logs. - Improved the ADIF compatibility up to ADIF 2.2.2. - BUG fixed: Improved the confirmed QSO accounting. - BUG fixed: RST format were not changed when another mode was selected if the CALL was empty. (TNX Alvaro, EA4RCT). - BUG fixed: Calls like F0XXX/TU8 were not recognised if written as TU8/F0XXX. - BUG fixed: TX_PWR is only saved when bigger than 0w :-) - BUG fixed: Prefixes were not properly managed and some information, as the STATE from ADIF files were not always well imported. - BUG fixed: Related with the ADIF saving CQ & ITU zones for QSO. It was not properly saved but can be recovered from the CALL. 20-dic-2008 - 0.4.6 - BUG fixed: Printing was not properly working due to library actualization. - BUG fixed: Fields STX/SRX/STATION_CALLSIGN/CONTEST_ID were copied from one QSO to the following one. 23-nov-2008 - 0.4.5 - GUI fixed: Changed the order of the input fields tab switching. - GUI fixed: Corrected the layout to fix the screen as ITU was not properly shown. - GUI improved: Added a new one color to differ a completely new one spot in the DX-cluster from a needed in a band. This last improvement is specially usefull in the search QSO to QSL. Test it! - GUI improved: Added a tab in the botton box with the DXCC status (only main HF bands). - New feature: Added the possibility to choose to show or not DX Spots based on CW/SSB activity. (TNX EA7BJ) - New feature: Added the support of the 0.136KHz and GHz bands (not to the GUI but KLog can process them). - BUG fixed: Minor check on QSL sent date was not properly done (no data lost). - BUG fixed: Some Entities & zones where not properly recognized. - BUG fixed: The state (needed/worked/confirmed) was not always properly shown. - Improved the way is readed the cty.dat file and added support for its new format. - Improved the ADIF compatibility supported fields, band frecuencies, modes... - Improved the QSO merging with previous data. - Updated translations: English, Spanish, TNX: Swedish (SM4ABE), German (DL5PD). 1-may-2008 - 0.4.4 - BUG fixed: KLog now recognises a "/LH" LightHouse stations (TNX G3OAG) - BUG fixed: TLF import did not show the imported QSO in the log. QSO were not lost, just not shown. They were added to the logfile and saved when saving. No data was lost. This bug was introduced in release 0.4.2 after an optimization in the logfile reading. BUG: Frequency was not compliance with ADIF as was saved in KHz instead of MHz. - BUG fixed: If a logfile does not provide a MY_GRIDSQUARE, KLog does not add the predefined MY_GRIDSQUARE. - BUG fixed: Some GRIDSQUARES were not detected as wrong althought they were. - Minor fix: Corrected the URL to CTY.DAT file in the start message. - GUI improved: Added a progress dialog when saving. - GUI changes: Some widgets have been changed to prepare for the Qt4 migration. Specially the Led near the QRZ box that will reapear as usual when KLog is migrated to Qt4. - Added the 70Mhz band. - New feature: New tool added "Merge QSO data" that looks in all the log for the QSO that has been worked more than once and merges the data like Name, QSL info, QTH, Locator, ... The information comming from all the appearances of a call in the log is grouped in the first appearance of that call in the log. 18-jan-2008 - 0.4.3.1 - Package fix: Distributed with the language (po) files. 12-jan-2008 - 0.4.3 - BUG fixed: KLog copied the QSL sent date into the QSL rec date. Only QSL rec date was lost but not the QSL status. - BUG fixed: KLog now recognises a "/J" (Jamboree On The Air) Scout Station. - GUI improved: Added the cty.dat URL. 12-Sep-2007 - 0.4.2 - New feature: The user can now configure to require or not the mandatory data for each QSO (QRZ, date, time, band, mode, RST tx & RST rx. (if not all the mandatory fields are entered, KLog's behaviour may be unexpected). - New feature: Klog creates a temp file (~.klog/tempklog.adi) where it saves automatically all the QSOs entered until the log is manually saved. It prevents the log to be lost in case of unprevented KLog/computer failure. (TNX SM5OUU) - BUG fixed: If the field (maybe any other field too) COMMENT is more than one line long, the log is broken and cannot be read. (TNX SM5OUU) - BUG fixed: KLog does not ask for the file name if you have previously opened one file and the name has not changed. - BUG fixed: In the GUI, the "Preferences" is correctly shown and not as "&Preferences". - BUG fixed: When modifying a QSO, the number of QSOs was incremented when the user click over OK. - BUG fixed: If a QSO was deleted the awards/number of QSO where not decresed. - BUG fixed: When the date - GUI improved: Deleted the WAE box (the WAE calculations was not implemented). - New translation: KLog is now also in Swedish.(TNX SM4BE) - New translation: KLog is now also in Galician.(TNX Fuco Mera) - Updated German translation.(TNX DL5PD) - Updated Spanish translation. 16-Dic-2006 - 0.4.1 - Bug fixed: The distance and beam is also resetted when the call box is deleted. - Bug fixed: Calls /M and /MM do not count for DXCC.(TNX SM5CNQ) - Bug fixed: It is possible to filter only for needed entities spots. - Change: The hamlib signal meter has been removed from the GUI. - New feature: There is a new tool available to find QSO from which the QSL is needed that you have still not sent the QSL. Very useful to find which QSL you need to send first! - New feature: The MY_GRIDSQUARE is managed by default by all QSO (saves the default if none is entered) 10-Sep-2006 - 0.4.0 - New feature: It is possible to manage user-created local awards (TPEA, DOK, WAS, ...) KLog reads user defined awards in a special format. - New feature: KLog reads ".adif" files also.(TNX DL5PD) - New feature: It is possible to add/delete new DXServer clusters in the setup box.(TNX DL5PD) - GUI Improved: IOTA continent is now "automagically" detected. - Bug fixed: Not really a bug but now, the log is cleaner as it does not save the "STATE" for ALL the QSO, only does it if needed. - Bug fixed: After modifying a QSO the band and mode did not return to the last used (TNX DL5PD). - Bug fixed: If the band changed, without any call in the Call box, KLog showed "new one, work it" - Bug fixed: If the band changed, when modifying KLog fooled the entity color band boxes. - Bug fixed: KLog recognises /MM as maritime mobile station - Bug fixed: When opening a new log, the number of QSO did not start from zero. - New translation: KLog is now also in German.(TNX DL5PD) 18-Jan-2006 - 0.3.3 - New feature: It is now possible to sort the log by numbers from the main log. - New feature: The frequency box is now also used when no hamlib support is active (double clicking over a dx-cluster spot. - New feature: If file name does not end in .adi, add the .adi. - Bug fixed: Reporting a bug does not crash KLog although the widget has been temporally/drastically simplified. - Bug fixed: It is possible to select the radio from the setup. - Bug fixed: (introduced in 0.3.2) It was not possible to activate the progress dialog. - Bug fixed: When clicking over "New File", confirmed entities was not set to "zero". - Bug fixed: When reading from cty.dat file, the prefix was reading with some spaces at the begining. - GUI Improved: After pressing OK/clear button, the QRZ box is selected. (TNX P.H. Rankin Hansen) - GUI Improved: You can now reach to Name&QTH using the tab key (TNX P.H. Rankin Hansen) - GUI Improved: QTH/Locator is now on the main QSO tab (TNX P.H. Rankin Hansen) 25-Apr-2005 - 0.3.2 - New feature-(unstable): Hamlib support to control/read the rig from KLog. - New feature-(unstable): It is possible to click over a DX-Spot and set the radio to that frecuency & mode to work the spot (hamlib). - New feature-(unstable): KLog reads the frecuency, band, mode and signal from the radio in real time (hamlib). - New feature: After QSLing using the Right Button option from the search box, the search box is updated so the QSL status is shown updated. - New feature: Local operator callsign can now be also logged. - Bug fixed: A call ending in /B is now correctly recognised as a beacon. - Bug fixed: Now it recognise all the "special suffix" like /r Rotuma, /a Mount Athos,... - Bug fixed: WARC Bands were not correctly detected. - GUI improved: The QRZ box always shows the QRZ as uppercase. (TNX ea4eej) - Bug fixed: KLog can now read ADIF files where the QSO can be in several lines. - Bug fixed: Importing from tlf, the QSO count was not properly done because of the comment lines. 16-Jan-2005 - 0.3.1 - KLog has been optimized and now runs faster. - New feature: KLog saves the date/time of the last log file save. - New feature: KLog ask the user for a comment when Importing a TLF log (for example to note that those QSO are from an specific contest or whatever). - Bug fixed: When selecting a DX-Spot from the DX-Cluster it did not overwrote the name. - Bug fixed: When writting the log, there was an space missing before the . It is just a "cosmetic" fix, not a real bug. - Bug fixed: The same with the QSL card status. - Bug fixed: KLog now recognises all the prefix that appears in cty.dat file with special CQ/ITU zones. - Bug fixed: KLog recognises the special call "3XDQC/P" as "3X" although it does not follow the "prefix+number+suffix" pattern - Bug fixed: When starting it now looks the cty.dat file in: ~/.klog and in the current directory before starting without Entities' data. (TNX oh7jjt) - Bug fixed: If we are modifying a QSO, the search box is not updated. Avoids some crashes. 07-Nov-2004 - 0.3.0 - Fixed source code to allow compiling in more architectures. - New feature: It is possible to show a progress dialog when opening the log file. This is configurable. - New feature: It is now possible to hide/show WARC spots or announces from cluster. - New feature: Printing the is now possible. - New feature: Sorting the log file is now possible. - New feature: New option in right button to send&rec QSL at once. - New feature: If a CALL has been previously worked it shows data to the actual QSO. - Fixed bug: When modifying, the QTH was not modified. - Fixed bug: It did not make you save if you just modify a QSO. - Improved the gui: The "T" (from RST) does not disappears but is disabled when is not needed. (TNX Ferm�n H.). - Improved the gui: The QSL info text box is always active. - Improved the gui: When connecting to the DX-Cluster server, automatically sets the DXCluster window as active. 2-May-2004 - 0.2.9 - New feature: Selection of a DX-Spot shows the Entity data and state. - New feature: KLog checks and captures the output of a sh/dx command in cluster. - Fixed bug(caused in 0.2.8): QRZs as KA3AA, when the prefix is just one letter but the call uses two are now well recognised. - Fixed bug: Better recognision from /number calls from DX-Cluster. 21-Mar-2004 - 0.2.8 - Fixed bug: Now ignores comments in TLF's files. - Fixed bug: QRZs as VP2MCV, with complex prefixes are now well recognised. - Improved the gui: RST, Power size adjusted. (TNX ea1ddn) - Improved the gui: Name and QTH moved to QSO tab. - Improved the gui: QSL via bureau is now the default option. (TNX ea1ddn) - New feature: Calculate distance and beam if locator is entered. (TNX ea1ddn) - New feature: Auto-open logfile when starting is now possible. (TNX ke6sls & ea1ddn) - New feature: Now it is possible to double-click over a DXCluster spot to copy it to the QSO input box. (TNX ea1ddn) - New feature: In the search box, QSOs are colored indicating if worked, needed, ... 04-Jan-2004 - 0.2.7 - Fixed bug: When editing a QSO, the QSL date was not properly displayed. - Fixed bug: When entering a QSO, if the band is changed, KLog checks the state in this new band. - Fixed bug: RST (tx&rx) in ADIF was always length 3, now is calculated for every QSO (at writing). - Fixed bug: When modifying if QSL rec, the date was shown as 00/00/0000 - New feature: It is posible to select a default mode & band in the setup. - First Icon draft created. 02-Dec-2003 - 0.2.6 - Fixed bug: When Non real time logging was setting the time was "real time" when modifying. (TNX rz3dfs) - Fixed bug: When reading the log file if an entity was not recognised Klog used to crash. - Fixed bug: Now we recognise calls like 3XY1L when reading from a log file. - Fixed bug: Improved the way of checking the confirmed/worked entities. - Fixed bug: /P, /M and /QRZ are now better recognised when reading from logfile or clicked. - Fixed bug: Stats were not shown after importing a tlf log file. - Fixed bug: The zone & entity numbering fixed. - New feature: It is posible to setup a default power level. - New feature: When receiving a qsl with the mouse's right button the numbers are updated. - New feature: Also a default color is selectionable as non-info color. - Improved the gui: Band info leds removed to gain space in the info widget. 26-Aug-2003 - 0.2.5 - Fixed bug:�RST was changed so when entering SSB RST. Entering 590 -> showed 509. (TNX ke6sls) - Fixed bug: In cluster some frecs (432MHz and 2190m) were not properly recognized. - New feature: It is now possible to hide HF/VHF/ANN spots or announces from cluster. - New feature: It ask for the file name when saving first time instead of using "klog.adi" as default. (TNX ke6sls) - New feature: It is now possible to add QSO in non real time (to add previous QSOs). (TNX yu1is) - New feature: Power value is remembered from previous QSO. (TNX ke6sls) - New feature: Basic bug report system. (TNX ke6sls) - New feature: Mode selection affects to the RST configuration (TNX yu1is & ke6sls) - New feature: Colors for confirmed/worked/needed are configurable by the user. - New feature: Added tips to many widgets to explain their functions. 31-Jul-2003 - 0.2.4 - Fixed bug: Some calls were not recognized when checked (as 3da0sv). - Fixed bug: When opening a second log having a previous one KLog did not ask for saving if needed. - New feature: Basic Setup dialog and functions. - New feature: Now the band combo change checks automatically the entity state. - New feature: Smart cluster tells you if a dx spot is needed, worked and/or confirmed using colors. - New feature: Clock is now in UTC by default but can be changed in preferences. 24-Jul-2003 - 0.2.3 - Improved the gui: The "entity state" LED has been moved to a always seen zone. - Improved the gui: The way to edit QSO. - Fixed bug: When searching it showed a wrong name and a qth. - New feature: Basic DX-Cluster support. - New feature: It is possible to add a log file to the current log. - New feature: QSO deletion. - New feature: QSO selection's data is shown in the show box. - New feature: You can delete qso & manage qsl from the list with righ button quickly & easily. 30-Jun-2003 - 0.2.2 - Changed the behavior of the search box to look not only for complete calls but characters. - Fixed bug: Improved the GUI layout. - Fixed bug: When editing a previous QSO the date was not always properly saved. - New feature: Added real time clock. 20-Mar-2003 - 0.2.0 - New feature: Added search for QSO tab. - New feature: Added Name field. - New feature: Added QTH field. - New feature: Added operator (self call) field. - Fixed bug: When saving log to file comment is not saved if there is no comment. - Fixed bug: When selecting a "portable" (/P) (or /number) qso in the list it didn't recognize the entity. - Translation updated: pt_BR. 13-Mar-2003 - 0.1-beta02 - Added many modes and some more bands. - New feature: Asking for saving when finishing without save. - New feature: Asking if overwrite when saving as to an existing file. - New feature: The main led only shows info about the current band. - New feature: Band/Mode sticky between contacts. - New feature: Added the long path beam and distance. - New feature: You can track each entity state per band with leds. - New feature: Basic WAZ award support. - Fixed bug: If you had a log and started a new one, the DXCC kept the data. - Fixed bug: The IOTA number was limited to 99 (now 999). 28-Feb-2003 - 0.1-beta - New feature: Led is green (new one), yellow (worked but not confirmed), red (confirmed). - New feature: Support calls as EA4TV/EA8, EA8/EA4TV. - New feature: Import TLF logs. - New feature: Added beam and distance calculations. - New feature: Added Locator & IOTA fields. - New feature: Basic DXCC award support. - Improved the search the Entity algorithm (much quick). - Clear button shows "Cancel" when modifying. - Changed many classes from Qt classes to KDE classes. - Fixed bug: Some times the QSL was checked automaticaly. - Fixed bug: The Mode combobox showed SBB and it is SSB. - Fixed bug: some calls showed as worked before and they were not. 29-Jan-2003 - 0.1-alpha - Fixed bug: When modifying a QSO it was not shown in the log box. - Fixed bug: If you clicked over the log box but not over a qso, the program crashed - Fixed bug: When modifying a QSO the date was always set to "now". - Now you can select what log file you want to open. - Now you can select the file's name when saving the log. - Now you can create a new log always you want. - Logs are now stored in ~/.klog directory by default. - Logs are saved as klog.adi by default. - Some prefix were not found in previous version. - QSL date is activated when a QSO is selected - QSL via is working, manager field, and QSL info field 22-Jan-2003 - 0.1-pre-alpha - First "release" of the software. - You can add/edit QSOs and save/read your log to/from the disk with a fixed name in ADIF format. - Can manage QSL sent/rec. klog-0.9.2.2/gpl-3.0-standalone.html0000644000076700000620000011150512627126144014670 0ustar staff GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

Preamble

The GNU General Public License is a free, copyleft license for software and other kinds of works.

The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.

To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.

For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.

Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.

Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.

The precise terms and conditions for copying, distribution and modification follow.

TERMS AND CONDITIONS

0. Definitions.

“This License” refers to version 3 of the GNU General Public License.

“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.

“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.

To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.

A “covered work” means either the unmodified Program or a work based on the Program.

To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.

To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.

An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.

1. Source Code.

The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.

A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.

The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.

The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.

The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.

The Corresponding Source for a work in source code form is that same work.

2. Basic Permissions.

All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.

You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.

Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.

3. Protecting Users' Legal Rights From Anti-Circumvention Law.

No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.

When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.

4. Conveying Verbatim Copies.

You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.

You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.

5. Conveying Modified Source Versions.

You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:

  • a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
  • b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
  • c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
  • d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.

A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.

6. Conveying Non-Source Forms.

You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:

  • a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
  • b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
  • c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
  • d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
  • e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.

A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.

A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.

“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.

If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).

The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.

Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.

7. Additional Terms.

“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.

When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.

Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:

  • a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
  • b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
  • c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
  • d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
  • e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
  • f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.

All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.

If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.

Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.

8. Termination.

You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).

However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.

Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.

Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.

9. Acceptance Not Required for Having Copies.

You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.

10. Automatic Licensing of Downstream Recipients.

Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.

An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.

You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.

11. Patents.

A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.

A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.

Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.

In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.

If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.

If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.

A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.

Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.

12. No Surrender of Others' Freedom.

If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.

13. Use with the GNU Affero General Public License.

Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.

14. Revised Versions of this License.

The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.

If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.

Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.

15. Disclaimer of Warranty.

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

16. Limitation of Liability.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

17. Interpretation of Sections 15 and 16.

If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program 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.

    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.

You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

klog-0.9.2.2/setuppagecolors.cpp0000644000076700000620000001707112627126144014522 0ustar staff/*************************************************************************** setuppagecolors.cpp - description ------------------- begin : nov 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include "setuppagecolors.h" SetupPageColors::SetupPageColors(QWidget *parent) : QWidget(parent) { //qDebug() << "SetupPageColors::SetupPageColors" << endl; newOneColorButton = new QPushButton; neededColorButton = new QPushButton; workedColorButton = new QPushButton; confirmedColorButton = new QPushButton; defaultColorButton = new QPushButton; newOneColorButton->setText(tr("New One")); neededColorButton->setText(tr("Needed in this band")); workedColorButton->setText(tr("Worked in this band")); confirmedColorButton->setText(tr("Confirmed in this band")); defaultColorButton->setText(tr("Default")); newOneColorButton->setAutoFillBackground ( true ); QVBoxLayout *buttonsLayout = new QVBoxLayout; buttonsLayout->addWidget(newOneColorButton); buttonsLayout->addWidget(neededColorButton); buttonsLayout->addWidget(workedColorButton); buttonsLayout->addWidget(confirmedColorButton); buttonsLayout->addWidget(defaultColorButton); setLayout(buttonsLayout); connect(newOneColorButton, SIGNAL(clicked()), this, SLOT(slotNewOneColorButtonClicked()) ); connect(neededColorButton, SIGNAL(clicked()), this, SLOT(slotNeededColorButtonClicked()) ); connect(workedColorButton, SIGNAL(clicked()), this, SLOT(slotWorkedColorButtonClicked()) ); connect(confirmedColorButton, SIGNAL(clicked()), this, SLOT(slotConfirmedColorButtonClicked()) ); connect(defaultColorButton, SIGNAL(clicked()), this, SLOT(slotDefaultColorButtonClicked()) ); setNewOneColor("#FF0000"); setNeededColor("#FF8C00"); setWorkedColor("#FFD700"); setConfirmedColor("#32CD32"); setDefaultColor("#00BFFF"); } SetupPageColors::~SetupPageColors() {; } void SetupPageColors::slotNewOneColorButtonClicked() { //qDebug() << "SetupPageColors::slotNewOneColorButtonClicked " << endl; QString style = "* { background-color: "; style = style + (giveColor(newOneColorButton->palette().color(QPalette::Button))).name(); style = style + "; }"; newOneColorButton->setStyleSheet(style); } void SetupPageColors::slotNeededColorButtonClicked () { //qDebug() << "SetupPageColors::slotNeededColorButtonClicked " << endl; QString style = "* { background-color: "; style = style + (giveColor(neededColorButton->palette().color(QPalette::Button))).name(); style = style + "; }"; neededColorButton->setStyleSheet(style); } void SetupPageColors::slotWorkedColorButtonClicked () { //qDebug() << "SetupPageColors::slotWorkedColorButtonClicked " << endl; QString style = "* { background-color: "; style = style + (giveColor(workedColorButton->palette().color(QPalette::Button))).name(); style = style + "; }"; workedColorButton->setStyleSheet(style); } void SetupPageColors::slotConfirmedColorButtonClicked () { //qDebug() << "SetupPageColors::slotNeededColorButtonClicked " << endl; QString style = "* { background-color: "; style = style + (giveColor(confirmedColorButton->palette().color(QPalette::Button))).name(); style = style + "; }"; confirmedColorButton->setStyleSheet(style); } void SetupPageColors::slotDefaultColorButtonClicked() { //qDebug() << "SetupPageColors::slotDefaultColorButtonClicked " << endl; QString style = "* { background-color: "; style = style + (giveColor(defaultColorButton->palette().color(QPalette::Button))).name(); style = style + "; }"; defaultColorButton->setStyleSheet(style); } QColor SetupPageColors::giveColor (QColor c) { // Receives the actual color, shows the user a color picker and returns the color that the user selects. QColor colorb; color = c; colorb = color; color = QColorDialog::getColor (color, this, tr("Choose a color")); if (color.isValid ()) { //qDebug() << "SetupPageColors::giveColor valid color: " << color.name() << endl; return color; } else { //qDebug() << "SetupPageColors::giveColor NOT valid color" << endl; return colorb; } } QString SetupPageColors::getNewOneColor() { //qDebug() << "SetupPageColors::getNewOneColor: " << (newOneColorButton->palette().color(QPalette::Button)).name() << endl; return (newOneColorButton->palette().color(QPalette::Button)).name(); } QString SetupPageColors::getNeededColor() { return (neededColorButton->palette().color(QPalette::Button)).name(); } QString SetupPageColors::getWorkedColor() { return (workedColorButton->palette().color(QPalette::Button)).name(); } QString SetupPageColors::getConfirmedColor() { return (confirmedColorButton->palette().color(QPalette::Button)).name(); } QString SetupPageColors::getDefaultColor() { return (defaultColorButton->palette().color(QPalette::Button)).name(); } void SetupPageColors::setNewOneColor(const QString c) { QString style = "* { background-color: "; style = style + c; style = style + "; }"; newOneColorButton->setStyleSheet(style); } void SetupPageColors::setNeededColor(const QString c) { QString style = "* { background-color: "; style = style + c; style = style + "; }"; neededColorButton->setStyleSheet(style); } void SetupPageColors::setWorkedColor(const QString c) { QString style = "* { background-color: "; style = style + c; style = style + "; }"; workedColorButton->setStyleSheet(style); } void SetupPageColors::setConfirmedColor(const QString c) { QString style = "* { background-color: "; style = style + c; style = style + "; }"; confirmedColorButton->setStyleSheet(style); } void SetupPageColors::setDefaultColor(const QString c) { QString style = "* { background-color: "; style = style + c; style = style + "; }"; defaultColorButton->setStyleSheet(style); } klog-0.9.2.2/INSTALL-osx.txt0000644000076700000620000000014412627126144013246 0ustar staffInstalling KLog on a OSX system is easy. Just click and drop the icon into the Applications folder klog-0.9.2.2/helpaboutdialog.h0000644000076700000620000000100012627126144014074 0ustar staff#ifndef HELPABOUTDIALOG_H #define HELPABOUTDIALOG_H //#include #include #include #include class HelpAboutDialog : public QDialog { Q_OBJECT public: HelpAboutDialog(const QString tversion); ~HelpAboutDialog(); private slots: void slotAcceptButtonClicked(); //void slotCancelButtonClicked(); private: void keyPressEvent(QKeyEvent *event); QTextBrowser *textBrowser; }; #endif // HELPABOUTDIALOG_H klog-0.9.2.2/setuppagelogs.h0000644000076700000620000001113712627126144013627 0ustar staff#ifndef SETUPPAGELOGS_H #define SETUPPAGELOGS_H /*************************************************************************** setuppagelogs.h - description ------------------- begin : feb 2012 copyright : (C) 2012 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include #include #include "dataproxy.h" #include "dataproxy_sqlite.h" #include "setuppagelogsnew.h" const int CONTEST_DX = 0; const int CONTEST_CQ_WW_SSB = 1; const int CONTEST_CQ_WW_CW = 2; const int CONTEST_CQ_WPX_SSB = 3; const int CONTEST_CQ_WPX_CW = 4; class SetupPageLogs : public QWidget { Q_OBJECT public: SetupPageLogs(QWidget *parent=0); ~SetupPageLogs(); int getSelectedLog(); void setSelectedLog(const int _i); /* QString getBands(); // 10m, 12m, 15m QString getModes(); //ssb, CW void setActiveBands(QStringList q); void setActiveModes(QStringList q); */ private slots: /* void slotBandActiveItemDoubleClicked ( QListWidgetItem * item ); void slotBandNotActiveItemDoubleClicked ( QListWidgetItem * item ); void slotBandSelButtonClicked( ); void slotBandUnSelButtonClicked( ); void slotModeSelButtonClicked( ); void slotModeUnSelButtonClicked( ); */ void slotNewButtonClicked(); void slotEditButtonClicked(); void slotRemoveButtonClicked(); void slotAnalyzeNewLogData(const QStringList _qs); void slotLogSelected(const QModelIndex & index); void slotLogDoubleClicked(const QModelIndex & index); //void slotCreateLog(); // signals: //void exitSignal(const int status); // 1 = OK, -1 = NOK, 2 = Cancel clicked private: //void createActions(); QStringList readLogs(); void createLogsPanel(); void createLogsModel(); void createActions(); //bool addNewLog(const QStringList _qs); void updateSelectedLogs(); void readSelectedLog(const int _i); void showError(const QString _errorC); /* Wizard to create a new log*/ //QWizardPage *createLogTypePage(); //QWizard *newLogWizard; // Wizard to create a new log /*^Wizard to create a new log^*/ QSqlRelationalTableModel *logsModel; QWidget *logsPanel; QTableView *logsView; QAbstractButton *finishButton; //QWidget *logsWidget; //QTreeWidget *logsQTreeWidget; //QListWidget *bandsNotActiveListWidget, *bandsActiveListWidget; //QListWidget *modesNotActiveListWidget, *modesActiveListWidget; //QStringList bands, modes; QPushButton *newLogPushButton, *editPushButton, *removePushButton; //*loadAllPushButton, *loadSelectedPushButton, *clearPushButton,; int lastLog; QString currentLogComment; QString currentStationCallSign; QComboBox *currentLogs; QStringList logsAvailable; SetupPageLogsNew *newLog; QString stationCallsign, operators, comment, dateString, typeContest; int contestCatMode, contestCatOperators, contestCatAssisted, contestCatPower, contestCatBands, contestBands, typeContestN; DataProxy *dataProxy; }; #endif // SETUPPAGELOGS_H klog-0.9.2.2/setupdialog.cpp0000644000076700000620000010512512627126144013621 0ustar staff/*************************************************************************** setupdialog.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "setupdialog.h" #include /* This class calls all the othet "Setup..." to manage the configuration */ SetupDialog::SetupDialog(const bool _firstTime) { //qDebug() << "SetupDialog::SetupDialog 1" << endl; util = new Utilities; nolog = true; configFileName = "klogrc"; version = "."; pageRequested = 0; //qDebug() << "SetupDialog::SetupDialog 2" << endl; dataProxy = new DataProxy_SQLite(); //qDebug() << "SetupDialog::SetupDialog 3" << endl; firstTime = _firstTime; if (firstTime) { //qDebug() << "SetupDialog::SetupDialog FIRST TIME = TRUE" << endl; } else { //qDebug() << "SetupDialog::SetupDialog FIRST TIME = FALSE" << endl; } //qDebug() << "SetupDialog::SetupDialog 3.1" << endl; logsPageTabN=-1; //qDebug() << "SetupDialog::SetupDialog 3.2" << endl; locator = new Locator(); //qDebug() << "SetupDialog::SetupDialog 3.3" << endl; tabWidget = new QTabWidget; //qDebug() << "SetupDialog::SetupDialog 3.4" << endl; userDataPage = new SetupPageUserDataPage(); //qDebug() << "SetupDialog::SetupDialog 3.5" << endl; bandsModesPage = new SetupPageBandsModes(this); //qDebug() << "SetupDialog::SetupDialog 3.6" << endl; dxClusterPage = new SetupPageDxCluster(this); //qDebug() << "SetupDialog::SetupDialog 3.7" << endl; colorsPage = new SetupPageColors(this); //qDebug() << "SetupDialog::SetupDialog 3.8" << endl; miscPage = new SetupPageMisc(this); //qDebug() << "SetupDialog::SetupDialog 3.9" << endl; worldEditorPage = new SetupPageWorldEditor (this); //qDebug() << "SetupDialog::SetupDialog 3.10" << endl; logsPage = new SetupPageLogs(this); //qDebug() << "SetupDialog::SetupDialog 3.11" << endl; clubLogPage = new SetupPageClubLog(this); //qDebug() << "SetupDialog::SetupDialog 3.12" << endl; //qDebug() << "SetupDialog::SetupDialog 4" << endl; tabWidget->addTab(userDataPage, tr("My Data")); tabWidget->addTab(bandsModesPage, tr("Bands/Modes")); tabWidget->addTab(dxClusterPage, tr("DX-Cluster")); tabWidget->addTab(colorsPage, tr("Colors")); tabWidget->addTab(miscPage, tr("Misc")); tabWidget->addTab(worldEditorPage, tr("World Editor")); logsPageTabN = tabWidget->addTab(logsPage, tr("Logs")); tabWidget->addTab(clubLogPage, tr("ClubLog")); QPushButton *closeButton = new QPushButton(tr("Cancel")); QPushButton *okButton = new QPushButton(tr("OK")); connect(closeButton, SIGNAL(clicked()), this, SLOT(slotCancelButtonClicked())); connect(okButton, SIGNAL(clicked()), this, SLOT(slotOkButtonClicked())); QHBoxLayout *horizontalLayout = new QHBoxLayout; horizontalLayout->addWidget(tabWidget); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(1); buttonsLayout->addWidget(okButton); buttonsLayout->addWidget(closeButton); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(horizontalLayout); mainLayout->addLayout(buttonsLayout); setLayout(mainLayout); setWindowTitle(tr("Config Dialog")); slotReadConfigData(); if ((pageRequested==6) && (logsPageTabN>0))// The user is opening a new log { tabWidget->setCurrentIndex(logsPageTabN); } nolog = !(haveAtleastOneLog()); //qDebug() << "SetupDialog::SetupDialog END" << endl; } SetupDialog::SetupDialog(const QString _configFile, const QString _softwareVersion, const int _page, const bool _firstTime) { //qDebug() << "SetupDialog::SetupDialog 2" << endl; util = new Utilities; firstTime = _firstTime; dataProxy = new DataProxy_SQLite(); configFileName = _configFile; version = _softwareVersion; pageRequested = _page; int logsPageTabN=-1; locator = new Locator(); tabWidget = new QTabWidget; userDataPage = new SetupPageUserDataPage(); bandsModesPage = new SetupPageBandsModes(this); dxClusterPage = new SetupPageDxCluster(this); colorsPage = new SetupPageColors(this); miscPage = new SetupPageMisc(this); worldEditorPage = new SetupPageWorldEditor (this); logsPage = new SetupPageLogs(this); clubLogPage = new SetupPageClubLog(this); tabWidget->addTab(userDataPage, tr("User data")); tabWidget->addTab(bandsModesPage, tr("Bands/Modes")); tabWidget->addTab(dxClusterPage, tr("D&X-Cluster")); tabWidget->addTab(colorsPage, tr("Colors")); tabWidget->addTab(miscPage, tr("Misc")); tabWidget->addTab(worldEditorPage, tr("World Editor")); logsPageTabN = tabWidget->addTab(logsPage, tr("Logs")); tabWidget->addTab(clubLogPage, tr("ClubLog")); QPushButton *closeButton = new QPushButton(tr("Cancel")); QPushButton *okButton = new QPushButton(tr("OK")); connect(closeButton, SIGNAL(clicked()), this, SLOT(slotCancelButtonClicked())); connect(okButton, SIGNAL(clicked()), this, SLOT(slotOkButtonClicked())); QHBoxLayout *horizontalLayout = new QHBoxLayout; horizontalLayout->addWidget(tabWidget); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(1); buttonsLayout->addWidget(okButton); buttonsLayout->addWidget(closeButton); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(horizontalLayout); mainLayout->addLayout(buttonsLayout); setLayout(mainLayout); setWindowTitle(tr("Config Dialog")); slotReadConfigData(); if ((pageRequested==6) && (logsPageTabN>0))// The user is opening a new log { tabWidget->setCurrentIndex(logsPageTabN); } nolog = !(haveAtleastOneLog()); } SetupDialog::~SetupDialog() { //qDebug() << "SetupDialog::~SetupDialog " << endl; } void SetupDialog::setData(const QString _configFile, const QString _softwareVersion, const int _page, const bool _firstTime) { //qDebug() << "SetupDialog::setData: " << QString::number(_page) << endl; nolog = !(haveAtleastOneLog()); firstTime = _firstTime; if (firstTime) { //qDebug() << "SetupDialog::setData FIRST TIME! " << endl; } else { //qDebug() << "SetupDialog::setData NOT FIRST TIME! " << endl; } setConfigFile(_configFile); setSoftVersion(_softwareVersion); setPage(_page); //removeBandModeDuplicates(); } void SetupDialog::setConfigFile(const QString _configFile) { //qDebug() << "SetupDialog::setConfigFile" << endl; configFileName = _configFile; } void SetupDialog::setSoftVersion(const QString _softwareVersion) { //qDebug() << "SetupDialog::setSoftVersion" << endl; version = _softwareVersion; } void SetupDialog::setPage(const int _page) { //qDebug() << "SetupDialog::setPage("<0))// The user is opening a new log { tabWidget->setCurrentIndex(pageRequested); } } void SetupDialog::slotCancelButtonClicked() { //qDebug() << "SetupDialog::slotCancelButtonClicked" << endl; if (firstTime || nolog) { if (nolog) { QMessageBox msgBox; msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("You need to enter at least one log in the Log's tab.")); msgBox.exec(); return; } emit exitSignal(2); } // close(); } void SetupDialog::createIcons() { //qDebug() << "SetupDialog::createIcons" << endl; QListWidgetItem *configButton = new QListWidgetItem(contentsWidget); configButton->setIcon(QIcon(":/images/config.png")); configButton->setText(tr("User data")); configButton->setTextAlignment(Qt::AlignHCenter); configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QListWidgetItem *logsButton = new QListWidgetItem(contentsWidget); logsButton->setIcon(QIcon(":/images/config.png")); logsButton->setText(tr("Logs")); logsButton->setTextAlignment(Qt::AlignHCenter); logsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QListWidgetItem *bandsButton = new QListWidgetItem(contentsWidget); bandsButton->setIcon(QIcon(":/images/query.png")); bandsButton->setText(tr("Bands/Modes")); bandsButton->setTextAlignment(Qt::AlignHCenter); bandsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QListWidgetItem *dxClusterButton = new QListWidgetItem(contentsWidget); dxClusterButton->setIcon(QIcon(":/images/query.png")); dxClusterButton->setText(tr("DX-Cluster")); dxClusterButton->setTextAlignment(Qt::AlignHCenter); dxClusterButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QListWidgetItem *colorsButton = new QListWidgetItem(contentsWidget); colorsButton->setIcon(QIcon(":/images/query.png")); colorsButton->setText(tr("Colors")); colorsButton->setTextAlignment(Qt::AlignHCenter); colorsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QListWidgetItem *miscButton = new QListWidgetItem(contentsWidget); miscButton->setIcon(QIcon(":/images/query.png")); miscButton->setText(tr("Misc")); miscButton->setTextAlignment(Qt::AlignHCenter); miscButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QListWidgetItem *worldButton = new QListWidgetItem(contentsWidget); worldButton->setIcon(QIcon(":/images/query.png")); worldButton->setText(tr("World")); worldButton->setTextAlignment(Qt::AlignHCenter); worldButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); connect(contentsWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*))); } void SetupDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) { //qDebug() << "SetupDialog::changePage" << endl; if (!current) current = previous; pagesWidget->setCurrentIndex(contentsWidget->row(current)); } void SetupDialog::slotOkButtonClicked() { //qDebug() << "SetupDialog::slotOkButonClicked" << endl; if ((userDataPage->getStationQrz()).length() < 3){ // There are no valid calls with less than 3 Chars QMessageBox msgBox; msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("You need to enter at least a valid QRZ.")); msgBox.exec(); return; } if (!haveAtleastOneLog()) { //qDebug() << "SetupDialog::slotOkButonClicked - NO LOG!" << endl; QMessageBox msgBox; msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("You have not selected the kind of log you want.\nYou will be redirected to the Log tab.\nPlease add and select the kind of log you want to use.")); msgBox.exec(); tabWidget->setCurrentIndex(logsPageTabN); return; } QFile file (configFileName); QString tmp; tmp = "true"; if (file.open (QIODevice::WriteOnly)){ QTextStream stream (&file); /*QString stationCall; int contest; int contestCategory; int modes;*/ //QRZ/CQ/ITU/CONTEST stream << "version=" << version << ";" << endl; stream << "callsign=" << userDataPage->getStationQrz() << ";" << endl; if ((userDataPage->getOperators()).length() >= 3){ // There are no valid calls with less than 3 Chars stream << "operators=" << userDataPage->getOperators() << ";" << endl; } //stream << "contest=" << userDataPage->getContest() << ";" << endl; //stream << "contestcategory=" << userDataPage->getContestCategory() << ";" << endl; stream << "cqz=" << QString::number(userDataPage->getCQz()) << ";" << endl; stream << "ituz=" << QString::number(userDataPage->getITUz()) << ";" << endl; if ( locator->isValidLocator(userDataPage->getStationLocator()) ) { stream << "StationLocator=" << userDataPage->getStationLocator() << ";" << endl; } if ((!(userDataPage->getName()).isNull()) && ( (userDataPage->getName()).length() > 0 )) { stream << "Name=" << userDataPage->getName() <<";" << endl; } if ((!(userDataPage->getAddress1()).isNull()) && ( (userDataPage->getAddress1()).length() > 0 )) { stream << "Address1=" << userDataPage->getAddress1() <<";" << endl; } if ((!(userDataPage->getAddress2()).isNull()) && ( (userDataPage->getAddress2()).length() > 0 )) { stream << "Address2=" << userDataPage->getAddress2() <<";" << endl; } if ((!(userDataPage->getAddress3()).isNull()) && ( (userDataPage->getAddress3()).length() > 0 )) { stream << "Address3=" << userDataPage->getAddress3() <<";" << endl; } if ((!(userDataPage->getAddress4()).isNull()) && ( (userDataPage->getAddress4()).length() > 0 )) { stream << "Address4=" << userDataPage->getAddress4() <<";" << endl; } if ((!(userDataPage->getCity()).isNull()) && ( (userDataPage->getCity()).length() > 0 )) { stream << "City=" << userDataPage->getCity() <<";" << endl; } if ((!(userDataPage->getZipCode()).isNull()) && ( (userDataPage->getZipCode()).length() > 0 )) { stream << "ZipCode=" << userDataPage->getZipCode() <<";" << endl; } if ((!(userDataPage->getProvince()).isNull()) && ( (userDataPage->getProvince()).length() > 0 )) { stream << "ProvinceState=" << userDataPage->getProvince() <<";" << endl; } if ((!(userDataPage->getCountry()).isNull()) && ( (userDataPage->getCountry()).length() > 0 )) { stream << "Country=" << userDataPage->getCountry() <<";" << endl; } if ((!(userDataPage->getRig1()).isNull()) && ( (userDataPage->getRig1()).length() > 0 )) { stream << "Rig1=" << userDataPage->getRig1() <<";" << endl; } if ((!(userDataPage->getRig2()).isNull()) && ( (userDataPage->getRig2()).length() > 0 )) { stream << "Rig2=" << userDataPage->getRig2() <<";" << endl; } if ((!(userDataPage->getRig3()).isNull()) && ( (userDataPage->getRig3()).length() > 0 )) { stream << "Rig3=" << userDataPage->getRig3() <<";" << endl; } if ((!(userDataPage->getAntenna1()).isNull()) && ( (userDataPage->getAntenna1()).length() > 0 )) { stream << "Antenna1=" << userDataPage->getAntenna1() <<";" << endl; } if ((!(userDataPage->getAntenna2()).isNull()) && ( (userDataPage->getAntenna2()).length() > 0 )) { stream << "Antenna2=" << userDataPage->getAntenna2() <<";" << endl; } if ((!(userDataPage->getAntenna3()).isNull()) && ( (userDataPage->getAntenna2()).length() > 0 )) { stream << "Antenna3=" << userDataPage->getAntenna3() <<";" << endl; } if ((userDataPage->getPower()).toFloat()>=0) { stream << "Power=" << userDataPage->getPower() << ";" << endl; } //stream << "locator=" << (MyLocatorkLineEdit->text ()).toUpper () << ";" << endl; //stream << "CallUsed=" << (UserDataPage.qrzLineEdit).text() << ";" << endl; //stream << "Operators=" << ";" << endl; stream << "Bands=" << bandsModesPage->getBands() << ";" << endl; stream << "Modes=" << bandsModesPage->getModes() << ";" << endl; //stream << "InMemory=" << miscPage->getInMemory() << ";" << endl; stream << "RealTime=" << miscPage->getRealTime() << ";" << endl; stream << "UTCTime=" << miscPage->getUTCTime() << ";" << endl; stream << "AlwaysADIF=" << miscPage->getAlwaysADIF() << ";" << endl; stream << "UseDefaultName=" << miscPage->getUseDefaultName() << ";" << endl; stream << "DefaultADIFFile=" << miscPage->getDefaultFileName() << ";" << endl; stream << "ImperialSystem=" << miscPage->getImperial() << ";" << endl; stream << "SendQSLWhenRec=" << miscPage->getSendQSLWhenRec() << ";" << endl; stream << "ShowCallsignInSearch=" << miscPage->getShowStationCallSignInSearch() << ";" << endl; stream << "KeepMyData=" << miscPage->getKeepMyData() << ";" << endl; stream << "CompleteWithPrevious=" << miscPage->getCompleteWithPrevious() << ";" << endl; if ((!(dxClusterPage->getSelectedDxClusterServer()).isNull()) && ( (dxClusterPage->getSelectedDxClusterServer()).length() > 0 )) { stream << "DXClusterServerToUse=" << dxClusterPage->getSelectedDxClusterServer() <<";" << endl; } QStringList stringList; stringList.clear(); stringList << dxClusterPage->getDxclusterServersComboBox(); if (stringList.size()>0) { for (int i = 0; i < stringList.size(); i++) { stream << "DXClusterServerPort="<< stringList.at(i) << ";" << endl; } } stream << "DXClusterShowHF=" << dxClusterPage->getShowHFRadiobutton() << ";" << endl; stream << "DXClusterShowVHF=" << dxClusterPage->getShowVHFRadiobutton() << ";" << endl; stream << "DXClusterShowWARC=" << dxClusterPage->getShowWARCRadiobutton() << ";" << endl; stream << "DXClusterShowWorked=" << dxClusterPage->getShowWorkedRadiobutton() << ";" << endl; stream << "DXClusterShowConfirmed=" << dxClusterPage->getShowConfirmedRadiobutton() << ";" << endl; stream << "DXClusterShowAnn=" << dxClusterPage->getShowANNRadiobutton() << ";" << endl; stream << "DXClusterShowWWV=" << dxClusterPage->getShowWWVRadiobutton() << ";" << endl; stream << "DXClusterShowWCY=" << dxClusterPage->getShowWCYRadiobutton() << ";" << endl; stream << "NewOneColor=" << colorsPage->getNewOneColor() << ";" << endl; stream << "NeededColor=" << colorsPage->getNeededColor() << ";" << endl; stream << "WorkedColor=" << colorsPage->getWorkedColor() << ";" << endl; stream << "ConfirmedColor=" << colorsPage->getConfirmedColor() << ";" << endl; stream << "DefaultColor=" << colorsPage->getDefaultColor() << ";" << endl; stream << "SelectedLog=" << QString::number(logsPage->getSelectedLog()) << ";" << endl; // CLUBLOG if ((clubLogPage->getClubLog()).toUpper() == "TRUE" ) { stream << "ClubLogActive=" << clubLogPage->getClubLog() << ";" << endl; stream << "ClubLogRealTime=" << clubLogPage->getClubLogRealTime() << ";" << endl; stream << "ClubLogCall=" << clubLogPage->getCallsign() << ";" << endl; stream << "ClubLogPass=" << clubLogPage->getPassword() << ";" << endl; stream << "ClubLogEmail=" << clubLogPage->getEmail() << ";" << endl; stream << "ClubLogUseStationCallsign=" << clubLogPage->getUseQSOStationCallsign() << ";" << endl; } // CLUBLOG file.close (); } QDialog::accept(); //close(); } void SetupDialog::slotReadConfigData() { //qDebug() << "SetupDialog::slotReadConfigData" << endl; if (firstTime) { setDefaults(); bands.removeDuplicates(); modes.removeDuplicates(); bandsModesPage->setActiveModes(modes); bandsModesPage->setActiveBands(bands); } QFile file(configFileName); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ //qDebug() << "SetupDialog::slotReadConfigData() File not found" << configFileName << endl; //firstTime = true; return; } //dxClusterServers.clear(); while (!file.atEnd()) { QByteArray line = file.readLine(); processConfigLine(line); } dxClusterPage->setDxclusterServersComboBox(dxClusterServers); dxClusterPage->setSelectedDxClusterServer(dxClusterServerToUse); if (modes.isEmpty()) { modes << "SSB" << "CW" << "RTTY"; } if (bands.isEmpty()) { bands << "10M" << "12M" << "15M" << "17M" << "20M" << "40M" << "80M" << "160M"; } int a = modes.removeDuplicates(); //qDebug() << "SetupDialog::slotReadConfigData - duplicate modes: " << QString::number(a) << endl; bandsModesPage->setActiveModes(modes); a = bands.removeDuplicates(); //qDebug() << "SetupDialog::slotReadConfigData - duplicate bands: " << QString::number(a) << endl; bandsModesPage->setActiveBands(bands); } bool SetupDialog::processConfigLine(const QString _line) { //qDebug() << "SetupDialog::processConfigLine: " << _line << endl; QString line = _line.simplified(); //line.simplified(); int i = 0; //aux variable QStringList values = line.split("=", QString::SkipEmptyParts); QString tab = QString(); if (line.startsWith('#')){ //qDebug() << "SetupDialog::processConfigLine: Comment Line!" << endl; return true; } if (!( (line.contains('=')) && (line.contains(';')))){ //qDebug() << "SetupDialog::processConfigLine: Wrong Line!" << endl; return false; } QString value = values.at(1); tab = (values.at(0)).toUpper(); int endValue = value.indexOf(';'); if (endValue>-1){ value = value.left(value.length() - (value.length() - endValue)); } value = checkAndFixASCIIinADIF(value); // Check whether the value is valid. if (tab == "CALLSIGN"){ //qDebug() << "SetupDialog::processConfigLine: CALLSIGN: " << value << endl; userDataPage->setStationQrz(value); }else if (tab == "OPERATORS"){ userDataPage->setOperators(value); }else if (tab=="CQZ"){ userDataPage->setCQz((value).toInt()); }else if (tab=="ITUZ"){ userDataPage->setITUz((value).toInt()); }else if (tab=="CONTEST"){ //userDataPage->setContest(value); }else if (tab=="MODES"){ readActiveModes(value); modes.removeDuplicates(); bandsModesPage->setActiveModes(modes); }else if (tab=="BANDS"){ readActiveBands(value); bands.removeDuplicates(); bandsModesPage->setActiveBands(bands); //}else if (tab=="INMEMORY"){ // miscPage->setInMemory(value); }else if (tab=="REALTIME"){ miscPage->setRealTime(value); }else if (tab=="UTCTIME"){ miscPage->setUTCTime(value); }else if (tab=="ALWAYSADIF"){ miscPage->setAlwaysADIF(value); }else if (tab=="USEDEFAULTNAME"){ miscPage->setDefaultFileName(value); }else if (tab=="DEFAULTADIFFILE"){ miscPage->setDefaultFileName(value.toLower()); }else if (tab=="IMPERIALSYSTEM"){ miscPage->setImperial(value.toLower()); }else if (tab=="KEEPMYDATA"){ miscPage->setKeepMyData(value.toLower()); }else if (tab=="COMPLETEWITHPREVIOUS"){ miscPage->setCompleteWithPrevious(value.toLower()); }else if (tab=="SENDQSLWHENREC"){ miscPage->setSendQSLWhenRec(value.toLower()); } else if (tab=="SHOWCALLSIGNINSEARCH"){ miscPage->setShowStationCallSignInSearch(value.toLower()); } else if (tab =="NAME") { userDataPage->setName(value); } else if (tab =="ADDRESS1") { userDataPage->setAddress1(value); } else if (tab =="ADDRESS2") { userDataPage->setAddress2(value); } else if (tab =="ADDRESS3") { userDataPage->setAddress3(value); } else if (tab =="ADDRESS4") { userDataPage->setAddress4(value); } else if (tab =="CITY") { userDataPage->setCity(value); } else if (tab =="ZIPCODE") { userDataPage->setZipCode(value); } else if (tab =="PROVINCESTATE") { userDataPage->setProvince(value); } else if (tab =="COUNTRY") { userDataPage->setCountry(value); } else if (tab =="POWER") { userDataPage->setPower(value); } else if (tab =="RIG1") { userDataPage->setRig1(value); } else if (tab =="RIG2") { userDataPage->setRig2(value); } else if (tab =="RIG3") { userDataPage->setRig3(value); } else if (tab =="ANTENNA1") { userDataPage->setAntenna1(value); } else if (tab =="ANTENNA2") { userDataPage->setAntenna2(value); } else if (tab =="ANTENNA3") { userDataPage->setAntenna3(value); } else if (tab =="STATIONLOCATOR"){ if ( locator->isValidLocator(value) ) { userDataPage->setStationLocator(value); } }else if (tab =="DXCLUSTERSHOWHF"){ dxClusterPage->setShowHFRadiobutton(value); }else if (tab =="DXCLUSTERSHOWVHF"){ dxClusterPage->setShowVHFRadiobutton(value); }else if (tab =="DXCLUSTERSHOWWARC"){ dxClusterPage->setShowWARCRadiobutton(value); }else if (tab =="DXCLUSTERSHOWWORKED"){ dxClusterPage->setShowWorkedRadiobutton(value); }else if (tab =="DXCLUSTERSHOWCONFIRMED"){ dxClusterPage->setShowConfirmedRadiobutton(value); }else if (tab =="DXCLUSTERSHOWANN"){ dxClusterPage->setShowANNRadiobutton(value); }else if (tab =="DXCLUSTERSHOWWWV"){ dxClusterPage->setShowWWVRadiobutton(value); }else if (tab =="DXCLUSTERSHOWWCY"){ dxClusterPage->setShowWCYRadiobutton(value); }else if(tab =="DXCLUSTERSERVERPORT"){ dxClusterServers << value; //qDebug() << "SetupDialog::processConfigLine: dxClusterServers: " << dxClusterServers.last() << endl; }else if (tab =="DXCLUSTERSERVERTOUSE"){ dxClusterServerToUse=value; } else if(tab =="NEWONECOLOR"){ colorsPage->setNewOneColor(value); }else if(tab =="NEEDEDCOLOR"){ colorsPage->setNeededColor(value); }else if(tab =="WORKEDCOLOR"){ colorsPage->setWorkedColor(value); }else if(tab =="CONFIRMEDCOLOR"){ colorsPage->setConfirmedColor(value); }else if(tab =="DEFAULTCOLOR"){ colorsPage->setDefaultColor(value); }else if(tab =="SELECTEDLOG"){ i = value.toInt(); if (dataProxy->doesThisLogExist(i)) { } else { i = 1; while(!dataProxy->doesThisLogExist(i)) { i++; } } logsPage->setSelectedLog(i); }else if(tab =="CLUBLOGACTIVE"){ clubLogPage->setClubLog(value); } else if(tab =="CLUBLOGREALTIME"){ clubLogPage->setClubLogRealTime(value); } else if(tab =="CLUBLOGCALL"){ clubLogPage->setCallsign(value); } else if(tab =="CLUBLOGPASS"){ clubLogPage->setPassword(value); } else if(tab =="CLUBLOGEMAIL"){ clubLogPage->setEmail(value); } else if(tab =="CLUBLOGUSESTATIONCALLSIGN"){ clubLogPage->setUseStationCall(value); }else{ //qDebug() << "SetupDialog::processConfigLine: NONE: " << endl; } // Lines are: Option = value; return true; } void SetupDialog::readActiveBands (const QString actives) { // Checks a "10m, 12m" QString, checks if they are valid bands and import to the // bands used in the program //qDebug() << "SetupDialog::readActiveBands: " << actives << endl; bool atLeastOne = false; QStringList values = actives.split(", ", QString::SkipEmptyParts); QStringList _abands; for (int i = 0; i < values.size() ; i++) { if (isValidBand(values.at(i))) { if (!atLeastOne) { //qDebug() << "SetupDialog::readActiveBands (at least One!): " << values.at(i) << endl; atLeastOne = true; _abands.clear(); } _abands << values.at(i); //qDebug() << "SetupDialog::readActiveBands: " << values.at(i) << endl; } } bands.clear(); _abands.removeDuplicates(); bands << dataProxy->getBandsInLog(-1); bands << _abands; bands.removeDuplicates(); } void SetupDialog::readActiveModes (const QString actives) { //qDebug() << "SetupDialog::readActiveModes: " << actives << endl; bool atLeastOne = false; QStringList _amodes;//, _backModes; // _backModes.clear(); // _backModes << modes; QStringList values = actives.split(", ", QString::SkipEmptyParts); values.removeDuplicates(); for (int i = 0; i < values.size() ; i++) { if (isValidMode(values.at(i))) { if (!atLeastOne) { atLeastOne = true; _amodes.clear(); } _amodes << values.at(i); } } modes.clear(); modes << dataProxy->getModesInLog(-1); modes << _amodes; modes.removeDuplicates(); //qDebug() << "SetupDialog::readActiveModes: " << modes.join(" / ") << endl; } bool SetupDialog::isValidBand (const QString b) { //qDebug() << "SetupDialog::isValidBand: "<< b << endl; QString stringQuery = QString("SELECT id FROM band WHERE name='%1'").arg(b); QSqlQuery query(stringQuery); query.next(); return query.isValid(); } bool SetupDialog::isValidMode (const QString b) { //qDebug() << "SetupDialog::isValidMode: " << b << endl; QString stringQuery = QString("SELECT id FROM mode WHERE name='%1'").arg(b); QSqlQuery query(stringQuery); query.next(); return query.isValid(); } void SetupDialog::setDefaults() { //qDebug() << "SetupDialog::setDefaults" << endl; //miscPage->setInMemory("TRUE"); miscPage->setRealTime("TRUE"); miscPage->setUTCTime("TRUE"); miscPage->setImperial("FALSE"); //Metric system is the default miscPage->setAlwaysADIF("FALSE"); miscPage->setSendQSLWhenRec("TRUE"); miscPage->setShowStationCallSignInSearch("TRUE"); miscPage->setKeepMyData("TRUE"); dxClusterPage->setShowHFRadiobutton("TRUE"); dxClusterPage->setShowVHFRadiobutton("TRUE"); dxClusterPage->setShowWARCRadiobutton("TRUE"); dxClusterPage->setShowWorkedRadiobutton("TRUE"); dxClusterPage->setShowConfirmedRadiobutton("TRUE"); dxClusterPage->setShowANNRadiobutton("TRUE"); dxClusterPage->setShowWWVRadiobutton("TRUE"); dxClusterPage->setShowWCYRadiobutton("TRUE"); dxClusterServers.clear(); dxClusterServers.append("dxfun.com:8000"); dxClusterServerToUse = "dxfun.com:8000"; if (modes.isEmpty()) { modes << "SSB" << "CW" << "RTTY"; modes.removeDuplicates(); } if (bands.isEmpty()) { bands << "10M" << "12M" << "15M" << "17M" << "20M" << "40M" << "80M" << "160M"; bands.removeDuplicates(); } } QString SetupDialog::checkAndFixASCIIinADIF(const QString _data) { //qDebug() << "SetupDialog::checkAndFixASCIIinADIF " << _data << endl; //TODO: this function is also in the FileManager class. Maybe I should call that one and keep just one copy ushort unicodeVal; QString st = _data; QString newString; newString.clear(); for(int i=0; i < st.length(); i++) { // Get unicode VALUE into unicodeVal unicodeVal = (st.at(i)).unicode(); if ((20 <= unicodeVal ) && (unicodeVal <= 126)) { newString.append(st.at(i)); } //qDebug() << "SetupDialog::checkAndFixunicodeinADIF: " << st.at(i) <<" = " << QString::number(unicodeVal) << endl; } // Show into another lineEdit return newString; } bool SetupDialog::haveAtleastOneLog() { return dataProxy->haveAtLeastOneLog(); } void SetupDialog::setClubLogActive(const bool _b) { if (_b == true) { clubLogPage->setClubLog("True"); } else { clubLogPage->setClubLog("False"); } } void SetupDialog::checkIfNewBandOrMode() { //qDebug() << "SetupDialog::checkIfNewBandOrMode " << endl; QStringList _items; _items.clear(); //qDebug() << "SetupDialog::checkIfNewBandOrMode -1" << endl; _items << dataProxy->getBandsInLog(-1); //qDebug() << "SetupDialog::checkIfNewBandOrMode -2" << endl; _items << (bandsModesPage->getBands()).split(", ", QString::SkipEmptyParts); //qDebug() << "SetupDialog::checkIfNewBandOrMode -3" << endl; _items.removeDuplicates(); //qDebug() << "SetupDialog::checkIfNewBandOrMode -4" << endl; bandsModesPage->setActiveBands(_items); //qDebug() << "SetupDialog::checkIfNewBandOrMode -5" << endl; _items.clear(); _items << dataProxy->getModesInLog(-1); _items << (bandsModesPage->getModes()).split(", ", QString::SkipEmptyParts); _items.removeDuplicates(); bandsModesPage->setActiveModes(_items); //qDebug() << "SetupDialog::checkIfNewBandOrMode END" << endl; } klog-0.9.2.2/translations/0000755000076700000620000000000012627374301013312 5ustar staffklog-0.9.2.2/translations/klog_ca.ts0000644000076700000620000051565612627126144015303 0ustar staff CTYPage Descargar datos de entidades Descarregar dades d''entitats Country data download Descarregar dades d''entitats KLog needs the country data... Kontest needs the country data... KLog necessita les dades de les entitats ... &Download &Descàrrega &Ignore &Ignorar Country data needed KLog uses the CTY.CSV file (from http://www.country-files.com/) to get the DXCC information. You need to download the cty.csv file if you want KLog to show you the countries, locator, ... of the QSO you do. Click on Download to download just now. KLog KLog Kontest Kontest I can't find the host. Please check your network and try again Do you want to try again? No es pot trobar la màquina. Revisi la configuració de xarxa i provi de nou Vol tornar-ho a intentar? DXClusterWidget Connect Connectar Clear Netejar Click on connect to connect to the DX-Cluster Premi Connectar per connectar al DX-Cluster Trying to connect to the server Intentant connectar amb el servidor KLog DXCluster Kontest DXCluster DXCluster del KLog The host was not found. Please check the host name and port settings. Màquina no trobada. Revisa el nom de la màquina i el port Click on Connect to connect to the DX-Cluster server Premi en Connectar per connectar al servidor de DX-Cluster The host was not found. Please check: - your network connection; - the host name and port settings. Màquina no trobada. Per favor revisi: - la connexió de xarxa - el nom i port de la màquina. The connection was refused by the peer. Make sure the DXCluster server is running, and check that the host name and port settings are correct. La connexió ha estat rebutjada pel servidor. Asseguri's que el servidor de DXCluster està executant-se i comprovi el nom de la màquina i el port. The following error occurred: %1. El següent error ha tingut lloc: %1. Connected to server Connectat al servidor KLog message Kontest message Missatge de KLog Enter your callsign to connect to the cluster: Introdueixi el seu indicatiu per connectar al cluster: Enter your password to connect to the cluster: (Just hit enter for no password) Introdueixi la seva contrasenya per connectar al cluster: (premi enter si no hi ha contrasenya) Enter your password to connect to the cluster: Introdueixi la seva contrasenya per connectar al cluster: Disconnect Desconnectar Not logged on, you may to enter your callsign again. No identificat, pot introduir la seva contrasenya de nou. Enter here the commands to be sent to the DX-Cluster server Introdueixi aquí les ordres a enviar al servidor de DX-Cluster Connection closed by the server Connexió tancada pel servidor Send Enviar DownLoadCTY Download of the CTY.CSV failed with the following error code: La descàrrega de CTY.CSV ha fallat amb el següent codi d'error: Download of the CTY.CSV done. Descàrrega de CTY.csv completada There is already a CTY.CSV file in the folder but it will be replaced with the new one. Ja hi ha un CTY.CSV a la carpeta però serà reemplaçat pel nou. Could not open No s'ha pogut obrir for writing. Per escriure FileManager Reading ADIF file... Llegint fitxer ADIF... Abort reading Cancel·lar lectura Reading ADIF file... QSO: Llegint fitxer ADIF... QSO: Writing ADIF file... Escrivint fitxer ADIF... Abort writing Cancel·lar lectura Writing ADIF file... QSO: Escrivint fitxer ADIF... QSO: Writing Cabrillo file... Escrivint fitxer Cabrillo ... KLog: Cabrillo Log Export not implemented Kontest: Cabrillo Log Export not implemented KLog: L'exportació del log en format Cabrillo no està implementada I am sorry but the Cabrillo Export To File feature has still not been implemented. Ho sentim però la funció d'exportar Cabrillo encara no està implementada. There are more than one log in this logfile. All logs will be imported in the current log. Do you want to continue? Hi ha més d'un log en aquest fitxer. Tots els logs s'importaran en el log actual. Vol continuar? Importing ADIF file... QSO: Important fitxer ADIF... QSO: 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) Sembla que hi ha alguns QSO duplicats en el fitxer ADIF que està important. Vol continuar? (Els QSO duplicats no s'importaran) This QSO is not including the minimum data to consider a QSO as valid!. Please edit the ADIF file and make sure that it include at least: CALL, QSO_DATE, TIME_ON, BAND and MODE. This QSO had: Aquest QSO no inclou les dades mínimes per ser considerat vàlid. Si us plau, editi el fitxer ADIF i asseguris que tots els QSO inclouen al menys: CALL, QSO_DATE, TIME_ON, BAND i MODE. Aquest QSO: - The band missing and the following call: El següent indicatiu però sense banda: - The call missing but was done at this time: Li manca l'indicatiu però es va fer a aquesta hora: - The mode missing and the following call: El següent indicatiu però sense modo: - The date missing and the following call: El següent indicatiu però sense la data: - The time missing and the following call: El següent indicatiu però sense l'hora: Do you want to continue with the current file? Vol continuar amb el fitxer actual? KLog: Not all required data found! KLog: No s'han trobat totes les dades necessàries! This QSO is not including the minimum data to consider a QSO as valid!. Please edit the ADIF file and make sure that it include at least: CALL, QSO_DATE, TIME_ON, BAND and MODE. Do you want to continue with the current file? Aquest QSO no inclou les dades mínimes per considerar-se vàlid. Si us plau, editi el fitxer ADIF i asseguri's que tots els QSO inclouen almenys: CALL, QSO_DATE, TIME_ON, BAND i MODE. ¿Vol continuar amb el fitxer actual? This log seems to lack of RST-TX information. Click on Yes to add a default 59 to all QSO with a similar problem. If you select NO, the QSO may not be imported. Aquest log no sembla tenir l'informació de RST TX. Premi en Sí, per afegir un 59 predeterminat a tots els QSO amb un problema similar. Si prem NO, el QSO pot no ser importat. KLog: No RST TX found! KLog: No s'ha trobat *RST *TX! This log seems to lack of RST-RX information. Click on Yes to add a default 59 to all QSO with a similar problem. If you select NO, the QSO may not be imported. Aquest log no sembla tenir l'informació de RST TX. Premi en Sí, per afegir un 59 predeterminat a tots els QSO amb un problema similar. Si prem NO, el QSO pot no ser importat. KLog: No RST RX found! KLog: No s'ha trobat *RST *RX! There are some QSO duplicated in the ADIF file you are importing. Do you want to continue? (Duped QSO will not be imported) Hi ha alguns QSO duplicats en el fitxer ADIF que està important. Vol continuar? (Els QSO duplicats no s'importaran) An unexpected error ocurred while importing. Please send this code to the developer for analysis: Ha ocorregut un error inesperat en importar. Si us plau enviï aquest códi al desenvolupador per a la seva anàlisi: An error ocurred while importing. No data will be imported. Please send this code to the developer for analysis: An error ocurred while MID-importing. No data will be imported. Please send this code to the developer for analysis: Ha ocorregut un error en importar. No s'importarà cap dada. Si us plau enviï aquest codi al desenvolupador per a la seva anàlisi: FileOrMemoryPage File or Memory Fitxer o memòria Please select whether you prefer to run the DB in memory or in a file:<ul><li>Running Kontest in memory will be much faster, specially when managing several thousands of QSOs.</li><li>Running Kontest in a file will be much secure and you will not be forced to save the file before exiting or opening the logfile when starting Kontest.</li></ul> Seleccioni si prefereix executar la BD en memòria o en un fitxer:<ul><li>Executar Kontest en memòria és molt més ràpid, especialment quan es gestionen varis milers de QSOs.</li><li>Executar Kontest en un fitxer serà més segur i no estarà obligat a guardar el fitxer abans de sortir o a obrir el fitxer del log en iniciar Kontest.</li></ul> Please select whether you prefer to run the DB in memory or in a file:<ul><li>Running KLog in memory will be much faster, specially when managing several thousands of QSOs.</li><li>Running KLog in a file will be much secure and you will not be forced to save the file before exiting or opening the logfile when starting KLog.</li></ul>Please know that in this version this feature is still not fully-implemented so KLog will run in file. Please select whether you prefer to run the DB in memory or in a file:<ul><li>Running Kontest in memory will be much faster, specially when managing several thousands of QSOs.</li><li>Running Kontest in a file will be much secure and you will not be forced to save the file before exiting or opening the logfile when starting Kontest.</li></ul>Please know that in this version this feature is still not fully-implemented so Kontest will run in file. Si us plau seleccioni si prefereix executar la BD en memòria o en un fitxer:<ul><li>Executar KLog en memòria serà més ràpid, especialment quan gestionivaris milers de QSOs.</li><li>Executar KLog en un fitxer serà molt més segur i no estarà forçat a guardar el fitxer cada vegada que surti o a obrir-lo quan entri a KLog.</li></ul>Nota: Tingui en compte que aquesta funcionalitat no està completament implementada i KLog s'executarà en un fitxer. Run KLog DB in &memory Run Kontest DB in &memory Executar la BD de KLog en &memòria Run KLog DB in a &file Run Kontest DB in a &file Executar la BD de KLog en un &fitxer Recommended for day-to-day logging Recomanat pel log del dia a dia Recommended for contest logging Recomanat pel log de concursos HelpAboutDialog Ok Ok About KLog About Kontest Quant a KLog HelpHelpDialog </h2><h4>By EA4TV - 2002-2015</h4></center><br>KLog is a free logging software for hamradio operators.<br><br><b>Please know that this is an BETA release and it may contain many bugs.<br>Backup your data before using this software!</b><br><br>KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing. <br><br>Find more information and latest release at<br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Author: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a> </h2><h4>By EA4TV - 2002-2014</h4></center><br>KLog is a free logging software for hamradio operators.<br><br><b>Please know that this is an BETA release and it may contain many bugs.<br>Backup your data before using this software!</b><br><br>KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing. <br><br>Find more information and latest release at<br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Author: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a> </h2><h4>By EA4TV - 2002-2015</h4></center><br>KLog es software lliure de log per a radioaficionats.<br><br><b>Tingui en compte que aquesta és una versió BETA i pot tenir molts errors.<br>Faci una còpia de seguretat de les seves dades abans d'usar aquest programa!</b><br><br>KLog ha estat completament reescrit des de la seva versió 0.6.2 per proporcionar una aplicació multiplataforma capaç de córrer en els principals sistemes operatius (Linux, OSX & Windows) i suporta noves funcionalitats que KLog no proporcionava. <br><br>Trobarà més informació en <br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Autor: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a> Ok Ok Help Help Dialog Ajuda IntroPage Welcome to KLog! Welcome to Kontest! Benvingut a KLog! Welcome to KLog! You need to agree the License before starting using this software Welcome to Kontest! You need to agree the License before starting using this software Benvingut a KLog! Ha d'acceptar els termes de la llicència abans de començar a fer ús d'aquest programa <html><head> <title>Welcome to KLog</title> </head><body> <p>It looks to be the first time you run KLog in this computer.</p> <p>KLog is a free hamradio logging software that is able to run in Linux, OSX and Windows. It is designed to provide general purpose, DX logging and contest logging.</p> <p>It support ADIF and Cabrillo file formats import and export, QSL managing support and many other features...</p> <p>Before you can start using KLog, you will be asked to: <ul> <li>Agree the terms of the license</li> <li>Define how do you prefer to run KLog</li> <li>Enter your call, CQ zone, ... and main configuration.</li> </ul> </p> <p>Enjoy KLog and contact the development team if you have any suggestion!</p> <p><h3>73 de EA4TV</h3></p> </body></html> <html><head> <title>Welcome to Kontest</title> </head><body> <p>It looks to be the first time you run Kontest in this computer.</p> <p>Kontest is a free hamradio logging software that is able to run in Windows and Linux. It is designed to provide general purpose, DX logging and contest logging.</p> <p>It support ADIF and Cabrillo file formats import and export, QSL managing support and many other features...</p> <p>Before you can start using Kontest, you will be asked to: <ul> <li>Agree the terms of the license</li> <li>Define how do you prefer to run Kontest</li> <li>Enter your call, CQ zone, ... and main configuration.</li> </ul> </p> <p>Enjoy Kontest and contact the development team if you have any suggestion!</p> <p><h3>73 de EA4TV</h3></p> </body></html> <html><head> <title>Benvingut a KLog</title> </head><body> <p>Sembla ser que es la primera vegada que s'executa KLog en aquest ordinador.</p> <p>KLog és un programari lliure de log per a radioaficionats capaç d'executar-se en Windows, Linux y OSX. Està dissenyat com log de propòsit general, DX i concursos.</p> <p>Suporta els formats ADIF i Cabrillo en importació i exportació, gestió de QSL i moltes altres funcions...</p> <p>Abans d'usar KLog se li demanarà que: <ul> <li>Accepti els termes de la llicència</li> <li>Defineixi com vol executar KLog</li> <li>Introdueixi el seu indicatiu, zona CQ, ... i la configuració principal.</li> </ul> </p> <p>¡Gaudeixi del KLog i contacti amb l'equip de desenvolupament si té algun suggeriment!</p> <p><h3>73 de EA4TV</h3></p> </body></html> Welcome to Kontest!You need to agree the License before stating using this software ¡Benvingut a KLog! Necessita acceptar la llicència abans de començar a fer ús d'aquest programa. LicPage KLog License agreement Kontest License agreement Llicència de KLog Welcome to Kontest!You need to agree the License before stating using this software ¡Benvingut a KLog! Necessita acceptar la llicència abans de començar a fer ús d'aquest programa. Welcome to KLog!You need to agree the License before starting using this software Welcome to Kontest!You need to agree the License before starting using this software ¡Benvingut a KLog! Ha d'aprovar els termes de la llicència abans de poder fer ús d'aquest programa I agree to the terms of the license Accepto els termes de la llicència You need to accept the terms of the license before using KLog You need to accept the terms of the license before using Kontest Necessita acceptar la llicència abans de fer ús de Klog MainWindow &Clear &Netejar &Export &Exportar &Select All &Seleccionar tots &Search Recerca Recalculate Recalcular Click to recalculate the award status Premi per a recalcular l''estat dels diplomes Starting KLog Starting Kontest Iniciant KLog &Add &Afegir &Spot Anunciar Status bar... Barra d''estat... DX Entity Entitat DX 10M 10M 15M 15M 20M 20M 40M 40M 80M 80M 160M 160M 2M 2M 6M 6M 12M 12M 17M 17M 30M 30M 70CM 70Cm Award: Diploma: IOTA: IOTA: &Log Window Finestra de Log &Score Window Finestra de Puntuació MHz MHz Y-Yes Y-Si N-No N-No R-Requested R-Requerida I-Ignore I-Ignorar V-Validated V-Validada Q-Queued Q-En cua V-Verified V-Verificada Y-Uploaded Y-Pujat N-Do not upload N-No pujar M-Modified M-Modificat B-Bureau B-Bureau D-Direct D-Directa E-Electronic E-Electrònica M-Manager M-Manager Kontest KLog An unexpected error ocurred when trying to add the QSO to your log. If the problem persists, please contact the developer for analysis: Ha ocorregut un error inesperat en intentar afegir el QSO a log. Si el problema persisteix, contacti amb el desenvolupador per a la seva anàlisi: Log Log Clear the searchs Netejar recerques Export the search result to an ADIF file Exporta el resultat de la recerca a un fitxer ADIF Select/Unselect all the QSO of the box Seleccioni/Deseleccioni tots els QSO del quadre Enter the QRZ to search Introdueixi el QRZ a cercar Search results Resultats de la recerca QRZ QRZ Date/Time Data/Hora Band Banda Mode Mode QSL Sent QSL Enviada QSL Rcvd QSL Rebuda id id Date Data Time Hora SRX SRX RSTtx RSTtx STX STX RSTrx RSTrx Points Punts Multiplier Multiplicador QRZ of the QSO QRZ del QSO TX RST RST TX RX RST RST RX TX Exchange Intercanvi TX RX Exchange Intercanvi RX Band of the QSO Banda del QSO Mode of the QSO Mode del QSO Date of the QSO Data del QSO Time of the QSO Hora del QSO Misc information Informació variada QSO information Informació del QSO Add the QSO to the log Afegir QSO al log Spots this QSO to the DX Cluster Envia el QSO al DX-Cluster Clears the box Netejar el quadre Input Entrada Ready A punt NEW MULT NOU MULT Not valid characters in the QRZ box Caràcters no vàlids en el QRZ Ready... A punt... &Clear selection &Netejar selecció Save File Guardar fitxer ADIF (*.adi) ADIF (*.adi) The logfile has been modified. Do you want to save your changes? El log s''ha modificat. Vol guardar els canvis? &File &Fitxer &New... &Nou ... &Open... &Obrir ... &Save As... &Guardar com ... &Print Log... &Imprimir Log ... E&xit &Sortir &Tools &Eines &Export to ADIF... &Exportar ADIF ... &Import from ADIF... &Importar ADIF ... &Fill QSO data &Completar QSO &Find QSO to QSL Cercar QSO a enviar &QSL &Update CTY.DAT &Actualitzar CTY.DAT &Setup &Configurar &Setup... &Configurar... &Help &Ajuda &Help... &Ajuda... &About... &Quant a... &Points Window Finestra de &puntuació &Export to Cabrillo... &Exportar a Cabrillo ... QSL Send Enviar QSL &Delete &Esborrar Delete a QSO Esborrar un QSO &Edit QSO &Editar QSO Edit this QSO Edita aquest QSO Via &bureau Via &bureau Send this QSL via bureau Envia aquesta QSL via bureau D&irect D&irecta Send this QSL via direct Envia aquesta QSL via directa &Request my QSL &Requerir la meva QSL Mark my QSL as requested Marcar la meva QSL com a requerida &Request the QSL Requerir la QSL Mark the QSL as requested Marcar la QSL com a requerida Via bureau && mark my QSL as requested Via bureau & marcar la meva QSL com a requerida QSL received via bureau & mark QSL as requested QSL rebuda via bureau & marcar QSL com a requerida Via bureau Via bureau QSL received via bureau QSL rebuda via bureau Direc&t && mark as my QSL requested Directa & marca-la com a QSL requerida QSL received via direct & mark my QSL as requested QSL rebuda via directa & marca la meva QSL com a requerida Direc&t Direc&ta QSL received via direct QSL rebuda via directa QSL &received via bureau QSL &rebuda via bureau Direct Directa QSL received via direc&t QSL rebuda via direc&ta You have requested to delete this QSO. Ha sol·licitat esborrar aquest QSO. Are you sure? Està segur? You have requested to delete the QSO with: %1 Ha sol·licitat esborrar el QSO amb: %1 DUPE DUPLICAT Miles Milles An unexpected error ocurred while looking for new bands & modes in your log. If the problem persists, please contact the developer for analysis: Ha ocorregut un error al cercar noves bandes i modos en el seu log. Si el problema persisteix, contacti amb el desenvolupador per a la seva anàlisi: TX Frequency in MHz Freqüència de TX en MHz RX Frequency in MHz Freqüència de RX en MHz Power used for the QSO in watts Potència emprada pel QSO en watts Power used by the DX Potència emprada pel DX Logging operator's callsign Indicatiu del operador Callsign used over the air Indicatiu utilitzat en el aire My QTH locator El meu QTH locator Name of the DX Nom del DX QTH of the DX QTH del DX Locator of the DX Locator del DX Status on ClubLog Estat en ClubLog Status of the eQSL sending Estat del enviament de eQSL Status of the eQSL reception Estat de recepció de eQSL Status of the LotW sending Estat de enviament de LotW Status of the LotW reception Estat de recepció de LotW Date of the ClubLog upload Data del enviament a ClubLog Date of the eQSL sending Data del enviament de eQSL Date of the eQSL reception Data de la recepció de eQSL Date of the LotW sending Data del enviament de LotW Date of the LotW reception Data de la recepció de LotW Status of the QSL sending Estat del enviament de QSL Status of the QSL reception Estat de la recepció de QSL QSL sending information Informació del enviament de QSL QSL reception information Informació del enviament de QSL Date of the QSL sending Data del enviament de QSL Date of the QSL reception Data de recepció de QSL Message of the QSL Missatge de la QSL QSL via information Informació de QSL via Number of confirmed DXCC entities Nombre d'entitats DXCC confirmades Number of worked DXCC entities Nombre d'entitats DXCC treballades Number of confirmed WAZ zones Nombre de zones WAZ confirmades Number of worked WAZ zones Nombre de zones WAZ treballades Number of confirmed local references Nombre de referències locals confirmades Number of worked local references Nombre de referèncias locals treballades Number of confirmed QSO Nombre de QSO confirmats Number of worked QSO Nombre de QSO treballats Number of DXCC worked on the selected year Nombre de DXCC treballats en l''any seleccionat Number of CQ Zones worked on the selected year Nombre de zones CQ treballadess en l''any seleccionat Score for the DXMarathon on the selected year Puntuació pel DXMarathon de l''any seleccionat Select the year you want to check Seleccioni l''any que vol comprovar Status of the DX entity Estat de l''entitat DX Name of the DX entity Nom de l''entitat DX Select the primary division for this QSO Seleccioni la divisió principal d''aquest QSO Select the secondary division for this QSO Seleccioni la divisió secundària d''aquest QSO Select the correct entity of the current QSO Seleccioni l''entitat correcte pel QSO actual Power(rx) Potència (rx) RST(tx) RST(tx) RST(rx) RST(rx) QSO QSO QSL Rec Gravació QSL QSL Via QSL Via QSL QSL eQSL Sent Enviat eQSL eQSL Rec Gravació eQSL LotW Sent Enviat LotW LotW Rec Gravació LotW eQSL eQSL Satellite Satèl·lit -- -- - Needed for DXMarathon - Necessari per DXMarathon The download failed!. Do you want to update the file? Descàrrega fallida. Desitja actualitzar el fitxer? The file has been downloaded! S''ha descarregat el fitxer! The file already exits and needs to be overwritten. Do you want to update the file? El fitxer ja existeix i ha de ser reescrit.. Desitja actualitzar el fitxer? Needed QSO to send the QSL QSO al que cal enviar la QSL My QSL requested to be sent S''ha sol·licitat l''enviament de la meva QSL DX QSL pending to be received QSL del DX pendent de rebre's Comments Comentaris Others Altres Power Potència Operator Operador Station Callsign Indicatiu de l''estació &Export Highlited &Exportar marcats KLog folder Export ALL the QSO coming from ALL the logs in the same logfile. QSOs will be mixed up in the same ADIF file. Exportar TOTS els QSO de TOTS els logs al mateix fitxer. Els QSO es barrejaran en el mateix fitxer ADIF. Import an ADIF file in the current log Importar fitxer ADIF al log actual Run the log reusing previous QSO to reuse and fill missing information in other QSO Recórrer el log reutilitzant QSO anteriors per emplenar informació en altres QSO Shows QSO that are needed and you should send your QSL and request the DX-QSL Mostra QSO necessaris, pels quals hauria d''enviar la seva QSL i sol·licitar la del DX Find &requested MY-QSL Cercar &requerides My-QSL Shows the QSO that have requested my QSL to be sent and is still pending. You should keep this queue empty! Mostra QSO que han requerit l''enviament de la meva QSL. Hauria de mantenir aquesta llista buida! &Find pending to receive DX-QSL &Trobar QSL DX pendents de rebre Shows the DX-QSL that has been requested or simply my QSL has been sent with no answer Mostra QSL-DX que han estat sol·licitades o que la seva QSL ha estat enviada sense resposta &Find requested DX-QSL &Cercar QSL-DX sol·licitada Shows the DX-QSL that has been requested Mostra QSL-DX que han estat sol·licitades Export all requested My-QSL QSO to an ADIF file (i.e. to import it in a QSL tag printing software) Exportar tots els QSO / My-QSL sol·licitats (ex. per importar-los a un programa d''impressió de targetes QSL) Update the country file to have updated DX-Entity data Actualitzar el fitxer d'entitats DX per tenir-lo al dia You can find the KLog data folder here: Select the propagation mode for this current QSO Seleccioni el mode de propagació per aquest QSO ClubLog ClubLog My Locator El meu locator My Data Les meves dades Continent Continent Prefix Prefix CQ CQ ITU ITU Short Path Camí curt Long Path Camí llarg Grad Grad Km Km Info Info Award Diploma &Export Marked &Exportar marcats IOTA IOTA Entity Entitat KLog KLog Id Id Fill QSO data Emplenar dades del QSO Find &requested QSL Cercar QSL &requerides &Export Requested QSL to ADIF... &Exportar a ADIF les QSL requerides... &Update CTY.CSV Act&ualitzar CTY.CSV About Qt... Quant a Qt... About... Quant a ... Nothing has been saved. You have to select a valid file type. Res no s''ha guardat. Ha d''especificar un tipus de fitxer vàlid. ADIF files (*.adi);;Cabrillo files (*.log);;Any file (*.*) Fitxers ADIF (*.adi);;Fitxers Cabrillo (*.log);;Qualsevol fitxer (*.*) Freq TX Freq TX Freq RX Freq RX Confirmed Confirmats Worked Treballats DXCC DXCC All Tots Primary Div Div principal Secondary Div Div secundària Propagation mode Mode de propagació You have selected an entity Ha seleccionat una entitat that is different from the KLog proposed entity que és diferent a l''entitat proposada per KLog Push Apply to apply your selection. Premi Aplicar per aplicar la selecció You have selected an entity: Seleccioni l''any que desitja comprovar that is different from the KLog proposed entity: que és diferent de l''entitat proposada per KLog: Search in the log Cercar en el log Search in all logs Cercar en tots els logs ADIF (*.adi *.adif) ADIF (*.adi *.adif) Export the current log to an ADIF logfile Exportar el log actual a un fitxer ADIF &Export all logs to ADIF... &Exportar a ADIF tots els logs... &Find pending to receive QSL Cercar QSL pendents de rebre ADIF files (*.adi *.adif);;Cabrillo files (*.log);;Any file (*.*) Fitxers ADIF (*.adi *.adif);;Fitxers Cabrillo (*.log);;Qualsevol fitxer (*.*) Via Direct && mark DX QSL as requested Via directa i marcar QSL DX com sol·licitada Send this QSL via direct & mark DX QSL as requested Enviar aquesta QSL via directa i marcar QSL DX com sol·licitada Via Bureau && mark DX QSL as requested Via Bureau i marcar QSL DX com sol·licitada Send this QSL via bureau & mark DX QSL as requested Enviar aquesta QSL via bureau i marcar QSL DX com sol·licitada QSL received via bureau & mark my QSL as requested QSL rebuda via bureau i marcar la meva QSL com sol·licitada Score Puntuació DX-Marathon DX-Marathon WAZ WAZ Local Local QSOs QSOs Awards Diplomes Search Cercar DX-Cluster DX-Cluster Save ADIF File Guardar fitxers ADIF Save Cabrillo File Guardar fitxer Cabrillo Cabrillo (*.log) Cabrillo (*.log) Open File Obrir fitxer &Modify &Modificar New One! Nou! New one in this band Nou en aquesta banda Worked in this band but not confirmed Treballat en aquesta banda però no confirmat Confirmed but needed in this band Confirmat però necessitat en aquesta banda Confirmed in this band Confirmat en aquesta banda No message Sense missatge Needed QSO! QSO necessitat! Worked but not confirmed! Treballat però no confirmat! Filling QSOs... Emplenant QSOs... Abort filling Cancel·lar emplenat Filling QSOs... QSO: Emplenant QSOs... QSO: Number Nombre Comment Comentari Print Log Imprimir log Printing the log... Imprimint el log... Abort printing Cancel·lar impresió Printing the log... QSO: Imprimint el log ...QSO: MainWindowSatTab Keep this data Mantenir aquestes dades Data entered in this tab will be copied into the next QSO Les dades introduïdes en aquesta pestanya es copiaran al següent QSO Name of the Satellite (format like AO-51) Name of the Satellite Nom del Satèl·lit (formato como AO-51) Satellite mode used Mode del Satèl·lit emprat Satellite Satèl·lit Mode Mode QObject Database Error Error de base de dades KLog DB needs to be upgraded. La BD de KLog necessita actualitzar-se. Do you want to upgrade it now? If DB is not upgraded KLog may not work properly. Desitja actualitzar-la ara? Si no s''actualitza és possible que KLog no funcioni correctament. KLog has detected a previous log in the DB. All data will be migrated to a newly created DX type log for you. KLog ha detectat un log anterior en la BD. Totes les dades seran migrades a un log tipus DX creat per a vostè. KLog: Enter Station callsign KLog: Introdueixi indicatiu Enter the station callsign used in this log Introdueixi l''indicatiu emprat en aquest log Station Callsign Indicatiu de l''estació All the data was migrated correctly. You should now to go to Setup->Preferences->Logs to check that everything is OK. Totes les dades s'han migrat correctament. Hauria d'anar a Preferències->Logs per comprovar que tot està OK Updating mode information... Actualizant informació de mode... Abort updating Cancel·lar actualització Updating mode information... QSO: Actualitzant informació del mode... QSO: Cancelling this update will cause data inconsistencies and possibly data loss. Do you still want to cancel? Cancel·lar aquesta actualització causarà inconsistència i possible pèrdua de dades. Vol cancel·lar? Updating bands information... Actualitzant informació de bandes... Updating bands information... QSO: Actualitzant informació de bandes... QSO: Updating bands information in %1 status... Actualitzant informació de bandes en %1... Updating bands information... Progress: Actualitzant informació de bandes... Progreso: Updating mode information in %1 status... Actualizant informació dels modes en %1... 0-new One Nou 1-Needed, work it! Necessari, treballi-ho! 2-Needed, work it! Necessari, treballi-ho! 3-Worked but not confirmed Treballat però no confirmat 4-Needed, work it! Necessari, treballi-ho! 5-Needed, work it! Necessari, treballi-ho! 6-Needed, work it! Necessari, treballi-ho! 7-Needed, work it! Necessari, treballi-ho! 8-Worked but not confirmed Treballat però no confirmat 9-Needed, work it! Necessari, treballi-ho! 10-Worked but not confirmed Treballat però no confirmat 11-Needed, work it! Necessari, treballi-ho! 12-Worked but not confirmed Treballat però no confirmat 13-Confirmed Confirmat New One, work it! nNew One, work it! ¡Nou, treballi-ho! Needed, work it! Necessari, treballi-ho! Worked but not confirmed Treballat però no confirmat! Confirmed Confirmat Not identified No identificat SetupDialog User data Dades del usuari Bands/Modes Bandes/modes My Data Les meves dades DX-Cluster DX-Cluster Colors Colors Misc Varis World Editor Editor d''entitats ClubLog ClubLog Cancel Cancel·lar OK OK Config Dialog Configuració D&X-Cluster D&X-Cluster You need to enter at least a valid QRZ. Ha d'introduir un QRZ vàlid. You have not selected the kind of log you want. You will be redirected to the Log tab. Please add and select the kind of log you want to use. No ha seleccionat el tipus de log que vol. Serà redirigit a la pestanya del Log. Si us plau afegeixi i seleccioni el tipus de log que vol emprar. Logs Logs You need to enter at least one log in the Log's tab. Ha d''introduir almenys un log en la pestanya del Log. World Entitats SetupEntityDialog Entity Entitat Name of the Entity Nom de l''entitat CQ CQ CQ zone Zona CQ ITU ITU ITU zone Zona ITU Latitude Latitud Longitude of the Entity Longitud de l''entidad Longitude Longitud UTC UTC Local time difference to UTC Diferencia de l''hora local amb la UTC Main prefix Prefix Main prefix of the entity Prefix principal de l''entitat ARRL Id Id ARRL ARRL id Id ARRL Prefixes Prefixes Comma separated possible prefixes. ie. EA1, EA2, ... Comma separated possible prefixes. Eg. EA1, EA2, ... Llista separada per comes de possibles prefixes. Ej. EA1, EA2, ... Date of the deletion Data d''eliminació Deleted Eliminat Cancel Cancel·lar OK Ok Entity Dialog Entitat SetupPageBandsModes Bands Bandes Modes Modes &Add Band &Afegir banda &Remove Band Elimina&r banda Add &Mode Afegir &mode Remove M&ode Eliminar m&ode SetupPageClubLog &Callsign Indi&catiu Clublog &password Contrase&nya Clublog &email Correu &electrònic Enter the email you used to register in clublog Introdueixi el correu-e que va emprar per registrar-se en clublog Enter the callsign you used to register in clublog Introdueixi l''indicatiu que va emprar per registrar-se en clublog Enter your password in clublog Introdueixi la seva contrasenya de clublog &Send QSOs in real time &Enviar QSOs en temps real &Activate ClubLog &Activar ClubLog Use QSO Station &Callsign Usar indicatiu de l''estació del QSO Send each QSO to ClubLog in real time, as they are added (or modified) in KLog Enviar cada QSO a ClubLog en temps real, segons es van afegint (o modificant) en KLog Starts the ClubLog support in KLog Inicia el suport de ClubLog en KLog Use the Station Callsign defined in each QSO instead of the defined here Utilitza en cada QSO l''indicatiu d''estació definit en comptes del definit aquí SetupPageColors New One Nou Needed in this band Necessari en aquesta banda Worked Treballat Worked in this band Treballat en aquesta banda Confirmed in this band Confirmed Confirmat en aquesta banda Default Predeterminat Choose a color Esculli un color SetupPageDxCluster Add Afegir Delete Esborrar Show &HF spots Show HF spots Mostrar avisos en I&HF Show V/&UHF spots Show V/UHF spots Mostrar avisos en V/&UHF Show W&ARC spots Show WARC spots Mostrar avisos en W&ARC Show &worked spots Show worked spots Mostrar a&visos treballats Show &confirmed spots Show confirmed spots Mostrar avisos &confirmats Show ANN/&FULL messages Show ANN/FULL messages Mostrar missatges ANN/&FULL Show WW&V messages Show WWV messages Mostrar missatges &WWV Show WC&Y messages Show WCY messages Mostrar missatges WC&Y DX Spots Avisos DX Messages Missatges KLog: Add a DXCluster server Kontest: Add a DXCluster server KLog: Afegir servidor DX-Cluster Add the address followed by the :port Example: dxfun.com:8000 If no port is specified, 41112 will be used by default: Add the address followed by the :port Example: dxfun.com:8000 If no port is specified, 41112 will be used by default.: Afegeix l''adreça seguida de :port Exemple: dxfun.com:8000 Si no s'especifica port s'usarà 41112 de forma predeterminada: SetupPageLogs Type Tipus Station callsign Indicatiu de l''estació Operators Operadors &New New &Nou Load All Carregar tots Load Carregar Clear Netejar Edit Editar Remove Esborrar &Edit &Editar &Remove Elimina&r Add a new log Afegir nou log Select the log you want to open Seleccioni el log a obrir KLog KLog Do you really want to remove this log? All the QSO from this log will be also deleted... Vol realment eliminar aquest log? S''eliminaran també tots els QSO d''aquest log... Log has not been removed. (#3) Log no eliminat (#3) Log has not been removed. (#2) Log no eliminat (#2) Log has not been removed. (#1) Log no eliminat (#1) An error has ocurred showing the following error code: '%1' An error has ocurred showing the folloing error code: '%1' Ha ocorregut un error amb el següent codi: '%1' KLog - SetupPageLogs KLog - SetupPageLogs Load all the logs Carregar tots els logs Load only the selected log Carregar només el log seleccionat Clear selection Netejar selecció Edit the selected log Editar el log selecionat Remove the selected log Esborrar el log seleccionat New Log Nou log StationCallsign Indicatiu Estació Callsign used for this log Indiatiu emprat per aquest log Comma separated list of operators: callsign1, callsign2 Llista separada per comes dels operadors: indicatiu1, indicatiu2 Your name or the station's responsible El teu nom o el nom del responsable de l''estació Start date of this log Data d''inici d''aquest log Type of Operation Tipus d''operació Name Nom Select the kind of operation for this log Seleccioni el tipus d''operació per aquest log Mode Category Categoria del mode Select the mode category Seleccioni la categoria del mode Operators Category Categoria de'operadors Select the operators category Seleccioni la categoria d'operadors Assisted Category Categoria asistida Select the assisted category Seleccioni la categoria de asistit Power Category Categoria de potència Select the power category Seleccioni la categoria de potència Bands Category Categoria de bandes Select the bands category Seleccioni la categoria de bandes ID ID Station Callsign Indicatiu de l''estació Comments Comentaris Callsign Indicatiu Date Data Comment Comentari QSOs QSOs DD-MM-YYYY DD-MM-AAAA SetupPageLogsNew &Ok &Ok &Cancel &Cancel·lar Select categories Seleccioni categories Station Callsign Indicatiu de l''estació Operators Operadors Comment Comentari Callsign used for this log Indicatiu emprat per aquest log Comma separated list of operators: callsign1, callsign2 Llista separada per comes dels operadors: indicatiu1, indicatiu2 Start date of this log Data d''inici d''aquest log Add a comment about this log Afegeixi un comentari per aquest log Type of Operation Tipus d''operació Name Nom Date Data Select the kind of operation for this log Seleccioni el tipus d''operació per aquest log Mode Category Categoria del mode Select the mode category Seleccioni la categoria del mode Operators Category Categoria de'operadors Select the operators category Seleccioni la categoria de 'operadors Assisted Category Categoria de 'asistit Select the assisted category Seleccioni la categoria de 'asistit Power Category Categoria de potència Select the power category Seleccioni la categoria de potència Bands Category Categoria de bandes Select the bands category Seleccioni la categoria de bandes Overlay Overlay &Date &Data &Station Callsign &Indicatiu Estació &Operators &Operadors Comm&ent Comentari &Type of Operation &Tipus d'Operació &Mode Category &Mode operació O&perators Category Categoria O&peradors &Assisted Category Categoria &Asistit Po&wer Category Categoria &Potència &Bands Category Categoria &Bandes O&verlay O&verlay Select the Overlay category Seleccioni la categoria de Overlay Categories not OK Categories no OK You need to enter a valid QRZ in the Station Callsign box. The log will not be opened. You need to enter a valid QRZ in the Station Callsign box The log will not be opened. Necessita introduir un indicatiu vàlid en el camp d'Indicatiu. El log no s''obrirà. You selected an invalid combination. The log will not be opened. You selected an invalid combination The log will not be opened. Ha seleccionat una categoria no vàlida. El log no s''obrirà. Categories OK Categories OK SetupPageMisc &Imperial system Imperial system Sistema &imperial DB in &Memory DB in Memory BD en &memòria &Log in real time Log in real time &Log en temps real &Time in UTC Time in UTC Hora en U&TC &Save ADIF on exit Save ADIF on exit Guardar ADIF al &sortir Use this &default filename Use this default filename Usar aquest fitxer &de forma predeterminada Mark &QSO to send QSL when QSL is received Mark QSO to send QSL when QSL is received Marcar com &QSL per enviar quan es rebi la QSL Complete QSO with previous data Completar QSO amb dades anteriores QSOs will be marked to be pending to send the QSL if the DX QSL is received and you have not sent your. Working in memory (vs in file) is much quicker but you will need to save the ADIF file each time you start Kontest. Els QSO es marcaran com pendents d''enviar si es rep la targeta del DX i no ha enviat la seva. Show the Station Callsign used in the search box Mostrar l''indicatiu de l''estació utilitzat en el requadre de recerca The search box will show also the callsign on the air to do the QSO. El requadre de recerca mostrarà també l''indicatiuo emprat per fer el QSO. Reset to My Data for all QSO Use My Data tab for all QSO Emprar Les Meves Dades per tots els QSO Show the Station &Callsign used in the search box Mostrar l''indicatiu usat en el &requadre de recerca &Reset to My Data for all QSO &Reiniciar Les Meves Dades en tots els QSO All the data from the My Data tab will be used or data from the previous QSO will be maintained. S''empraran totes les dades de la pestanya Les Meves Dades o be s''usaran dades del QSO anterior. Check it for Imperial system (Miles instead of Kilometres). Marcar si desitja fer ús del sistema imperial (Milles en lloc de Quilòmetres). Working in memory (vs in file) is much quicker but you will need to save the ADIF file each time you exit KLog. Working in memory (vs in file) is much quicker but you will need to save the ADIF file each time you exit KLog. Treballar en memòria (en lloc de fitxer) és més ràpid però haurà de salvar el fitxer ADIF cada vegada que surti de KLog. Select to use real time. Seleccioni per emprar temps real. Select to use UTC time. Seleccioni per emprar UTC. Select if you want to save to ADIF on exit. Seleccioni si desitja guardar en ADIF al sortir. Select to use the following name for the logfile and not being asked for it anymore. Seleccioni per emprar el següent nom de fitxer i que no se li pregunti més. Complete the current QSO with previous QSO data. Completar el QSO actual amb dades de QSO anteriors. This is the default file where ADIF will be saved. Aquest és el nom de fitxer predeterminat on es guardarà el fitxer ADIF. Click to change the default ADIF file Premi per canviar el nom predeterminat del fitxer ADIF Open File Obrir fitxer ADIF (*.adi) ADIF (*.adi) SetupPageUserDataPage Enter your CALLSIGN that will be used for logging Introdueixi el seu INDICATIU per usar-lo en el log &Personal data Personal data Dades &personals Station &data Station data &Dades de l''estació Enter your name Introdueixi el seu nom Enter your address - 1st line Introdueixi la seva adreça - 1ª línia Enter your address - 2nd line Enter your address - 2nd line Introdueixi la seva adreça - 2ª línia Enter your address - 3st line Introdueixi la seva adreça - 3ª línia Enter your address - 4nd line Enter your address - 4nd line Introdueixi la seva adreça - 4ª línia Enter your city Introdueixi la seva ciutat Enter your zip code Introdueixi el seu codi postal Enter your province or state Introdueixi la seva província o estat Enter your country Introdueixi el seu país &Name Name &Nom &Address Address &Adreça Cit&y City Ci&utat &Zip Code Zip Code Codi &postal Pro&v/State Prov/State Pro&v/Estat Countr&y Country Paí&s Enter your rig #1 information Introdueixi l''informació del seu equip de ràdio #1 Enter your rig #2 information Introdueixi l''informació del seu equip de ràdio #2 Enter your rig #3 information Introdueixi l''informació del seu equip de ràdio #3 Enter your antenna #1 information Introdueixi l''informació de la seva antena #1 Enter your antenna #2 information Introdueixi l''informació de la seva antena #2 Enter your antenna #3 information Introdueixi l''informació de la seva antena #3 Enter your power information Introdueixi l''informació en vers la seva potència &Rig 1 &Equip 1 R&ig 2 E&quip 2 Ri&g 3 Eq&uip 3 Antenna &1 Antena &1 Antenna &2 Antena &2 Antenna &3 Antena &3 Po&wer Po&tència &QRZ &QRZ &Operators &Operadors &CQ Zone Zona &CQ &ITU Zone Zona &ITU &Locator &Locator &Locator (not valid) &Locator (no vàlid) Rig 1 Equip 1 Rig 2 Equip 2 Rig 3 Equip 3 Antenna 1 Antena 1 Antenna 2 Antena 2 Power Potència Enter the station callsign that will be used for logging Introdueixi l''indicatiu de l''estació que serà usat pel log Enter the operators (comma separated if more than one). Introdueixi els operadors (separats per comes si hi ha més d''un). QRZ QRZ Operators Operadors CQ Zone Zona CQ ITU Zone Zona ITU Locator Locator Enter the locator of your station. KLog will propose one locator based on your callsign Enter the locator of your station. Kontest will propose one locator based on your callsign Introdueixi el locator de la seva estació. KLog li proposarà un basat en el seu indicatiu Contest category Categoria de concurs Locator (not valid) Locator (no vàlid) SetupPageWorldEditor Prefix Prefix Entity Entitat ARRL id Id ARRL Continent Continent CQ Zone Zona CQ ITU Zone Zona ITU UTC UTC Latitude Latitud Longitude Longitud Deleted Eliminat Since Date Des de data To Date Fins la data StartWizard KLog - The free hamradio logging software KLog - The free hamradio logging software KLog - El programa lliure de log per radioaficionats Quit Setup Sortir configuració Setup is not complete yet. Are you sure you want to quit setup? La configuració no està completa. Està segur de voler sortir de la configuració? World Entity Entitat Continent Continent Reading cty.dat... Llegint cty.dat... Abort reading Cancel·lar lectura Reading cty.csv... Llegint cty.csv... eLogClubLog Host not found! Maquinari no trobat! Timeout error! Error de temps excedit! It seems to be a PASSWORD ERROR, check your password Sembla haver-hi un error de contrasenya, revisi-la KLog - ClubLog KLog - clublog KLog - ClubLog It seems that your Clublog's password is not correct Please check your password in the setup. Clublog uploads will be disabled. Sembla que la seva contrasenya de ClubLog no és correcta. Si us plau, revisi la seva contrasenya en la configuració. L''enviament a ClubLog serà deshabilitat. Undefined error... Error no definit... Callsign missing Manca l'indicatiu Invalid callsign Indicatiu no vàlid Skipping SWL callsign Saltant indicatiu SWL Callsign is your own call Callsign is your ow call L''indicatiu és el propi indicatiu Invalid callsign with no DXCC mapping Indicatiu no vàlid sense correspondència amb DXCC Updated QSO QSO actualitzat Invalid ADIF record Registre ADIF no vàlid Missing ADIF record Manca registre ADIF Test mode - parameters ok, no action taken Mode Test - paràmetres OK, sense acció Excesive API Usage Ús excessiu de API Internal Error Error intern Rejected Rebutjat QSO Duplicate QSO duplicat QSO Modified QSO modificat Missing Login Manca Login QSO OK QSO OK Upload denied Pujada rebutjada No callsign selected No s'ha seleccionat indicatiu No match found Sense coincidència Dropped QSO QSO eliminat OK OK Login rejected Login rebutjat Rejected: Callsign is your own call Rebutjat: L'indicatiu és el seu propi indicatiu klog-0.9.2.2/translations/klog_es.ts0000644000076700000620000051377512627126144015327 0ustar staff CTYPage Descargar datos de entidades Descargar datos de entidades Country data download Descargar datos de entidades KLog needs the country data... Kontest needs the country data... KLog necesita datos de las entidades ... &Download &Descargar &Ignore &Ignorar Country data needed Información de entidades KLog uses the CTY.CSV file (from http://www.country-files.com/) to get the DXCC information. KLog usa el fichero CTY.CSV (de http://www.country-files.com/) para obtener la información del DXCC. You need to download the cty.csv file if you want KLog to show you the countries, locator, ... of the QSO you do. Necesita descargar el cty.csv si quiere que KLog muestre información de entidad, locator, ... de los QSO que haga. Click on Download to download just now. Pulse en Descargar para descargar ahora. KLog KLog Kontest Kontest I can't find the host. Please check your network and try again Do you want to try again? No se pudo encontrar la máaquina. Revise su configuración de red y pruebe de nuevo ¿Quiere volverlo a intentar? DXClusterWidget Connect Conectar Clear Limpiar Click on connect to connect to the DX-Cluster Pulse en conectar para conectar al DX-Cluster Trying to connect to the server Intentando conectar con el servidor KLog DXCluster Kontest DXCluster DXCluster de KLog The host was not found. Please check the host name and port settings. Máquina no encontrada. Revisa el nombre de la máquina y el puerto Click on Connect to connect to the DX-Cluster server Pulse en Conectar para conectar al servidor de DX-Cluster The host was not found. Please check: - your network connection; - the host name and port settings. Máquina no encontrada. Por favor revise: - la conexión de red - el nombre y puerto de la máquina. The connection was refused by the peer. Make sure the DXCluster server is running, and check that the host name and port settings are correct. La conexióon fue rechazada por el servidor. Asegúrese de que el servidor de DXCluster estáa ejecutáandose y compruebe el nombre de máquina y puerto. The following error occurred: %1. El siguiente error ha tenido lugar: %1. Connected to server Conectado al servidor KLog message Kontest message Mensaje de KLog Enter your callsign to connect to the cluster: Introduzca su indicativo para conectar al cluster: Enter your password to connect to the cluster: (Just hit enter for no password) Introduzca su contraseña para conectar al cluster: (pulse enter si no hay contraseña) Enter your password to connect to the cluster: Introduzca su contraseña para conectar al cluster: Disconnect Desconectar Not logged on, you may to enter your callsign again. No identificado, puede introducir su contraseña de nuevo. Enter here the commands to be sent to the DX-Cluster server Introduzca aquí los comandos a enviar al servidor de DX-Cluster Connection closed by the server Conexión cerrada por el servidor Send Enviar DownLoadCTY Download of the CTY.CSV failed with the following error code: La descarga de CTY.CSV falló con el siguiente código de error: Download of the CTY.CSV done. Descarga de CTY.CSV hecha. There is already a CTY.CSV file in the folder but it will be replaced with the new one. Ya hay un CTY.CSV en la carpeta pero será reemplazado por el nuevo. Could not open No pudo abrirse for writing. para escribir. FileManager Reading ADIF file... Leyendo fichero ADIF... Abort reading Cancelar lectura Reading ADIF file... QSO: eyendo fichero ADIF... QSO: Writing ADIF file... Escribiendo fichero ADIF... Abort writing Cancelar escritura Writing ADIF file... QSO: Escribiendo fichero ADIF ... QSO: Writing Cabrillo file... Escribiendo fichero Cabrillo ... KLog: Cabrillo Log Export not implemented Kontest: Cabrillo Log Export not implemented KLog: La exportación de log en en formato Cabrillo no está implementada I am sorry but the Cabrillo Export To File feature has still not been implemented. Lo sentimos pero la función de Exportar Cabrillo aun no está implementada. There are more than one log in this logfile. All logs will be imported in the current log. Do you want to continue? Hay más de un log en este fichero. Todos los logs se importarán en el log actual. ¿Quiere continuar? Importing ADIF file... QSO: Importando fichero ADIF... QSO: 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) Parece que hay algunos QSO duplicados en el fichero ADIF que está importando. ¿Quiere continuar? (Los QSO duplicados no se importarán) This QSO is not including the minimum data to consider a QSO as valid!. Please edit the ADIF file and make sure that it include at least: CALL, QSO_DATE, TIME_ON, BAND and MODE. This QSO had: Este QSO no incluye los datos mínimos para ser considerado válido. Por favor, edite el fichero ADIF y asegúrese de que todos los QSO incluyen al menos: CALL, QSO_DATE, TIME_ON, BAND y MODE. Este QSO: - The band missing and the following call: - El siguiente indicativo pero sin banda: - The call missing but was done at this time: - Le falta el indicativo pero fue hecho a esta hora: - The mode missing and the following call: - El siguiente indicativo pero sin modo: - The date missing and the following call: - El siguiente indicativo pero sin fecha: - The time missing and the following call: - El siguiente indicativo pero sin hora: Do you want to continue with the current file? ¿Quiere continuar con el fichero? KLog: Not all required data found! KLog: ¡No se encontraron todos los datos necesarios! This QSO is not including the minimum data to consider a QSO as valid!. Please edit the ADIF file and make sure that it include at least: CALL, QSO_DATE, TIME_ON, BAND and MODE. Do you want to continue with the current file? Este QSO no incluye los datos mínimos para ser considerado válido. Por favor, edite el fichero ADIF y asegúrese de que todos los QSO incluyen al menos: CALL, QSO_DATE, TIME_ON, BAND y MODE. ¿Quiere continuar con el fichero actual? This log seems to lack of RST-TX information. Click on Yes to add a default 59 to all QSO with a similar problem. If you select NO, the QSO may not be imported. Este log no parece tener la información de RST TX. Pulse en Sí, para añadir un 59 predeterminado a todos los QSO con un problema similar. Si pulsa NO, el QSO puede no ser importado. KLog: No RST TX found! KLog: ¡No se encontró RST TX! This log seems to lack of RST-RX information. Click on Yes to add a default 59 to all QSO with a similar problem. If you select NO, the QSO may not be imported. Este log no parece tener la información de RST RX. Pulse en Sí, para añadir un 59 predeterminado a todos los QSO con un problema similar. Si pulsa NO, el QSO puede no ser importado. KLog: No RST RX found! KLog: ¡No se encontró RST RX! There are some QSO duplicated in the ADIF file you are importing. Do you want to continue? (Duped QSO will not be imported) Hay algunos QSO duplicados en el fichero ADIF que estáa importando. ¿Quiere continuar? (Los QSO duplicados no se importarán) An unexpected error ocurred while importing. Please send this code to the developer for analysis: Ha ocurrido un error inesperado al importar. Por favor envíe este cóodigo al desarrollador para su análisis: An error ocurred while importing. No data will be imported. Please send this code to the developer for analysis: An error ocurred while MID-importing. No data will be imported. Please send this code to the developer for analysis: Ha ocurrido un error al importar. No se importará ningún dato. Por favor envíe este código al desarrollador para su análisis: FileOrMemoryPage File or Memory Fichero o memoria Please select whether you prefer to run the DB in memory or in a file:<ul><li>Running Kontest in memory will be much faster, specially when managing several thousands of QSOs.</li><li>Running Kontest in a file will be much secure and you will not be forced to save the file before exiting or opening the logfile when starting Kontest.</li></ul> Seleccione si prefiere ejecutar la BD en memoria o en un fichero:<ul><li>Ejecutar Kontest en memoria es mucho más rápido, especialmente cuando se gestionan varios miles de QSOs.</li><li>Ejecutar Kontest en un fichero será más seguro y no estará obligado a guardar el fichero antes de salir o a abrir el fichero de log al iniciar Kontest.</li></ul> Please select whether you prefer to run the DB in memory or in a file:<ul><li>Running KLog in memory will be much faster, specially when managing several thousands of QSOs.</li><li>Running KLog in a file will be much secure and you will not be forced to save the file before exiting or opening the logfile when starting KLog.</li></ul>Please know that in this version this feature is still not fully-implemented so KLog will run in file. Please select whether you prefer to run the DB in memory or in a file:<ul><li>Running Kontest in memory will be much faster, specially when managing several thousands of QSOs.</li><li>Running Kontest in a file will be much secure and you will not be forced to save the file before exiting or opening the logfile when starting Kontest.</li></ul>Please know that in this version this feature is still not fully-implemented so Kontest will run in file. Por favor seleccione si prefiere ejecutar la BD en memoria o en un fichero:<ul><li>Ejecutar KLog en memoria será más rápido, especialmente cuando gestione varios miles de QSOs.</li><li>Ejecutar KLog en un fichero será mucho más seguro y no estará forzado a guardar el fichero cada vez que salga o a abrirlo cuando entre a KLog.</li></ul>Nota: Tenga en cuenta que esta funcionalidad no está completamente implementada y KLog se ejecutará en un fichero. Run KLog DB in &memory Run Kontest DB in &memory Ejecutar la BD de KLog en &memoria Run KLog DB in a &file Run Kontest DB in a &file Ejecutar la BD de KLog en un &fichero Recommended for day-to-day logging Recomendado para el log del día a día Recommended for contest logging Recomendado para log de concursos HelpAboutDialog Ok Ok About KLog About Kontest Acerca de KLog HelpHelpDialog </h2><h4>By EA4TV - 2002-2015</h4></center><br>KLog is a free logging software for hamradio operators.<br><br><b>Please know that this is an BETA release and it may contain many bugs.<br>Backup your data before using this software!</b><br><br>KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing. <br><br>Find more information and latest release at<br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Author: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a> </h2><h4>By EA4TV - 2002-2014</h4></center><br>KLog is a free logging software for hamradio operators.<br><br><b>Please know that this is an BETA release and it may contain many bugs.<br>Backup your data before using this software!</b><br><br>KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing. <br><br>Find more information and latest release at<br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Author: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a> </h2><h4>By EA4TV - 2002-2015</h4></center><br>KLog es software libre de log para radioaficionados.<br><br><b>Tenga en cuenta que esta es una versión BETA y puede tener muchos errores.<br>¡Haga una copia de seguridad de sus datos antes de usar este programa!</b><br><br>KLog ha sido completamente reescrito desde su versión 0.6.2 para proporcionar una aplicación multiplataforma capaz de correr en los sistemas operativos principales (Linux, OSX & Windows) y soporta nuevas funcionalidades que KLog no proporcionaba. <br><br>Encuentre más información en <br><a href=http://jaime.robles.es/klog>http://jaime.robles.es/klog</a><br><br>Autor: Jaime Robles, EA4TV<br><a href=mailto:jaime@robles.es>jaime@robles.es</a> Ok Ok Help Help Dialog Ayuda IntroPage Welcome to KLog! Welcome to Kontest! ¡Bienvenido a KLog! Welcome to KLog! You need to agree the License before starting using this software Welcome to Kontest! You need to agree the License before starting using this software ¡Bienvenido a KLog! Debe aceptar los términos de la licencia antes de empezar a usar este programa <html><head> <title>Welcome to KLog</title> </head><body> <p>It looks to be the first time you run KLog in this computer.</p> <p>KLog is a free hamradio logging software that is able to run in Linux, OSX and Windows. It is designed to provide general purpose, DX logging and contest logging.</p> <p>It support ADIF and Cabrillo file formats import and export, QSL managing support and many other features...</p> <p>Before you can start using KLog, you will be asked to: <ul> <li>Agree the terms of the license</li> <li>Define how do you prefer to run KLog</li> <li>Enter your call, CQ zone, ... and main configuration.</li> </ul> </p> <p>Enjoy KLog and contact the development team if you have any suggestion!</p> <p><h3>73 de EA4TV</h3></p> </body></html> <html><head> <title>Welcome to Kontest</title> </head><body> <p>It looks to be the first time you run Kontest in this computer.</p> <p>Kontest is a free hamradio logging software that is able to run in Windows and Linux. It is designed to provide general purpose, DX logging and contest logging.</p> <p>It support ADIF and Cabrillo file formats import and export, QSL managing support and many other features...</p> <p>Before you can start using Kontest, you will be asked to: <ul> <li>Agree the terms of the license</li> <li>Define how do you prefer to run Kontest</li> <li>Enter your call, CQ zone, ... and main configuration.</li> </ul> </p> <p>Enjoy Kontest and contact the development team if you have any suggestion!</p> <p><h3>73 de EA4TV</h3></p> </body></html> <html><head> <title>Bienvenido a KLog</title> </head><body> <p>Parece ser la primera vez que se ejecuta KLog en este ordenador.</p> <p>KLog es un software libre de log para radioaficionados capaz de ejecutarse en Windows, Linux y OSX. Está diseñado como log de propósito general, DX y concursos.</p> <p>Soporta los formatos ADIF y Cabrillo en importación y exportación, gestión de QSL y muchas otras funciones...</p> <p>Antes de usar KLog se pedirá que: <ul> <li>Acepte los términos de la licencia</li> <li>Defina cómo quiere ejecutar KLog</li> <li>Introduzca su indicativo, zona CQ, ... y la configuración principal.</li> </ul> </p> <p>¡Distrute de KLog y contacte con el equipo de desarrollo si tienee alguna sugerencia!</p> <p><h3>73 de EA4TV</h3></p> </body></html> Welcome to Kontest!You need to agree the License before stating using this software ¡Bienvenido a KLog! Necesita aceptar la licencia antes de empezar a usar este programa. LicPage KLog License agreement Kontest License agreement Licencia de KLog Welcome to Kontest!You need to agree the License before stating using this software ¡Bienvenido a KLog! Necesita aceptar la Licencia antes de empezar a usar este programa Welcome to KLog!You need to agree the License before starting using this software Welcome to Kontest!You need to agree the License before starting using this software ¡Bienvenido a KLog! Debe aprobar los términos de la licencia antes de poder usar este programa I agree to the terms of the license Acepto los términos de la licencia You need to accept the terms of the license before using KLog You need to accept the terms of the license before using Kontest Necesita aceptar los términos de la licencia antes de usar KLog MainWindow &Clear &Limpiar &Export &Exportar &Select All &Seleccionar todos &Search Bu&scar Recalculate Recalcular Click to recalculate the award status Pulse para recalcular el estado de los diplomas Starting KLog Starting Kontest Iniciando KLog &Add &Añadir &Spot An&unciar Status bar... Barra de estado ... DX Entity Entidad DX 10M 10M 15M 15M 20M 20M 40M 40M 80M 80M 160M 160M 2M 2M 6M 6M 12M 12M 17M 17M 30M 30M 70CM 70Cm Award: Diploma: IOTA: IOTA: &Log Window Ventana de &Log &Score Window Ventana de &Puntuación MHz MHz Y-Yes Y-Si N-No N-No R-Requested R-Requerida I-Ignore I-Ignorar V-Validated V-Validada Q-Queued Q-Encolada V-Verified V-Verificada Y-Uploaded Y-Subido N-Do not upload N-No subir M-Modified M-Modificado B-Bureau B-Bureau D-Direct D-Directa E-Electronic E-Electrónica M-Manager M-Manager Kontest KLog An unexpected error ocurred when trying to add the QSO to your log. If the problem persists, please contact the developer for analysis: Ha ocurrido un error inesperado al intentar añadir el QSO a log. Si el problema persiste, contacte con el desarrollador para su análisis: Log Log Clear the searchs Limpiar búsquedas Export the search result to an ADIF file Exporta el resultado de la búsqueda a un fichero ADIF Select/Unselect all the QSO of the box Selecione/Deseleccione todos los QSO del cuadro Enter the QRZ to search Introduzca el QRZ a buscar Search results Resultados de la búsqueda QRZ QRZ Date/Time Fecha/Hora Band Banda Mode Modo QSL Sent QSL Enviada QSL Rcvd QSL Recibida id id Date Fecha Time Hora SRX SRX RSTtx RSTtx STX STX RSTrx RSTrx Points Puntos Multiplier Multiplicador QRZ of the QSO QRZ del QSO TX RST RST TX RX RST RST RX TX Exchange Intercambio TX RX Exchange Intercambio RX Band of the QSO Banda del QSO Mode of the QSO Modo del QSO Date of the QSO Fecha del QSO Time of the QSO Hora del QSO Misc information Información variada QSO information Información del QSO Add the QSO to the log Añadir QSO al log Spots this QSO to the DX Cluster Envía el QSO al DX-Cluster Clears the box Limpia el cuadro Input Entrada Ready Listo NEW MULT NUEVO MULT Not valid characters in the QRZ box Caracteres no válidos en el QRZ Ready... Listo... &Clear selection &Limpiar selección Save File Guardar fichero ADIF (*.adi) ADIF (*.adi) The logfile has been modified. Do you want to save your changes? El log se ha modificado. ¿Quiere guardar los cambios? &File &Fichero &New... &Nuevo ... &Open... &Abrir ... &Save As... &Guardar como ... &Print Log... &Imprimir log ... E&xit &Salir &Tools &Herramientas &Export to ADIF... &Exportar ADIF ... &Import from ADIF... &Importar ADIF ... &Fill QSO data &Completar QSO &Find QSO to QSL Buscar QSO a enviar &QSL &Update CTY.DAT &Actualizar CTY.DAT &Setup &Configurar &Setup... &Configurar... &Help &Ayuda &Help... &Ayuda... &About... &Acerca de... &Points Window Ventana de &puntuación &Export to Cabrillo... &Exportar Cabrillo ... QSL Send Enviar QSL &Delete &Borrar Delete a QSO Borrar un QSO &Edit QSO &Editar QSO Edit this QSO Edita este QSO Via &bureau Vía &bureau Send this QSL via bureau Envia esta QSL vía bureau D&irect D&irecta Send this QSL via direct Envía esta QSL vía directa &Request my QSL &Requerir mi QSL Mark my QSL as requested Marcar mi QSL como requerida &Request the QSL Requerir la QSL Mark the QSL as requested Marcar la QSL como requerida Via bureau && mark my QSL as requested Vía bureau & marcar my QSL como requerida QSL received via bureau & mark QSL as requested QSL recibida vía bureau & marcar QSL como requerida Via bureau Vía bureau QSL received via bureau QSL recibida vía bureau Direc&t && mark as my QSL requested Directa & marcar mi QSL requerida QSL received via direct & mark my QSL as requested QSL recibida vía directa & marcar mi QSL como requerida Direc&t Direc&ta QSL received via direct QSL recibida vía directa QSL &received via bureau QSL &recibida vía bureau Direct Directa QSL received via direc&t QSL recibida vía direc&ta You have requested to delete this QSO. Ha solicitado eliminar este QSO. Are you sure? ¿Está seguro? You have requested to delete the QSO with: %1 Ha solicitado eliminar el QSO con: %1 DUPE DUPLICADO Miles Millas An unexpected error ocurred while looking for new bands & modes in your log. If the problem persists, please contact the developer for analysis: Ha ocurrido un error al buscar nuevas bandas y modos en su log. Si el problema persiste, contacte con el desarrolador para su análisis: TX Frequency in MHz Frecuencia de TX en MHz RX Frequency in MHz Frecuencia de RX en MHz Power used for the QSO in watts Potencia usada para el QSO en vatios Power used by the DX Potencia usada por el DX Logging operator's callsign Indicativo del operador Callsign used over the air Indicativo usado en el aire My QTH locator Mi QTH locator Name of the DX Nombre del DX QTH of the DX QTH del DX Locator of the DX Locator del DX Status on ClubLog Estado en ClubLog Status of the eQSL sending Estado de envío de eQSL Status of the eQSL reception Estado de recepción de eQSL Status of the LotW sending Estado de envío de LotW Status of the LotW reception Estado de recepción de LotW Date of the ClubLog upload Dato del envío a ClubLog Date of the eQSL sending Fecha del envío de eQSL Date of the eQSL reception Fecha de la recepción de eQSL Date of the LotW sending Fecha del envío de LotW Date of the LotW reception Fecha de la recepción de LotW Status of the QSL sending Estado del envío de QSL Status of the QSL reception Estado de la recepción de QSL QSL sending information Información de envío de QSL QSL reception information Información de envío de QSL Date of the QSL sending Fecha del envío de QSL Date of the QSL reception Fecha de recepción de QSL Message of the QSL Mensaje de la QSL QSL via information Información de QSL via Number of confirmed DXCC entities Número de entidades DXCC confirmadas Number of worked DXCC entities Número de entidades DXCC trabajadas Number of confirmed WAZ zones Número de zonas WAZ confirmadas Number of worked WAZ zones Número de zonas WAZ trabajadas Number of confirmed local references Número de referencias locales confirmadas Number of worked local references Número de referencias locales trabajadas Number of confirmed QSO Número de QSO confirmados Number of worked QSO Número de QSO trabajados Number of DXCC worked on the selected year Número de DXCC trabajados en el año seleccionado Number of CQ Zones worked on the selected year Número zonas CQ trabajadas en el año seleccionado Score for the DXMarathon on the selected year Puntuación para el DXMarathon del año seleccionado Select the year you want to check Seleccione el año que quieres comprobar Status of the DX entity Estado de la entidad DX Name of the DX entity Nombre de la entidad DX Select the primary division for this QSO Seleccione la división principal de este QSO Select the secondary division for this QSO Seleccione la división secundaria de este QSO Select the correct entity of the current QSO Seleccione la entidad correcta para el QSO actual Power(rx) Potencia (rx) RST(tx) RST(tx) RST(rx) RST(rx) QSO QSO QSL Rec QSL Rec QSL Via QSL Vía QSL QSL eQSL Sent Envío eQSL eQSL Rec Recepción eQSL LotW Sent Env LotW LotW Rec Rec LotW eQSL eQSL Satellite Satélite -- -- - Needed for DXMarathon - Necesitado para DXMarathon The download failed!. Do you want to update the file? Descarga fallida. ¿Quiere actualizar el fichero? The file has been downloaded! ¡Se ha descargado el fichero! The file already exits and needs to be overwritten. Do you want to update the file? El fichero ya existe y debe ser sobreescrito. ¿Quiere actualizar el fichero? Needed QSO to send the QSL QSO al que es necesario enviar la QSL My QSL requested to be sent Se ha solicitado el envío de mi QSL DX QSL pending to be received QSL del DX pendiente de recibir Comments Comentarios Others Otros Power Potencia Operator Operador Station Callsign Indicativo de la estación &Export Highlited &Exportar marcados KLog folder Carpeta de KLog Export ALL the QSO coming from ALL the logs in the same logfile. QSOs will be mixed up in the same ADIF file. Exportar TODOS los QSO de TODOS los logs al mismo fichero. Los QSO se mezclarán en el mismo fichero ADIF. Import an ADIF file in the current log Importar fichero ADIF al log actual Run the log reusing previous QSO to reuse and fill missing information in other QSO Recorrer el log reutilizando QSO anteriores para rellenar información en otros QSO Shows QSO that are needed and you should send your QSL and request the DX-QSL Muestra QSO necesarios, para los que debería enviar su QSL y solicitar la del DX Find &requested MY-QSL Buscar &requeridas Mi-QSL Shows the QSO that have requested my QSL to be sent and is still pending. You should keep this queue empty! Muestra QSO que han requerido el envío de mi QSL. Debería mantener esta lista vacía! &Find pending to receive DX-QSL &Encontrar QSL DX pendientes de recibir Shows the DX-QSL that has been requested or simply my QSL has been sent with no answer Muestra QSL-DX que han sido solicitadas o cuya QSL ha sido enviada sin respuesta &Find requested DX-QSL &Buscar QSL-DX solicitada Shows the DX-QSL that has been requested Muestra QSL-DX que han sido solicitadas Export all requested My-QSL QSO to an ADIF file (i.e. to import it in a QSL tag printing software) Exportar los QSO con mi QSL solicitada (ej. Para importarla en un programa de impresión de tarjetas) Update the country file to have updated DX-Entity data Actualizar el fichero de entidades para tener datos de entidades DX actualizados You can find the KLog data folder here: Puede encontrar la carpeta de KLog aquí: Select the propagation mode for this current QSO Seleccione el modo de propagación para este QSO ClubLog ClubLog My Locator Mi locator My Data Mis datos Continent Continente Prefix Prefijo CQ CQ ITU ITU Short Path Salto corto Long Path Salto largo Grad Grad Km Km Info Info Award Diploma &Export Marked &Exportar marcados IOTA IOTA Entity Entidad KLog KLog Id Id Fill QSO data Rellenar datos de QSO Find &requested QSL Buscar QSL &requeridas &Export Requested QSL to ADIF... &Exportar a ADIF QSL requeridas... &Update CTY.CSV Act&ualizar CTY.CSV About Qt... Acerca de Qt... About... Acerca de ... Nothing has been saved. You have to select a valid file type. No se ha guardado nada. Debe especificar un tipo de fichero válido. ADIF files (*.adi);;Cabrillo files (*.log);;Any file (*.*) Ficheros ADIF (*.adi);;Ficheros Cabrillo (*.log);;Cualquier fichero (*.*) Freq TX Freq TX Freq RX Freq RX Confirmed Confirmados Worked Trabajados DXCC DXCC All Todos Primary Div Div principal Secondary Div Div secundaria Propagation mode Modo de propagación You have selected an entity Ha seleccionado una entidad that is different from the KLog proposed entity que es distinta de la entidad propuesta por KLog Push Apply to apply your selection. Pulse Aplicar para aplicar la selección You have selected an entity: Seleccione el año que quiere comprobar that is different from the KLog proposed entity: que es diferente de la entidad que KLog propone: Search in the log Buscar en el log Search in all logs Buscar en todos los logs ADIF (*.adi *.adif) Export the current log to an ADIF logfile Exportar el log actual a un fichero ADIF &Export all logs to ADIF... &Exportar a ADIF todos los logs... &Find pending to receive QSL Buscar pendientes de recibir QSL ADIF files (*.adi *.adif);;Cabrillo files (*.log);;Any file (*.*) Ficheros ADIF (*.adi *.adif);;Ficheros Cabrillo (*.log);;Cuaquier fichero (*.*) Via Direct && mark DX QSL as requested Vía directa y marcar QSL DX como solicitada Send this QSL via direct & mark DX QSL as requested Enviar esta QSL vía directa y marcar QSL DX como solicitada Via Bureau && mark DX QSL as requested Vía Bureau y marcar QSL DX como solicitada Send this QSL via bureau & mark DX QSL as requested Enviar esta QSL vía bureau y marcar QSL DX como solicitada QSL received via bureau & mark my QSL as requested QSL recibida vía bureau y marcar my QSL como solicitada Score Puntuación DX-Marathon DX-Marathon WAZ WAZ Local Local QSOs QSOs Awards Diplomas Search Buscar DX-Cluster DX-Cluster Save ADIF File Guardar fichero ADIF Save Cabrillo File Guardar fichero Cabrillo Cabrillo (*.log) Cabrillo (*.log) Open File Abrir fichero &Modify &Modificar New One! ¡Nuevo! New one in this band Nuevo en esta banda Worked in this band but not confirmed Trabajado en esta banda pero no confirmado Confirmed but needed in this band Confirmado pero necesitado en esta banda Confirmed in this band Confirmado en esta banda No message Sin mensaje Needed QSO! ¡QSO necesitado! Worked but not confirmed! ¡Trabajado pero no confirmado! Filling QSOs... Rellenando QSOs... Abort filling Cancelar rellenado Filling QSOs... QSO: Rellenando QSOs... QSO: Number Número Comment Comentario Print Log Imprimir log Printing the log... Imprimiendo el log... Abort printing Cancelar impresión Printing the log... QSO: Imprimiendo el log ...QSO: MainWindowSatTab Keep this data Mantener estos datos Data entered in this tab will be copied into the next QSO Los datos introducidos en esta pestaña se copiarán al siguiente QSO Name of the Satellite (format like AO-51) Name of the Satellite Nombre del satélite (formato como AO-51) Satellite mode used Modo del satélite usado Satellite Satélite Mode Modo QObject Database Error Error de base de datos KLog DB needs to be upgraded. La BD de KLog necesita actualizarse. Do you want to upgrade it now? If DB is not upgraded KLog may not work properly. ¿Quiere actualizarla ahora? Si no se actualiza es posible que KLog no funcione correctamente. KLog has detected a previous log in the DB. All data will be migrated to a newly created DX type log for you. KLog ha detectado un log anterior en la BD. Todos los datos serán migrados a un log tipo DX creado para usted. KLog: Enter Station callsign KLog: Introduzca indicativo Enter the station callsign used in this log Introduzca el indicativo usado en este log Station Callsign Indicativo de la estación All the data was migrated correctly. You should now to go to Setup->Preferences->Logs to check that everything is OK. Todos los datos se migraron correctamente. Debería ir a Preferencias->Logs para comprobar que todo está OK Updating mode information... Actualizando información de modo... Abort updating Cancelar actualización Updating mode information... QSO: Actualizando informacióon de modo... QSO: Cancelling this update will cause data inconsistencies and possibly data loss. Do you still want to cancel? Cancelar esta actualización causará inconsistencia de datos y posible pérdida de datos. ¿Quiere cancelar? Updating bands information... Actualizando información de bandas... Updating bands information... QSO: Actualizando información de bandas... QSO: Updating bands information in %1 status... Actualizando información de bandas en %1... Updating bands information... Progress: Actualizando información de bandas... Progreso: Updating mode information in %1 status... Actualizando información de modos en %1... 0-new One Nuevo 1-Needed, work it! ¡Necesitado, trabájelo! 2-Needed, work it! ¡Necesitado, trabájelo! 3-Worked but not confirmed Trabajado pero no confirmado 4-Needed, work it! ¡Necesitado, trabájelo! 5-Needed, work it! ¡Necesitado, trabájelo! 6-Needed, work it! ¡Necesitado, trabájelo! 7-Needed, work it! ¡Necesitado, trabájelo! 8-Worked but not confirmed Trabajado pero no confirmado 9-Needed, work it! ¡Necesitado, trabájelo! 10-Worked but not confirmed Trabajado pero no confirmado 11-Needed, work it! ¡Necesitado, trabájelo! 12-Worked but not confirmed Trabajado pero no confirmado 13-Confirmed Confirmado New One, work it! nNew One, work it! ¡Nuevo, trabájelo! Needed, work it! ¡Necesitado, trabájelo! Worked but not confirmed ¡Trabajado pero no confirmado! Confirmed Confirmado Not identified No identificado SetupDialog User data Datos de usuario Bands/Modes Bandas/modos My Data Mis datos DX-Cluster DX-Cluster Colors Colores Misc Varios World Editor Editor de entidades ClubLog ClubLog Cancel Cancelar OK OK Config Dialog Configuración D&X-Cluster D&X-Cluster You need to enter at least a valid QRZ. Debe introducir un QRZ válido. You have not selected the kind of log you want. You will be redirected to the Log tab. Please add and select the kind of log you want to use. No ha seleccionado el tipo de log que quiere. Será redirigido a la pestaña de Log. Por favor añada y seleccione el tipo de log que quiere usar. Logs Logs You need to enter at least one log in the Log's tab. Debe introducir al menos un log en la pestaña de Log. World Entidades SetupEntityDialog Entity Entidad Name of the Entity Nombre de la entidad CQ CQ CQ zone Zona CQ ITU ITU ITU zone Zona ITU Latitude Latitud Longitude of the Entity Longitud de la entidad Longitude Longitud UTC UTC Local time difference to UTC Diferencia de la hora local con UTC Main prefix Prefijo Main prefix of the entity Prefijo principal de la entidad ARRL Id Id ARRL ARRL id Id ARRL Prefixes Prefijos Comma separated possible prefixes. ie. EA1, EA2, ... Comma separated possible prefixes. Eg. EA1, EA2, ... Lista separada por comas de prefijos posibles. Ej. EA1, EA2, ... Date of the deletion Fecha de eliminación Deleted Eliminado Cancel Cancelar OK Ok Entity Dialog Entidad SetupPageBandsModes Bands Bandas Modes Modos &Add Band &Añadir banda &Remove Band Elimina&r banda Add &Mode Añadir &modo Remove M&ode Eliminar m&odo SetupPageClubLog &Callsign Indi&cativo Clublog &password Contrase&ña Clublog &email Correo &electrónico Enter the email you used to register in clublog Introduzca el correo-e que usó para registrarse en clublog Enter the callsign you used to register in clublog Introduzca el indicativo que usó para registrarse en clublog Enter your password in clublog Introduzca su contraseña de clublog &Send QSOs in real time &Enviar QSOs en tiempo real &Activate ClubLog &Activar ClubLog Use QSO Station &Callsign Usar indicativo de estación del QSO Send each QSO to ClubLog in real time, as they are added (or modified) in KLog Enviar cada QSO a ClubLog en tiempo real, según se van añadiendo (o modificando) en KLog Starts the ClubLog support in KLog Inicia el soporte de ClubLog en KLog Use the Station Callsign defined in each QSO instead of the defined here Usa en cada QSO el indicativo de estación definido en vez del definido aquí SetupPageColors New One Nuevo Needed in this band Necesitado en esta banda Worked Trabajado Worked in this band Trabajado en esta banda Confirmed in this band Confirmed Confirmado en esta banda Default Predeterminado Choose a color Elija un color SetupPageDxCluster Add Añadir Delete Borrar Show &HF spots Show HF spots Mostrar avisos en I&HF Show V/&UHF spots Show V/UHF spots Mostrar avisos en V/&UHF Show W&ARC spots Show WARC spots Mostrar avisos en W&ARC Show &worked spots Show worked spots Mostrar a&visos trabajados Show &confirmed spots Show confirmed spots Mostrar avisos &confirmados Show ANN/&FULL messages Show ANN/FULL messages Mostrar mensajes ANN/&FULL Show WW&V messages Show WWV messages Mostrar mensajes &WWV Show WC&Y messages Show WCY messages Mostrar mensajes WC&Y DX Spots Avisos DX Messages Mensajes KLog: Add a DXCluster server Kontest: Add a DXCluster server KLog: Añadir servidor DX-Cluster Add the address followed by the :port Example: dxfun.com:8000 If no port is specified, 41112 will be used by default: Add the address followed by the :port Example: dxfun.com:8000 If no port is specified, 41112 will be used by default.: Añade la dirección seguida de :puerto Ejemplo: dxfun.com:8000 Si no se especifica puerto se usará 41112 de forma predeterminada: SetupPageLogs Type Station callsign Indicativo de la estación Operators Operadores &New New &Nuevo Load All Cargar todos Load Cargar Clear Limpiar Edit Editar Remove Borrar &Edit &Editar &Remove Elimina&r Add a new log Añadir nuevo log Select the log you want to open Seleccione el log a abrir KLog KLog Do you really want to remove this log? All the QSO from this log will be also deleted... ¿Quiere realmente eliminar este log? Se eliminarán también todos los QSO de este log... Log has not been removed. (#3) Log no eliminado (#3) Log has not been removed. (#2) Log no eliminado (#2) Log has not been removed. (#1) Log no eliminado (#1) An error has ocurred showing the following error code: '%1' An error has ocurred showing the folloing error code: '%1' Ha ocurrido un error con el siguiente código: '%1' KLog - SetupPageLogs KLog - SetupPageLogs Load all the logs Cargar todos los logs Load only the selected log Cargar sólo el log seleccionado Clear selection Limpiar selección Edit the selected log Editar el log selecionado Remove the selected log Eliminar el log seleccionado New Log Nuevo log StationCallsign Indicativo Estacion Callsign used for this log Indiativo usado para este log Comma separated list of operators: callsign1, callsign2 Lista separada por comas de los operadores: indicativo1, indicativo2 Your name or the station's responsible Tu nombre o el nombre del responsable de la estación Start date of this log Fecha de inicio de este log Type of Operation Tipo de operación Name Nombre Select the kind of operation for this log Selecciona el tipo de operación para este log Mode Category Categoría de modo Select the mode category Selecciona la categoría de modo Operators Category Categoría de operadores Select the operators category Selecciona la categoría de operadores Assisted Category Categoría de asistido Select the assisted category Selecciona la categoría de asistido Power Category Categoría de potencia Select the power category Selecciona la categoría de potencia Bands Category Categoría de bandas Select the bands category Selecciona la categoría de bandas ID ID Station Callsign Indicativo de la estación Comments Comentarios Callsign Indicativo Date Fecha Comment Comentario QSOs QSOs DD-MM-YYYY DD-MM-AAAA SetupPageLogsNew &Ok &Ok &Cancel &Cancelar Select categories Seleccione categorías Station Callsign Indicativo de la estación Operators Operadores Comment Comentario Callsign used for this log Indicativo usado para este log Comma separated list of operators: callsign1, callsign2 Lista separada por comas de los operadores: indicativo1, indicativo2 Start date of this log Fecha de inicio de este log Add a comment about this log Añada un comentario para este log Type of Operation Tipo de operación Name Nombre Date Fecha Select the kind of operation for this log Seleccione el tipo de operación para este log Mode Category Categoría de modo Select the mode category Seleccione la categoría de modo Operators Category Categoría de operadores Select the operators category Seleccione la categoría de operadores Assisted Category Categoría de asistido Select the assisted category Seleccione la categoría de asistido Power Category Categoría de potencia Select the power category Seleccione la categoría de potencia Bands Category Categoría de bandas Select the bands category Seleccione la categoría de bandas Overlay Overlay &Date &Fecha &Station Callsign &Indicativo Estación &Operators &Operadores Comm&ent Commentario &Type of Operation &Tipo de Operación &Mode Category &Modo operación O&perators Category Categoría O&peradores &Assisted Category Categoría &Asistido Po&wer Category Categoría &Potencia &Bands Category Categoría &Bandas O&verlay O&verlay Select the Overlay category Seleccione la categoría de overlay Categories not OK Categorías no OK You need to enter a valid QRZ in the Station Callsign box. The log will not be opened. You need to enter a valid QRZ in the Station Callsign box The log will not be opened. Necesita introducir un indicativo válido en el cuadro de Indicativo. El log no se abrirá. You selected an invalid combination. The log will not be opened. You selected an invalid combination The log will not be opened. Ha seleccionado una categoría no válida. El log no se abrirá. Categories OK Categorías OK SetupPageMisc &Imperial system Imperial system Sistema &imperial DB in &Memory DB in Memory BD en &memoria &Log in real time Log in real time &Log en tiempo real &Time in UTC Time in UTC Hora en U&TC &Save ADIF on exit Save ADIF on exit Guardar ADIF al &salir Use this &default filename Use this default filename Usar este fichero &de forma predeterminada Mark &QSO to send QSL when QSL is received Mark QSO to send QSL when QSL is received Marcar como &QSL por enviar cuando se recibe la QSL Complete QSO with previous data Completar QSO con datos anteriores QSOs will be marked to be pending to send the QSL if the DX QSL is received and you have not sent your. Working in memory (vs in file) is much quicker but you will need to save the ADIF file each time you start Kontest. Los QSO se marcarán como pendientes de enviar si se recibe la tarjeta del DX y no ha enviado la suya. Show the Station Callsign used in the search box Mostrar el indicativo de la estación utilizado en el cuadro de búsqueda The search box will show also the callsign on the air to do the QSO. El cuadro de búsqueda mostraráa también el indicativo usado para hacer el QSO. Reset to My Data for all QSO Use My Data tab for all QSO Reiniciar a Mis Datos para todos los QSO Show the Station &Callsign used in the search box Mostrar indicativo usado en el &cuadro de búsqueda &Reset to My Data for all QSO &Reiniciar Mis Datos en todos los QSO All the data from the My Data tab will be used or data from the previous QSO will be maintained. Todos los datos de la pestaña Mis Datos se usarán o bien se usarán datos del QSO anterior. Check it for Imperial system (Miles instead of Kilometres). Marcar si quiere usar sistema imperial (Millas en vez de Kilómetros). Working in memory (vs in file) is much quicker but you will need to save the ADIF file each time you exit KLog. Working in memory (vs in file) is much quicker but you will need to save the ADIF file each time you exit KLog. Trabajar en memoria (en vez de fichero) es más rápido pero deberá salvar el fichero ADIF cada vez que salga de KLog. Select to use real time. Seleccione para usar tiempo real. Select to use UTC time. Seleccione para usar UTC. Select if you want to save to ADIF on exit. Seleccione si quiere guardar en ADIF al salir. Select to use the following name for the logfile and not being asked for it anymore. Seleccione para usar el siguiente nombre de fichero y que no se le pregunte más. Complete the current QSO with previous QSO data. Completar el QSO actual con datos de QSO anteriores. This is the default file where ADIF will be saved. Este es el nombre de fichero predeterminado donde se guardará el fichero ADIF. Click to change the default ADIF file Pulse para cambiar el nombre predeterminado del fichero ADIF Open File Abrir fichero ADIF (*.adi) ADIF (*.adi) SetupPageUserDataPage Enter your CALLSIGN that will be used for logging Introduzca su INDICATIVO para usarlo en el log &Personal data Personal data Datos &personales Station &data Station data &Datos de la estación Enter your name Introduzca su nombre Enter your address - 1st line Introduzca su dirección - 1ª línea Enter your address - 2nd line Enter your address - 2nd line Introduzca su dirección - 2ª línea Enter your address - 3st line Introduzca su dirección - 3ª línea Enter your address - 4nd line Enter your address - 4nd line Introduzca su dirección - 4ª línea Enter your city Introduzca su ciudad Enter your zip code Introduzca su código postal Enter your province or state Introduzca su provincia o estado Enter your country Introduzca su país &Name Name &Nombre &Address Address &Dirección Cit&y City Ci&udad &Zip Code Zip Code Código &postal Pro&v/State Prov/State Pro&v/Estado Countr&y Country Paí&s Enter your rig #1 information Introduzca la información de su equipo/radio #1 Enter your rig #2 information Introduzca la información de su equipo/radio #2 Enter your rig #3 information Introduzca la información de su equipo/radio #3 Enter your antenna #1 information Introduzca la información de su antena #1 Enter your antenna #2 information Introduzca la información de su antena #2 Enter your antenna #3 information Introduzca la información de su antena #3 Enter your power information Introduzca información sobre su potencia &Rig 1 &Equipo 1 R&ig 2 E&quipo 2 Ri&g 3 Eq&uipo 3 Antenna &1 Antena &1 Antenna &2 Antena &2 Antenna &3 Antena &3 Po&wer Po&tencia &QRZ &QRZ &Operators &Operadores &CQ Zone Zona &CQ &ITU Zone Zona &ITU &Locator &Locator &Locator (not valid) &Locator (no válido) Rig 1 Equipo 1 Rig 2 Equipo 2 Rig 3 Equipo 3 Antenna 1 Antena 1 Antenna 2 Antena 2 Power Potencia Enter the station callsign that will be used for logging Introduzca el indicativo de la estación que será usado para el log Enter the operators (comma separated if more than one). Introduzca los operadores (separados por comas si hay más de uno). QRZ QRZ Operators Operadores CQ Zone Zona CQ ITU Zone Zona ITU Locator Locator Enter the locator of your station. KLog will propose one locator based on your callsign Enter the locator of your station. Kontest will propose one locator based on your callsign Introduzca el locator de su estación. KLog le propondrá uno basado en su indicativo Contest category Categoría de concurso Locator (not valid) Locator (no válido) SetupPageWorldEditor Prefix Prefijo Entity Entidad ARRL id Id ARRL Continent Continente CQ Zone Zona CQ ITU Zone Zona ITU UTC UTC Latitude Latitud Longitude Longitud Deleted Eliminado Since Date Desde fecha To Date Hasta fecha StartWizard KLog - The free hamradio logging software KLog - The free hamradio logging software KLog - El programa libre de log de radioaficionados Quit Setup Salir Setup is not complete yet. Are you sure you want to quit setup? La configuración no está completa. ¿Está seguro de querer salir de la configuración? World Entity Entidad Continent Continente Reading cty.dat... Leyendo cty.dat... Abort reading Cancelar lectura Reading cty.csv... Leyendo cty.csv... eLogClubLog Host not found! ¡Máquina no encontrada! Timeout error! ¡Error de tiempo excedido! It seems to be a PASSWORD ERROR, check your password Parece haber un error de contraseña, revísela KLog - ClubLog KLog - clublog KLog - ClubLog It seems that your Clublog's password is not correct Please check your password in the setup. Clublog uploads will be disabled. Parece que su contraseña de ClubLog no es correcta. Por favor, revise su contraseña en la configuración. El envío a ClubLog será deshabilitado. Undefined error... Error no definido... Callsign missing Falta indicativo Invalid callsign Indicativo no válido Skipping SWL callsign Saltando indicativo SWL Callsign is your own call Callsign is your ow call El indicativo es su propio indicativo Invalid callsign with no DXCC mapping Indicativo no válido sin correspondencia con DXCC Updated QSO QSO actualizado Invalid ADIF record Registro ADIF no válido Missing ADIF record Falta registro ADIF Test mode - parameters ok, no action taken Modo Test - parámetros OK, sin acción Excesive API Usage Uso excesivo de API Internal Error Error interno Rejected Rechazado QSO Duplicate QSO duplicado QSO Modified QSO modificado Missing Login Falta login QSO OK QSO OK Upload denied Subida rechazada No callsign selected No se seleccionó indicativo No match found Sin coincidencia Dropped QSO QSO eliminado OK OK Login rejected Login rechazado Rejected: Callsign is your own call Rechazado: El indicativo es su propio indicativo klog-0.9.2.2/contest_cqwwdxssb.cpp0000644000076700000620000003726312627126144015074 0ustar staff/*************************************************************************** contestcqwwdxssb.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "contest_cqwwdxssb.h" //#include /* V. MULTIPLIER: Two types of multiplier will be used. A multiplier of one (1) for each different zone contacted on each band. A multiplier of one (1) for each different country contacted on each band. Stations are permitted to contact their own country and zone for multiplier credit. The CQ Zone Map, DXCC country list, WAE country list, and WAC boundaries are standards. Maritime mobile stations count only for a zone multiplier. VI. POINTS: Contacts between stations on different continents are worth three (3) points. Contacts between stations on the same continent but different countries, one (1) point. Exception: For North American stations only, contacts between stations within the North American boundaries count two (2) points. Contacts between stations in the same country are permitted for zone or country multiplier credit but have zero (0) point value. VII. SCORING: All stations: the final score is the result of the total QSO points multiplied by the sum of your zone and country multipliers. Example: 1000 QSO points 100 multiplier (30 Zones + 70 Countries) = 100,000 (final score). */ ContestCQWWDXSSB::ContestCQWWDXSSB() { //qDebug() << "ContestCQWWDXSSB::ContestCQWWDXSSB" << endl; myEntity = ""; myCQz = ""; myContinent = ""; NA = -1; mycategory = ""; arrlSection = ""; stationQrz = ""; claimedScore = ""; name = ""; address = ""; operators = ""; soapbox = ""; thiscontest = ""; club = ""; createdby = ""; } ContestCQWWDXSSB::ContestCQWWDXSSB(const QStringList _qs) { // Receives: QStringList _qs; //_qs << myEntity << myCQz << myContinent << NA-id; myEntity = _qs.at(0); myCQz = _qs.at(1); myContinent = _qs.at(2); NA = _qs.at(3); // NA is North America for scoring purposes thiscontest = "CQ-WW-SSB"; mycategory = "SINGLE-OP ALL HIGH"; club = "NoClub"; createdby ="KLog-Alpha"; /* OFFICIAL CATEGORIES CATEGORY: SINGLE-OP ALL HIGH CATEGORY: SINGLE-OP 160M HIGH CATEGORY: SINGLE-OP 80M HIGH CATEGORY: SINGLE-OP 40M HIGH CATEGORY: SINGLE-OP 20M HIGH CATEGORY: SINGLE-OP 15M HIGH CATEGORY: SINGLE-OP 10M HIGH CATEGORY: SINGLE-OP ALL LOW CATEGORY: SINGLE-OP 160M LOW CATEGORY: SINGLE-OP 80M LOW CATEGORY: SINGLE-OP 40M LOW CATEGORY: SINGLE-OP 20M LOW CATEGORY: SINGLE-OP 15M LOW CATEGORY: SINGLE-OP 10M LOW CATEGORY: SINGLE-OP ALL QRP CATEGORY: SINGLE-OP 160M QRP CATEGORY: SINGLE-OP 80M QRP CATEGORY: SINGLE-OP 40M QRP CATEGORY: SINGLE-OP 20M QRP CATEGORY: SINGLE-OP 15M QRP CATEGORY: SINGLE-OP 10M QRP CATEGORY: SINGLE-OP-ASSISTED ALL CATEGORY: SINGLE-OP-ASSISTED 160M CATEGORY: SINGLE-OP-ASSISTED 80M CATEGORY: SINGLE-OP-ASSISTED 40M CATEGORY: SINGLE-OP-ASSISTED 20M CATEGORY: SINGLE-OP-ASSISTED 15M CATEGORY: SINGLE-OP-ASSISTED 10M CATEGORY: MULTI-ONE CATEGORY: MULTI-TWO CATEGORY: MULTI-MULTI CATEGORY: CHECKLOG */ arrlSection = "DX"; stationQrz = ""; claimedScore = "000"; name = "No-Name"; address = "MyPoBox\nADDRESS: SecondLineOfAddress"; operators = "EA4TV, EA4GCA"; soapbox = "MySoapbox\nSOAPBOX: Another line\nSOAPBOX: and even one more"; //qDebug() << "ContestCQWWDXSSB::ContestCQWWDXSSB: " << myEntity << "/" << myCQz << "/" << myContinent << "/" << NA << endl; } ContestCQWWDXSSB::~ContestCQWWDXSSB(){ } bool ContestCQWWDXSSB::isMultiplier(const QStringList _qs){ //qDebug() << "ContestCQWWDXSSB::isMultiplier" << endl; for (int i = 0; i<_qs.length(); i++){ ////qDebug() << _qs.at(i) <<", "; } // Receives: QStringList _qs; //_qs << DX-Entity << DXCQz << DX-band; // V. MULTIPLIER: Two types of multiplier will be used. // // A multiplier of one (1) for each different zone contacted on each band. // A multiplier of one (1) for each different country contacted on each band. // Stations are permitted to contact their own country and zone for multiplier credit. // The CQ Zone Map, DXCC country list, WAE country list, and WAC boundaries are standards. // Maritime mobile stations count only for a zone multiplier. if (_qs.length() != 3){ //qDebug() << "ContestCQWWDXSSB::isMultiplier: diferent THAN 3" << endl; return false; } QString dxEntity = _qs.at(0); QString dxCQz = _qs.at(1); if (!( (isValidCQz(dxCQz) ) && (isValidEntity(dxEntity) ) ) ){ return false; } //TODO: Check if the band is a valid string QString dxBand = _qs.at(2); // A multiplier of one (1) for each different zone contacted on each band. QString queryString; QSqlQuery query; queryString = QString("SELECT id FROM log WHERE bandid='%1' AND stx='%2'").arg(dxBand).arg(dxCQz); //qDebug() << "ContestCQWWDXSSB::isMultiplier-1: " << queryString << endl; query.exec(queryString); query.next(); if (!(query.isValid())){ //qDebug() << "ContestCQWWDXSSB::isMultiplier: Not Worked Zone" << endl; return true; } // A multiplier of one (1) for each different country contacted on each band. queryString = QString("SELECT id FROM log WHERE bandid='%1' AND dxcc='%2'").arg(dxBand).arg(dxEntity); //qDebug() << "ContestCQWWDXSSB::isMultiplier-2: " << queryString << endl; query.exec(queryString); query.next(); if (!(query.isValid())){ //qDebug() << "ContestCQWWDXSSB::isMultiplier: MULT2 - Not worked DXCC" << endl; return true; } return false; } int ContestCQWWDXSSB::getQSOPoints(const QStringList _qs){ //qDebug() << "ContestCQWWDXSSB::getQSOPoints" << endl; // Receives: QStringList _qs; //_qs << DX-Entity << DX-Continent // VI. POINTS: // // Contacts between stations on different continents are worth three (3) points. // Contacts between stations on the same continent but different countries, one (1) point. // Exception: For North American stations only, contacts between stations within the North American // boundaries count two (2) points. // // Contacts between stations in the same country are permitted for zone or country multiplier // credit but have zero (0) point value. if (_qs.length() != 2){ return false; } QString dxEntity =_qs.at(0); QString dxContinent = _qs.at(1); if (myContinent != dxContinent){ return 3; }else if (myContinent == NA) { return 2; } else if (myEntity != dxEntity){ return 1; }else{ return 0; } return 0; } bool ContestCQWWDXSSB::isValidCQz(const QString _cqz){ //qDebug() << "ContestCQWWDXSSB::isValidCQz: " << _cqz << endl; if ( (_cqz.toInt()>0) && (_cqz.toInt()<41) ){ return true; }else{ return false; } return false; } bool ContestCQWWDXSSB::isValidEntity(const QString _ent){ //qDebug() << "ContestCQWWDXSSB::isValidEntity: " << _ent << endl; if ( (_ent.toInt()>0) ) { return true; }else{ return false; } return false; } bool ContestCQWWDXSSB::saveFileToSend(const QString& _fileName) { //qDebug() << "Contest::saveFileToSend" << _fileName << endl; QFile file(_fileName); QSqlQuery query1; if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return false; QTextStream out(&file); //_qs << myEntity << myCQz << myContinent << NA-id; //myARRLSect << StationQRZ << myCategory << myClub << //myAddress << operators(comma separated EA4TV, EA4GCA, ...) //SoapBox out << "START-OF-LOG: 3" << endl; out << "ARRL-SECTION: " << arrlSection << endl; out << "CALLSIGN: " << stationQrz << endl; out << "CATEGORY: " + mycategory << endl; out << "CLAIMED-SCORE: " << claimedScore << endl; out << "CLUB: " << club << endl; out << "CONTEST: " << thiscontest << endl; out << "NAME: " << name << endl; out << "ADDRESS: " << address << endl; out << "CREATED-BY: " << createdby << endl; out << "OPERATORS: " << operators << endl;// [required for multi-op stations] out << "SOAPBOX: " << soapbox << endl; //[add lines if needed] QSqlQuery query("SELECT * FROM log"); QSqlRecord rec = query.record(); int nameCol; QString aux1, aux2, queryString; /* START-OF-LOG: 3.0 CONTEST: CQ-WW-RTTY CONTEST: CQ-WW-SSB CONTEST: CQ-WW-CW CALLSIGN: LU6ETB CATEGORY-OPERATOR: SINGLE-OP CATEGORY-BAND: 10M CATEGORY-POWER: HIGH CATEGORY-ASSISTED: NON-ASSISTED CLAIMED-SCORE: 1410 OPERATORS: N5KO CLUB: Radio Club Quilmes NAME: Trey Garlough ADDRESS: 7375 Oak Ridge Road ADDRESS-CITY: Aptos ADDRESS-STATE: CA ADDRESS-POSTALCODE: 95003 ADDRESS-COUNTRY: USA QSO: 3799 PH 2000-11-26 0711 N6TW 59 03 K9QZO 59 04 0 END-OF-LOG: */ while (query.next()) { if ( query.isValid()) { out << "QSO: "; nameCol = rec.indexOf("freq"); aux1 = (query.value(nameCol)).toString(); if (aux1.length()<1) { nameCol = rec.indexOf("bandid"); aux1 = (query.value(nameCol)).toString(); queryString = QString("SELECT cabrillo FROM band WHERE id='%1'").arg(aux1); query1.exec(queryString); query1.next(); if (query1.isValid()) { aux1 = query1.value(0).toString(); //qDebug() << "ContestCQWWDXSSB::saveFileToSend: band: " << queryString << "/" << aux1 << endl; if (!(aux1.length()>1)) { aux1 = " NULL"; } } } aux1.remove(QChar('.'), Qt::CaseInsensitive); out << aux1.rightJustified(5, ' ', true) << " "; nameCol = rec.indexOf("modeid"); aux1 = (query.value(nameCol)).toString(); queryString = QString("SELECT name FROM mode WHERE id='%1'").arg(aux1); query1.exec(queryString); query1.next(); if (query1.isValid()) { aux1 = (query1.value(0)).toString(); if (aux1=="RTTY") { out << "RY "; } else if (aux1=="CW") { out << "CW "; } else { out << "PH "; } } nameCol = rec.indexOf("qso_date"); aux1 = (query.value(nameCol)).toString(); //qDebug() << "ContestCQWWDXSSB::saveFileToSend date: " << aux1 << endl; aux1.replace(QString("/"), QString("-")); if ((aux1.length()) == 10) { out << aux1 << " "; } nameCol = rec.indexOf("time_on"); aux1 = (query.value(nameCol)).toString(); //qDebug() << "ContestCQWWDXSSB::saveFileToSend time1: " << aux1 << endl; aux1.remove(QChar(':'), Qt::CaseInsensitive); aux1.truncate(4); aux1 = aux1.leftJustified(4, '0', true); out << aux1 << " "; //qDebug() << "ContestCQWWDXSSB::saveFileToSend time2: " << aux1 << endl; nameCol = rec.indexOf("station_callsign"); aux1 = (query.value(nameCol)).toString(); if (aux1.length()<3) { nameCol = rec.indexOf("operator"); aux1 = (query.value(nameCol)).toString(); } out << aux1.leftJustified(13, ' ', true) << " "; nameCol = rec.indexOf("rst_sent"); aux1 = (query.value(nameCol)).toString(); aux1.truncate(3); out << aux1.leftJustified(3, ' ', true) << " "; //qDebug() << "ContestCQWWDXSSB::saveFileToSend: rsttx" << aux1 << endl; nameCol = rec.indexOf("stx"); aux1 = (query.value(nameCol)).toString(); aux1.truncate(6); out << aux1.leftJustified(6, ' ', true) << " "; nameCol = rec.indexOf("call"); aux1 = (query.value(nameCol)).toString(); aux1.truncate(13); out << aux1.leftJustified(13, ' ') << " "; nameCol = rec.indexOf("rst_rcvd"); aux1 = (query.value(nameCol)).toString(); out << aux1.leftJustified(3, ' ', true) << " "; nameCol = rec.indexOf("srx"); aux1 = (query.value(nameCol)).toString(); aux1.truncate(6); out << aux1.leftJustified(6, ' ', true) << " "; nameCol = rec.indexOf("transmiterid"); aux1 = (query.value(nameCol)).toString(); aux1.truncate(1); out << aux1 ; // out << "0"; // This is the RIG used to log the QSO. 1 is used as out << endl; } } out << "END-OF-LOG:" << endl; return true; } int ContestCQWWDXSSB::getTotalScore() { return (getMultipliers()) * (getPoints()); } int ContestCQWWDXSSB::getMultipliers() { int multipliers = 0; QSqlQuery query("SELECT * FROM log"); QSqlRecord rec = query.record(); int nameCol = rec.indexOf("multiplier"); while (query.next()) { if (query.isValid()) { multipliers += (query.value(nameCol)).toInt(); } } return multipliers; } int ContestCQWWDXSSB::getPoints() { int points = 0; QSqlQuery query("SELECT * FROM log"); QSqlRecord rec = query.record(); int nameCol = rec.indexOf("points"); while (query.next()) { if (query.isValid()) { points += (query.value(nameCol)).toInt(); } } return points; } klog-0.9.2.2/awards.cpp0000644000076700000620000021114012627126144012555 0ustar staff#include "awards.h" /*************************************************************************** awards.cpp - description ------------------- begin : nov 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include Awards::Awards() { //qDebug() << "Awards::Awards" << endl; world = new World(); dataProxy = new DataProxy_SQLite(); dxMarathon = new DXMarathon(); util = new Utilities(); //world->create(); //newOneColor = Qt::green; //neededColor = Qt::darkGreen; //workedColor = Qt::magenta; //confirmedColor = Qt::red; //defaultColor = Qt::gray; newOneColor = Qt::black; neededColor = Qt::black; workedColor = Qt::black; confirmedColor = Qt::black; defaultColor = Qt::black; dxccWorked.clear(); dxccConfirmed.clear(); wazWorked.clear(); wazConfirmed.clear(); } Awards::~Awards() { } void Awards::setAwardDXCC(const int _qsoId) { //qDebug() << "Awards::setAwardDXCC: _qsoId: " << QString::number(_qsoId) << endl; QString stringQuery; QSqlQuery query; //int nameCol; QString _ln; bool sqlOK; //bool __confirmed = dataProxy->isQSLReceived(_qsoId); QString _band, _mode, _confirmed, _qsoid, _refid, _refcon, _dxcc; _qsoid = QString::number(_qsoId); stringQuery = QString("SELECT dxcc, bandid, modeid, qsl_rcvd, lognumber FROM log WHERE id='%1'").arg(_qsoid); //qDebug() << "Awards::setAwardDXCC: stringQuery: " << stringQuery << endl; sqlOK = query.exec(stringQuery); if (!sqlOK) { //qDebug() << "Awards::setAwardDXCC: 1 exec NOK: " << stringQuery << endl; } query.next(); QSqlRecord rec = query.record(); } void Awards::setAwardWAZ(const int _qsoId) { //qDebug() << "Awards::setAwardWAZ: _qsoId: " << QString::number(_qsoId) << endl; QString stringQuery; QSqlQuery query; int nameCol; QString _ln; QString _cqz, _band, _mode, _confirmed, _qsoid, _refid, _refcon; _qsoid = QString::number(_qsoId); stringQuery = QString("SELECT cqz, bandid, modeid, qsl_rcvd, lognumber FROM log WHERE id='%1'").arg(_qsoid); //qDebug() << "Awards::setAwardWAZ: stringQuery-0: " << stringQuery << endl; query.exec(stringQuery); query.next(); QSqlRecord rec = query.record(); if ( query.isValid() ) { nameCol = rec.indexOf("cqz"); _cqz = (query.value(nameCol)).toString(); nameCol = rec.indexOf("bandid"); _band = (query.value(nameCol)).toString(); nameCol = rec.indexOf("modeid"); _mode = (query.value(nameCol)).toString(); nameCol = rec.indexOf("qsl_rcvd"); _confirmed = (query.value(nameCol)).toString(); nameCol = rec.indexOf("lognumber"); _ln = (query.value(nameCol)).toString(); if (_confirmed == "Y") { _confirmed = "1" ; } else { _confirmed = "0"; } } //qDebug() << "Awards::setAwardWAZ: " << _cqz << "/" << _band << "/" << _mode << "/" << _confirmed << endl; stringQuery = QString("SELECT id, confirmed FROM awardwaz WHERE cqz='%1' AND band='%2' AND mode='%3' AND lognumber='%4'").arg(_cqz).arg(_band).arg(_mode).arg(_ln); //qDebug() << "Awards::setAwardWAZ: stringQuery:-1 " << stringQuery << endl; query.exec(stringQuery); query.next(); rec = query.record(); if (query.isValid()) { nameCol = rec.indexOf("id"); _refid = query.value(nameCol).toString(); nameCol = rec.indexOf("confirmed"); _refcon = (query.value(nameCol)).toString(); if ( _refcon == "1") { // NOP -> Everything is already saved } else { // TODO: We need to modify the registry to save the confirmed status of the pair. if (_confirmed=="1") { stringQuery = QString("UPDATE awardwaz SET cqz='%1', band='%2', mode='%3', confirmed='%4', qsoid='%5' WHERE id='%6'").arg(_cqz).arg(_band).arg(_mode).arg(_confirmed).arg(_qsoid).arg(_refid ); //qDebug() << "Awards::setAwardWAZ: stringQuery:-2 " << stringQuery << endl; query.exec(stringQuery); } else { } } } else { stringQuery = QString("INSERT INTO awardwaz (cqz, band, mode, confirmed, lognumber, qsoid) values('%1','%2','%3','%4','%5','%6')").arg(_cqz).arg(_band).arg(_mode).arg(_confirmed).arg(_ln).arg(_qsoid); //qDebug() << "Awards::setAwardWAZ: stringQuery:-3 " << stringQuery << endl; query.exec(stringQuery); } } int Awards::getDXCCWorked(const int _logNumber) { //qDebug() << "Awards::getDXCCWorked (logNumber): " << QString::number(_logNumber) << endl; QSqlQuery query; QString stringQuery; bool sqlOK; stringQuery = QString("SELECT count (dxcc) from (SELECT DISTINCT dxcc FROM awarddxcc WHERE lognumber='%1' AND dxcc <>'')").arg(_logNumber); sqlOK = query.exec(stringQuery); //qDebug() << "Awards::getDXCCWorked: stringQuery: " << stringQuery << endl; if (sqlOK) { query.next(); if (query.isValid()) { //qDebug() << "Awards::getDXCCWorked: " << QString::number((query.value(0)).toInt()) << endl; return (query.value(0)).toInt(); } else { //qDebug() << "Awards::getDXCCWorked: 0" << endl; return 0; } } else { //qDebug() << "Awards::getDXCCWorked: Query error" << endl; return 0; } } int Awards::getDXCCConfirmed(const int _logNumber) { //qDebug() << "Awards::getDXCCConfirmed (logNumber): " << QString::number(_logNumber) << endl; QSqlQuery query; QString stringQuery; bool sqlOK; stringQuery = QString("SELECT COUNT (dxcc) FROM (SELECT DISTINCT dxcc FROM awarddxcc WHERE confirmed='1' AND lognumber='%1' AND dxcc <>'')").arg(_logNumber); sqlOK = query.exec(stringQuery); //qDebug() << "Awards::getDXCCWorked: stringQuery: " << stringQuery << endl; if (sqlOK) { query.next(); if (query.isValid()) { //qDebug() << "Awards::getDXCCConfirmed: " << QString::number((query.value(0)).toInt()) << endl; return (query.value(0)).toInt(); } else { //qDebug() << "Awards::getDXCCConfirmed: 0" << endl; return 0; } } else { //qDebug() << "Awards::getDXCCConfirmed: query error" << endl; return 0; } } int Awards::getWAZWorked(const int _logNumber) { //qDebug() << "Awards::getWAZWorked (logNumber): " << QString::number(_logNumber) << endl; QSqlQuery query; QString stringQuery; //stringQuery = QString("SELECT count (cqz) FROM (SELECT DISTINCT cqz FROM log WHERE cqz!='' AND qsl_rcvd='Y' AND lognumber='%1')").arg(_logNumber); stringQuery = QString("SELECT count (cqz) FROM (SELECT DISTINCT cqz FROM log WHERE cqz!='' AND lognumber='%1')").arg(_logNumber); //stringQuery = QString("SELECT count (cqz) from (SELECT DISTINCT cqz FROM awardwaz WHERE lognumber='%1' AND cqz <> '')").arg(_logNumber); query.exec(stringQuery); query.next(); if (query.isValid()) { return (query.value(0)).toInt(); } else { return 0; } } int Awards::getWAZConfirmed(const int _logNumber) { //qDebug() << "Awards::getWAZConfirmed (logNumber): " << QString::number(_logNumber) << endl; QSqlQuery query; QString stringQuery; //Usar la siguiente para el confirmed stringQuery = QString("SELECT count (cqz) FROM (SELECT DISTINCT cqz FROM log WHERE cqz!='' AND qsl_rcvd='Y' AND lognumber='%1')").arg(_logNumber); //stringQuery = QString("SELECT COUNT (cqz) FROM (SELECT DISTINCT cqz FROM awardwaz WHERE lognumber='%1' AND confirmed='1' AND cqz <> '')").arg(_logNumber); query.exec(stringQuery); query.next(); if (query.isValid()) { return (query.value(0)).toInt(); } else { return 0; } } bool Awards::isThisSpotConfirmed(const QStringList _qs) { if (getDXStatus(_qs) == 13) { return true; } else { return false; } } int Awards::getDXStatus (const QStringList _qs) { //qDebug() << "Awards::getDXStatus: Call: " << _qs.at(0) << "/ Band: " << _qs.at(1) << "/ Mode: " << _qs.at(2) << "/ Log: " << _qs.at(3) << endl; // Receives: QStringList _qs; //_qs << QRZ << BandId << << ModeId << lognumber; /* Not mode -1 - Error. - ERROR - ERROR 0 - New one - New One - New One - 0 1 - Worked but not in this band nor this mode - Needed One - Needed One - 1 2 - Worked in this band, not this mode - Needed One - Worked One - 3 3 - Worked in this band and in this mode - Worked One - Worked One - 3 4 - Worked in this mode, not this band - Needed One - Needed One - 1 5 - Confirmed in another band/mode but not worked in this band nor this mode - Needed One - Needed One - 1 6 - Confirmed in another band/mode but just worked in this band and not in this mode - Needed One - Worked One - 3 7 - Confirmed in another band/mode but just worked in this mode and not in this band - Needed One - Needed One - 1 8 - Confirmed in another band/mode but just worked in this band and mode - Worked One - Worked One - 3 9 - Confirmed in this mode, but not worked this band - Needed One - Needed One - 1 10 - Confirmed in this mode, but worked this band - Worked One - Worked One - 3 11 - Confirmed in this band but not worked in this mode - Needed One - Confirmed One - 13 12 - Confirmed in this band but worked in this mode - Worked One - Confirmed One - 13 13 - Confirmed in this band and mode - Confirmed One - Confirmed One - 13 */ /* 0 - New One - Never worked before - RED 1 - Needed - New one in this band - ORANGE 2 - Worked - Worked in this band but not confirmed - YELLOW 3 - Confirmed - Confirmed in this band - GREEN */ if (_qs.length() != 4 ) { return -1; } //int errorCode = 0; int _band = _qs.at(1).toInt(); int _mode = _qs.at(2).toInt(); int _logNumber = _qs.at(3).toInt(); int dxccEntity = world->getQRZARRLId(_qs.at(0) ); if (dxccEntity<=0) { return -1; } //qDebug() << "Awards::getDXStatus: dxccEntity: " << QString::number(dxccEntity) << endl; bool checkingMode = true; if (_mode==-1) { checkingMode = false; //qDebug() << "Awards::getDXStatus: checkingMode = FALSE" << endl; } // dxccStatusMode(const int _ent, const int _mode, const int _logNumber) //-1 error / 0 Not worked / 1 worked / 2 confirmed int wb = dxccStatusBand(dxccEntity, _band, _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed int wm = dxccStatusMode(dxccEntity, _mode, _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed if (wm==-1) { checkingMode = false; } //qDebug() << "Awards::getDXStatus: wb=" << QString::number(wb) << " - wm=" << QString::number(wm) << endl; switch(dxccStatus(dxccEntity, _logNumber)) { case 0: //qDebug() << "Awards::getDXStatus: return 0" << endl; return 0; // ATNO break; case 1: // Worked, not confirmed switch (wb) { case 0: // Not worked in this band but in another band if (checkingMode) { if (wm==1) { //qDebug() << "Awards::getDXStatus: return 4" << endl; return 4; } else { //qDebug() << "Awards::getDXStatus: return 1" << endl; return 1; } } else { //qDebug() << "Awards::getDXStatus: return 4 nc" << endl; return 4; } break; case 1: // Worked in this band if (checkingMode) { if (wm==1) { //qDebug() << "Awards::getDXStatus: return 3" << endl; return 3; } else { //qDebug() << "Awards::getDXStatus: return 2" << endl; return 2; } } else { //qDebug() << "Awards::getDXStatus: return 3 nc" << endl; return 3; } break; default: // ERROR //qDebug() << "Awards::getDXStatus: return -1 - 1" << endl; return -1; break; } break; case 2: // Confirmed if (wb==2) { if (checkingMode) { if (wm==2) { //qDebug() << "Awards::getDXStatus: return 13" << endl; return 13; } else if (wm==1) { //qDebug() << "Awards::getDXStatus: return 12" << endl; return 12; } else { //qDebug() << "Awards::getDXStatus: return 11" << endl; return 11; } } else { //qDebug() << "Awards::getDXStatus: return 13 nc" << endl; return 13; } } else if ((wb ==1) || (wb == 0)) { if (checkingMode) { if (wb==1) { if (wm==1) { //qDebug() << "Awards::getDXStatus: return 8" << endl; return 8; } else { //qDebug() << "Awards::getDXStatus: return 6" << endl; return 6; } } else { if (wm==1) { //qDebug() << "Awards::getDXStatus: return 7" << endl; return 7; } else { //qDebug() << "Awards::getDXStatus: return 5" << endl; return 5; } } } else { if (wb==0) { //qDebug() << "Awards::getDXStatus: return 7 nc" << endl; return 7; } else { //qDebug() << "Awards::getDXStatus: return 8 nc" << endl; return 8; } } } else { //qDebug() << "Awards::getDXStatus: return -1 - 2" << endl; return -1; } break; default: //qDebug() << "Awards::getDXStatus: return -1 default" << endl; return -1; break; } // END OF SWITCH return -1; } int Awards::dxccStatusBandMode(const int _ent, const int _band, const int _mode, const int _logNumber, bool _checkingMode) {//-1 error / 0 Not worked / 1 worked / 2 confirmed //qDebug() << "Awards::dxccStatusBandMode: " << QString::number(_ent) << "/" << QString::number(_band) << "/" << QString::number(_mode) << endl; QSqlQuery query = QSqlQuery(); QString queryString = QString(); if (_checkingMode) { //qDebug() << "Awards::dxccStatusBandMode: Checking Mode TRUE" << endl; queryString = QString("SELECT confirmed FROM awarddxcc WHERE dxcc='%1' AND band='%2' AND mode='%3' AND lognumber='%4' ").arg(QString::number(_ent)).arg(QString::number(_band)).arg(QString::number(_mode)).arg(QString::number(_logNumber)); } else { //qDebug() << "Awards::dxccStatusBandMode: Checking Mode FALSE" << endl; queryString = QString("SELECT confirmed FROM awarddxcc WHERE dxcc='%1' AND band='%2' AND lognumber='%3' ").arg(QString::number(_ent)).arg(QString::number(_band)).arg(QString::number(_logNumber)); } if (query.exec(queryString)) { if (query.next()) { if ( query.isValid() ) { if(query.value(0).toInt() == 1) { //qDebug() << "Awards::dxccStatusBandMode: return - 2" << endl; return 2; } else if(query.value(0).toInt() == 0) { //qDebug() << "Awards::dxccStatusBandMode: return - 1" << endl; return 1; } else { //qDebug() << "Awards::dxccStatusBandMode: return - 0-1" << endl; return 0; } } else { //qDebug() << "Awards::dxccStatusBandMode: return - 0-2" << endl; return 0; } } else { // No value => Not Worked //qDebug() << "Awards::dxccStatusBandMode: return - 0-3" << endl; return 0; } } else { // The query fails... //TODO: Manage the query error //qDebug() << "Awards::dxccStatusBandMode: return - -1" << endl; return -1; } //qDebug() << "Awards::dxccStatusBandMode: return - 0-4" << endl; return 0; } int Awards::dxccStatus(const int _ent, const int _logNumber) {//-1 error / 0 Not worked / 1 worked / 2 confirmed //qDebug() << "Awards::dxccStatus: " << QString::number(_ent) << endl; QSqlQuery query = QSqlQuery(); QString queryString = QString(); int worked = 0; queryString = QString("SELECT confirmed FROM awarddxcc WHERE dxcc='%1' AND lognumber='%2' ").arg(QString::number(_ent)).arg(QString::number(_logNumber)); if (query.exec(queryString)) { while (query.next()) { if ( query.isValid() ) { if(query.value(0).toInt() == 1) { return 2; } else if(query.value(0).toInt() == 0) { worked = 1; } } } //qDebug() << "Awards::dxccStatus: return "<< QString::number(worked) << endl; return worked; } else { // The query fails... //TODO: Manage the query error //qDebug() << "Awards::dxccStatus: return -1" << endl; return -1; } //qDebug() << "Awards::dxccStatus: return 0" << endl; return 0; } QColor Awards::getQRZDXStatusColor(const QStringList _qs) { //qs << dxCall << spotBand << "-1" << QString::number(currentLog) ; //qDebug() << "Awards::getQRZDXStatusColor qs.length: " << QString::number(_qs.length()) << endl; //From Search QSO to QSL: q << _call << bandid << _mode << QString::number(currentLog); //qDebug() << "Awards::getQRZDXStatusColor: " << _qs.at(0) << "/" << _qs.at(1) << "/" << _qs.at(2) << _qs.at(3) << endl; // Receives: QStringList _qs; //_qs << QRZ << BandID << ModeId << lognumber; /* 0 - New One 1 - Needed 2 - Worked 3 - Confirmed */ QColor returnedColor; int status = getDXStatus(_qs); //qDebug() << "Awards::getQRZDXStatusColor: status: " << QString::number(status) << "/" << getDXStatusString(status) << endl; //qDebug() << "Awards::getQRZDXStatusColor: status: " << QString::number(status) << endl; switch (status) { case 0: returnedColor = newOneColor; break; case 1: returnedColor = neededColor; break; case 2: returnedColor = neededColor; break; case 3: returnedColor = workedColor; break; case 4: returnedColor = neededColor; break; case 5: returnedColor = neededColor; break; case 6: returnedColor = neededColor; break; case 7: returnedColor = neededColor; break; case 8: returnedColor = workedColor; break; case 9: returnedColor = neededColor; break; case 10: returnedColor = workedColor; break; case 11: returnedColor = neededColor; break; case 12: returnedColor = workedColor; break; case 13: returnedColor = confirmedColor; break; break; default: returnedColor = defaultColor; break; } return returnedColor; } QString Awards::getDXStatusString (const int _status) { //qDebug() << "Awards::getDXStatusString: " << QString::number(_status) << endl; QString message = QString(); switch (_status) { case 0: message = QObject::tr("New One, work it!"); //message = QObject::tr("0-new One"); break; case 1: message = QObject::tr("Needed, work it!"); //message = QObject::tr("1-Needed, work it!"); break; case 2: message = QObject::tr("Needed, work it!"); break; case 3: message = QObject::tr("Worked but not confirmed"); break; case 4: message = QObject::tr("Needed, work it!"); break; case 5: message = QObject::tr("Needed, work it!"); break; case 6: message = QObject::tr("Needed, work it!"); break; case 7: message = QObject::tr("Needed, work it!"); break; case 8: message = QObject::tr("Worked but not confirmed"); break; case 9: message = QObject::tr("Needed, work it!"); break; case 10: message = QObject::tr("Worked but not confirmed"); break; case 11: message = QObject::tr("Needed, work it!"); break; case 12: message = QObject::tr("Worked but not confirmed"); break; case 13: message = QObject::tr("Confirmed"); break; break; default: message = QObject::tr("Not identified"); break; } return message; } QString Awards::checkIfValidIOTA(const QString _tiota) { /********************************** IOTA should be always with this format: CC-NNN being: - CC the shortname of the continent - NNN Number of the reference. NNN has ALWAYS to include THREE(3) characters. ADIF Specs says: CC is the continent designator {NA, SA, EU , AF, OC, AS, AN} XXX is the island designator, where 0 <= XXX ,<= 999 [use leading zeroes] Returns a valid format IOTA if possible and "" in other cases. ************************************/ //qDebug() << "Awards::checkIfValidIOTA: " << _tiota << endl; bool _valid = false; QString _continent; QString _number; if (_tiota.count("-") == 1) { QStringList _values = _tiota.split("-", QString::SkipEmptyParts); _continent = _values.at(0); _number = _values.at(1); } else { return ""; } //qDebug() << "Awards::checkIfValidIOTA (cont) " << _continent << endl; //qDebug() << "Awards::checkIfValidIOTA (numb): " << _number << endl; // Check if continent is valid QString stringQuery = QString("SELECT id FROM continent WHERE shortname ='%1'").arg(_continent); QSqlQuery query; query.exec(stringQuery); while (query.next()) { if (query.isValid()) { _valid = true; if ( (_number.toInt() >0 ) && ((_number.toInt()) < 1000 )) { if ((_number.length()) == 3) { return _continent + "-" + _number ; } else if ((_number.length()) == 2) { return _continent + "-0" + QString::number((_number).toInt()); } else if ((_number.length()) == 1) { return _continent + "-00" + QString::number((_number).toInt()); } else { return ""; } } else { return ""; } } } return ""; } void Awards::setColors (const QString _newOne, const QString _needed, const QString _worked, const QString _confirmed, const QString _default) //void Awards::setColors (const QString &_newOne, const QString &_needed, const QString &_worked, const QString &_confirmed, const QString &_default) { //qDebug() << "Awards::setColors: " << _newOne << "/" << _needed << "/" << _worked << "/" << _confirmed << "/" << _default << endl; defaultColor = QColor(_default.toUpper()); neededColor = QColor(_needed.toUpper()); workedColor = QColor(_worked.toUpper()); confirmedColor = QColor(_confirmed.toUpper()); newOneColor = QColor(_newOne.toUpper()); if (defaultColor.isValid()) { defaultColor.setNamedColor(_default.toUpper()); } else { } if (neededColor.isValid()) { neededColor.setNamedColor(_needed.toUpper()); } else { } if (confirmedColor.isValid()) { confirmedColor.setNamedColor(_confirmed.toUpper()); } else { } if (newOneColor.isValid()) { newOneColor.setNamedColor(_newOne.toUpper()); } else { } if (workedColor.isValid()) { workedColor.setNamedColor(_worked.toUpper()); } else { //qDebug() << "Awards::setColors: Worked NOT VALID" << endl; } } QColor Awards::getDefaultColor() { return defaultColor; } void Awards::recalculateAwards() { /* TODO: I need to optimize this function. The select & insert of setAwardDXCC are too slow) Should go in a transaction */ //qDebug() << "Awards::recalculateAwards" << endl; //select distinct dxcc, band, mode from awarddxcc QList awardsQList; awardsQList.clear(); QSqlDatabase db = QSqlDatabase::database(); //1.- Delete ALL the data in awarddxcc and awardwaz QSqlQuery query, queryInsert, queryCQZ, queryUpdate; QString queryString, aux, _call, _qslStatus; bool cancelPressed = false; bool CQZknown = false; bool CQZknownBefore = false; bool DXCCknown = false; bool DXCCknownBefore = false; bool queryOk = false; //bool queryOkcq = false; int errorCode = -1; int nameCol, _id; int _dxcc, _band, _mode, _cqz, _logNumber; int _confirmed; int i = 0; int step = 1; int numberOfQsos = 0; if (query.exec("SELECT MAX(id) FROM log")) { query.next(); numberOfQsos = query.value(0).toInt(); //qDebug() << "Awards::recalculateAwards: MAX = " << QString::number(numberOfQsos) << endl; step = util->getProgresStepForDialog(numberOfQsos); } else { //qDebug() << "Awards::recalculateAwards: Query FAILED so MAX = " << QString::number(numberOfQsos) << endl; } query.exec("DELETE FROM awarddxcc"); query.exec("DELETE FROM awardwaz"); QProgressDialog progress("Updating the award status... " + QString::number(numberOfQsos) + " QSOs", "Abort Update", 0, numberOfQsos); progress.setWindowModality(Qt::WindowModal); queryString = QString("SELECT dxcc, call, bandid, modeid, qsl_rcvd, lognumber, cqz, id FROM log"); if (query.exec(queryString)) { QSqlRecord rec = query.record(); db.transaction(); while ( (query.next()) && (!cancelPressed)) { i++; DXCCknownBefore = false; CQZknownBefore = false; nameCol = rec.indexOf("call"); _call = (query.value(nameCol)).toString(); nameCol = rec.indexOf("id"); _id = (query.value(nameCol)).toInt(); nameCol = rec.indexOf("dxcc"); _dxcc = (query.value(nameCol)).toInt(); //qDebug() << "Awards::recalculateAwards: CALL/ID/DXCC: " << _call << "/"<< _id << "/" << QString::number(_dxcc) << endl; if (_dxcc<=0) { //qDebug() << "Awards::recalculateAwards: DXCC not known for id: " << QString::number(_id) << "Searching..." << endl; _dxcc = world->getQRZARRLId(_call); if (_dxcc<=0) { //qDebug() << "Awards::recalculateAwards: DXCC not known for id: " << QString::number(_id) << endl; DXCCknown = false; } else { DXCCknown = true; //qDebug() << "Awards::recalculateAwards: DXCC found " << QString::number(_id) << "/" << QString::number(_dxcc)<< endl; } } else { DXCCknown = true; DXCCknownBefore = true; //qDebug() << "Awards::recalculateAwards: DXCC already known for id: " << QString::number(_id) << " = " << QString::number(_dxcc) << endl; } //qDebug() << "Awards::recalculateAwards: CALL/ID/DXCC-2: " << _call << "/"<< _id << "/" << QString::number(_dxcc) << endl; nameCol = rec.indexOf("bandid"); _band = (query.value(nameCol)).toInt(); nameCol = rec.indexOf("modeid"); _mode = (query.value(nameCol)).toInt(); nameCol = rec.indexOf("qsl_rcvd"); _qslStatus = (query.value(nameCol)).toString(); if (_qslStatus == "Y") { _confirmed = 1 ; } else { _confirmed = 0; } //qDebug() << "Awards::recalculateAwards: Recalculating CQZ " << endl; nameCol = rec.indexOf("cqz"); _cqz = (query.value(nameCol)).toInt(); //awardsQList << QString::number(_cqz); if ((_cqz<=0) && (_dxcc>0)) { //qDebug() << "Awards::recalculateAwards: CQZ not known for id: " << QString::number(_id) << "Searching..." << endl; _cqz = world->getEntityCqz(_dxcc); if (_cqz<=0) { //qDebug() << "Awards::recalculateAwards: CQZ not known for id: " << QString::number(_id) << endl; CQZknown = false; } else { CQZknown = true; //qDebug() << "Awards::recalculateAwards: CQZ found " << QString::number(_id) << "/" << QString::number(_cqz)<< endl; } } else if ((_cqz<=0) && (_dxcc<=0)) { //qDebug() << "Awards::recalculateAwards: CQZ nor DXCC not known for id: " << QString::number(_id) << endl; CQZknown = false; DXCCknown = false; } else { CQZknown = true; CQZknownBefore = true; //qDebug() << "Awards::recalculateAwards: CQZ already known for id: " << QString::number(_id) << " = " << QString::number(_cqz) << endl; } nameCol = rec.indexOf("lognumber"); _logNumber = (query.value(nameCol)).toInt(); if (_dxcc>0) { awardsQList << QString::number(_dxcc); if (_cqz>0) { awardsQList << QString::number(_cqz); } else { awardsQList << QString::number(-1); } awardsQList << QString::number(_band); awardsQList << QString::number(_mode); awardsQList << QString::number(_confirmed); awardsQList << QString::number(_id); awardsQList << QString::number(_logNumber); } // awardsQList << _dxcc / _cqz / _band / _mode / confirmed / id / logNumber if ((DXCCknown) && (!DXCCknownBefore)) { //I should update the DXCC in the log as it was not known before and now it is! errorCode = setDXCCToQSO(_dxcc, _id); } if ((CQZknown) && (!CQZknownBefore)) { //I should update the DXCC in the log as it was not known before and now it is! errorCode = setCQToQSO(_cqz, _id); } if (( (i % step ) == 0) ) { // To update the speed I will only show the progress once each X QSOs aux = "Updating the award status... " + QString::number(i) + "/" + QString::number(numberOfQsos); progress.setLabelText(aux); progress.setValue(i); } else { } if (progress.wasCanceled()) { cancelPressed = true; } } // END of While db.commit(); query.prepare( "INSERT INTO awarddxcc (dxcc, band, mode, confirmed, lognumber, qsoid) VALUES (:dxcc, :band, :mode, :confirmed, :lognumber, :qsoid)" ); queryCQZ.prepare( "INSERT INTO awardwaz (cqz, band, mode, confirmed, lognumber, qsoid) VALUES (:cqz, :band, :mode, :confirmed, :lognumber, :qsoid)" ); db.transaction(); //queryString = QString("SELECT dxcc, call, bandid, modeid, qsl_rcvd, lognumber, cqz, id FROM log"); // awardsQList << _dxcc / _cqz / _band / _mode / confirmed / id / logNumber int _cqzt = -1; for (int i = 0; i < awardsQList.size(); i++) { query.bindValue( ":dxcc", awardsQList.at(i)); _dxcc = (awardsQList.at(i)).toInt(); i++; _cqzt = (awardsQList.at(i)).toInt(); // We read the CQz if (_cqzt>0) // CQ { queryCQZ.bindValue( ":cqz", awardsQList.at(i)); } i++; query.bindValue( ":band", awardsQList.at(i)); _band = (awardsQList.at(i)).toInt(); if (_cqzt>0) // CQ { queryCQZ.bindValue( ":band", awardsQList.at(i)); } i++; query.bindValue( ":mode", awardsQList.at(i)); _mode = (awardsQList.at(i)).toInt(); if (_cqzt>0) // CQ { queryCQZ.bindValue( ":mode", awardsQList.at(i)); } i++; query.bindValue( ":confirmed", awardsQList.at(i)); _confirmed = (awardsQList.at(i)).toInt(); //qDebug() << "Awards::recalculateAwards: Confirmed=" << QString::number(_confirmed) << endl; if (_cqzt>0) // CQ { queryCQZ.bindValue( ":confirmed", awardsQList.at(i)); } i++; query.bindValue( ":qsoid", awardsQList.at(i)); _id =(awardsQList.at(i)).toInt(); if (_cqzt>0) // CQ { queryCQZ.bindValue( ":qsoid", awardsQList.at(i)); } i++; query.bindValue( ":lognumber", awardsQList.at(i)); if (_cqzt>0) // CQ { queryCQZ.bindValue( ":lognumber", awardsQList.at(i)); } queryOk = query.exec(); // Add a DXCC if (queryOk) {// New worked QSO inserted in AwardDXCC //qDebug() << "Awards::recalculateAwards: queryOK!" << endl; } else {// Something happened while adding the new worked DXCC (may be already worked/confirmed or simply something went wrong) //qDebug() << "Awards::recalculateAwards: queryOK = False" << endl; errorCode = query.lastError().number(); if (errorCode == 19) { // More than probably the SET band/mode/DXCC is already in the DB //qDebug() << "Awards::recalculateAwards: queryOK = False - errorCode 19" << endl; if (_confirmed == 1) { //qDebug() << "Awards::recalculateAwards: queryOK = False - errorCode 19 & _confirmed = true. Updating: " << _id << "..." << endl; errorCode = setAwardDXCCConfirmed(_band, _mode, _dxcc, _id) ; //qDebug() << "Awards::recalculateAwards: queryOK = False - errorCode 19 & _confirmed = true. Updated: " << errorCode << "..." << endl; } else { //qDebug() << "Awards::recalculateAwards: queryOK = False - errorCode 19 & _confirmed = false, no need to update anything: " << _id << endl; //No consigo que se mantenga cuando se ha confirmado un pais } } else { //qDebug() << "Awards::recalculateAwards: LastQuery-2: " << query.lastQuery() << endl; //qDebug() << "Awards::recalculateAwards: LastError-data-2: " << query.lastError().databaseText() << endl; //qDebug() << "Awards::recalculateAwards: LastError-driver-2: " << query.lastError().driverText() << endl; //qDebug() << "Awards::recalculateAwards: LastError-n-2: " << QString::number(query.lastError().number() ) << endl; } } //queryOkcq = queryCQZ.exec(); // Add a CQz } db.commit(); } else { return; } //qDebug() << "Awards::recalculateAwards - END" << endl; } int Awards::getQSOsInLog(const int _logNumber) { //qDebug() << "Awards::getQSOsInLog: " << QString::number(_logNumber) << endl; QSqlQuery query; QString queryString; queryString = QString("SELECT COUNT (id) FROM log WHERE lognumber='%1'").arg(_logNumber) ; if( !query.exec(queryString) ) { return -1; } else { query.next(); if (query.isValid()) { return query.value(0).toInt(); } else { return -2; } } } void Awards::setAwards(const int _dxcc, const int _waz, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId) { //qDebug() << "Awards::setAwards: " << QString::number(_dxcc) << endl; /* _workedOrConfirmed = -1 Remove this pair _workedOrConfirmed = 0 Set as Worked _workedOrConfirmed = 1 Set as Confirmed */ int d = _dxcc; int b = _band; int m = _mode; int w = _workedOrConfirmed; int l = _logNumber; int i = _qsoId; //setAwardDXCC(_dxcc, _band, _mode, _workedOrConfirmed, _logNumber); // //bool Awards::setAwardDXCC(const int _dxcc, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId) setAwardDXCC(d, b, m, w, l, i); setAwardWAZ(d, b, m, w, l, i); //setAwardWAZ(_waz, _band, _mode, _workedOrConfirmed, _logNumber); } void Awards::setAwards(const int _qsoId) { //qDebug() << "Awards::setAwards: _qsoId: " << QString::number(_qsoId) << endl; QString stringQuery, _confirmed, _call; QSqlQuery query; int nameCol; bool DXCCknown=false; bool CQZknown=false; int _dxcc, _cqz, _band, _mode, _logNumber, _alreadyConfirmed; bool _confirmedB = false; stringQuery = QString("SELECT dxcc, call, bandid, modeid, qsl_rcvd, lognumber, cqz FROM log WHERE id='%1'").arg(_qsoId); if (query.exec(stringQuery)) { query.next(); QSqlRecord rec = query.record(); nameCol = rec.indexOf("call"); _call = (query.value(nameCol)).toString(); nameCol = rec.indexOf("dxcc"); _dxcc = (query.value(nameCol)).toInt(); nameCol = rec.indexOf("cqz"); _cqz = (query.value(nameCol)).toInt(); nameCol = rec.indexOf("bandid"); _band = (query.value(nameCol)).toInt(); nameCol = rec.indexOf("modeid"); _mode = (query.value(nameCol)).toInt(); nameCol = rec.indexOf("qsl_rcvd"); _confirmed = (query.value(nameCol)).toString(); nameCol = rec.indexOf("lognumber"); _logNumber = (query.value(nameCol)).toInt(); if (_dxcc <= 0) { _dxcc = world->getQRZARRLId(_call); if (_dxcc > 0) { DXCCknown = true; } else { DXCCknown = false; } } else { DXCCknown = true; } if ( (_cqz <= 0) && (DXCCknown) ) { _cqz = world->getEntityCqz(_dxcc); if (_cqz > 0) { CQZknown = true; } else { CQZknown = false; } } else if (_cqz > 0) { CQZknown = true; } else { CQZknown = false; } if (_confirmed == "Y") { //qDebug() << "Awards::setAwards: QSO is CONFIRMED: " << QString::number(_qsoId) << " = " << QString::number(_dxcc) << endl; _confirmed = "1" ; _confirmedB = true; } else { //qDebug() << "Awards::setAwards: QSO is only WORKED: " << QString::number(_qsoId) << " = " << QString::number(_dxcc) << endl; _confirmed = "0"; _confirmedB = false; } } else { //qDebug() << "Awards::setAwards: ERROR IN First Select: " << QString::number(_qsoId) << endl; //qDebug() << "Awards::setAwardDXCC: ERROR IFS: " << QString::number(_qsoId) << endl; //qDebug() << "Awards::setAwardDXCC: ERROR IFS Driver-error: " <0) { stringQuery = QString("INSERT INTO awarddxcc (dxcc, band, mode, confirmed, lognumber, qsoid) values('%1','%2','%3','%4','%5','%6')").arg(_dxcc).arg(_band).arg(_mode).arg(_workedOrConfirmed).arg(_logNumber).arg(_qsoId); if (query.exec(stringQuery) ) { //qDebug() << "Awards::setAwardDXCC: OK DXCC _qsoId: " << QString::number(_qsoId) << endl; isOK1 = true; } else { //qDebug() << "Awards::setAwardDXCC: NOK DXCC _qsoId: " << QString::number(_qsoId) << endl; //qDebug() << "Awards::setAwardDXCC: NOK DXCC Driver-error: " <0) { QString stringQuery = QString("INSERT INTO awardwaz (cqz, band, mode, confirmed, lognumber, qsoid) values('%1','%2','%3','%4','%5','%6')").arg(_cqz).arg(_band).arg(_mode).arg(_workedOrConfirmed).arg(_logNumber).arg(_qsoId); if (query.exec(stringQuery) ) { //qDebug() << "Awards::setAwardWAZ: OK CQZ _qsoId: " << QString::number(_qsoId) << endl; isOK1 = true; } else { //qDebug() << "Awards::setAwardWAZ: NOK CQZ _qsoId: " << QString::number(_qsoId) << endl; return false; } } else { return false; } // Second phase, the memory storage. //TODO: Choose whether I use a DB or memory but both may not be optimal. int value = (QString::number(_band) + QString::number(_mode)).toInt(); if (_workedOrConfirmed == -1) { wazWorked.remove(_cqz, value); wazConfirmed.remove(_cqz, value); isOK2 = true; } if ( wazConfirmed.contains(_cqz, value) ) { // Already confirmed, nothing to do isOK2 = true; } else { if (wazWorked.contains(_cqz, value)) { //It is worked if (_workedOrConfirmed == 1) { wazConfirmed.insert(_cqz, value); isOK2 = true; } else { } } else { // It is not worked! wazWorked.insert(_cqz, value); isOK2 = true; } } return (isOK1 && isOK2); } /* int Awards::getProgresStepForDialog(int totalSteps){ //qDebug() << "FileManager::getProgresStepForDialog"; if (totalSteps <=100) return 1; else if (totalSteps <=1000) return 5; else if (totalSteps <=4000) return 10; else if (totalSteps <=5000) return 15; else if (totalSteps <=7000) return 20; else if (totalSteps <=9999) return 25; else return 50; } */ int Awards::setAwardDXCCst(const int _dxcc, const int _band, const int _mode, const bool _confirmed, const int _logNumber, const int _qsoId) { //qDebug() << "Awards::setAwardDXCCst-0: " << QString::number(_dxcc) << "/" << QString::number(_band) << "/" << QString::number(_mode) << "/" << QString::number(_logNumber) << "/" << QString::number(_qsoId) << endl; int nameCol=-1; QString _refid = QString(); /* _confirmedQSO == false QSO is just worked _confirmedQSO == true QSO is confirmed */ //TODO: Fix the way we check for data validity for this function if (!( (_dxcc>=0) && (_band >=0) && (_mode>=0) && (_logNumber>=0) && (_qsoId >=0) )) { //qDebug() << "Awards::setAwardDXCCst: Not valid data received!" << endl; return -1; } int _iconfirmed; if (_confirmed) { _iconfirmed = 1; } else { _iconfirmed = 0; } //qDebug() << "Awards::setAwardDXCCst: _qsoId: " << QString::number(_qsoId) << "/" << QString::number(_iconfirmed) << endl; QString stringQuery = QString(); QSqlQuery query; bool sqlOK = false; int errorCode = -1; stringQuery = QString("SELECT id, confirmed FROM awarddxcc where dxcc='%1' AND band='%2' AND mode='%3' AND lognumber='%4'").arg(_dxcc).arg(_band).arg(_mode).arg(_logNumber); //stringQuery = QString("INSERT INTO awarddxcc (dxcc, band, mode, confirmed, lognumber, qsoid) values('%1','%2','%3','%4','%5','%6')").arg(_dxcc).arg(_band).arg(_mode).arg(_iconfirmed).arg(_logNumber).arg(_qsoId); sqlOK = query.exec(stringQuery); if (sqlOK) { //qDebug() << "Awards::setAwardDXCCst-1:" << endl; query.next(); QSqlRecord rec = query.record(); if (query.isValid()) {// We have some data, we need to UPDATE - We are only confirming! //qDebug() << "Awards::setAwardDXCCst: We have some data, we neer to update" << endl; nameCol = rec.indexOf("id"); _refid = query.value(nameCol).toString(); stringQuery = QString("UPDATE awarddxcc SET confirmed='1', qsoid='%1' WHERE id='%2'").arg(_qsoId).arg(_refid); //qDebug() << "Awards::setAwardDXCCst: (UPDATE): " << stringQuery << endl; if (sqlOK) { // Set of data updated //qDebug() << "Awards::setAwardDXCCst: Data updated!" << endl; return 1; } else { // Something failed. Trace it! errorCode = query.lastError().number(); //qDebug() << "Awards::setAwardDXCCst(UPDATE): LastQuery: " << query.lastQuery() << endl; //qDebug() << "Awards::setAwardDXCCst(UPDATE): LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "Awards::setAwardDXCCst(UPDATE): LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "Awards::setAwardDXCCst(UPDATE): LastError-n: " << QString::number(query.lastError().number() ) << endl; return -1; } } else { // We don't have this set, we need to INSERT stringQuery = QString("INSERT INTO awarddxcc (dxcc, band, mode, confirmed, lognumber, qsoid) values('%1','%2','%3','%4','%5','%6')").arg(_dxcc).arg(_band).arg(_mode).arg(_iconfirmed).arg(_logNumber).arg(_qsoId); sqlOK = query.exec(stringQuery); //qDebug() << "Awards::setAwardDXCCst: We don't have data... so we INSERT" << endl; //qDebug() << "Awards::setAwardDXCCst: (INSERT): " << stringQuery << endl; if (sqlOK) { // Set of data included //qDebug() << "Awards::setAwardDXCCst: Data inserted!" << endl; } else { // Something failed. Trace it! errorCode = query.lastError().number(); //qDebug() << "Awards::setAwardDXCCst(INSERT): LastQuery: " << query.lastQuery() << endl; //qDebug() << "Awards::setAwardDXCCst(INSERT): LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "Awards::setAwardDXCCst(INSERT): LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "Awards::setAwardDXCCst(INSERT): LastError-n: " << QString::number(query.lastError().number() ) << endl; return -1; } } } else { // Trave the error... what may be happening??? errorCode = query.lastError().number(); //qDebug() << "Awards::setAwardDXCCst(SELECT): LastQuery: " << query.lastQuery() << endl; //qDebug() << "Awards::setAwardDXCCst(SELECT): LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "Awards::setAwardDXCCst(SELECT): LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "Awards::setAwardDXCCst(SELECT): LastError-n: " << QString::number(query.lastError().number() ) << endl; return -1; } return -1; } int Awards::setAwardWAZst(const int _cqz, const int _band, const int _mode, const bool _confirmed, const int _logNumber, const int _qsoId) { //qDebug() << "Awards::setAwardWAZst(CQZ/BAND/MODE/WORKED/log/qsoid): " << QString::number(_cqz) << "/" << QString::number(_band) << "/" << QString::number(_mode) << "/" << QString::number(_logNumber) << "/" << QString::number(_qsoId) << endl; /* _confirmed == false QSO is just worked _confirmed == true QSO is confirmed */ //TODO: Fix the way we check for data validity for this function if (!( (_cqz>=0) && (_band >=0) && (_mode>=0) && (_logNumber>=0) && (_qsoId >=0) )) { //qDebug() << "Awards::setAwardWAZst: some data was NOK" << endl; return -1; } int _iconfirmed; if (_confirmed) { _iconfirmed = 1; } else { _iconfirmed = 0; } QString stringQuery; QSqlQuery query; bool sqlOK; int errorCode = -1; stringQuery = QString("INSERT INTO awardwaz (cqz, band, mode, confirmed, lognumber, qsoid) values('%1','%2','%3','%4','%5','%6')").arg(_cqz).arg(_band).arg(_mode).arg(_iconfirmed).arg(_logNumber).arg(_qsoId); sqlOK = query.exec(stringQuery); if ((sqlOK) && (!_confirmed)) // First time a DXCC/Band/mode is worked { //qDebug() << "Awards::setAwardWAZst: _qsoId: " << QString::number(_qsoId) << "- 1" << endl; return 1; } else if ((sqlOK) && (_confirmed)) // First time a CQZ/Band/Mode is confirmed { //qDebug() << "Awards::setAwardWAZst: _qsoId: " << QString::number(_qsoId) << "- 2" << endl; return 2; } else { //qDebug() << "Awards::setAwardWAZst: _qsoId: " << QString::number(_qsoId) << "- sqlOK ERROR: " << endl; errorCode = query.lastError().number(); //qDebug() << "Awards::setAwardWAZst: LastQuery: " << query.lastQuery() << endl; //qDebug() << "Awards::setAwardWAZst: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "Awards::setAwardWAZst: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "Awards::setAwardWAZst: LastError-n: " << QString::number(query.lastError().number() ) << endl; } return -1; } int Awards::setAwardDXCCConfirmed(const int _band, const int _mode, const int _dxcc, const int _newQSOid) // Changes the status of a DXCC from worked to confirmed { //qDebug() << "Awards::setAwardDXCCConfirmed: " << QString::number(_band) << "/" << QString::number(_mode) << "/" << QString::number(_dxcc)<< "/" << QString::number(_newQSOid)<< endl; /* * Check if the DXCC is worked * If worked, change the qsoid and set is confirmed * If not worked (or _prev=0), add the DXCC as confimed * */ QString stringQuery; QSqlQuery query = QSqlQuery(); bool sqlOK = false; int errorCode = -1; int nameCol = -1; QString aux = QString(); stringQuery = QString("SELECT qsoid FROM awarddxcc WHERE band='%1' AND mode='%2' AND dxcc='%3'").arg(_band).arg(_mode).arg(_dxcc); sqlOK = query.exec(stringQuery); if (sqlOK) { QSqlRecord rec = query.record(); if (query.next()) { if (query.isValid()) { nameCol = rec.indexOf("qsoid"); aux = (query.value(nameCol)).toString(); stringQuery = QString("UPDATE awarddxcc SET confirmed='1', qsoid='%1' WHERE qsoid='%2'").arg(_newQSOid).arg(aux); sqlOK = query.exec(stringQuery); if (sqlOK) { return _newQSOid; } else { // UPDATE failed errorCode = query.lastError().number(); //qDebug() << "Awards::setAwardDXCCConfirmed-Update: LastQuery: " << query.lastQuery() << endl; //qDebug() << "Awards::setAwardDXCCConfirmed-Update: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "Awards::setAwardDXCCConfirmed-Update: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "Awards::setAwardDXCCConfirmed-Update: LastError-n: " << QString::number(query.lastError().number() ) << endl; return errorCode; } } else { // Not valid record //qDebug() << "Awards::setAwardDXCCConfirmed: Not valid record" << endl; return -3; } } else { // Not next record //qDebug() << "Awards::setAwardDXCCConfirmed: Not next record" << endl; return -2; } } else { // errorCode = query.lastError().number(); //qDebug() << "Awards::setAwardDXCCConfirmed: LastQuery: " << query.lastQuery() << endl; //qDebug() << "Awards::setAwardDXCCConfirmed: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "Awards::setAwardDXCCConfirmed: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "Awards::setAwardDXCCConfirmed: LastError-n: " << QString::number(query.lastError().number() ) << endl; return errorCode; } return 1; } int Awards::setDXCCToQSO(const int _dxcc, const int _qsoid) // Defines the DXCC in a QSO { //qDebug() << "Awards::setDXCCToQSO: " << QString::number(_dxcc) << "/" << QString::number(_qsoid) << endl; int errorCode = -1; QString queryString = QString("UPDATE log SET dxcc='%1' WHERE id='%2'").arg(_dxcc).arg(_qsoid); QSqlQuery query = QSqlQuery(); bool sqlOK = query.exec(queryString); if (sqlOK) { return 1; } else { //qDebug() << "Awards::setDXCCToQSO: DXCC Updated in Log but failed...." << endl; errorCode = query.lastError().number(); //qDebug() << "Awards::setDXCCToQSO: LastQuery: " << query.lastQuery() << endl; //qDebug() << "Awards::setDXCCToQSO: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "Awards::setDXCCToQSO: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "Awards::setDXCCToQSO: LastError-n: " << QString::number(query.lastError().number() ) << endl; return errorCode; } } int Awards::setCQToQSO(const int _cqz, const int _qsoid) // Defines the CQ in a QSO { //qDebug() << "Awards::setCQToQSO: " << QString::number(_cqz) << "/" << QString::number(_qsoid) << endl; int errorCode = -1; QString queryString = QString("UPDATE log SET cqz='%1' WHERE id='%2'").arg(_cqz).arg(_qsoid); QSqlQuery query = QSqlQuery(); bool sqlOK = query.exec(queryString); if (sqlOK) { return 1; } else { //qDebug() << "Awards::setCQToQSO: DXCC Updated in Log but failed...." << endl; errorCode = query.lastError().number(); //qDebug() << "Awards::setCQToQSO: LastQuery: " << query.lastQuery() << endl; //qDebug() << "Awards::setCQToQSO: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "Awards::setCQToQSO: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "Awards::setCQToQSO: LastError-n: " << QString::number(query.lastError().number() ) << endl; return errorCode; } } bool Awards::getIsDXCCConfirmed(const int _dxcc, const int _logNumber) { // isDXCCConfirmed(const int _dxcc, const int _currentLog); return dataProxy->isDXCCConfirmed(_dxcc, _logNumber); } int Awards::getDXMarathonDXCC(const int _year, const int _logNumber) { //qDebug() << "Awards::getDXMarathonDXCC: " << QString::number(_year) << endl; return dxMarathon->getDXMarathonDXCC(_year, _logNumber); } int Awards::getDXMarathonCQ(const int _year, const int _logNumber) { //qDebug() << "Awards::getDXMarathonCQ: " << QString::number(_year) << endl; return dxMarathon->getDXMarathonCQ(_year, _logNumber); } int Awards::getDXMarathonScore(const int _year, const int _logNumber) { //qDebug() << "Awards::getDXMarathonScore: " << QString::number(_year) << endl; return dxMarathon->getDXMarathonScore(_year, _logNumber); } bool Awards::isDXMarathonNeed(const int _dxcc, const int _cq, const int _year, const int _logNumber) { return dxMarathon->neededForDXMarathon(_dxcc, _cq, _year, _logNumber); } int Awards::dxccStatusBand(const int _ent, const int _band, const int _logNumber) //-1 error / 0 Not worked / 1 worked / 2 confirmed { //-1 error / 0 Not worked / 1 worked / 2 confirmed //qDebug() << "Awards::dxccStatusBand: " << QString::number(_ent) << "/" << QString::number(_band) << endl; QSqlQuery query = QSqlQuery(); QString queryString = QString(); queryString = QString("SELECT confirmed FROM awarddxcc WHERE dxcc='%1' AND band='%2' AND lognumber='%4' ").arg(QString::number(_ent)).arg(QString::number(_band)).arg(QString::number(_logNumber)); if (query.exec(queryString)) { if (query.next()) { if ( query.isValid() ) { if(query.value(0).toInt() == 1) // Confirmed { return 2; } else if(query.value(0).toInt() == 0) // Worked { return 1; } else // Not worked { return 0; } } // Not present => Not worked else { return 0; } } else // Not present => Not worked { // No value => Not Worked return 0; } } else { // The query fails... //TODO: Manage the query error return -1; } //qDebug() << "Awards::dxccStatusBand: return - 0.3" << endl; return 0; // if arrives to here decision => not worked } int Awards::dxccStatusMode(const int _ent, const int _mode, const int _logNumber) //-1 error / 0 Not worked / 1 worked / 2 confirmed { //-1 error / 0 Not worked / 1 worked / 2 confirmed //qDebug() << "Awards::dxccStatusMode: " << QString::number(_ent) << "/" << QString::number(_mode) << endl; QSqlQuery query = QSqlQuery(); QString queryString = QString(); if (_mode == -1) { return -1; } queryString = QString("SELECT confirmed FROM awarddxcc WHERE dxcc='%1' AND mode='%2' AND lognumber='%4' ").arg(QString::number(_ent)).arg(QString::number(_mode)).arg(QString::number(_logNumber)); if (query.exec(queryString)) { if (query.next()) { if ( query.isValid() ) { if(query.value(0).toInt() == 1) // Confirmed { return 2; } else if(query.value(0).toInt() == 0) // Worked { return 1; } else // Not worked { return 0; } } // Not present => Not worked else { return 0; } } else // Not present => Not worked { // No value => Not Worked return 0; } } else { // The query fails... //TODO: Manage the query error return -1; } return 0; // if arrives to here decision => not worked } klog-0.9.2.2/setuppageuserdata.h0000644000076700000620000001171612627126144014476 0ustar staff#ifndef SETUPPAGEUSERDATA_H #define SETUPPAGEUSERDATA_H /*************************************************************************** setuppageuserdata.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include //#include #include "world.h" #include "locator.h" class SetupPageUserDataPage : public QWidget { Q_OBJECT public: SetupPageUserDataPage(QWidget *parent=0); ~SetupPageUserDataPage(); QString getStationQrz(); QString getOperators(); QString getStationLocator(); int getCQz(); int getITUz(); QString getName(); QStringList getAddress(); QString getAddress1(); QString getAddress2(); QString getAddress3(); QString getAddress4(); QString getCity(); QString getZipCode(); QString getProvince(); QString getCountry(); bool setName (const QString _aux); bool setAddress1 (const QString _aux); bool setAddress2 (const QString _aux); bool setAddress3 (const QString _aux); bool setAddress4 (const QString _aux); bool setAddress (const QStringList _aux); bool setCity (const QString _aux); bool setZipCode (const QString _aux); bool setProvince (const QString _aux); bool setCountry (const QString _aux); bool setStationQrz(const QString _qrz); bool setOperators(const QString _aux); bool setStationLocator(const QString _loc); bool setCQz(const int _cqz); bool setITUz(const int _ituz); QString getRig1(); QString getRig2(); QString getRig3(); QString getAntenna1(); QString getAntenna2(); QString getAntenna3(); QStringList getRigs(); QStringList getAntennas(); QString getPower(); bool setRigs(const QStringList _aux); bool setAntennas(const QStringList _aux); bool setPower(const QString _aux); bool setRig1 (const QString _aux); bool setRig2 (const QString _aux); bool setRig3 (const QString _aux); bool setAntenna1 (const QString _aux); bool setAntenna2 (const QString _aux); bool setAntenna3 (const QString _aux); private slots: void slotMyLocatorTextChanged(); void slotOperatorsChanged(); void slotQRZTextChanged(); // void slotContestOverLayChanged(int i); private: bool checkOperatorsLineQString(const QString _auxLine); QTabWidget *tabWidget; QLineEdit *qrzLineEdit; // Station Callsign QLineEdit *operatorsLineEdit; //Operators QLineEdit *cqzLineEdit; QLineEdit *ituzLineEdit; QLineEdit *myLocatorLineEdit; QLabel *myLocatorLabel; //Personal Tab QLineEdit *nameLineEdit; QTextEdit *addressTextEdit; QLineEdit *address1LineEdit; QLineEdit *address2LineEdit; QLineEdit *address3LineEdit; QLineEdit *address4LineEdit; QLineEdit *cityLineEdit; QLineEdit *zipLineEdit; QLineEdit *provinceLineEdit; QLineEdit *countryLineEdit; // Station Tab QLineEdit *rig1LineEdit; QLineEdit *rig2LineEdit; QLineEdit *rig3LineEdit; QLineEdit *ant1LineEdit; QLineEdit *ant2LineEdit; QLineEdit *ant3LineEdit; //QLineEdit *powerLineEdit; QDoubleSpinBox *myPowerSpinBox; QPalette *defaultPalette, *wrongPalette; QColor redColor; Locator *locator; World world; bool operatorsOK; bool operatorOK; }; #endif // SETUPPAGEUSERDATA_H klog-0.9.2.2/setupdialog.h0000644000076700000620000001067212627126144013270 0ustar staff#ifndef SETUPDIALOG_H #define SETUPDIALOG_H /*************************************************************************** setupdialog.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include #include "setuppageuserdata.h" #include "setuppagebandsmodes.h" #include "setuppagemisc.h" #include "setuppagedxcluster.h" #include "setuppagecolors.h" #include "setuppagelogs.h" #include "setuppageworldeditor.h" #include "setuppageclublog.h" #include "dataproxy_sqlite.h" #include "utilities.h" #include "locator.h" class QListWidget; class QListWidgetItem; class QStackedWidget; class SetupDialog : public QDialog { Q_OBJECT public: SetupDialog(const bool _firstTime=true); SetupDialog(const QString _configFile, const QString _softwareVersion, const int _page=0, const bool _firstTime = true); ~SetupDialog(); void setData(const QString _configFile, const QString _softwareVersion, const int _page, const bool _firstTime=true); void setClubLogActive(const bool _b); void checkIfNewBandOrMode(); public slots: signals: void exitSignal(const int status); // 1 = OK, -1 = NOK, 2 = Cancel clicked private slots: void changePage(QListWidgetItem *current, QListWidgetItem *previous); void slotReadConfigData(); void slotOkButtonClicked(); void slotCancelButtonClicked(); private: void setConfigFile(const QString _configFile); void setSoftVersion(const QString _softwareVersion); void setConfigured(const bool _configured); void setPage(const int _page); void createIcons(); bool processConfigLine(const QString _line); void setDefaults(); void readActiveBands (const QString actives); void readActiveModes (const QString actives); bool isValidBand (const QString b); bool isValidMode (const QString b); QString checkAndFixASCIIinADIF(const QString _data); bool haveAtleastOneLog(); bool firstTime; // To know if we are calling it from the Start wizard or not bool nolog; // If there is no log being managed QString dxClusterServerToUse; QStringList dxClusterServers; QTabWidget *tabWidget; int logsPageTabN; QListWidget *contentsWidget; QStackedWidget *pagesWidget; SetupPageUserDataPage *userDataPage; SetupPageBandsModes *bandsModesPage; SetupPageDxCluster *dxClusterPage; SetupPageMisc *miscPage; SetupPageColors *colorsPage; SetupPageLogs *logsPage; SetupPageWorldEditor *worldEditorPage; SetupPageClubLog *clubLogPage; int pageRequested; // The page on the Dialog that is requested to be shown when you call it //QString kontestDir; QString configFileName, version; QStringList bands, modes; Locator *locator; DataProxy *dataProxy; Utilities *util; }; #endif // SETUPDIALOG_H klog-0.9.2.2/dataproxy_sqlite.h0000644000076700000620000001142412627126144014340 0ustar staff#ifndef DATAPROXY_SQLITE_H #define DATAPROXY_SQLITE_H #include #include #include "dataproxy.h" #include "database.h" class DataProxy_SQLite : public DataProxy { public: DataProxy_SQLite(); ~DataProxy_SQLite(); void createLogModel(); void createLogPanel(); bool haveAtLeastOneLog(); int getIdFromModeName(const QString& _modeName); int getIdFromBandName(const QString& _bandName); int getSubModeIdFromSubMode(const QString _subModeName); int getModeIdFromSubModeId(const int _sm); QStringList getBands(); QStringList getModes(); QStringList getBandsInLog(const int _log); QStringList getModesInLog(const int _log); QString getNameFromBandId (const int _id); QString getNameFromModeId (const int _id); QString getNameFromSubModeId (const int _id); QString getSubModeFromId (const int _id); QString getNameFromSubMode (const QString _sm); // Checks if a submode is deprecated TODO: CHeck if really needed QString getModeFromSubMode (const QString _sm); bool isModeDeprecated (const QString _sm); QString getFreqFromBandId(const int _id); int getBandIdFromFreq(const double _n); int getLastQSOid(); 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); bool qslSentViaDirect(const int _qsoId, const QString _updateDate); bool qslSentViaBureau(const int _qsoId, const QString _updateDate); bool qslRecViaBureau(const int _qsoId, const QString _updateDate); bool qslRecViaBureau(const int _qsoId, const QString _updateDate, const bool _queueSentQSL); bool qslRecViaDirect(const int _qsoId, const QString _updateDate); bool qslRecViaDirect(const int _qsoId, const QString _updateDate, const bool _queueSentQSL); bool qslSentAsRequested(const int _qsoId, const QString _updateDate); bool qslRecAsRequested(const int _qsoId, const QString _updateDate); bool setClubLogSent(const int _qsoId, const QString _st, const QString _updateDate); bool isHF(const int _band); bool isWARC(const int _band); bool isVHF(const int _band); QString getCallFromId(const int _qsoId); QStringList getClubLogRealTimeFromId(const int _qsoId); // Complete with previous QString getNameFromQRZ(const QString _call); QString getQTHFromQRZ(const QString _call); QString getLocatorFromQRZ(const QString _call); QString getIOTAFromQRZ(const QString _call); 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(); bool clearLog(); int getDXCConYear(const int _year, const int _logNumber); int getCQzonYear(const int _year, const int _logNumber); bool newDXMarathon(const int _dxcc, const int _cq, const int _year, const int _logNumber); QStringList getContestNames(); QStringList getContestCat(const int _catn); QStringList getContestOverlays(); int getContestTypeN(const int _co, const int _catop, const int _catas, const int _catpo, const int _catba, const int _catov, const int _catmo); QStringList getDataFromContestType(const int _n); QStringList getBandNames(); QStringList getPropModeList(); QStringList getValidCatOptions(const int _currentCat, const int _lowerCa); 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; DataBase *db; //QSqlRelationalTableModel *logModel; }; #endif // DATAPROXY_SQLITE_H klog-0.9.2.2/main.cpp0000644000076700000620000001717112627126144012230 0ustar staff /* This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include #include #include #include #include #include "startwizard.h" #include "mainwindow.h" int main(int argc, char *argv[]) { QString version = "0.9.2.2"; QDir d1 = QDir(); QApplication app(argc, argv); //QApplication app(argc, argv); app.setApplicationName(QString("KLog")); app.setApplicationVersion(QString(version)); // Translations begin QTranslator qtTranslator; qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); app.installTranslator(&qtTranslator); QTranslator myappTranslator; #if defined(Q_OS_WIN) myappTranslator.load(QCoreApplication::applicationDirPath() + "/translations/klog_" + (QLocale::system().name())); // qDebug() << "KLog WIN " << endl; // qDebug() << "KLog: " << QLocale::system().name() << endl; //qDebug() << "KLog trans: " << QLibraryInfo::location(QLibraryInfo::TranslationsPath) << endl; //qDebug() << "KLog currentPath: " << QDir::currentPath() << endl; #elif defined(Q_OS_OSX) myappTranslator.load(QCoreApplication::applicationDirPath() + "/translations/klog_" + (QLocale::system().name())); //myappTranslator.load("translations/klog_" + (QLocale::system().name())); //qDebug() << "KLog OSX " << endl; //qDebug() << "KLog: " << QLocale::system().name() << endl; //qDebug() << "KLog trans: " << QLibraryInfo::location(QLibraryInfo::TranslationsPath) << endl; //qDebug() << "KLog currentPath: " << QDir::currentPath() << endl; #else myappTranslator.load("klog_" + (QLocale::system().name())); //qDebug() << "KLog OTHER OS " << endl; #endif //myappTranslator.load("klog_" + (QLocale::system().name()).left(2)); //qDebug() << "KLog locale: " << QLocale::system().name() << endl; //qDebug() << "KLog locale2: " << (QLocale().name()).left(2) << endl; //qDebug() << "KLog language: " << QLocale::system().language() << endl; //qDebug() << "KLog AppPath: " << QCoreApplication::applicationDirPath() << endl; app.installTranslator(&myappTranslator); // Translations end QString configFileName, kontestDir; int inMemory; //bool dbInMemory = true; #ifdef Q_OS_WIN //qDebug() << "WINDOWS DETECTED!" << endl; kontestDir = QDir::homePath()+"/klog"; // We create the \klog for the logs and data configFileName = kontestDir+"/klogrc.cfg"; #else //qDebug() << "NO WINDOWS DETECTED!" << endl; kontestDir = QDir::homePath()+"/.klog"; // We create the ~/.kontest for the logs and data configFileName = kontestDir+"/klogrc"; #endif //if (!QDir::setCurrent (kontestDir) ) if (!QDir::setCurrent (kontestDir) ) { //qDebug() << "MAIN: KLogDir does not exist.... creating " << endl; //QDir d1(kontestDir); //d1.setCurrent() if (d1.mkdir(kontestDir)) { if (QDir::setCurrent (kontestDir) ) { //qDebug() << "MAIN: KLogDir has just been created and pointed " << endl; } else { //qDebug() << "MAIN: KLogDir has just been created and pointed FAILED! " << endl; } } else { //qDebug() << "MAIN: KLogDir can not be created?? " << endl; } } else { //qDebug() << "MAIN: KLogDir already existed!! " << endl; } if(!QFile::exists(configFileName)) { //qDebug() << "MAIN: Starting wizard... " << endl; StartWizard *wizard = new StartWizard(kontestDir, version); wizard->setModal(true); inMemory = wizard->exec(); if (inMemory == 1) { //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; MainWindow mw(kontestDir, version); mw.show(); return app.exec(); } else { //qDebug() << "MAIN: Wizard cancelled " << QString::number(inMemory) << " ... should close " << endl; QMessageBox msgBox; msgBox.setText("Install wizard was cancelled before completing..."); msgBox.setInformativeText("Do you want to remove the KLog dir from your disk?"); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No ); msgBox.setDefaultButton(QMessageBox::Yes); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Yes: if (QDir::setCurrent (QDir::homePath()) ) { if (d1.remove(kontestDir)) { QMessageBox msgBox; msgBox.setText("Your KLog dir has been removed\n\nThank you for running KLog!."); msgBox.exec(); } else { QMessageBox msgBox; msgBox.setText("I could not remove your KLog dir. You should do it manually if you want it removed from your hard disk.\n\nThank you for running KLog!."); msgBox.exec(); } } else { QMessageBox msgBox; msgBox.setText("Your KLog dir could not be removed. You should do it manually if you want it removed from your hard disk.\n\nThank you for running KLog!."); msgBox.exec(); } break; case QMessageBox::No: QMessageBox msgBox; msgBox.setText("Remember that your KLog dir is in your system...\n\nThank you for running KLog!."); msgBox.exec(); break; } return 0; } } else { MainWindow mw(kontestDir, version); mw.show(); return app.exec(); } //return app.exec(); } klog-0.9.2.2/setuppagebandsmodes.h0000644000076700000620000000602412627126144015001 0ustar staff#ifndef SETUPPAGEBANDSMODES_H #define SETUPPAGEBANDSMODES_H /*************************************************************************** setuppagebandsmodes.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include #include #include #include #include "dataproxy.h" #include "dataproxy_sqlite.h" class SetupPageBandsModes : public QWidget { Q_OBJECT public: SetupPageBandsModes(QWidget *parent=0); ~SetupPageBandsModes(); QString getBands(); // 10m, 12m, 15m QString getModes(); //ssb, CW void setActiveBands(QStringList q); void setActiveModes(QStringList q); private slots: void slotBandActiveItemDoubleClicked ( QListWidgetItem * item ); void slotBandNotActiveItemDoubleClicked ( QListWidgetItem * item ); void slotBandSelButtonClicked( ); void slotBandUnSelButtonClicked( ); void slotModeSelButtonClicked( ); void slotModeUnSelButtonClicked( ); private: void createActions(); void addBandModeDefaults(); //QWidget *bandsWidget; QListWidget *bandsNotActiveListWidget, *bandsActiveListWidget; QListWidget *modesNotActiveListWidget, *modesActiveListWidget; QStringList bands, modes; QPushButton *bandSelPushButton, *bandUnSelPushButton, *modeSelPushButton, *modeUnSelPushButton; DataProxy *dataProxy; //QCheckBox *10m; }; #endif // SETUPPAGEBANDSMODES_H klog-0.9.2.2/INSTALL.txt0000644000076700000620000000030612627126144012437 0ustar staffThis file is about the installation process of KLog. Please read: INSTALL-linux.txt for linux installations. INSTALL-OSX.txt for OSX installations. INSTALL-win.txt for Windows installations. klog-0.9.2.2/elogclublog.h0000644000076700000620000000325512627126144013245 0ustar staff#ifndef ELOGCLUBLOG_H #define ELOGCLUBLOG_H #include #include #include #include #include #include #include #include class eLogClubLog : public QObject { Q_OBJECT public: explicit eLogClubLog(); ~eLogClubLog(); void setCredentials(const QString _call, const QString _email, const QString _pass, const bool _useQSOStationCall); int sendQSO(QStringList _qso); int deleteQSO(QStringList _qso); int modifyQSO (QStringList _oldQSO, QStringList _newQSO); private: QString getClubLogAdif(const QStringList _q); int sendData(const QString _q); // Sends the data (http post) to ClubLog QString prepareToTranslate(const QString _m); // Get the message and put it in a tr to be able to translate it QString call, email, pass, api, stationCallsign; QNetworkAccessManager *manager; QNetworkReply* reply; int currentQSO; int result; QString target; bool useQSOStationCallsign; private slots: void slotQsoUploadFinished(QNetworkReply* data); void slotFileUploadFinished(QNetworkReply* data); void downloadProgress(qint64 received, qint64 total); void slotErrorManagement(QNetworkReply::NetworkError networkError); signals: void actionReturnDownload(const int _i, const int _qsoId); void done(); void actionShowProgres(qint64 received, qint64 total); void actionError(const int _i); void showMessage(const QString _t); void disableClubLogAction(const bool _b); }; #endif // DOWNLOADCTY_H klog-0.9.2.2/setupentitydialog.cpp0000644000076700000620000004172512627126144015063 0ustar staff/*************************************************************************** setupentitydialog.cpp - description ------------------- begin : sept 2012 copyright : (C) 2012 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "setupentitydialog.h" //#include /* This class calls all the othet "Setup..." to manage the configuration */ SetupEntityDialog::SetupEntityDialog(){ //qDebug() << "SetupEntityDialog::SetupEntityDialog: " << endl; //QPalette::ColorRole QWidget::foregroundRole () const; //QPalette::ColorRole //paletteOrig = new QPalette; //paletteWrong = new QPalette; //paletteWrong.setColor(QPalette::Normal, QPalette::WindowText, Qt::red); //paletteWrong = new QPalette(); //*paletteWrong->setColor(QPalette::WindowText, Qt::red); //paletteWrong.setColor(QPalette::WindowText, color.setNamedColor("red")); palw.setColor(QPalette::Text, Qt::red); //pal.setColor(QPalette::Text, Qt::black); entityData.clear(); entityBool = false; mainPrefixBool = false; cqBool = false; ituBool = false; contBool = false; latBool = false; lonBool = false; utcBool = false; arrlidBool = false; delBool = false; delDateBool = false; prefBool = false; //qDebug() << "SetupEntityDialog::SetupEntityDialog - 0" << endl; QLabel *entityLabel = new QLabel(tr("Entity")); entityLineEdit = new QLineEdit; entityLineEdit->setToolTip(tr("Name of the Entity")); QLabel *cqLabel = new QLabel(tr("CQ")); cqLineEdit = new QLineEdit; cqLineEdit->setToolTip(tr("CQ zone")); QLabel *ituLabel = new QLabel(tr("ITU")); ituLineEdit = new QLineEdit; ituLineEdit->setToolTip(tr("ITU zone")); //QLabel *contLabel = new QLabel(tr("Continent")); //contLineEdit = new QLineEdit; //contLineEdit->setToolTip(tr("Continent of the Entity")); QLabel *latLabel = new QLabel(tr("Latitude")); latLineEdit = new QLineEdit; latLineEdit->setToolTip(tr("Longitude of the Entity")); QLabel *lonLabel = new QLabel(tr("Longitude")); lonLineEdit = new QLineEdit; lonLineEdit->setToolTip(tr("Longitude of the Entity")); QLabel *utcLabel = new QLabel(tr("UTC")); utcLineEdit = new QLineEdit; utcLineEdit->setToolTip(tr("Local time difference to UTC")); QLabel *mprefLabel = new QLabel(tr("Main prefix")); mprefLineEdit = new QLineEdit; mprefLineEdit->setToolTip(tr("Main prefix of the entity")); //qDebug() << "SetupEntityDialog::SetupEntityDialog - 1" << endl; QLabel *arrlidLabel = new QLabel(tr("ARRL Id")); arrlidLineEdit = new QLineEdit; arrlidLineEdit->setToolTip(tr("ARRL id")); //QLabel *deletedLabel = new QLabel(tr("Deleted")); //deletedLineEdit = new QLineEdit; //deletedLineEdit->setToolTip(tr("Mark if the entity is deleted")); QLabel *prefLabel = new QLabel(tr("Prefixes")); prefLineEdit = new QLineEdit; prefLineEdit->setToolTip(tr("Comma separated possible prefixes. ie. EA1, EA2, ...")); delQDateEdit = new QDateEdit; delQDateEdit->setToolTip(tr("Date of the deletion")); delRbutton = new QRadioButton(tr("Deleted"), this); QPushButton *closeButton = new QPushButton(tr("Cancel")); QPushButton *okButton = new QPushButton(tr("OK")); //qDebug() << "SetupEntityDialog::SetupEntityDialog - 2" << endl; /* connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); connect(okButton, SIGNAL(clicked()), this, SLOT(slotOkButtonClicked())); connect(entityLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckEntity() ) ); connect(mprefLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckMainprefix() ) ); connect(cqLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckCQz() ) ); connect(ituLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckITUz() ) ); connect(contLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckContinent() ) ); connect(latLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckLatitude() ) ); connect(lonLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckLongitude() ) ); connect(utcLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckUTC() ) ); connect(arrlidLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckARRLid() ) ); connect(delRbutton, SIGNAL(checked), this, SLOT(slotCheckDeleted() ) ); connect(delQDateEdit, SIGNAL(dateChanged), this, SLOT(slotCheckDeletedDate() ) ); connect(prefLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotCheckPrefixes() ) ); */ //qDebug() << "SetupEntityDialog::SetupEntityDialog - 3" << endl; QVBoxLayout *cqLayout = new QVBoxLayout; cqLayout->addWidget(cqLabel); cqLayout->addWidget(cqLineEdit); QVBoxLayout *ituLayout = new QVBoxLayout; ituLayout->addWidget(ituLabel); ituLayout->addWidget(ituLineEdit); QVBoxLayout *latLayout = new QVBoxLayout; latLayout->addWidget(latLabel); latLayout->addWidget(latLineEdit); QVBoxLayout *lonLayout = new QVBoxLayout; lonLayout->addWidget(lonLabel); lonLayout->addWidget(lonLineEdit); QHBoxLayout *posLayout = new QHBoxLayout; posLayout->addLayout(cqLayout); posLayout->addLayout(ituLayout); posLayout->addLayout(latLayout); posLayout->addLayout(lonLayout); QVBoxLayout *utcLayout = new QVBoxLayout; utcLayout->addWidget(utcLabel); utcLayout->addWidget(utcLineEdit); QVBoxLayout *arrlidLayout = new QVBoxLayout; arrlidLayout->addWidget(arrlidLabel); arrlidLayout->addWidget(arrlidLineEdit); QVBoxLayout *delLayout = new QVBoxLayout; delLayout->addWidget(delRbutton); delLayout->addWidget(delQDateEdit); QHBoxLayout *thirdLayout = new QHBoxLayout; thirdLayout->addLayout(utcLayout); thirdLayout->addLayout(arrlidLayout); thirdLayout->addLayout(delLayout); QVBoxLayout *prefLayout = new QVBoxLayout; prefLayout->addWidget(prefLabel); prefLayout->addWidget(prefLineEdit); QGridLayout *dataLayout = new QGridLayout; dataLayout->addWidget(entityLabel, 0, 0); dataLayout->addWidget(entityLineEdit, 1, 0); dataLayout->addWidget(mprefLabel, 0, 1); dataLayout->addWidget(mprefLineEdit, 1, 1); dataLayout->addLayout(posLayout, 2, 0, 2, -1); dataLayout->addLayout(thirdLayout, 4, 0, 4, -1); dataLayout->addLayout(prefLayout, 8, 0, 8, -1); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(1); buttonsLayout->addWidget(okButton); buttonsLayout->addWidget(closeButton); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(dataLayout); mainLayout->addStretch(1); mainLayout->addSpacing(12); mainLayout->addLayout(buttonsLayout); //qDebug() << "SetupEntityDialog::SetupEntityDialog - 3" << endl; setLayout(mainLayout); setWindowTitle(tr("Entity Dialog")); pal = lonLineEdit->palette(); //qDebug() << "SetupEntityDialog::SetupEntityDialog: END" << endl; } SetupEntityDialog::~SetupEntityDialog() { //qDebug() << "SetupEntityDialog::~SetupEntityDialog " << endl; } void SetupEntityDialog::slotOkButtonClicked() { //qDebug() << "SetupEntityDialog::slotOkButtonClicked " << endl; QStringList ql; ql.clear(); if (entityBool && mainPrefixBool && cqBool && ituBool && contBool && latBool && lonBool && utcBool && arrlidBool && delBool && delDateBool && prefBool) { ql << checkEntity(); ql << checkMainprefix(); ql << checkContinent(); ql << checkCQz(); ql << checkITUz(); ql << checkLatitude(); ql << checkLongitude(); ql << checkUTC(); ql << checkARRLid(); ql << checkDeleted(); //ql << checkDeletedDate(); ql << checkPrefixes(); emit entityAdded(ql); accept(); } else { reject(); } reject(); } QString SetupEntityDialog::checkContinent() { //qDebug() << "SetupEntityDialog::checkContinent" << endl; if(contBool) { return contLineEdit->text(); } else { return ""; } return ""; } QString SetupEntityDialog::checkEntity() { //qDebug() << "SetupEntityDialog::checkEntity" << endl; if(entityBool) { return entityLineEdit->text(); } else { return ""; } return ""; } QString SetupEntityDialog::checkMainprefix() { //qDebug() << "SetupEntityDialog::checkMainprefix" << endl; if(mainPrefixBool) { return mprefLineEdit->text(); } else { return ""; } return ""; } QString SetupEntityDialog::checkCQz() { //qDebug() << "SetupEntityDialog::checkCQz" << endl; if(cqBool) { return cqLineEdit->text(); } else { return ""; } return ""; } QString SetupEntityDialog::checkITUz() { //qDebug() << "SetupEntityDialog::checkITUz" << endl; if(ituBool) { return ituLineEdit->text(); } else { return ""; } return ""; } QString SetupEntityDialog::checkLatitude() { //qDebug() << "SetupEntityDialog::checkLatitude" << endl; if(latBool) { return latLineEdit->text(); } else { return ""; } return ""; } QString SetupEntityDialog::checkLongitude() { //qDebug() << "SetupEntityDialog::checkLongitude" << endl; if(lonBool) { return lonLineEdit->text(); } else { return ""; } return ""; } QString SetupEntityDialog::checkUTC() { //qDebug() << "SetupEntityDialog::checkUTC" << endl; if(utcBool) { return utcLineEdit->text(); } else { return ""; } return ""; } QString SetupEntityDialog::checkARRLid() { //qDebug() << "SetupEntityDialog::checkARRLid" << endl; if(arrlidBool) { return arrlidLineEdit->text(); } else { return ""; } return ""; } QString SetupEntityDialog::checkDeleted() { //qDebug() << "SetupEntityDialog::checkDeleted" << endl; if(delBool) { return "Y"; } else { return "N"; } return ""; } QString SetupEntityDialog::checkDeletedDate() { //qDebug() << "SetupEntityDialog::checkDeletedDate" << endl; if(delDateBool) { return "00/00/0000"; } else { return ""; } return ""; } QString SetupEntityDialog::checkPrefixes() { //qDebug() << "SetupEntityDialog::checkPrefixes" << endl; if(prefBool) { return prefLineEdit->text(); } else { return ""; } return ""; } void SetupEntityDialog::slotCancelButtonClicked() { //qDebug() << "SetupEntityDialog::slotCancelButtonClicked " << endl; reject(); } void SetupEntityDialog::slotCheckEntity() { //qDebug() << "SetupEntityDialog::slotCheckEntity " << endl; QString aux; aux = entityLineEdit->text(); if (aux.length()>2) { entityBool = true; entityLineEdit->setPalette(pal); } else { entityBool = false; entityLineEdit->setPalette(palw); } } void SetupEntityDialog::slotCheckMainprefix() { //qDebug() << "SetupEntityDialog::slotCheckMainprefix" << endl; QString aux; aux = mprefLineEdit->text(); if (aux.length()>0) { mprefLineEdit->setPalette(pal); mainPrefixBool = true; } else { mainPrefixBool = false; mprefLineEdit->setPalette(palw); } } void SetupEntityDialog::slotCheckCQz() { //qDebug() << "SetupEntityDialog::slotCheckCQz" << endl; QString aux; aux = cqLineEdit->text(); if (aux.length()>0) { cqBool = true; cqLineEdit->setPalette(pal); } else { cqBool = false; cqLineEdit->setPalette(palw); } } void SetupEntityDialog::slotCheckITUz() { //qDebug() << "SetupEntityDialog::slotCheckITUz" << endl; QString aux; aux = ituLineEdit->text(); if (aux.length()>0) { ituBool = true; ituLineEdit->setPalette(pal); } else { ituBool = false; ituLineEdit->setPalette(palw); } } void SetupEntityDialog::slotCheckContinent() { //qDebug() << "SetupEntityDialog::slotCheckContinent" << endl; QString aux; aux = contLineEdit->text(); if (aux.length()>2) { contBool = true; contLineEdit->setPalette(pal); } else { contBool = false; contLineEdit->setPalette(palw); } } void SetupEntityDialog::slotCheckLatitude() { //qDebug() << "SetupEntityDialog::slotCheckLatitude" << endl; QString aux; aux = latLineEdit->text(); if (aux.length()>0) { latBool = true; latLineEdit->setPalette(pal); } else { latBool = false; latLineEdit->setPalette(palw); } } void SetupEntityDialog::slotCheckLongitude() { //qDebug() << "SetupEntityDialog::slotCheckLongitude" << endl; QString aux; aux = lonLineEdit->text(); if (aux.length()>3) { //lonLineEdit->setPalette(*paletteOrig); lonBool = true; lonLineEdit->setPalette(pal); } else { //lonLineEdit->setForegroundRole(QPalette::WindowText); lonLineEdit->setPalette(palw); //lonLineEdit->setPalette(*paletteWrong); lonBool = false; } } void SetupEntityDialog::slotCheckUTC() { //qDebug() << "SetupEntityDialog::slotCheckUTC" << endl; QString aux; aux = utcLineEdit->text(); if (aux.length()>0) { utcBool = true; utcLineEdit->setPalette(pal); } else { utcBool = false; utcLineEdit->setPalette(palw); } } void SetupEntityDialog::slotCheckARRLid() { //qDebug() << "SetupEntityDialog::slotCheckARRLid" << endl; QString aux; aux = arrlidLineEdit->text(); // int n = aux.toInt(); if (aux.length()>0) { arrlidBool = false; arrlidLineEdit->setPalette(pal); } else { arrlidBool = false; arrlidLineEdit->setPalette(palw); } } void SetupEntityDialog::slotCheckDeleted() { //qDebug() << "SetupEntityDialog::slotCheckDeleted" << endl; if (delRbutton->isChecked()) { delBool = true; } else { delBool = false; } } void SetupEntityDialog::slotCheckDeletedDate() { //qDebug() << "SetupEntityDialog::slotCheckDeletedDate" << endl; delDateBool = false; //arrlidLineEdit->setPalette(palw); } void SetupEntityDialog::slotCheckPrefixes() { //qDebug() << "SetupEntityDialog::slotCheckPrefixes" << endl; QString aux; aux = prefLineEdit->text(); aux = aux.simplified(); QStringList list = aux.split(",", QString::SkipEmptyParts); if (aux.length()>0) { prefBool = true; prefLineEdit->setPalette(pal); //"EA1, EA2, EA3" } else { prefBool = false; prefLineEdit->setPalette(palw); } } klog-0.9.2.2/setuppagebandsmodes.cpp0000644000076700000620000002525212627126144015340 0ustar staff/*************************************************************************** setuppagebandsmodes.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include "setuppagebandsmodes.h" SetupPageBandsModes::SetupPageBandsModes(QWidget *parent) : QWidget(parent){ //qDebug() << "SetupPageBandsModes::SetupPageBandsModes" << endl; // bandsWidget = new QWidget; dataProxy = new DataProxy_SQLite(); //qDebug() << "SetupPageBandsModes::SetupPageBandsModes -1" << endl; bandsNotActiveListWidget = new QListWidget(this); bandsActiveListWidget = new QListWidget(this); modesNotActiveListWidget = new QListWidget(this); modesActiveListWidget = new QListWidget(this); bandsNotActiveListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); bandsActiveListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); modesNotActiveListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); modesActiveListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); QGroupBox *bandsGroupBox = new QGroupBox(tr("Bands")); QGroupBox *modesGroupBox = new QGroupBox(tr("Modes")); QHBoxLayout *bandsLayout = new QHBoxLayout; bandsLayout->addWidget(bandsNotActiveListWidget); bandsLayout->addWidget(bandsActiveListWidget); bandsLayout->addStretch(1); bandsGroupBox->setLayout(bandsLayout); QHBoxLayout *modesLayout = new QHBoxLayout; modesLayout->addWidget(modesNotActiveListWidget); modesLayout->addWidget(modesActiveListWidget); modesLayout->addStretch(1); modesGroupBox->setLayout(modesLayout); bandSelPushButton = new QPushButton(tr("&Add Band"), this);; bandUnSelPushButton = new QPushButton(tr("&Remove Band"), this); modeSelPushButton = new QPushButton(tr("Add &Mode"), this); modeUnSelPushButton = new QPushButton(tr("Remove M&ode"), this);; QVBoxLayout *bandsButtonsLayout = new QVBoxLayout; bandsButtonsLayout->addWidget(bandSelPushButton); bandsButtonsLayout->addWidget(bandUnSelPushButton); QVBoxLayout *modesButtonsLayout = new QVBoxLayout; modesButtonsLayout->addWidget(modeSelPushButton); modesButtonsLayout->addWidget(modeUnSelPushButton); QHBoxLayout *bandsModesWidgetLayout = new QHBoxLayout; bandsModesWidgetLayout->addWidget(bandsGroupBox); bandsModesWidgetLayout->addLayout(bandsButtonsLayout); bandsModesWidgetLayout->addWidget(modesGroupBox); bandsModesWidgetLayout->addLayout(modesButtonsLayout); bands.clear(); bands << dataProxy->getBands(); modes << dataProxy->getModes(); bandsNotActiveListWidget->addItems(bands); modesNotActiveListWidget->addItems(modes); setLayout(bandsModesWidgetLayout); connect(bandsNotActiveListWidget, SIGNAL(itemDoubleClicked ( QListWidgetItem * )), this, SLOT(slotBandActiveItemDoubleClicked ( QListWidgetItem * ) ) ); connect(bandsActiveListWidget, SIGNAL(itemDoubleClicked ( QListWidgetItem * )), this, SLOT(slotBandNotActiveItemDoubleClicked ( QListWidgetItem * ) ) ); connect(bandSelPushButton, SIGNAL(clicked ( )), this, SLOT(slotBandSelButtonClicked ( ) ) ); connect(bandUnSelPushButton, SIGNAL(clicked ( )), this, SLOT(slotBandUnSelButtonClicked ( ) ) ); connect(modeSelPushButton, SIGNAL(clicked ( )), this, SLOT(slotModeSelButtonClicked ( ) ) ); connect(modeUnSelPushButton, SIGNAL(clicked ( )), this, SLOT(slotModeUnSelButtonClicked ( ) ) ); //connect(logView, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickLog( const QModelIndex& ) ) ); } SetupPageBandsModes::~SetupPageBandsModes(){ //qDebug() << "SetupPageBandsModes::~SetupPageBandsModes" << endl; } void SetupPageBandsModes::createActions(){ //void itemDoubleClicked ( QListWidgetItem * item ) } void SetupPageBandsModes::slotBandActiveItemDoubleClicked ( QListWidgetItem * item ){ //qDebug() << "SetupPageBandsModes::slotBandActiveItemDoubleClicked" << item->text() << endl; bandsActiveListWidget->addItem(item->text()); bandsNotActiveListWidget->removeItemWidget(item); } void SetupPageBandsModes::slotBandNotActiveItemDoubleClicked ( QListWidgetItem * item ){ //qDebug() << "SetupPageBandsModes::slotBandNotActiveItemDoubleClicked" << item->text() << endl; bandsNotActiveListWidget->addItem(item->text()); bandsActiveListWidget->removeItemWidget(item); //bandsNotActiveListWidget->addItem(itemitem->text()); //bandsNotActiveListWidget->removeItemWidget(item); } void SetupPageBandsModes::slotBandSelButtonClicked(){ //qDebug() << "SetupPageBandsModes::slotBandSelButtonClicked" << endl; QListWidgetItem *it; for (int i = 0; i < bandsNotActiveListWidget->count(); i++) { it = bandsNotActiveListWidget->item(i); if( (*it).isSelected() ) { bandsActiveListWidget->addItem((it)->text()); bandsNotActiveListWidget->takeItem(i); i--; } else { } } }; void SetupPageBandsModes::slotBandUnSelButtonClicked(){ //qDebug() << "SetupPageBandsModes::slotBandUnSelButtonClicked" << endl; QListWidgetItem *it; for (int i = 0; i < bandsActiveListWidget->count(); i++) { it = bandsActiveListWidget->item(i); if( (*it).isSelected() ) { bandsNotActiveListWidget->addItem((it)->text()); bandsActiveListWidget->takeItem(i); i--; } else { } } }; void SetupPageBandsModes::slotModeSelButtonClicked(){ //qDebug() << "SetupPageBandsModes::slotModeSelButtonClicked" << endl; QListWidgetItem *it; for (int i = 0; i < modesNotActiveListWidget->count(); i++) { it = modesNotActiveListWidget->item(i); if( (*it).isSelected() ) { modesActiveListWidget->addItem((it)->text()); modesNotActiveListWidget->takeItem(i); i--; } else { } } }; void SetupPageBandsModes::slotModeUnSelButtonClicked(){ //qDebug() << "SetupPageBandsModes::slotModeUnSelButtonClicked" << endl; QListWidgetItem *it; for (int i = 0; i < modesActiveListWidget->count(); i++) { it = modesActiveListWidget->item(i); if( (*it).isSelected() ) { modesNotActiveListWidget->addItem((it)->text()); modesActiveListWidget->takeItem(i); i--; } else { } } }; QString SetupPageBandsModes::getBands() { //qDebug() << "SetupPageBandsModes::getBands" << endl; QString b; QListWidgetItem *it; if ( (bandsActiveListWidget->count()) < 1) { return ""; } for (int i = 0; i < bandsActiveListWidget->count(); i++) { it = bandsActiveListWidget->item(i); b = b + it->text(); b = b + ", "; } if (b.size()<2) { }else { b.chop(2); } //qDebug() << "SetupPageBandsModes::getBands: " << b << endl; return b; } QString SetupPageBandsModes::getModes() { //qDebug() << "SetupPageBandsModes::getModes" << endl; QString b; QListWidgetItem *it; if ( (modesActiveListWidget->count()) < 1) { return ""; } for (int i = 0; i < modesActiveListWidget->count(); i++) { it = modesActiveListWidget->item(i); b = b + it->text(); b = b + ", "; } if (b.size()<2) { }else { b.chop(2); } //qDebug() << "SetupPageBandsModes::getModes: " << b << endl; return b; } void SetupPageBandsModes::setActiveBands(QStringList q) { //qDebug() << "SetupPageBandsModes::setActiveBands " << endl; QListWidgetItem *it, *itn; bandsActiveListWidget->clear(); q.removeDuplicates(); bandsActiveListWidget->addItems(q); for (int i = 0; i < bandsActiveListWidget->count(); i++) { it = bandsActiveListWidget->item(i); for (int j = 0; j < bandsNotActiveListWidget->count(); j++) { itn = bandsNotActiveListWidget->item(j); if ( (itn->text()) == (it->text()) ) { bandsNotActiveListWidget->takeItem(j); } } } } void SetupPageBandsModes::setActiveModes(QStringList q) { //qDebug() << "SetupPageBandsModes::setActiveModes " << endl; QListWidgetItem *it, *itn; modesActiveListWidget->clear(); int a = q.removeDuplicates(); //QStringList a; //q.removeDuplicates(); modesActiveListWidget->addItems(q); for (int i = 0; i < modesActiveListWidget->count(); i++) { it = modesActiveListWidget->item(i); for (int j = 0; j < modesNotActiveListWidget->count(); j++) { itn = modesNotActiveListWidget->item(j); if ( (itn->text()) == (it->text()) ) { modesNotActiveListWidget->takeItem(j); } } } } void SetupPageBandsModes::addBandModeDefaults() { } klog-0.9.2.2/contest.cpp0000644000076700000620000000476712627126144012772 0ustar staff/*************************************************************************** contest.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "contest.h" //#include Contest::Contest() { //qDebug() << "Contest::Contest" << endl; } Contest::Contest(const QStringList _qs) { //qDebug() << "Contest::Contest (_qs)" << endl; } Contest::~Contest() { } bool Contest::isMultiplier(const QStringList _qs) { //qDebug() << "Contest::isMultiplier" << endl; return false; } int Contest::getQSOPoints(const QStringList _qs) { //qDebug() << "Contest::getQSOPoints" << endl; return 0; } int Contest::getTotalScore() { return 0; } int Contest::getMultipliers() { return 0; } int Contest::getPoints() { return 0; } bool Contest::saveFileToSend(const QString& _fileName) { //qDebug() << "Contest::saveFileToSend" << endl; return false; } klog-0.9.2.2/INSTALL-win.txt0000644000076700000620000000014712627126144013235 0ustar staffInstalling KLog on a Windows system is easy. Just double-click on the installer and follow the steps. klog-0.9.2.2/setuppagelogsnew.h0000644000076700000620000001137012627126144014340 0ustar staff#ifndef SETUPPAGELOGSNEW_H #define SETUPPAGELOGSNEW_H /*************************************************************************** setuppagelogsnew.h - description ------------------- begin : feb 2015 copyright : (C) 2015 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ // // This class implements the Dialog to add a new log // #include "dataproxy.h" #include "dataproxy_sqlite.h" #include #include //TODO: Read the data when the user clicks the OK button //TODO: Fill the data from the list of logs when the user wants to edit a log class SetupPageLogsNew : public QDialog { Q_OBJECT public: //SetupPageLogsNew(QWidget *parent = 0); SetupPageLogsNew(QWidget *parent = 0); void setEditing(const bool b); void setStationCallSign(const QString _st); void setOperators(const QString _st); void setComment(const QString _st); void setDateString(const QString _st); void setTypeN(const int _n); void setType(const QString _st); void setCMode(const int _n); void setCOperators(const int _n); void setCAssisted(const int _n); void setCPower(const int _n); void setCBands(const int _n); void setBands(const int _n); void setCOverlay(const int _n); private slots: void slotOKButtonClicked(); void slotCancelButtonClicked(); void slotStationCallSignTextChanged(); void slotTypeComboBoxChanged(); void slotCatAssistedComboBoxChanged(); void slotCatOperatorsComboBoxChanged(); void slotOperatorsTextChanged(); void slotCatPowerComboBoxChanged(); void slotCatBandsComboBoxChanged(); void slotBandsComboBoxChanged(); void slotCatModeComboBoxChanged(); void slotCatOverlayComboBoxChanged(); signals: void newLogData(const QStringList _qs); // private: bool isThereAnyNotManagedLog(); void createWidget(); void gatherAndSend(); QStringList getValidCatOptions(const int _currentCat, const int _higherCat); int getSelectedTypeContest(); void fillWithType(const int _n); void updateAllCats(); void showOK(); void showNOK(); DataProxy *dataProxy; QDateEdit *dateEdit; QLineEdit *stationCallsignLineEdit; QLineEdit *operatorsLineEdit, *commentLineEdit; QComboBox *typeComboBox; QComboBox *contestCatModeComboBox; QComboBox *contestCatOperatorsComboBox; QComboBox *contestCatAssistedComboBox; QComboBox *contestCatPowerComboBox; QComboBox *contestCatBandsComboBox; QComboBox *contestBandsComboBox; QComboBox *contestCatOverlayComboBox; QString stationCallsign, operators, comment, dateString, typeConteststr; int typeContest, typeContestSelected, contestCatMode, contestCatOperators, contestCatAssisted, contestCatPower, contestCatBands, contestBands, contestCatOverlay; bool stationCallsignFilled, operatorsFilled; int typeOperation; // DX, CQ-WW-SSB, CQ-WW-CW, CQ-WPX-SSB, CQ-WPX-CW QPushButton *okButton, *cancelButton; QStringList logData; bool editing; QLabel *catAsLabel, *catOpLabel, *catModeLabel, *catPowerLabel, *catBandsLabel, *overlayLabel; QLabel *typeLabel, *validCats, *stationCallsignLabel, *operatorsLabel, *commentLabel, *dateLabel; //nameLabel->setBuddy(); bool checking, bCass, bCOp, bCMo, bCPo, bCBa, bCOv, bCTy; }; #endif // SETUPPAGELOGSNEW_H klog-0.9.2.2/setuppageworldeditor.cpp0000644000076700000620000002101212627126144015545 0ustar staff#include "setuppageworldeditor.h" SetupPageWorldEditor::SetupPageWorldEditor(QWidget *parent) : QWidget(parent) { //qDebug() << "SetupPageWorldEditor::SetupPageWorldEditor" << endl; //worldPanel = new QWidget; world = new World(); setupEntityDialog = new SetupEntityDialog(); worldModel = new QSqlRelationalTableModel(this); worldView = new QTableView; worldView->setContextMenuPolicy(Qt::CustomContextMenu); worldView->setSortingEnabled(true); createWorldModel(); createWorldPanel(); worldView->setCurrentIndex(worldModel->index(0, 0)); addEntityPushButton = new QPushButton; delEntityPushButton = new QPushButton; editEntityPushButton = new QPushButton; exportWorldPushButton = new QPushButton; loadWorldPushButton = new QPushButton; addEntityPushButton->setText("Add"); delEntityPushButton->setText("Delete"); editEntityPushButton->setText("Edit"); exportWorldPushButton->setText("Export World"); loadWorldPushButton->setText("Import World"); addEntityPushButton->setEnabled(false); delEntityPushButton->setEnabled(false); editEntityPushButton->setEnabled(false); addEntityPushButton->setToolTip("Still not implemented."); delEntityPushButton->setToolTip("Still not implemented."); editEntityPushButton->setToolTip("Still not implemented."); exportWorldPushButton->setEnabled(false); loadWorldPushButton->setEnabled(false); exportWorldPushButton->setToolTip("Still not implemented."); loadWorldPushButton->setToolTip("Still not implemented."); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(exportWorldPushButton); buttonsLayout->addWidget(loadWorldPushButton); buttonsLayout->addSpacerItem(new QSpacerItem(10,0,QSizePolicy::Expanding,QSizePolicy::Maximum)); buttonsLayout->addWidget(addEntityPushButton); buttonsLayout->addWidget(editEntityPushButton); buttonsLayout->addWidget(delEntityPushButton); /* QHBoxLayout *wbuttonsLayout = new QHBoxLayout; wbuttonsLayout->addSpacerItem(new QSpacerItem(10,0,QSizePolicy::Expanding,QSizePolicy::Maximum)); wbuttonsLayout->addWidget(exportWorldPushButton); wbuttonsLayout->addWidget(loadWorldPushButton); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addLayout(wbuttonsLayout); buttonsLayout->addLayout(ebuttonsLayout); */ QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(worldView); layout->addLayout(buttonsLayout); setLayout(layout); createActions(); } SetupPageWorldEditor::~SetupPageWorldEditor() { //qDebug() << "SetupPageWorldEditor::~SetupPageWorldEditor" << endl; } void SetupPageWorldEditor::createWorldPanel() { worldView->setModel(worldModel); QString stringQuery = QString("SELECT * FROM entity"); QSqlQuery query(stringQuery); QSqlRecord rec = query.record(); // Number of columns int columns = rec.count(); for (int i = 0; i < columns; i++ ){ worldView->setColumnHidden(i, true); } columns = rec.indexOf("mainprefix"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("name"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("dxcc"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("continent"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("cqz"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("ituz"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("utc"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("latitude"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("longitude"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("deleted"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("sincedate"); worldView->setColumnHidden(columns, false); columns = rec.indexOf("todate"); worldView->setColumnHidden(columns, false); worldView->setItemDelegate(new QSqlRelationalDelegate(this)); worldView->setSelectionMode( QAbstractItemView::SingleSelection); worldView->setSelectionBehavior(QAbstractItemView::SelectRows); worldView->resizeColumnsToContents(); worldView->horizontalHeader()->setStretchLastSection(true); } void SetupPageWorldEditor::createWorldModel() { /* WORLD_DXCCid = 0, WORLD_Nameid = 1, WORLD_MainPrefix = 2, WORLD_CQZ = 3, WORLD_ITUZ = 4, WORLD_Cont = 5 */ QString stringQuery = QString("SELECT * FROM entity"); QSqlQuery q(stringQuery); QSqlRecord rec = q.record(); int nameCol; //worldModel = new QSqlRelationalTableModel(this); worldModel->setTable("entity"); worldModel->setEditStrategy(QSqlTableModel::OnFieldChange); nameCol = rec.indexOf("mainprefix"); worldModel->setSort(nameCol, Qt::AscendingOrder); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Prefix")); nameCol = rec.indexOf("name"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Entity")); nameCol = rec.indexOf("dxcc"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("ARRL id")); nameCol = rec.indexOf("continent"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Continent")); nameCol = rec.indexOf("cqz"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("CQ Zone")); nameCol = rec.indexOf("ituz"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("ITU Zone")); nameCol = rec.indexOf("utc"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("UTC")); nameCol = rec.indexOf("latitude"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Latitude")); nameCol = rec.indexOf("longitude"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Longitude")); nameCol = rec.indexOf("deleted"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Deleted")); nameCol = rec.indexOf("sincedate"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("Since Date")); nameCol = rec.indexOf("todate"); worldModel->setHeaderData(nameCol, Qt::Horizontal, tr("To Date")); worldModel->select(); } void SetupPageWorldEditor::createActions() { //qDebug() << "SetupPageWorldEditor::createActions" << endl; connect(addEntityPushButton, SIGNAL(clicked()), this, SLOT(slotAddButtonClicked()) ); connect(delEntityPushButton, SIGNAL(clicked()), this, SLOT(slotDelButtonClicked()) ); connect(editEntityPushButton, SIGNAL(clicked()), this, SLOT(slotEditButtonClicked()) ); connect(worldView, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickEntity( const QModelIndex& ) ) ); //SIGNAL received from the setupEntityDialog // void entityAdded(const QStringList _qs); // entity connect(setupEntityDialog, SIGNAL(entityAdded(QStringList)), this, SLOT(slotAnalyzeEntityAddedSignal(QStringList) ) ); } void SetupPageWorldEditor::slotAnalyzeEntityAddedSignal(const QStringList _qs) { /* //qDebug() << "SetupPageWorldEditor::slotAnalyzeEntityAddedSignal\n" << _qs.at(0) << "\n" << _qs.at(1) << "\n" << _qs.at(2) << "\n" << _qs.at(3) << "\n" << _qs.at(4) << "\n" << _qs.at(5) << "\n" << _qs.at(6) << "\n" << _qs.at(7) << "\n" << _qs.at(8) << "\n" << _qs.at(9) << "\n" << _qs.at(10) << "\n" << endl; */ } void SetupPageWorldEditor::slotAddButtonClicked() { //qDebug() << "SetupPageWorldEditor::slotAddButtonClicked" << endl; setupEntityDialog->exec(); //TODO } void SetupPageWorldEditor::slotDelButtonClicked() { //qDebug() << "SetupPageWorldEditor::slotDelButtonClicked" << endl; //TODO } void SetupPageWorldEditor::slotEditButtonClicked() { //qDebug() << "SetupPageWorldEditor::slotEditButtonClicked" << endl; //TODO } void SetupPageWorldEditor::slotDoubleClickEntity( const QModelIndex & index) { //qDebug() << "SetupPageWorldEditor::slotDoubleClickEntity" << endl; //TODO QSqlQuery query; QString queryString; int row = index.row(); //qDebug() << "SetupPageWorldEditor::slotDoubleClickEntity: ARRLid: " << QString::number((worldModel->index(row, 8)).data(0).toInt()) << endl; } klog-0.9.2.2/helpaboutdialog.cpp0000644000076700000620000000444612627126144014450 0ustar staff#include "helpaboutdialog.h" //#include HelpAboutDialog::HelpAboutDialog(const QString tversion) { //qDebug() << "HelpAboutDialog::HelpAboutDialog" << endl; QString text; QString _version = tversion; text = "

KLog " + _version + "

By EA4TV - 2002-2015


KLog is a free logging software for hamradio operators.

Please know that this is an BETA release and it may contain many bugs.
Backup your data before using this software!


KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing.

Find more information and latest release at
http://jaime.robles.es/klog

Author: Jaime Robles, EA4TV
jaime@robles.es"; textBrowser = new QTextBrowser; textBrowser->setOpenLinks(true); textBrowser->setOpenExternalLinks(true); textBrowser->setHtml(text); QPushButton *acceptButton = new QPushButton(tr("Ok")); textBrowser->setOpenExternalLinks(true); //textBrowser->setHTML(url); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(acceptButton); /// QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(textBrowser); mainLayout->addLayout(buttonsLayout); setLayout(mainLayout); setWindowTitle(tr("About KLog")); /// connect(acceptButton, SIGNAL(clicked()), this, SLOT(slotAcceptButtonClicked())); } HelpAboutDialog::~HelpAboutDialog() { //qDebug() << "HelpAboutDialog::~HelpAboutDialog" << endl; } void HelpAboutDialog::slotAcceptButtonClicked() { //qDebug() << "HelpAboutDialog::slotAcceptButtonClicked" << endl; accept(); } void HelpAboutDialog::keyPressEvent(QKeyEvent *event){ switch (event->key()) { //case Qt::Key_Return: // ENTER PRESSED //slotQRZReturnPressed(); // break; //case Qt::Key_Enter: // ENTER PRESSED // slotQRZReturnPressed(); break; default: //QFrame::keyPressEvent(event) slotAcceptButtonClicked(); } } klog-0.9.2.2/dataproxy_sqlite.cpp0000644000076700000620000023005412627126144014675 0ustar staff/*************************************************************************** dataproxy_sqlite.cpp - description ------------------- begin : sept 2014 copyright : (C) 2014 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "dataproxy_sqlite.h" //#include DataProxy_SQLite::DataProxy_SQLite() { //qDebug() << "DataProxy_SQLite::DataProxy_SQLite" << endl; db = new DataBase(0); //qDebug() << "DataProxy_SQLite::DataProxy_SQLite 1" << endl; //dbCreated = db->createConnection(); //dbCreated = db->createBandModeMaps(); //qDebug() << "DataProxy_SQLite::DataProxy_SQLite - END" << endl; } DataProxy_SQLite::~DataProxy_SQLite(){ //qDebug() << "DataProxy_SQLite::~DataProxy_SQLite" << endl; } void DataProxy_SQLite::createLogModel(){ //qDebug() << "DataProxy_SQLite::createLogModel" << endl; } void DataProxy_SQLite::createLogPanel(){ //qDebug() << "DataProxy_SQLite::createLogPanel" << endl; } int DataProxy_SQLite::getIdFromModeName(const QString& _modeName) { //qDebug() << "DataProxy_SQLite::getIdFromModeName: " << _modeName << "/" << QString::number(db->getModeIDFromName2(_modeName)) << endl; if (_modeName.length()<2) { return -3; } return db->getModeIDFromName2(_modeName); } int DataProxy_SQLite::getSubModeIdFromSubMode(const QString _subModeName) { if (_subModeName.length()<2) { return -3; } QSqlQuery query; QString stQuery = QString("SELECT id FROM mode WHERE submode='%1'").arg(_subModeName); if (query.exec(stQuery)) { query.next(); if (query.isValid()) { return (query.value(0)).toInt(); } else { return -1; } } else { return -2; } } int DataProxy_SQLite::getModeIdFromSubModeId(const int _sm) { return getIdFromModeName(getModeFromSubMode(getSubModeFromId(_sm))); } QString DataProxy_SQLite::getModeFromSubMode (const QString _sm) { if (_sm.length()<2) { return ""; } QSqlQuery query; QString stQuery = QString("SELECT name FROM mode WHERE submode='%1'").arg(_sm); if (query.exec(stQuery)) { query.next(); if (query.isValid()) { return (query.value(0)).toString(); } else { return ""; } } else { return ""; } } bool DataProxy_SQLite::isModeDeprecated (const QString _sm) { if (_sm.length()<2) { return -3; } QSqlQuery query; QString stQuery = QString("SELECT deprecated FROM mode WHERE submode='%1'").arg(_sm); if (query.exec(stQuery)) { query.next(); if (query.isValid()) { if ( (query.value(0)).toInt() == 1 ) { return true; } else { return false; } } else { return false; // In case we can't check, we don't state it as deprecated } } else { return false; // In case we can't check, we don't state it as deprecated } } int DataProxy_SQLite::getIdFromBandName(const QString& _bandName) { //qDebug() << "DataProxy_SQLite::getIdFromBandName: " << _bandName << "/" << QString::number(db->getBandIDFromName2(_bandName))<< endl; if (_bandName.length()<1) { return -3; } return db->getBandIDFromName2(_bandName); } QString DataProxy_SQLite::getNameFromBandId (const int _id) { //qDebug() << "DataProxy_SQLite::getNameFromBandId " << endl; return db->getBandNameFromID2(_id); } QString DataProxy_SQLite::getNameFromModeId (const int _id) { //qDebug() << "DataProxy_SQLite::getNameFromModeId" << endl; //return db->getSubModeNameFromNumber(_id); return db->getModeNameFromID2(_id); } QString DataProxy_SQLite::getNameFromSubModeId (const int _id) { //qDebug() << "DataProxy_SQLite::getNameFromSubModeId: " << QString::number(_id) << endl; return db->getModeNameFromID2(_id); QSqlQuery query; QString stringQuery = QString("SELECT submode, name, deprecated FROM mode WHERE id='%1'").arg(_id); query.exec(stringQuery); query.next(); if (query.isValid()) { if ( (query.value(2)).toInt()<0 ) { // DEPRECATED VALUE, return the MODE return (query.value(1)).toString(); } else { return (query.value(0)).toString(); } } else { return ""; } } 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); query.next(); if (query.isValid()) { return (query.value(0)).toString(); } else { return ""; } return ""; } QString DataProxy_SQLite::getNameFromSubMode (const QString _sm) { QSqlQuery query; QString stringQuery = QString("SELECT name, deprecated FROM mode WHERE submode='%1'").arg(_sm.toUpper()); query.exec(stringQuery); query.next(); if (query.isValid()) { if ( (query.value(1)).toInt()<0 ) { // DEPRECATED VALUE, return the MODE return (query.value(0)).toString(); } else { return _sm.toUpper(); } } else { return ""; } return ""; } QString DataProxy_SQLite::getFreqFromBandId(const int _id) { return db->getFreqFromBandId(_id); } int DataProxy_SQLite::getBandIdFromFreq(const double _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() { QStringList bands = QStringList(); QSqlQuery query("SELECT name FROM band"); while (query.next()) { if (query.isValid()){ bands << query.value(0).toString(); } } return bands; } QStringList DataProxy_SQLite::getModes() { QStringList modes = QStringList(); QSqlQuery query("SELECT submode FROM mode"); while (query.next()) { if (query.isValid()){ modes << query.value(0).toString(); } } return modes; } QStringList DataProxy_SQLite::getBandsInLog(const int _log) { QStringList bands = QStringList(); QString stringQuery = QString(); if (_log <= 0) { stringQuery = QString("SELECT DISTINCT band.name FROM log, band WHERE band.id = log.bandid ORDER BY band.id DESC"); } else { stringQuery = QString("SELECT DISTINCT band.name FROM log, band WHERE band.id = log.bandid AND log.lognumber='%1' ORDER BY band.id DESC").arg(_log); } QSqlQuery query(stringQuery); while (query.next()) { if (query.isValid()){ bands << query.value(0).toString(); } } return bands; } QStringList DataProxy_SQLite::getModesInLog(const int _log) { //qDebug() << "DataProxy_SQLite::getModesInLog: " << endl; QStringList modes = QStringList(); QString stringQuery = QString(); if (_log <=0 ) { stringQuery = QString("SELECT mode.id, mode.submode, COUNT (mode.submode) FROM log, mode WHERE mode.id = log.modeid GROUP BY mode.submode ORDER BY count (mode.submode) DESC"); } else { stringQuery = QString("SELECT mode.id, mode.submode, COUNT (mode.submode) FROM log, mode WHERE mode.id = log.modeid AND log.lognumber='%1' GROUP BY mode.submode ORDER BY count (mode.submode) DESC").arg(_log); } QSqlQuery query(stringQuery); while (query.next()) { if (query.isValid()){ modes << query.value(1).toString(); } } //qDebug() << "DataProxy_SQLite::getModesInLog: " << modes.join(" - ") << endl; return modes; } int DataProxy_SQLite::getLastQSOid() { //qDebug() << "DataProxy_SQLite::getLastQSOid" << endl; QSqlQuery query; if (query.exec("SELECT MAX(id) from log")) { query.next(); if (query.isValid()) { return (query.value(0)).toInt(); } else { return -1; } } else { return -1; } } bool DataProxy_SQLite::clearLog() { //qDebug() << "DataProxy_SQLite::clearLog" << endl; int errorCode = 0; QSqlQuery query; if (query.exec("DELETE FROM log")) { //qDebug() << "DataProxy_SQLite::clearLog: Log deleted!" << endl; } else { //qDebug() << "DataProxy_SQLite::clearLog: Log deleted FAILED" << endl; errorCode = query.lastError().number(); //qDebug() << "DataProxy_SQLite::clearLog - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-n: " << QString::number(query.lastError().number() ) << endl; } if (query.exec("DELETE FROM awarddxcc")) { //qDebug() << "DataProxy_SQLite::clearLog: Awarddxcc deleted!" << endl; } else { //qDebug() << "DataProxy_SQLite::clearLog: Awarddxcc deletedFAILED" << endl; errorCode = query.lastError().number(); //qDebug() << "DataProxy_SQLite::clearLog - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-n: " << QString::number(query.lastError().number() ) << endl; } if (query.exec("DELETE FROM awardwaz")) { //qDebug() << "DataProxy_SQLite::clearLog: Awardwaz deleted!" << endl; } else { //qDebug() << "DataProxy_SQLite::clearLog: Awardwaz deleted FAILED" << endl; errorCode = query.lastError().number(); //qDebug() << "DataProxy_SQLite::clearLog - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-n: " << QString::number(query.lastError().number() ) << endl; } query.finish(); //query.clear(); if (query.isActive()) { //qDebug() << "DataProxy_SQLite::clearLog: Query Active!" << endl; return false; } else { query.prepare("VACUUM;"); //qDebug() << "DataProxy_SQLite::clearLog: Query Not Active!" << endl; if (query.exec()) { //qDebug() << "DataProxy_SQLite::clearLog: VACUUM OK!" << endl; return true; } else { //qDebug() << "DataProxy_SQLite::clearLog: VACUUM FAILED" << endl; errorCode = query.lastError().number(); //qDebug() << "DataProxy_SQLite::clearLog - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "DataProxy_SQLite::clearLog: LastError-n: " << QString::number(query.lastError().number() ) << endl; } } return false; } bool DataProxy_SQLite::qslSentViaDirect(const int _qsoId, const QString _updateDate) { //qDebug() << "DataProxy_SQLite::qslSentViaDirect" << endl; QSqlQuery query; QString stringQuery; stringQuery = QString("UPDATE log SET qsl_sent = 'Y', qsl_sent_via = 'D', qslsdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); //QDebug() << "DataProxy_SQLite::qslSentViaDirect: " << stringQuery << endl; if (query.exec(stringQuery)) { return true; } return false; } bool DataProxy_SQLite::qslSentViaBureau(const int _qsoId, const QString _updateDate) { //qDebug() << "DataProxy_SQLite::qslSentViaBureau" << endl; QSqlQuery query; QString stringQuery; stringQuery = QString("UPDATE log SET qsl_sent = 'Y', qsl_sent_via = 'B', qslsdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); if (query.exec(stringQuery)) { return true; } return false; } bool DataProxy_SQLite::qslRecViaBureau(const int _qsoId, const QString _updateDate) { //qDebug() << "DataProxy_SQLite::" << QString::number (_qsoId) << "/" << _updateDate << endl; QSqlQuery query; QString stringQuery; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); if (query.exec(stringQuery)) { //qDebug() << "DataProxy_SQLite:: TRUE" << endl; return true; } //qDebug() << "DataProxy_SQLite:: FALSE" << endl; return false; } bool DataProxy_SQLite::qslRecViaBureau(const int _qsoId, const QString _updateDate, const bool _queueSentQSL) { //qDebug() << "DataProxy_SQLite::qslRecViaBureau: " << _updateDate << endl; QSqlQuery query; QString stringQuery; bool requestQSL = false; if (_queueSentQSL) { stringQuery = QString("SELECT qsl_sent FROM log WHERE id = '%1'").arg(_qsoId); if(query.exec(stringQuery)) { query.next(); if (query.isValid()) { stringQuery = (query.value(0)).toString(); if ((stringQuery == "Y") || (stringQuery == "R")) { // NO ACTION REQUIRED, QSL IS ALREADY SENT //qDebug() << "DataProxy_SQLite::qslRecViaBureau: QSL already requested" << endl; requestQSL = false; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); } else { //qDebug() << "DataProxy_SQLite::qslRecViaBureau: Request QSL-1" << endl; requestQSL = true; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); } } else { //qDebug() << "DataProxy_SQLite::qslRecViaBureau: Request QSL-2" << endl; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); requestQSL = true; } } else { //qDebug() << "DataProxy_SQLite::qslRecViaBureau: Request QSL-3" << endl; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); requestQSL = true; } } else { requestQSL = false; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); } //stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'B', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); if (query.exec(stringQuery)) { //qDebug() << "DataProxy_SQLite::qslRecViaBureau TRUE" << endl; return true; } //qDebug() << "DataProxy_SQLite::qslRecViaBureau FALSE" << endl; return false; } bool DataProxy_SQLite::qslRecViaDirect(const int _qsoId, const QString _updateDate) { //qDebug() << "DataProxy_SQLite::qslRecViaDirect" << endl; QSqlQuery query; QString stringQuery; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); if (query.exec(stringQuery)) { return true; } return false; } bool DataProxy_SQLite::qslRecViaDirect(const int _qsoId, const QString _updateDate, const bool _queueSentQSL) { //qDebug() << "DataProxy_SQLite::qslRecViaDirect: " << _updateDate << endl; QSqlQuery query; QString stringQuery; if (_queueSentQSL) { stringQuery = QString("SELECT qsl_sent FROM log WHERE id = '%1'").arg(_qsoId); if(query.exec(stringQuery)) { query.next(); if (query.isValid()) { stringQuery = (query.value(0)).toString(); if ((stringQuery == "Y") || (stringQuery == "R")) { // NO ACTION REQUIRED, QSL IS ALREADY SENT //qDebug() << "DataProxy_SQLite::qslRecViaDirect: QSL already requested" << endl; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); } else { //qDebug() << "DataProxy_SQLite::qslRecViaDirect: Request QSL-1" << endl; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); } } else { //qDebug() << "DataProxy_SQLite::qslRecViaDirect: Request QSL-2" << endl; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); } } else { //qDebug() << "DataProxy_SQLite::qslRecViaDirect: Request QSL-3" << endl; stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qsl_sent='R', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); } } else { stringQuery = QString("UPDATE log SET qsl_rcvd = 'Y', qsl_rcvd_via = 'D', qslrdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); } if (query.exec(stringQuery)) { //qDebug() << "DataProxy_SQLite::qslRecViaDirect TRUE" << endl; return true; } //qDebug() << "DataProxy_SQLite::qslRecViaDirect FALSE" << endl; return false; } bool DataProxy_SQLite::qslSentAsRequested(const int _qsoId, const QString _updateDate) { //TODO: Add some protection to the data before modifying //qDebug() << "DataProxy_SQLite::qslSentAsRequested" << endl; QSqlQuery query; QString stringQuery; stringQuery = QString("UPDATE log SET qsl_sent = 'R', qslsdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); //qDebug() << "DataProxy_SQLite::qslSentAsRequested: " << stringQuery << endl; if (query.exec(stringQuery)) { //qDebug() << "DataProxy_SQLite::qslSentAsRequested" << endl; return true; } return false; } bool DataProxy_SQLite::qslRecAsRequested(const int _qsoId, const QString _updateDate) { //TODO: Add some protection to the data before modifying //qDebug() << "DataProxy_SQLite::qslRecAsRequested" << endl; QSqlQuery query; QString stringQuery; stringQuery = QString("UPDATE log SET qsl_rcvd = 'R', qslsdate = '%1' WHERE id = '%2'").arg(_updateDate).arg(_qsoId); //qDebug() << "DataProxy_SQLite::qslRecAsRequested: " << stringQuery << endl; if (query.exec(stringQuery)) { //qDebug() << "DataProxy_SQLite::qslRecAsRequested" << endl; return true; } return false; } bool DataProxy_SQLite::setClubLogSent(const int _qsoId, const QString _st, const QString _updateDate) { // Updates the QSO with the ClubLog status & date QSqlQuery query; QString stringQuery; stringQuery = QString("UPDATE log SET clublog_qso_upload_status = '%1', clublog_qso_upload_date = '%2' WHERE id = '%3'").arg(_st).arg(_updateDate).arg(_qsoId); //qDebug() << "DataProxy_SQLite::setClubLogSent: " << stringQuery << endl; if (query.exec(stringQuery)) { //qDebug() << "DataProxy_SQLite::setClubLogSent - TRUE" << endl; return true; } //qDebug() << "DataProxy_SQLite::setClubLogSent - FALSE" << endl; return false; } bool DataProxy_SQLite::isQSLReceived(const int _qsoId) { //qDebug() << "DataProxy_SQLite::isQSLReceived" << QString::number(_qsoId) << endl; QSqlQuery query; QString stringQuery; stringQuery = QString("SELECT qsl_rcvd FROM log WHERE id = '%1'").arg(_qsoId); query.exec(stringQuery); query.next(); if (query.isValid()) { stringQuery = (query.value(0)).toString(); if (stringQuery == "Y") { //qDebug() << "DataProxy_SQLitew::isQSLReceived: " << QString::number(_qsoId) << "QSL Received" << endl; return true; } else { //qDebug() << "DataProxy_SQLite::isQSLReceived: " << QString::number(_qsoId) << "QSL NOT Received-1" << endl; return false; } } else { //qDebug() << "DataProxy_SQLite::isQSLReceived: " << QString::number(_qsoId) << "QSL NOT Received-2" << endl; return false; } } bool DataProxy_SQLite::isQSLSent(const int _qsoId) { //qDebug() << "DataProxy_SQLite::isQSLSent: " << QString::number(_qsoId) << endl; QSqlQuery query; QString stringQuery; stringQuery = QString("SELECT qsl_sent FROM log WHERE id = '%1'").arg(_qsoId); query.exec(stringQuery); query.next(); if (query.isValid()) { stringQuery = (query.value(0)).toString(); if (stringQuery == "Y") { //qDebug() << "DataProxy_SQLite::isQSLSent: " << QString::number(_qsoId) << "QSL Sent" << endl; return true; } else { //qDebug() << "DataProxy_SQLite::isQSLSent: " << QString::number(_qsoId) << "QSL NOT Sent-1" << endl; return false; } } else { //qDebug() << "DataProxy_SQLite::isQSLSent: " << QString::number(_qsoId) << "QSL NOT Sent-2" << endl; return false; } } QString DataProxy_SQLite::getCallFromId(const int _qsoId) { //qDebug() << "DataProxy_SQLite::getCallFromId" << endl; QSqlQuery query; QString stringQuery = QString("SELECT call FROM log WHERE id='%1'").arg(_qsoId); query.exec(stringQuery); query.next(); if (query.isValid()) { return (query.value(0)).toString(); } else { return ""; } } QStringList DataProxy_SQLite::getClubLogRealTimeFromId(const int _qsoId) { //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: " << QString::number(_qsoId) << endl; /* Return a QStringList with 16 fields with these data: QSO_DATE, TIME_ON, QSLRDATE, QSLSDATE, CALL, OPERATOR, MODE, BAND, BAND_RX, FREQ, QSL_RCVD, LOTW_QSL_RCVD, QSL_SENT, DXCC, PROP_MODE, CREDIT_GRANTED */ QSqlQuery query; int nameCol = -1; QStringList dataC = QStringList(); QString aux1 = QString(); QString aux2 = QString(); QString call = QString(); // IMPORTANT: band_rx is not always present, and if it is not present, the query with INNER JOIN will fail. // To fix that we will do two queries, one to check if I have all the data and if not another one with a reduced scope. QString stringQuery = QString("SELECT qso_date, time_on, qslrdate, qslsdate, call, station_callsign, operator, M.name, B.name, R.name, freq, qsl_rcvd, lotw_qsl_rcvd, qsl_sent, dxcc, prop_mode, credit_granted FROM log INNER JOIN band as B ON bandid = B.id INNER JOIN band as R ON band_rx = R.id INNER JOIN mode as M ON modeid = M.id WHERE log.id='%1'").arg(_qsoId); bool sqlOk = query.exec(stringQuery); if (!sqlOk) { //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: LastError-n: " << QString::number(query.lastError().number() ) << endl; } dataC << QString::number(_qsoId); QSqlRecord rec = query.record(); if (sqlOk) { //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId sqlOK" << endl; if (query.next()) //if (1) { if (query.isValid()) { nameCol = rec.indexOf("qso_date"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("time_on"); //aux = (query.value(nameCol)).toString(); aux1 = checkAndFixASCIIinADIF(aux1); //aux1 = checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile-time_on: " << aux1 << endl; aux1 = (query.value(nameCol)).toString(); //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId time: " << aux1 << endl; if ( ((aux1.length()) == 5) || ((aux1.length()) == 8) ){ aux1.remove(QChar(':'), Qt::CaseInsensitive); dataC << aux1; //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId time1.5: " << aux1 << endl; } //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId time2: " << aux1 << endl; dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("qslrdate"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("qslsdate"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("call"); call = (query.value(nameCol)).toString(); dataC << call; nameCol = rec.indexOf("operator"); dataC << (query.value(nameCol)).toString(); //nameCol = rec.indexOf("M.name"); //TODO: Fix this to get the proper column dataC << (query.value(7)).toString(); //nameCol = rec.indexOf("B.name"); dataC << (query.value(8)).toString(); //TODO: Fix this to get the proper column //nameCol = rec.indexOf("R.name"); //TODO: Fix this to get the proper column (use an index instead of a number) dataC << (query.value(9)).toString(); nameCol = rec.indexOf("freq"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("qsl_rcvd"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("lotw_qsl_rcvd"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("qsl_sent"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("dxcc"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("prop_mode"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("credit_granted"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("station_callsign"); aux2 = (query.value(nameCol)).toString(); if (aux2.length()>2) { dataC << aux2; } else { dataC << call; } //dataC << (query.value(nameCol)).toString(); //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: RETURNING ... OK" << endl; return dataC; } else { //NO VALID //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId NO VALID NOT OK" << endl; return QStringList(); } } else { QString stringQuery = QString("SELECT qso_date, time_on, qslrdate, qslsdate, call, station_callsign, operator, M.name, B.name, freq, qsl_rcvd, lotw_qsl_rcvd, qsl_sent, dxcc, prop_mode, credit_granted FROM log INNER JOIN band as B ON bandid = B.id INNER JOIN mode as M ON modeid = M.id WHERE log.id='%1'").arg(_qsoId); //QString stringQuery = QString("SELECT qso_date, time_on, qslrdate, qslsdate, call, operator, M.name, B.name, freq, qsl_rcvd, lotw_qsl_rcvd, qsl_sent, dxcc, prop_mode, credit_granted FROM log INNER JOIN band as B ON bandid = B.id INNER JOIN mode as M ON modeid = M.id WHERE log.id='%1'").arg(_qsoId); //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId NO NEXT NOT OK" << endl; call = QString(); sqlOk = query.exec(stringQuery); rec = query.record(); if (sqlOk) { //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId OK2" << endl; if (query.next()) { //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId NEXT OK2" << endl; if (query.isValid()) { nameCol = rec.indexOf("qso_date"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("time_on"); aux1 = (query.value(nameCol)).toString(); //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId time2-1: " << aux1 << endl; if ( ((aux1.length()) == 5) || ((aux1.length()) == 8) ){ aux1.remove(QChar(':'), Qt::CaseInsensitive); dataC << aux1; //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId time2-1.5: " << aux1 << endl; } //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId time2-2: " << aux1 << endl; //dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("qslrdate"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("qslsdate"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("call"); call = (query.value(nameCol)).toString(); dataC << call; nameCol = rec.indexOf("operator"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("M.name"); //TODO: Fix this to get the proper column dataC << (query.value(7)).toString(); nameCol = rec.indexOf("B.name"); dataC << (query.value(8)).toString(); //TODO: Fix this to get the proper column //nameCol = rec.indexOf("band_rx"); //TODO: Fix this to get the proper column (use an index instead of a number) dataC << ""; nameCol = rec.indexOf("freq"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("qsl_rcvd"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("lotw_qsl_rcvd"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("qsl_sent"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("dxcc"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("prop_mode"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("credit_granted"); dataC << (query.value(nameCol)).toString(); aux2 = QString(); nameCol = rec.indexOf("station_callsign"); aux2 = (query.value(nameCol)).toString(); if (aux2.length()>2) { dataC << aux2; } else { dataC << call; } //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: RETURNING ... OK" << endl; return dataC; } else { //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId NO VALID NOT OK2" << endl; return QStringList(); } } else { //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId NO NEXT NOT OK2" << endl; return QStringList(); } } else { //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId NOT OK2" << endl; return QStringList(); } return QStringList(); // NO NEXT } } else { //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId NOT sqlOK" << endl; //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: 2 LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: 2 LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: 2 LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId: 2 LastError-n: " << QString::number(query.lastError().number() ) << endl; return QStringList(); } //qDebug() << "DataProxy_SQLite::getClubLogRealTimeFromId END NOT OK" << endl; return QStringList(); } QString DataProxy_SQLite::getNameFromQRZ(const QString _call) { if (_call.length() <= 0) { //qDebug() << "DataProxy_SQLite::getNameFromQRZ return 0" << endl; return QString(); } QSqlQuery query; QString queryString = QString("SELECT name FROM log WHERE call='%0'").arg(_call); bool sqlOk = query.exec(queryString); if (sqlOk) { while (query.next()) { if (query.isValid()) { if (((query.value(0)).toString()).length()>0) { //qDebug() << "DataProxy_SQLite::getNameFromQRZ: " << (query.value(0)).toString() << endl; return (query.value(0)).toString(); } } } return QString(); } else { return QString(); } } QString DataProxy_SQLite::getQTHFromQRZ(const QString _call) { if (_call.length() <= 0) { return QString(); } QSqlQuery query; QString queryString = QString("SELECT qth FROM log WHERE call='%0'").arg(_call); bool sqlOk = query.exec(queryString); if (sqlOk) { while (query.next()) { if (query.isValid()) { if (((query.value(0)).toString()).length()>0) { return (query.value(0)).toString(); } } } return QString(); } else { return QString(); } } QString DataProxy_SQLite::getLocatorFromQRZ(const QString _call) { if (_call.length() <= 0) { return QString(); } QSqlQuery query; QString queryString = QString("SELECT gridsquare FROM log WHERE call='%0'").arg(_call); bool sqlOk = query.exec(queryString); if (sqlOk) { while (query.next()) { if (query.isValid()) { if (((query.value(0)).toString()).length()>0) { return (query.value(0)).toString(); } } } return QString(); } else { return QString(); } } QString DataProxy_SQLite::getIOTAFromQRZ(const QString _call) { if (_call.length() <= 0) { return QString(); } QSqlQuery query; QString queryString = QString("SELECT iota FROM log WHERE call='%0'").arg(_call); bool sqlOk = query.exec(queryString); if (sqlOk) { while (query.next()) { if (query.isValid()) { if (((query.value(0)).toString()).length()>0) { return (query.value(0)).toString(); } } } return QString(); } else { return QString(); } } QString DataProxy_SQLite::getQSLViaFromQRZ(const QString _call) { if (_call.length() <= 0) { return QString(); } QSqlQuery query; QString queryString = QString("SELECT DISTINCT qsl_via FROM log WHERE call='%0'").arg(_call); bool sqlOk = query.exec(queryString); if (sqlOk) { while (query.next()) { if (query.isValid()) { if (((query.value(0)).toString()).length()>0) { return (query.value(0)).toString(); } } } return QString(); } else { return QString(); } } bool DataProxy_SQLite::deleteQSO(const int _qsoId) { //qDebug() << "DataProxy_SQLite::deleteQSO" << endl; QSqlQuery query; QString stringQuery = QString("DELETE FROM log WHERE id='%1'").arg(_qsoId); return query.exec(stringQuery); } int DataProxy_SQLite::isWorkedB4(const QString _qrz, const int _currentLog) { //qDebug() << "DataProxy_SQLite::isWorkedB4" << endl; QSqlQuery query; QString queryString; if (_currentLog < 0) { queryString = QString("SELECT id FROM log WHERE call='%1'").arg(_qrz); } else { queryString = QString("SELECT id FROM log WHERE call='%1' AND lognumber='%2'").arg(_qrz).arg(_currentLog); } query.exec(queryString); query.next(); if (query.isValid()) { return (query.value(0)).toInt(); } else { return -1; } } 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; QString queryString = QString("SELECT confirmed from awarddxcc WHERE dxcc='%1' AND lognumber='%2'").arg(_dxcc).arg(_currentLog); QSqlQuery query; if (query.exec (queryString)) { query.next(); if (query.isValid()) { if ( (query.value(0)).toInt() == 1) { //qDebug() << "DataProxy_SQLite::isDXCCConfrmed: TRUE" << endl; return true; } else { //qDebug() << "DataProxy_SQLite::isDXCCConfrmed: FALSE1" << endl; return false; } } else { //qDebug() << "DataProxy_SQLite::isDXCCConfrmed: FALSE2" << endl; return false; } } else { //qDebug() << "DataProxy_SQLite::isDXCCConfrmed: FALSE3" << endl; return false; } //qDebug() << "DataProxy_SQLite::isDXCCConfrmed: FALSE4" << endl; return false; } bool DataProxy_SQLite::isHF(const int _band) { if ((_band>=18) && (_band<=27)) { //qDebug() << "DataProxy_SQLite::isHF: TRUE" << endl; return true; } else { //qDebug() << "DataProxy_SQLite::isHF: FALSE" << endl; return false; } } bool DataProxy_SQLite::isWARC(const int _band) { if ((_band == 19) || (_band==21) ||(_band==23) ) { //qDebug() << "DataProxy_SQLite::isWARC: tRUE" << endl; return true; } else { //qDebug() << "DataProxy_SQLite::isWARC: FALSE" << endl; return false; } } bool DataProxy_SQLite::isVHF(const int _band) { if (_band<=17) { //qDebug() << "DataProxy_SQLite::isVHF: TRUE" << endl; return true; } else { //qDebug() << "DataProxy_SQLite::isVHF: FALSE" << endl; return false; } } QStringList DataProxy_SQLite::getOperatingYears(const int _currentLog) { //qDebug() << "DataProxy_SQLite::getYearsOperating: " << QString::number(_currentLog) << endl; QStringList years = QStringList(); QSqlQuery query; QString queryString = QString("SELECT DISTINCT (substr (qso_date, 0, 5)) FROM log WHERE lognumber='%0'").arg(_currentLog); QString year = QString(); bool sqlOk = query.exec(queryString); if (sqlOk) { //qDebug() << "DataProxy_SQLite::getYearsOperating: sqlOk = true" << endl; while (query.next()) { if (query.isValid()) { year = (query.value(0)).toString(); years << year; year.clear(); } } //qDebug() << "DataProxy_SQLite::getYearsOperating: END OK - " << QString::number(years.size())<< endl; return years; //return years.sort(); } else { //qDebug() << "DataProxy_SQLite::getYearsOperating: sqlOk = false" << endl; return years; } } void DataProxy_SQLite::compressDB() { db->compress(); } int DataProxy_SQLite::getDXCConYear(const int _year, const int _logNumber) { //qDebug() << "DataProxy_SQLite::getDXCConYear: " << QString::number(_year) << "/" << QString::number(_logNumber) << endl; QSqlQuery query; QString stringQuery; bool sqlOK; stringQuery = QString("SELECT count (dxcc) from (SELECT DISTINCT dxcc FROM log WHERE lognumber='%0' AND qso_date LIKE '%%1%' AND dxcc <>'')").arg(_logNumber).arg(_year); sqlOK = query.exec(stringQuery); //qDebug() << "DataProxy_SQLite::getDXCConYear: stringQuery: " << stringQuery << endl; if (sqlOK) { query.next(); if (query.isValid()) { //qDebug() << "DataProxy_SQLite::getDXCConYear: " << QString::number((query.value(0)).toInt()) << endl; return (query.value(0)).toInt(); } else { //qDebug() << "DataProxy_SQLite::getDXCConYear: 0" << endl; return 0; } } else { //qDebug() << "DataProxy_SQLite::getDXCConYear: Query error" << endl; return 0; } } int DataProxy_SQLite::getCQzonYear(const int _year, const int _logNumber) { //qDebug() << "DataProxy_SQLite::getCQzonYear: " << QString::number(_year) << endl; QSqlQuery query; QString stringQuery; bool sqlOK; stringQuery = QString("SELECT count (cqz) from (SELECT DISTINCT cqz FROM log WHERE lognumber='%0' AND qso_date LIKE '%%1%' AND cqz <>'')").arg(_logNumber).arg(_year); sqlOK = query.exec(stringQuery); //qDebug() << "DataProxy_SQLite::getCQzonYear: stringQuery: " << stringQuery << endl; if (sqlOK) { query.next(); if (query.isValid()) { //qDebug() << "DataProxy_SQLite::getCQzonYear: " << QString::number((query.value(0)).toInt()) << endl; return (query.value(0)).toInt(); } else { //qDebug() << "DataProxy_SQLite::getCQzonYear: 0" << endl; return 0; } } else { //qDebug() << "DataProxy_SQLite::getCQzonYear: Query error" << endl; return 0; } } bool DataProxy_SQLite::newDXMarathon(const int _dxcc, const int _cq, const int _year, const int _logNumber) { //qDebug() << "DataProxy_SQLite::newDXMarathon" << endl; QSqlQuery query; QString stringQuery; bool sqlOK; bool existingDXCC = false; bool existingCQz = false; stringQuery = QString("SELECT dxcc, cqz FROM log WHERE (lognumber='%1' AND qso_date LIKE'%%2%') AND (dxcc ='%3' OR cqz ='%4')").arg(_logNumber).arg(_year).arg(_dxcc).arg(_cq); sqlOK = query.exec(stringQuery); if (sqlOK) { while(query.next()) { if (query.isValid()) { if ( (query.value(0)).toInt() == _dxcc) { //qDebug() << "DataProxy_SQLite::newDXMarathon - Existing DXCC" << endl; existingDXCC = true; } if ( (query.value(1)).toInt() == _cq) { //qDebug() << "DataProxy_SQLite::newDXMarathon - Existing CQz" << endl; existingCQz = true; } } } if (existingDXCC && existingCQz) { //qDebug() << "DataProxy_SQLite::newDXMarathon - FALSE" << endl; return false; } else { //qDebug() << "DataProxy_SQLite::newDXMarathon - TRUE1" << endl; return true; } } else { //qDebug() << "DataProxy_SQLite::newDXMarathon - TRUE2" << endl; return true; // It is an error inthe query but Work First Worry Later, let us work that QSO. } //qDebug() << "DataProxy_SQLite::newDXMarathon - TRUE3" << endl; return true; } QStringList DataProxy_SQLite::getContestNames() { //qDebug() << "DataProxy_SQLite::getContestNames() " << endl; QStringList contests = QStringList(); QSqlQuery query; QString stringQuery; bool sqlOK; stringQuery = QString("SELECT DISTINCT name from supportedcontests ORDER BY id ASC"); sqlOK = query.exec(stringQuery); if (sqlOK) { while(query.next()) { if (query.isValid()) { stringQuery = (query.value(0)).toString(); //qDebug() << "DataProxy_SQLite::getContestNames: " << stringQuery << endl; contests.append(stringQuery); } else { return QStringList(); } } return contests; } else { return QStringList(); } return QStringList(); } QStringList DataProxy_SQLite::getContestCat(const int _catn) { QStringList contests = QStringList(); QSqlQuery query; QString stringQuery; bool sqlOK; switch (_catn) { case 1: stringQuery = QString("SELECT DISTINCT name from contestcatoperator ORDER BY id ASC"); break; case 2: stringQuery = QString("SELECT DISTINCT name from contestcatassisted ORDER BY id ASC"); break; case 3: stringQuery = QString("SELECT DISTINCT name from contestcatpower ORDER BY id ASC"); break; case 4: stringQuery = QString("SELECT DISTINCT name from contestcatband ORDER BY id ASC"); break; case 5: stringQuery = QString("SELECT DISTINCT name from contestcatoverlay ORDER BY id ASC"); break; case 6: stringQuery = QString("SELECT DISTINCT name from contestcatmode ORDER BY id ASC"); break; default: return QStringList(); break; } sqlOK = query.exec(stringQuery); if (sqlOK) { while(query.next()) { if (query.isValid()) { stringQuery = (query.value(0)).toString(); contests.append(stringQuery); } else { return QStringList(); } } return contests; } else { return QStringList(); } return QStringList(); } QStringList DataProxy_SQLite::getContestOverlays() { //qDebug() << "DataProxy_SQLite::getContestOverlays: "<< endl; QStringList contests = QStringList(); QSqlQuery query; QString stringQuery; bool sqlOK; stringQuery = QString("SELECT DISTINCT name from contestcatoverlay ORDER BY id ASC"); sqlOK = query.exec(stringQuery); if (sqlOK) { while(query.next()) { if (query.isValid()) { stringQuery = (query.value(0)).toString(); //qDebug() << "DataProxy_SQLite::getContestOverlays: " << stringQuery << endl; contests.append(stringQuery); } else { return QStringList(); } } return contests; } else { return QStringList(); } return QStringList(); } QStringList DataProxy_SQLite::getBandNames() { QStringList bands = QStringList(); QSqlQuery query; QString stringQuery; bool sqlOK; stringQuery = QString("SELECT DISTINCT name from band"); sqlOK = query.exec(stringQuery); if (sqlOK) { while(query.next()) { if (query.isValid()) { stringQuery = (query.value(0)).toString(); bands.append(stringQuery); } else { return QStringList(); } } return bands; } else { return QStringList(); } } QStringList DataProxy_SQLite::getPropModeList() { //qDebug() << "DataProxy_SQLite::getPropModeLists" << endl; QString aux = QString(); QStringList qs; qs.clear(); QString stringQuery = QString("SELECT id, shortname, name FROM prop_mode_enumeration"); 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(); qs << aux; } else { } } } else { return QStringList(); } return qs; } QStringList DataProxy_SQLite::getValidCatOptions(const int _currentCat, const int _lowerCat) { //qDebug() << "DataProxy_SQLite::getContestNames: " << QString::number(_currentCat) <<"/" << QString::number(_lowerCat) << endl; QStringList contests = QStringList(); QSqlQuery query; QString stringQuery; bool sqlOK; switch (_currentCat) { case 0: stringQuery = QString("SELECT DISTINCT contestcatoperator.name FROM contestcatoperator JOIN contest ON contest.catoperator=contestcatoperator.id WHERE contest.contest='%1' ORDER BY contestcatoperator.id").arg(_lowerCat); break; case 1: stringQuery = QString("SELECT DISTINCT contestcatassisted.name FROM contestcatassisted JOIN contest ON contest.catassisted=contestcatassisted.id WHERE contest.catoperator='1' ORDER BY contestcatassisted.id").arg(_lowerCat); break; case 2: stringQuery = QString("SELECT DISTINCT contestcatpower.name FROM contestcatpower JOIN contest ON contest.catpower=contestcatpower.id WHERE contest.catoperator='1' ORDER BY contestcatpower.id").arg(_lowerCat); break; case 3: stringQuery = QString("SELECT DISTINCT contestcatband.name FROM contestcatband JOIN contest ON contest.catband=contestcatband.id WHERE contest.catoperator='1' ORDER BY contestcatband.id").arg(_lowerCat); break; case 4: stringQuery = QString("SELECT DISTINCT contestcatoverlay.name FROM contestcatoverlay JOIN contest ON contest.catoverlay=contestcatoverlay.id WHERE contest.catoperator='1' ORDER BY contestcatoverlay.id").arg(_lowerCat); break; case 5: stringQuery = QString("SELECT DISTINCT contestcatmode.name FROM contestcatmode JOIN contest ON contest.catmode=contestcatmode.id WHERE contest.catoperator='1' ORDER BY contestcatmode.id").arg(_lowerCat); break; default: return QStringList(); break; } sqlOK = query.exec(stringQuery); if (sqlOK) { while(query.next()) { if (query.isValid()) { stringQuery = (query.value(0)).toString(); contests.append(stringQuery); } else { return QStringList(); } } return contests; } else { return QStringList(); } } bool DataProxy_SQLite::haveAtLeastOneLog() { //qDebug() << "DataProxy_SQLite::haveAtLeastOneLog()" << endl; QSqlQuery query; if (query.exec("SELECT COUNT(id) from logs")) { query.next(); if (query.isValid()) { if((query.value(0)).toInt()>0) { return true; } else { return false; } } else { return false; } } else { return false; } return false; } int DataProxy_SQLite::getNumberOfManagedLogs() { //qDebug() << "DataProxy_SQLite::getNumberOfManagedLogs" << endl; QSqlQuery query; if (query.exec("SELECT COUNT (*) from logs")) { query.next(); if (query.isValid()) { return (query.value(0)).toInt(); } else { return -1; } } else { 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; QSqlQuery query; QString st = QString("SELECT stationcall FROM logs WHERE id='%1'").arg(_log); if (query.exec(st)) { query.next(); if (query.isValid()) { //qDebug() << "DataProxy_SQLite::getStationCallSignFromLog: " << (query.value(0)).toString() << endl; return (query.value(0)).toString(); } else { //qDebug() << "DataProxy_SQLite::getStationCallSignFromLog: Not valid" << endl; return QString(); } } else { //qDebug() << "DataProxy_SQLite::getStationCallSignFromLog: query failed" << endl; return QString(); } //qDebug() << "DataProxy_SQLite::getStationCallSignFromLog: END" << endl; return QString(); } int DataProxy_SQLite::getContestTypeN(const int _co, const int _catop, const int _catas, const int _catpo, const int _catba, const int _catov, const int _catmo) {//typeContestSelected, contestCatOperators, contestCatAssisted, contestCatPower, contestCatBands, contestCatOverlay, contestCatMode //qDebug() << "DataProxy_SQLite::getContestTypeN: " << endl; QSqlQuery query; QString st = QString("SELECT id FROM contest WHERE contest='%1' AND catoperator='%2' AND catassisted='%3' AND catpower='%4' AND catoverlay='%5' AND catmode='%6' AND catband='%7'").arg(_co).arg(_catop).arg(_catas).arg(_catpo).arg(_catov).arg(_catmo).arg(_catba); //qDebug() << "DataProxy_SQLite::getContestTypeN: " << st << endl; if (query.exec(st)) { //qDebug() << "DataProxy_SQLite::getContestTypeN: (OK) LastQuery: " << query.lastQuery() << endl; query.next(); if (query.isValid()) { //qDebug() << "DataProxy_SQLite::getContestTypeN: " << (query.value(0)).toString() << endl; return (query.value(0)).toInt(); } else { //qDebug() << "DataProxy_SQLite::getContestTypeN: Not valid (-1)" << endl; return -1; } } else { //qDebug() << "DataProxy_SQLite::getContestTypeN: (ERROR) LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataProxy_SQLite::getContestTypeN: query failed (-1)" << endl; return -1; } //qDebug() << "DataProxy_SQLite::getContestTypeN: END (-1)" << endl; return -1; } QStringList DataProxy_SQLite::getDataFromContestType(const int _n) { //qDebug() << "DataProxy_SQLite::getDataFromContestType - n: " << QString::number(_n) << endl; QStringList dataC = QStringList(); QSqlQuery query, query1; QString stringQuery; int nameCol = -1; bool sqlOK; stringQuery = QString("SELECT supportedcontests.name, contest.contest, contest.catoperator, contest.catassisted, contest.catpower, contest.catoverlay, contest.catmode, contest.catband FROM supportedcontests JOIN contest ON contest.contest=supportedcontests.id WHERE contest.id='%1'").arg(_n); sqlOK = query.exec(stringQuery); //qDebug() << "DataProxy_SQLite::getDataFromContestType: LastQuery: " << query.lastQuery() << endl; QSqlRecord rec = query.record(); if (sqlOK) { //qDebug() << "DataProxy_SQLite::getDataFromContestType: Query OK" << endl; if(query.next()) { //qDebug() << "DataProxy_SQLite::getDataFromContestType: Query Next" << endl; if (query.isValid()) { //qDebug() << "DataProxy_SQLite::getDataFromContestType: Query Valid" << endl; //qDebug() << "DataProxy_SQLite::getDataFromContestType:-1 " << endl; nameCol = rec.indexOf("contest"); dataC << (query.value(nameCol)).toString(); //qDebug() << "DataProxy_SQLite::getDataFromContestType: -2" << endl; nameCol = rec.indexOf("catoperator"); dataC << (query.value(nameCol)).toString(); //qDebug() << "DataProxy_SQLite::getDataFromContestType: -3" << endl; nameCol = rec.indexOf("catassisted"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("catpower"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("catoverlay"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("catmode"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("name"); dataC << (query.value(nameCol)).toString(); nameCol = rec.indexOf("catband"); dataC << (query.value(nameCol)).toString(); return dataC; } else { //qDebug() << "DataProxy_SQLite::getDataFromContestType: Query value no valid" << endl; return QStringList(); } } else { //qDebug() << "DataProxy_SQLite::getDataFromContestType: No Next" << endl; return QStringList(); } return dataC; } else { //qDebug() << "DataProxy_SQLite::getDataFromContestType: Query not OK" << endl; return QStringList(); } } int DataProxy_SQLite::getHowManyQSOInLog(const int _log) { QSqlQuery query; QString aux; aux = QString("SELECT count(id) FROM log WHERE lognumber='%1'").arg(_log); if (query.exec(aux)) { query.next(); if (query.isValid()) { return (query.value(0)).toInt(); } else { return 0; } } else { 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; } 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; } klog-0.9.2.2/NEWS0000644000076700000620000000007612627126144011273 0ustar staffLook at http://jaime.robles.es/category/klog/ for NEWS of KLogklog-0.9.2.2/setuppagedxcluster.h0000644000076700000620000000741312627126144014702 0ustar staff#ifndef SETUPPAGEDXCLUSTER_H #define SETUPPAGEDXCLUSTER_H /*************************************************************************** setuppagedxcluster.h - description ------------------- begin : nov 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include //#include //#include //#include #include class SetupPageDxCluster : public QWidget { Q_OBJECT public: SetupPageDxCluster(QWidget *parent=0); ~SetupPageDxCluster(); QStringList getDxclusterServersComboBox(); void setDxclusterServersComboBox(const QStringList t); QString getSelectedDxClusterServer(); void setSelectedDxClusterServer(const QString t); QString getShowHFRadiobutton(); QString getShowVHFRadiobutton(); QString getShowWARCRadiobutton(); QString getShowWorkedRadiobutton(); QString getShowConfirmedRadiobutton(); QString getShowANNRadiobutton(); QString getShowWWVRadiobutton(); QString getShowWCYRadiobutton(); void setShowHFRadiobutton(const QString t); void setShowVHFRadiobutton(const QString t); void setShowWARCRadiobutton(const QString t); void setShowWorkedRadiobutton(const QString t); void setShowConfirmedRadiobutton(const QString t); void setShowANNRadiobutton(const QString t); void setShowWWVRadiobutton(const QString t); void setShowWCYRadiobutton(const QString t); private slots: void slotAddButtonClicked(); void slotDeleteButtonClicked(); private: void createActions(); bool checkIfValidDXCluster (const QString &tdxcluster); bool checkIfNewDXCluster (const QString &tdxcluster); QComboBox *dxclusterServersComboBox; QPushButton *addClusterButton; QPushButton *deleteClusterButton; QRadioButton *showHFRadiobutton; QRadioButton *showVHFRadiobutton; QRadioButton *showWARCRadiobutton; QRadioButton *showWorkedRadiobutton; QRadioButton *showConfirmedRadiobutton; QRadioButton *showANNRadiobutton; QRadioButton *showWWVRadiobutton; QRadioButton *showWCYRadiobutton; QRadioButton *saveAllDXClusterDataRadiobutton; //QStringList dxClusterServers; }; #endif // SETUPPAGEDXCLUSTER_H klog-0.9.2.2/mainwindow.h0000644000076700000620000004401112627126144013116 0ustar staff#ifndef MAINWINDOW_H #define MAINWINDOW_H /*************************************************************************** mainwindow.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include #include #include #include #include #include #include "database.h" #include "setupdialog.h" #include "helpaboutdialog.h" #include "helphelpdialog.h" #include "world.h" #include "filemanager.h" #include "contest.h" #include "contest_cqwwdxssb.h" #include "dataproxy.h" #include "dataproxy_sqlite.h" #include "locator.h" #include "dxcluster.h" #include "awards.h" #include "mainwindowsattab.h" #include "elogclublog.h" #include "utilities.h" #include "downloadcty.h" class QTimer; class QDateTime; class QPushButton; class QLineEdit; class QComboBox; class QTimeEdit; class QDateEdit; //class QStatusBar; class QMenuBar; class QMenu; class QMessageBox; class QTextEdit; class QProgressDialog; class QPoint; class QGroupBox; class QTabWidget; class QFrame; class QTableView; class QLabel; enum { Log_Id = 0, Log_Name = 1, Log_BandId = 2, Log_ModeId = 3, Log_DateId = 4, Log_TimeId = 5 }; enum { NoContest = 0, CQ_WW_SSB = 1, CQ_WW_CW = 2, CQ_WPX_SSB = 3, CQ_WPX_CW = 4, CQ_WPX_RTTY = 5 }; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(const QString _kontestDir, const QString tversion); private slots: void slotQRZReturnPressed(); void slotQRZSpacePressed(); void slotQRZTextChanged(); void slotSRXTextChanged(); void slotSTXTextChanged(); void slotLocatorTextChanged(); void slotMyLocatorTextChanged(); void slotSearchBoxTextChanged(); void slotSearchExportButtonClicked(); void slotSearchBoxSelectAllButtonClicked(); void slotSearchClearButtonClicked(); void slotSearchBoxSelectionChanged(); void slotSearchBoxReSearchButtonClicked(); //void slotSearchBoxOnItemChanged( QTreeWidgetItem * item, int column); void slotModeComboBoxChanged(); void slotBandComboBoxChanged(); void slotIOTAComboBoxChanged(); void slotOperatingYearComboBoxChanged(); void slotOKButtonClicked(); void slotSpotItButtonClicked(); void slotClearButtonClicked(); void slotUpdateTime(); void slotLogWinShow(); void slotScoreWinShow(); void slotSetup(const int _page=0); void slotQsoDeleteFromLog(); void slotQSLSentViaBureauFromLog(); void slotQSLSentViaDirectFromLog(); void slotQSLRecViaDirectFromLog(); void slotQSLRecViaBureauFromLog(); void slotQSOToEditFromLog(); void slotQsoDeleteFromSearch(); void slotQSLSentViaBureauFromSearch(); void slotQSLSentViaDirectFromSearch(); void slotQSLSentViaDirectMarkDXReqFromSearch(); void slotQSLSentViaBureuMarkDXReqFromSearch(); void slotQSLRecViaDirectFromSearch(); void slotQSLRecViaBureauFromSearch(); void slotQSLRecViaDirectMarkReqFromSearch(); void slotQSLRecViaBureauMarkReqFromSearch(); void slotQSLSentMarkAsRequested(); void slotQSLRecMarkAsRequested(); void slotQSOToEditFromSearch(); void slotrstTXTextChanged(); void slotrstRXTextChanged(); void slotADIFExport(); void slotADIFExportAll(); void slotADIFImport(); void slotRQSLExport(); void slotCabrilloExport(); void slotQSLRecvComboBoxChanged(); void slotQSLSentComboBoxChanged(); void sloteQSLRecvComboBoxChanged(); void sloteQSLSentComboBoxChanged(); void slotQSLViaTextChanged(); void slotSetPropMode(const QString _p); void slotUpdateCTYDAT(); void slotWorldReload(); void slotToolSearchNeededQSLToSend(); void slotToolSearchRequestedQSLToSend(); void slotToolSearchNeededQSLPendingToReceive(); void slotToolSearchNeededQSLRequested(); void slotToolSearchQSL(const int actionQSL); void slotExitFromSlotDialog(const int exitID); //void slotDownloadFinished(QNetworkReply *reply); void fillQSOData(); void newFile(); void openFile(); bool saveFile(const QString _fileName); bool saveFileAs(); bool slotOpenKLogFolder(); void slotFilePrint(); //void slotFileClose(); void slotHelpHelpAction(); void slotHelpAboutAction(); void slotAboutQt(); // logpanel void slotRighButtonFromLog( const QPoint& pos); void slotDoubleClickLog( const QModelIndex & index); void slotDoubleClickSearch( QTreeWidgetItem* item, int); // Double click on a QSO in the search box void slotRecalculateAwardsButtonClicked(); //SEARCH void slotRighButtonSearch(const QPoint& pos); ///SEARCH // CLUSTER void slotAnalyzeDxClusterSignal(const QStringList _qs); // CLUSTER //CLUBLOG void slotElogClubLogShowMessage(const QString _s); void slotElogClubLogProcessAnswer(const int _i, const int _qID); void slotElogClubLogDisable(const bool _b); //CLUBLOG private: bool maybeSave(); //UPDATE CTY.DAT /* bool downloadCTYFile(); bool downloadCtyDatFile(); bool saveToDisk(const QString &filename, QIODevice *data); QString saveFileName(const QUrl &url); QNetworkAccessManager manager; QNetworkRequest request; */ // NEW DownLoadCTY *downloadcty; // void createStatusBar(); void createUI(); void createUICQWW(); void createUIDX(); //void createDXClusterUI(); void clearBandLabels(); void createMenusCommon(); void createMenusCQWW(); void createActionsCommon(); void createActionsCQWW(); void createActionsDX(); void createlogPanel(); void createlogModel(const int _i); void createScorePanel(); void createSearchResultsPanel(); void initialContestModeConfiguration(); void createKeyEvents(); void updateStatusBar(const QString statusm); bool readCtyFile(); void showMenuRightButtonFromLogCreateActions(); void righButtonFromLogMenu(const int trow); void showMenuRightButtonSearchCreateActions(); void righButtonSearchMenu(const int trow); void qslSentViaBureau(const int _qsoId); //void qslSentViaDirect(const int _qsoId); void qslRecViaBureau(const int _qsoId); void qslRecViaDirect(const int _qsoId); void qslRecViaBureauMarkReq(const int _qsoId); void qslRecViaDirectMarkReq(const int _qsoId); bool isQSLReceived(const int _qsoId); bool isQSLSent(const int _qsoId); bool validCharactersInCall(const QString _qrz); // Looks for SQLi and no valid chars in the QRZ QString readDataFromUI(); // Reads the QSO data from the UI and returns the SQL Query QString readDataFromUIDX(); QString readDataFromUIDXModifying(); int getDXCCFromComboBox(); QString getPropModeFromComboBox(); //QString readDataFromUICQWW(); void setAwardDXCC(const int _qsoId, bool modifying); // Adds or modify the status of a DXCC entity // data << dxcc(id) << band(id) << mode(id) << confirmed(0/1) << qsoid(id) << modify(0/1); int checkIfWorkedB4(const QString _qrz); bool checkContest(); void showStatusOfDXCC(const QStringList _qs); void showDXMarathonNeeded(const int _dxcc, const int _cqz, const int _year, const int _log); bool createConnection(); void createData(); bool processConfigLine(const QString _line); void readConfigData(); void defineStationCallsign(); void checkIfNewBandOrMode(); void readActiveBands (const QStringList actives); void readActiveModes (const QStringList actives); void qsoToEdit (const int _qso); void showInfoFromLocators(const QString _loc1, const QString _loc2); void clearInfoFromLocators(); void completeWithPreviousQSO(const QString _call); //void showQRZEntityInfo(const QString _qrz); 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); void updateQSLRecAndSent(); double checkFreqRanges(double _f); void selectCorrectComboBoxEntity(const int _ent); // Select the appropriate entity in the ComboBox //int Km2Mile(const bool _imperialSystemSelected, const bool _dataInMiles, const int _km); // CLUSTER void clusterSpotToLog(const QString _call, const QString _freq); QStringList dxclusterServersList; QString dxclusterServerToConnect; int dxclusterServerPort; // CLUSTER QWidget *mainWidget; QWidget *dxClusterTabWidget, *searchTabWidget; World *world; FileManager *filemanager; Locator *locator; Awards *awards; Utilities *util; //WorldEditorWidget *worldEditor; HelpHelpDialog *helpHelpDialog; HelpAboutDialog *helpAboutDialog; QPushButton *addButton; QLabel *distShortLabelN; QLabel *distLongLabelN; //QLabel distShortLabelN; //QLabel distLongLabelN; QSqlRelationalTableModel *logModel; QWidget *logPanel; QTableView *logView; QTreeWidget *searchResultsTreeWidget; QLabel *logLabel; QWidget *scoreWindow; //, dxWindow; QTextEdit *scoreTextEdit; // QGroupBox *gridGroupBox, *qrzgroupBox, *searchgroupBox; QFrame *dxUpLeftInputFrame;//, *dxUpRightOutputFrame; QLineEdit *qrzLineEdit, *nameLineEdit, *qthLineEdit, *locatorLineEdit; QComboBox *bandComboBox, *modeComboBox; QDateEdit *dateEdit; QTimeEdit *timeEdit; //QStatusBar *statusBar, *qsoStatusBar; QString statusBarMessage; QTabWidget *dxBottonTab, *dxUpLeftTab, *dxUpRightTab; QMenu *fileMenu; QMenu *toolMenu; QMenu *viewMenu; QMenu *setupMenu; QMenu *helpMenu; QAction *klogFolderAct; QAction *openAct; QAction *saveAct; QAction *exitAct; QAction *printLogAct; QAction *addAct; QAction *editAct; QAction *removeAct; QAction *logWinAct; QAction *setupAct; QAction *helpAct; QAction *aboutAct; QAction *aboutQtAct; QAction *scoreWinAct; QAction *scoreeWinAct; QAction *ADIFExport; QAction *ADIFExportAll; QAction *ADIFImport; QAction *ReqQSLExport; QAction *CabrilloExport; QAction *fillQsoAct; QAction *findQSO2QSLAct; QAction *findRequestedQSLAct; QAction *findQSLPendingToReceiveAct; QAction *findQSLDXRequestedAct; QAction *downloadCTYAct; QAction *loggWinAct; QAction *delQSOFromLogAct; QAction *qsoToEditFromLogAct; QAction *qslSentViaBureauFromLogAct; QAction *qslSentViaDirectFromLogAct; QAction *qslRecViaBureauFromLogAct; QAction *qslRecViaDirectFromLogAct; QAction *qslSentRequestedAct; QAction *qslRecRequestedAct; QAction *delQSOFromSearchAct; QAction *qsoToEditFromSearchAct; QAction *qslSentViaBureauFromSearchAct; QAction *qslSentViaDirectFromSearchAct; QAction *qslSentViaDirectMarkRcvReqFromSearchAct; QAction *qslSentViaBureauMarkRcvReqFromSearchAct; QAction *qslRecViaBureauFromSearchAct; QAction *qslRecViaDirectFromSearchAct; QAction *qslRecViaBureauMarkReqFromSearchAct; QAction *qslRecViaDirectMarkReqFromSearchAct; QLineEdit *rstTXLineEdit; QLineEdit *rstRXLineEdit; QLineEdit *STXLineEdit; QLineEdit *SRXLineEdit; QPushButton *OKButton, *spotItButton, *clearButton; QStringList bands; QStringList modes; QStringList entitiesList, propModeList; // UI DX QLabel *entityPrimLabel, *entitySecLabel, *iotaAwardLabel, *entityNameLabel, *propModeLabel; QLabel *infoLabel1, *infoLabel2; QLabel *bandLabel1, *bandLabel2, *bandLabel3, *bandLabel4; QLabel *bandLabel5, *bandLabel6, *bandLabel7, *bandLabel8; QLabel *bandLabel9, *bandLabel10, *bandLabel11, *bandLabel12; QLabel *continentLabel, *prefixLabel, *cqzLabel, *ituzLabel; QLabel *gradShortLabel, *distShortLabel; QLabel *gradLongLabel, *distLongLabel; QComboBox *iotaContinentComboBox, *entityPrimDivComboBox, *entitySecDivComboBox, *entityNameComboBox, *propModeComboBox; QComboBox *operatingYearsComboBox; QLineEdit *iotaNumberLineEdit, *operatorLineEdit, *stationCallSignLineEdit, *myLocatorLineEdit, *commentLineEdit; QTextEdit *notesTextEdit; QDoubleSpinBox *myPowerSpinBox, *rxPowerSpinBox, *txFreqSpinBox, *rxFreqSpinBox; QLCDNumber *freqQLCDNumber; QLCDNumber *dxccConfirmedQLCDNumber, *dxccWorkedQLCDNumber, *wazConfirmedQLCDNumber, *wazWorkedQLCDNumber, *localConfirmedQLCDNumber, *localWorkedQLCDNumber, *qsoConfirmedQLCDNumber, *qsoWorkedQLCDNumber, *dxMarathonDXCCQLCDNumber, *dxMarathonCQQLCDNumber, *dxMarathonPointsQLCDNumber; QComboBox *eqslSentComboBox, *eqslRecComboBox, *lotwSentComboBox, *lotwRecComboBox, *clublogComboBox; QDateEdit *eqslSentQDateEdit, *eqslRecQDateEdit, *lotwSentQDateEdit, *lotwRecQDateEdit, *clublogQDateEdit; QComboBox *qslSentComboBox, *qslRecComboBox, *qslSentViaComboBox, *qslRecViaComboBox; QDateEdit *qslSentQDateEdit, *qslRecQDateEdit; QTextEdit *qslmsgTextEdit; QLineEdit *qslViaLineEdit; QLineEdit *searchBoxLineEdit; QPushButton *searchBoxClearButton, *searchBoxExportButton, *searchBoxSelectAllButton, *searchBoxReSearchButton; QRadioButton *searchAllRadioButton; QPushButton *recalculateAwardsButton; bool searchSelectAllClicked, stationCallSignShownInSearch; bool qslingNeeded; MainWindowSatTab *satTabWidget; bool keepSatPage; // UI DX SetupDialog *setupDialog; // DXClusterWidget *dxClusterWidget; bool dxClusterShowHF, dxClusterShowVHF, dxClusterShowWARC, dxClusterShowWorked, dxClusterShowConfirmed, dxClusterShowAnn, dxClusterShowWWV, dxClusterShowWCY; //QWidget *dxClusterWidget; //QListWidget *dxClusterListWidget; //QPushButton *sendDXClusterButton; //QLineEdit *inputDXClusterLineEdit; // // QTimer *timer; QDateTime *dateTime; QString kontestDir, defaultADIFLogFile, configFileName; QString softwareVersion; QString currentQrz; QString previousQrz; QString stx; QString srx; QPalette palRed, palBlack; // To paint Text in red or black(normal) bool realTime, UTCTime, alwaysADIF, needToSave, useDefaultLogFileName, upAndRunning, qrzSmallModDontCalculate, imperialSystem, sendQSLWhenRec, keepMyData, completeWithPrevious, completedWithPreviousQTH, completedWithPreviousLocator, completedWithPreviousName, completedWithPreviousIOTA, completedWithPreviousQSLVia; bool cleaning; bool manageMode; // If true, the DXCC and awards will take the mode into consideration to decide if needed or worked. False implies only band is taken into account // Station Setup bool configured, modify; bool needToEnd; // Just to control if the software needs to end. bool qrzAutoChanging; //To stop executing the slotQRZTextChanged just because KLog uppercase a letter QString mainQRZ, stationQRZ, operatorQRZ, myLocator, dxLocator; QString lastOperatorQRZ, lastStationQRZ, lastMyLocator; double myPower, lastPower; int my_CQz, my_ITUz, defaultMode, defaultBand, currentMode, currentModeShown, currentBand, currentBandShown; int currentEntity, previousEntity; bool InValidCharsInPrevCall; int currentLog; // This is to be able to manage multiple logs without showing // them all at the same time. int modifyingQSO; // When modifying, the QSO is saved here. int selectedYear; // Station Setup QColor defaultColor; QColor neededColor; QColor workedColor; QColor confirmedColor; QColor newOneColor; // bool clublogActive, clublogRealTime; QString clublogUser, clublogPass, clublogEmail; eLogClubLog *elogClublog; int clublogAnswer; QStringList clublogPrevQSO; // // Contest int contestMode, points, qsoPoints, multipliers, qsoMultiplier; Contest *contest; // Contest DataProxy *dataProxy; DataBase *db; bool DBinMemory; QTextDocument *doc; protected: void keyPressEvent(QKeyEvent *event); void closeEvent(QCloseEvent *event); }; #endif klog-0.9.2.2/README-DEVEL0000644000076700000620000002011112627126144012301 0ustar staffThis is a file to read if you want to join the KLog development team. This document will explain the KLog architecture, requirements, tips and important to know things to take into account when joining the KLog development team. CONTENT: 1 - BEFORE CODING 2 - KLOG ARCHITECTURE 3 - BEFORE CODING 4 - CODING 5 - AFTER CODING 6 - GUI 7 - DOCUMENTATION 8 - TRANSLATIONS 9 - DEPLOYING 0 - MISSION AND OBJECTIVE The objective of KLog is to provide a free software that runs in Linux, OSX and Windows. KLog will provide hamradio contest and DX logging support. 0.1 - REQUIREMENTS - Able to run in Linux, OSX and Windows. - Easy to use. - Able to localize to any language. - Any data can be exportable into ADIF (http://www.adif.org). - Can import standard ADIF. - Can export to Cabrillo (http://www.kkn.net/~trey/cabrillo/). - Provides a user manual / documentation. 1 - BEFORE CODING: Read this document. Join the KLog mailing list and send a "Hello that's me and I am here" message: http//MAILINGLIST Interesting links: http://www.qtcentre.org/wiki/index.php?title=Keeping_the_GUI_Responsive Packer: http://upx.sourceforge.net/ = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 2 - KLOG ARCHITECTURE KLog is intended to be a MODULAR software with the requirement to be modular ;-) so it is easy to add new features (mainly contests and awards support). 2.1 IMPORTANT THINGS TO HAVE IN MIND - KLog version number is using the following system: Release versions: The Decimal par of the version number will always use even numbers like 0, 1.2, 2.20, ... while the decimal part of the development or Release Candidate versions will always be an odd number ie 0.1, 1.3, ... The release number is defined in the "main.cpp" file. - KLog should manage several logs. The "log" table of the DB has a column called "lognumber". ALL QSO has a lognumber id that identifies the log it belongs to. Each lognumber will have associated a Name and/or ID (TBD) so the user is able to "open" just that log. It is important that all the QSO operations are aware of this lognumber id. - The log table has a "marked" column. This column is to allow mass operations. Changing this column has to be done with care and leave it "unmarked" once the desired operation is finished. KLog should unmark(N) all QSO when starts and exits. Mark = 'X', unmark='N' or other. Marked column should not be saved. - Any change to the DB architecture must be communicated and agreed with the development team before commiting to the SVN and following the 2.4 DB UPDATES area in this document. 2.2 CONTEST SUPPORT The "Contest" class (in contest.h) is a base class and all the contest should inherit it. The "Contest" class has several virtual functions that should re-implemented in all derived classes. 2.2.1 ADDING A NEW CONTEST To add a new contest, a new class, inheriting the "Contest" class should be created. The new contest file should be named: "contest_nameofthecontest.h" and "contest_nameofthecontest.cpp" and should be included in the mainwindow.h A new contest must include: - Import/Export Cabrillo file 2.3 AWARD SUPPORT 2.4 DB UPDATES A DB update consist on: - All the intended changes. - Update the softwarecontrol TABLE on the DB To update the DB structure there are several things to have in mind: - The current version of the DB is defined in database.h const float DBVersionf = 0.003; - All the actions to update the DB to the new structure are done here: DataBase::updateIfNeeded - After making any update = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 3 - BEFORE CODING Update your sources from the SVN: Remember that other developer may has done a commit. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 4 - CODING - The development language is English. - All Strings to be shown to the user must be translatable. i.e. tr("String") 4.1 - STYLE 4.2 - ADIF SUPPORT KLog is using some application defined ADIF fields: APP_{PROGRAMID}_{FIELDNAME} Header fields: APP_KLOG_LOG_DATE_EXPORT: The date and time (in UTC) when the log was exported. APP_KLOG_QSOS: The number of QSOs in the log. DEPRECATED: APP_KLOG_RELEASE: Release of KLog used to export the log file. CHANGED TO PROGRAMVERSION (ADIF standard) QSO fields: APP_KLOG_POINTS: Points given by the QSO. APP_KLOG_MULTIPLIER: Information about the multiplier status of the QSO. APP_KLOG_LOGN: Lognumber if the ADIF file contains several logs. KLog is also importing other application defined ADIF fields: APP_N1MM_POINTS: That is imported into the points column in the log table. 4.3 SHORTCUTS Before adding or modifying any shortcut: - It should be agreed in the devel mailing list. - It should be as standard as possible, reuse the same shortcuts of main/popular contest software. - It should be checked and added to a list below. 4.4 DATA BASE - The DB version has to be checked and modified after a DB schema modification. - Any modification to the DB has to be provided with the code to update from any previous version. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 5 - AFTER CODING Test that your code compiles and does not break the previous code. Document your changes and close/update the tasks/bugs you have worked on. Remember to commit your code to the SVN. Try to do "atomic" commits. That is to commit updates that may be disabled as a block. i.e. A new function or a modification to a function. Don't commit several things at once if you can avoid it. This is just a recommendation to avoid big commits that, in case of a problem are difficult to trace. Document your commits: ALWAYS add a clear comment to the commits so it is easy to know what is it about. 5.1 TEST CHECKLIST Here is the list of tests to be done before releasing new software: - Install in a new installation of Windows/OSX - Upgrade from a previous version - Create a new log - Add a new QSO - Edit a QSO from log - Edit a QSO from searchs - Remove a QSO - Connect to the DXCLuster - Click on a spot on the DXCLuster - Export an ADIF file - Import an ADIF file - Remove KLog in Windows = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 6 - GUI 6.1 CONTEST GUI - The GUI should only have the data fields that are needed for that contest, keeping the GUI simple and easy to use. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 7 - DOCUMENTATION - One feature will not be considered completed until it is not added to the user manual. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 9 - TRANSLATIONS 9.1 ADDING TRANSLATIONS To add a new translation add the new language file to the klog.pro file following the sintax: TRANSLATIONS = KLog_es.ts \ klog_fr.ts Being es, fr, the ISO codes naming the language. 9.2 TRANSLATING Translators should work in the *.ts files. 9.2 UPDATING TRANSLATIONS Update translations: Run: lupdate -verbose klog.pro in the klog directory to update the language files = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 9 - DEPLOYING Before deploying, translations should be updated. 9.1 DEPLOYING ON LINUX 9.2 DEPLOYING ON OSX Build KLog with QTCreator Run the following command from the build directory: mv klog.app KLog.app create new folder in KLog.app/Contents/PlugIns/sqldrivers copy $QT_DIR/plugins/sqldrivers/libqsqlite.dylib to the new folder (/Developer/Applications/Qt/plugins/) create new folder: KLog.app/Contents/MacOs/translations copy the *.qm (translation) files into KLog.app/Contents/MacOS/translations macdeployqt KLog.app/ -dmg mv KLog.dmg KLog-[VERSION].dmg 9.3 DEPLOYING ON WINDOWS Currently using an Open Source Licence of: BitRock InstallBuilder Installer: http://en.wikipedia.org/wiki/List_of_installation_software klog-0.9.2.2/mainwindow.cpp0000644000076700000620000116231212627126144013457 0ustar staff/*************************************************************************** mainwindow.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include #include #include #include #include #include "mainwindow.h" //#include MainWindow::MainWindow(const QString _kontestDir, const QString tversion) { //qDebug() << "MainWindow::MainWindow: "<< _kontestDir << " Ver: " << tversion << endl; upAndRunning = false; // To define some actions that can only be run when starting the software //connect(&manager, SIGNAL(finished(QNetworkReply*)), SLOT(slotDownloadFinished(QNetworkReply*))); // To download cty.csv // doc = new QTextDocument; util = new Utilities; needToEnd = false; cleaning = false; qrzAutoChanging = false; dxclusterServerToConnect = "dxfun.com"; dxclusterServerPort = 8000; contestMode = NoContest; defaultADIFLogFile = "klog.adi"; softwareVersion = tversion; kontestDir = _kontestDir; InValidCharsInPrevCall = false; stationCallSignShownInSearch = true; configured = false; modify = false; qslingNeeded = false; // When clicking on Find QSO to QSL manageMode = false; selectedYear = 0; defaultMode = 0; defaultBand = 0; //qDebug() << "MainWindow::MainWindow: 1 - currentMode: " << QString::number(currentMode) << endl; currentMode = 0; //qDebug() << "MainWindow::MainWindow: 2 - currentMode: " << QString::number(currentMode) << endl; currentModeShown = currentMode; currentBand = 0; currentBandShown = currentBand; currentLog = 1; points = 0; multipliers = 0; qsoPoints = 0; qsoMultiplier = 0; operatorQRZ = ""; stationQRZ = ""; mainQRZ = ""; myLocator = ""; dxLocator =""; myPower = 0.0; lastPower = myPower; lastOperatorQRZ = operatorQRZ; lastStationQRZ = stationQRZ; lastMyLocator = myLocator; entitiesList.clear(); propModeList.clear(); currentEntity = -1; // To optimize the calls to different world methods if the entity does not change. Used in slotQRZTextChanged previousEntity = -1;// To optimize the calls to different world methods if the entity does not change. realTime=true; UTCTime=true; keepMyData=true; completeWithPrevious=false; completedWithPreviousQTH=false; completedWithPreviousLocator=false; completedWithPreviousName=false; completedWithPreviousIOTA=false; completedWithPreviousQSLVia=false; alwaysADIF=false; useDefaultLogFileName=false; needToSave=false; qrzSmallModDontCalculate=false; imperialSystem=false; sendQSLWhenRec = true; dxClusterShowHF=true; dxClusterShowVHF=true; dxClusterShowWARC=true; dxClusterShowWorked=true; dxClusterShowConfirmed=true; dxClusterShowAnn=true; dxClusterShowWWV=true; dxClusterShowWCY=true; keepSatPage = false; clublogActive = false; clublogRealTime = false; clublogUser = QString(); clublogPass = QString(); clublogEmail = QString(); elogClublog = new eLogClubLog(); clublogAnswer = -1; defaultColor.setNamedColor("slategrey"); neededColor.setNamedColor("yellow"); workedColor.setNamedColor("blue"); confirmedColor.setNamedColor("red"); newOneColor.setNamedColor("green"); //Default band/modes bands << "10M" << "15M" << "20M" << "40M" << "80M" << "160M"; modes << "SSB" << "CW" << "RTTY"; logModel = new QSqlRelationalTableModel(this); logView = new QTableView; logView->setContextMenuPolicy(Qt::CustomContextMenu); logView->setSortingEnabled(true); helpHelpDialog = new HelpHelpDialog(softwareVersion); helpAboutDialog = new HelpAboutDialog(softwareVersion); searchResultsTreeWidget = new QTreeWidget; searchResultsTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu); searchResultsTreeWidget->setSortingEnabled(true); //searchResultsTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); searchResultsTreeWidget->setSelectionMode(QAbstractItemView::MultiSelection); searchResultsTreeWidget->setMouseTracking(true); searchBoxClearButton = new QPushButton(tr("&Clear"), this); searchBoxExportButton = new QPushButton(tr("&Export Highlited"), this); searchBoxSelectAllButton = new QPushButton(tr("&Select All"), this); searchBoxReSearchButton = new QPushButton(tr("&Search"), this); searchAllRadioButton = new QRadioButton (tr("All"), this); searchSelectAllClicked = false; recalculateAwardsButton = new QPushButton(tr("Recalculate"), this); recalculateAwardsButton->setToolTip(tr("Click to recalculate the award status")); scoreTextEdit = new QTextEdit; distShortLabelN = new QLabel; distLongLabelN = new QLabel; #ifdef Q_OS_WIN //qDebug() << "WINDOWS DETECTED!" << endl; //kontestDir = QDir::homePath()+"/kontest"; // We create the \kontest for the logs and data configFileName = kontestDir+"/klogrc.cfg"; #else //qDebug() << "NO WINDOWS DETECTED!" << endl; //kontestDir = QDir::homePath()+"/.kontest"; // We create the ~/.kontest for the logs and data configFileName = kontestDir+"/klogrc"; #endif downloadcty = new DownLoadCTY(kontestDir, softwareVersion); connect( downloadcty, SIGNAL(done()), this, SLOT(slotWorldReload()) ); //qDebug() << "MainWindow::MainWindow: logbook: " << QString(kontestDir + "logbook.dat") << endl; bool existingData = QFile::exists(kontestDir + "logbook.dat"); if (existingData) { //qDebug() << "MainWindow::MainWindow: existing data" << endl; //configured= false; } else { //qDebug() << "MainWindow::MainWindow: NOT existing data" << endl; } statusBarMessage = tr("Starting KLog"); if (!QDir::setCurrent ( kontestDir )){ QDir d1(kontestDir); if (d1.mkdir(kontestDir)) { QDir::setCurrent ( kontestDir ); } } //qDebug() << "MainWindow::MainWindow: 3" << endl; DBinMemory = false; db = new DataBase(softwareVersion, DBinMemory); //qDebug() << "MainWindow::MainWindow: 4" << endl; world = new World(kontestDir, softwareVersion); //qDebug() << "MainWindow::MainWindow: 5" << endl; if (!db->createConnection()) { //qDebug() << "MainWindow::MainWindow: Conection not created" << endl; return; } else { db->updateIfNeeded(); // Check if we need to update the DB //qDebug() << "MainWindow::MainWindow: DB Updated" << endl; if (!existingData) { //qDebug() << "MainWindow::MainWindow: !existingData" << endl; world->create(kontestDir); entitiesList = world->getEntitiesNames(); //createData(); }else { //qDebug() << "MainWindow::MainWindow: existingData" << endl; } } //qDebug() << "MainWindow::MainWindow: proxy to be created" << endl; dataProxy = new DataProxy_SQLite(); propModeList = dataProxy->getPropModeList(); //qDebug() << "MainWindow::MainWindow: setupDialog to be created" << endl; setupDialog = new SetupDialog(!configured); //qDebug() << "MainWindow::MainWindow: satTabWidget to be created" << endl; satTabWidget = new MainWindowSatTab(); //qDebug() << "MainWindow::MainWindow: fileManager to be created" << endl; filemanager = new FileManager(kontestDir, softwareVersion, *db); //qDebug() << "MainWindow::MainWindow: locator to be created" << endl; locator = new Locator(); //qDebug() << "MainWindow::MainWindow: awards to be created" << endl; awards = new Awards(); mainWidget = new QWidget(this); setCentralWidget(mainWidget); //qDebug() << "MainWindow::MainWindow: 8" << endl; dateTime = new QDateTime(); selectedYear = (dateTime->currentDateTime()).date().year(); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(slotUpdateTime()) ); timer->start(1000); previousQrz = ""; qrzLineEdit = new QLineEdit; nameLineEdit = new QLineEdit; qthLineEdit = new QLineEdit; locatorLineEdit = new QLineEdit; rstTXLineEdit = new QLineEdit; rstRXLineEdit = new QLineEdit; STXLineEdit = new QLineEdit; SRXLineEdit = new QLineEdit; bandComboBox = new QComboBox; modeComboBox = new QComboBox; dateEdit = new QDateEdit; dateEdit->setDisplayFormat("dd/MM/yyyy"); timeEdit = new QTimeEdit; OKButton = new QPushButton(tr("&Add"), this); //spotItButton = new QPushButton(tr("&Spot"), this); //spotItButton->setEnabled(false); clearButton = new QPushButton(tr("&Clear"), this); // UI DX infoLabel1 = new QLabel(tr("Status bar...")); infoLabel2 = new QLabel(tr("DX Entity")); bandLabel1 = new QLabel(tr("10M")); bandLabel2 = new QLabel(tr("15M")); bandLabel3 = new QLabel(tr("20M")); bandLabel4 = new QLabel(tr("40M")); bandLabel5 = new QLabel(tr("80M")); bandLabel6 = new QLabel(tr("160M")); bandLabel7 = new QLabel(tr("2M")); bandLabel8 = new QLabel(tr("6M")); bandLabel9 = new QLabel(tr("12M")); bandLabel10 = new QLabel(tr("17M")); bandLabel11 = new QLabel(tr("30M")); bandLabel12 = new QLabel(tr("70CM")); entityPrimLabel = new QLabel(tr("Primary Div")); entitySecLabel = new QLabel(tr("Secondary Div")); iotaAwardLabel = new QLabel(tr("IOTA")); entityNameLabel = new QLabel(tr("Entity")); propModeLabel = new QLabel(tr("Propagation mode")); iotaContinentComboBox = new QComboBox; entityPrimDivComboBox = new QComboBox; entitySecDivComboBox = new QComboBox; entityNameComboBox = new QComboBox; propModeComboBox = new QComboBox; //notesTextEdit = new QTextEdit; commentLineEdit = new QLineEdit; continentLabel = new QLabel; prefixLabel = new QLabel; cqzLabel = new QLabel; ituzLabel = new QLabel; gradShortLabel = new QLabel; distShortLabel = new QLabel; gradLongLabel = new QLabel; distLongLabel = new QLabel; logPanel = new QWidget; loggWinAct = new QAction(tr("&Log Window"), this); scoreeWinAct = new QAction(tr("&Score Window"), this); scoreWindow = new QWidget; operatorLineEdit = new QLineEdit; stationCallSignLineEdit = new QLineEdit; myLocatorLineEdit = new QLineEdit; myPowerSpinBox = new QDoubleSpinBox; myPowerSpinBox->setDecimals(2); myPowerSpinBox->setMaximum(9999); rxPowerSpinBox = new QDoubleSpinBox; rxPowerSpinBox->setDecimals(2); rxPowerSpinBox->setMaximum(9999); txFreqSpinBox = new QDoubleSpinBox; txFreqSpinBox->setDecimals(3); txFreqSpinBox->setMaximum(9999); txFreqSpinBox->setSuffix(tr("MHz")); rxFreqSpinBox = new QDoubleSpinBox; rxFreqSpinBox->setDecimals(3); rxFreqSpinBox->setMaximum(9999); rxFreqSpinBox->setSuffix(tr("MHz")); dxccConfirmedQLCDNumber = new QLCDNumber; dxccWorkedQLCDNumber = new QLCDNumber; wazConfirmedQLCDNumber = new QLCDNumber; wazWorkedQLCDNumber = new QLCDNumber; localConfirmedQLCDNumber = new QLCDNumber; localWorkedQLCDNumber = new QLCDNumber; qsoConfirmedQLCDNumber = new QLCDNumber; qsoWorkedQLCDNumber = new QLCDNumber; dxMarathonDXCCQLCDNumber = new QLCDNumber; dxMarathonCQQLCDNumber = new QLCDNumber; dxMarathonPointsQLCDNumber = new QLCDNumber; operatingYearsComboBox = new QComboBox; qsoWorkedQLCDNumber->setDigitCount(7); qsoConfirmedQLCDNumber->setDigitCount(7); qslSentComboBox = new QComboBox; qslRecComboBox = new QComboBox; eqslSentComboBox = new QComboBox; eqslRecComboBox = new QComboBox; lotwSentComboBox = new QComboBox; lotwRecComboBox = new QComboBox; clublogComboBox = new QComboBox; QStringList qsAux; qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("I-Ignore") << tr("V-Validated"); eqslRecComboBox->addItems(qsAux); lotwRecComboBox->addItems(qsAux); qsAux.clear(); qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); eqslSentComboBox->addItems(qsAux); lotwSentComboBox->addItems(qsAux); qslSentComboBox->addItems(qsAux); qsAux.clear(); qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("I-Ignore") << tr("V-Verified"); qslRecComboBox->addItems(qsAux); qsAux.clear(); qsAux << tr("Y-Uploaded") << tr("N-Do not upload") << tr("M-Modified"); clublogComboBox->addItems(qsAux); qslSentViaComboBox = new QComboBox; qslRecViaComboBox = new QComboBox; qsAux.clear(); qsAux << tr("B-Bureau") << tr("D-Direct") << tr("E-Electronic") << tr("M-Manager"); qslSentViaComboBox->addItems(qsAux); qslRecViaComboBox->addItems(qsAux); eqslSentQDateEdit = new QDateEdit; eqslRecQDateEdit = new QDateEdit; lotwSentQDateEdit = new QDateEdit; lotwRecQDateEdit = new QDateEdit; clublogQDateEdit = new QDateEdit; qslSentQDateEdit = new QDateEdit; qslRecQDateEdit = new QDateEdit; qslmsgTextEdit = new QTextEdit; qslViaLineEdit = new QLineEdit; clublogComboBox->setCurrentIndex(1); // Do not upload qslRecComboBox->setCurrentIndex(1); // Not received qslSentComboBox->setCurrentIndex(1); // Not sent eqslSentComboBox->setCurrentIndex(1); eqslRecComboBox->setCurrentIndex(1); lotwSentComboBox->setCurrentIndex(1); lotwRecComboBox->setCurrentIndex(1); // Check date & time and set them in the UI at the begining dateTime->currentDateTime(); dateEdit->setDate((dateTime->currentDateTime()).date()); timeEdit->setTime((dateTime->currentDateTime()).time()); //Search tab searchBoxLineEdit = new QLineEdit; // UI DX // CLUSTER //qDebug() << "MainWindow::MainWindow: dxclusterwidget to be created" << endl; dxClusterWidget = new DXClusterWidget(dxclusterServerToConnect , dxclusterServerPort, this); // palRed.setColor(QPalette::Text, Qt::red); palBlack.setColor(QPalette::Text, Qt::black); // //************************************************** //createDXClusterUI(); connect( setupDialog, SIGNAL(exitSignal(int)), this, SLOT(slotExitFromSlotDialog(int)) ); //qDebug() << "MainWindow::MainWindow: reconfigdata" << endl; readConfigData(); if (needToEnd) { //QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db->compress(); //qDebug() << "MainWindow::MainWindow: 12.5" << endl; exit(0); } //qDebug() << "MainWindow::MainWindow: UI to be created" << endl; createUI(); //qDebug() << "MainWindow::MainWindow: logmodel to be created" << endl; createlogModel(currentLog); createSearchResultsPanel(); loggWinAct->setShortcut(Qt::CTRL + Qt::Key_L); connect(loggWinAct, SIGNAL(triggered()), this, SLOT(slotLogWinShow())); //logPanel->addAction(loggWinAct); //logPanel->addAction(scoreeWinAct); scoreeWinAct->setShortcut(Qt::CTRL + Qt::Key_P); connect(scoreeWinAct, SIGNAL(triggered()), this, SLOT(slotScoreWinShow())); scoreWindow->addAction(scoreeWinAct); scoreWindow->addAction(loggWinAct); createScorePanel(); setWindowTitle(tr("KLog")); logView->setCurrentIndex(logModel->index(0, 0)); //searchResultsTreeWidget->setCurrentIndex(logModel->index(0, 0)); //qDebug() << "MainWindow::MainWindow: 16" << endl; if (dataProxy->getNumberOfManagedLogs()<1) { //qDebug() << "MainWindow::MainWindow: 16.1" << endl; slotSetup(6); //qDebug() << "MainWindow::MainWindow: 16.2" << endl; } //qDebug() << "MainWindow::MainWindow: 17" << endl; checkIfNewBandOrMode(); //qDebug() << "MainWindow::MainWindow: 18" << endl; if ( (contestMode == CQ_WW_SSB) || (contestMode == CQ_WW_CW) ) { //qDebug() << "MainWindow::MainWindow: 18.1" << endl; } else if ( (contestMode == CQ_WPX_SSB) || (contestMode == CQ_WPX_CW) ) { //qDebug() << "MainWindow::MainWindow: 18.2" << endl; } else { //qDebug() << "MainWindow::MainWindow: 18.3" << endl; if (dataProxy->getLastQSOid()<=1) { //qDebug() << "MainWindow::MainWindow: 18.4" << endl; operatingYearsComboBox->addItem(QString::number(selectedYear)); } else { //qDebug() << "MainWindow::MainWindow: 18.5 - currentLog: " << QString::number(currentLog) << endl; operatingYearsComboBox->addItems(dataProxy->getOperatingYears(currentLog)); //qDebug() << "MainWindow::MainWindow: 18.5.1 - currentLog: " << QString::number(currentLog) << endl; operatingYearsComboBox->setCurrentIndex(operatingYearsComboBox->findText((dataProxy->getOperatingYears(currentLog)).last())); //qDebug() << "MainWindow::MainWindow: 18.5.2" << endl; } //qDebug() << "MainWindow::MainWindow: 18.6." << endl; updateQSLRecAndSent(); //qDebug() << "MainWindow::MainWindow: 18.7" << endl; awards->recalculateAwards(); //qDebug() << "MainWindow::MainWindow: 18.8" << endl; showAwards(); //qDebug() << "MainWindow::MainWindow: 18.9" << endl; dxClusterWidget->setCurrentLog(currentLog); //qDebug() << "MainWindow::MainWindow: 18.10" << endl; } //qDebug() << "MainWindow::MainWindow: 19" << endl; currentBandShown = dataProxy->getIdFromBandName(bandComboBox->currentText()); currentModeShown = dataProxy->getIdFromModeName(modeComboBox->currentText()); currentBand = currentBandShown; currentMode = currentModeShown; //qDebug() << "MainWindow::MainWindow: 4 - currentMode: " << QString::number(currentMode) << endl; //qDebug() << "MainWindow::MainWindow: 17 - currentBand: " << QString::number(currentBand) << endl; slotClearButtonClicked(); //logModel->select(); upAndRunning = true; //qDebug() << "MainWindow::MainWindow: END" << endl; } void MainWindow::createStatusBar() { statusBar()->showMessage(tr("Ready")); } void MainWindow::createUI() { //qDebug() << "MainWindow::createUI" << endl; createStatusBar(); if ( (contestMode == CQ_WW_SSB) || (contestMode == CQ_WW_CW) ) { createUICQWW(); createActionsCommon(); createActionsCQWW(); createMenusCommon(); createMenusCQWW(); } else if ( (contestMode == CQ_WPX_SSB) || (contestMode == CQ_WPX_CW) ) { } else { createUIDX(); createActionsCommon(); createActionsDX(); createMenusCommon(); } } void MainWindow::slotModeComboBoxChanged() { //qDebug() << "MainWindow::slotModeComboBoxChanged: " << QString::number(modeComboBox->currentIndex()) << endl; int i; i = dataProxy->getSubModeIdFromSubMode(modeComboBox->currentText()); if (i>=0) { //qDebug() << "MainWindow::MainWindow: 5 - currentMode: " << QString::number(currentMode) << endl; currentMode = i; //qDebug() << "MainWindow::MainWindow: 6 - currentMode: " << QString::number(currentMode) << endl; } //qDebug() << "MainWindow::slotModeComboBoxChanged: i: " << QString::number(i) << endl; //qDebug() << "MainWindow::slotModeComboBoxChanged: currentMode: " << QString::number(currentMode) << endl; //qDebug() << "MainWindow::slotModeComboBoxChanged: " << QString::number(modeComboBox->currentIndex()) << "/" << QString::number(currentMode) << endl; currentBandShown = dataProxy->getIdFromBandName(bandComboBox->currentText()); currentModeShown = dataProxy->getIdFromModeName(modeComboBox->currentText()); currentBand = currentBandShown; //qDebug() << "MainWindow::MainWindow: 7 - currentMode: " << QString::number(currentMode) << endl; currentMode = currentModeShown; //qDebug() << "MainWindow::MainWindow: 8 - currentMode: " << QString::number(currentMode) << endl; //currentBandShown = bandComboBox->currentIndex(); //currentModeShown = modeComboBox->currentIndex(); i = checkIfWorkedB4(currentQrz); QStringList _qs; //for the showStatusOfDXCC(const QStringList _qs) _qs.clear(); if (manageMode) { _qs << currentQrz << QString::number(currentBandShown) << QString::number(currentModeShown) << QString::number(currentLog); } else { _qs << currentQrz << QString::number(currentBandShown) << "-1" << QString::number(currentLog); } showStatusOfDXCC(_qs); } void MainWindow::slotBandComboBoxChanged(){ //qDebug() << "MainWindow::slotBandComboBoxChanged: " << QString::number(bandComboBox->currentIndex()) << endl; int i; i = dataProxy->getIdFromBandName(bandComboBox->currentText()); if (i>=0) { currentBand = i; //txFreqSpinBox->setValue(dataProxy->getFreqFromBandId(i)); } //qDebug() << "MainWindow::slotBandComboBoxChanged: " << QString::number(bandComboBox->currentIndex()) << "/" << QString::number(currentBand) << endl; currentBandShown = dataProxy->getIdFromBandName(bandComboBox->currentText()); currentModeShown = dataProxy->getIdFromModeName(modeComboBox->currentText()); currentBand = currentBandShown; //qDebug() << "MainWindow::MainWindow: 9 - currentMode: " << QString::number(currentMode) << endl; currentMode = currentModeShown; //qDebug() << "MainWindow::MainWindow: 10 - currentMode: " << QString::number(currentMode) << endl; //currentModeShown = modeComboBox->currentIndex(); i = checkIfWorkedB4(currentQrz); QStringList _qs; //for the showStatusOfDXCC(const QStringList _qs) _qs.clear(); if (manageMode) { _qs << currentQrz << QString::number(currentBandShown) << QString::number(currentModeShown) << QString::number(currentLog); } else { _qs << currentQrz << QString::number(currentBandShown) << "-1" << QString::number(currentLog); } showStatusOfDXCC(_qs); } void MainWindow::slotQRZReturnPressed() { //qDebug() << "MainWindow::slotQRZReturnPressed: " << qrzLineEdit->text() << " - " << QString::number(bandComboBox->currentIndex()) << "/" << QString::number(modeComboBox->currentIndex()) << endl; //int newId = -1; int lastId = -1; int errorCode = 0; QString aux; int _x; //for clublog management //bool ret = false; QString tqrz = qrzLineEdit->text(); //currentMode = modeComboBox->currentIndex(); //currentBandShown = bandComboBox->currentIndex(); slotBandComboBoxChanged(); slotModeComboBoxChanged(); switch (contestMode) { // Just to prepare or some tasks before reading DATA from UI case CQ_WW_SSB: //qDebug() << "MainWindow::slotQRZReturnPressed: CQ-WW-SSB:" << endl; if ((SRXLineEdit->text()).toInt() < 1 ){ return; } break; case CQ_WW_CW: //qDebug() << "MainWindow::slotQRZReturnPressed: CQ-WW-CW:" << endl; break; default: //qDebug() << "MainWindow::slotQRZReturnPressed: Default:" << endl; break; } //http://www.sqlite.org/autoinc.html // NULL = is the keyword for the autoincrement to generate next value QSqlQuery query; QString queryString = readDataFromUI(); //qDebug() << "MainWindow::slotQRZReturnPressed: queryString: " << queryString << endl; if (queryString != "NULL") { if (!query.exec(queryString)) { //qDebug() << "MainWindow::slotQRZReturnPressed: Query ERROR: (queryString): " << queryString << endl; errorCode = query.lastError().number(); QMessageBox msgBox; msgBox.setIcon(QMessageBox::Warning); aux = tr("An unexpected error ocurred when trying to add the QSO to your log. If the problem persists, please contact the developer for analysis: "); msgBox.setText(aux + "MW-1#" + QString::number(errorCode)); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Ok: break; default: // should never be reached break; } return; } else { //TODO: To move the following lines to this part to properly manage the query result!! //ret = true; //qDebug() << "MainWindow::slotQRZReturnPressed: QSO Added! " << endl; needToSave = true; if (modify) { //qDebug() << "MainWindow::slotQRZReturnPressed: Modifying! " << endl; if(modifyingQSO>0) { awards->setAwards(modifyingQSO); if ((clublogActive) & (clublogRealTime)) { //qDebug() << "MainWindow::slotQRZReturnPressed: (Modifiying ClubLog) Lastid: "<< QString::number(lastId) << endl; // Delete QSO in CLubLog _x = elogClublog->deleteQSO(clublogPrevQSO); // Add modified QSO in ClubLog _x = elogClublog->sendQSO(dataProxy->getClubLogRealTimeFromId(modifyingQSO)); } else { //qDebug() << "MainWindow::slotQRZReturnPressed: (No ClubLog) Lastid: "<< QString::number(lastId) << endl; } } // CHECK WHAT WAS THE QSOID to add the awards, if needed } else { //qDebug() << "MainWindow::slotQRZReturnPressed: Not Modifying " << endl; lastId = dataProxy->getLastQSOid(); if (lastId>=0) { //qDebug() << "MainWindow::slotQRZReturnPressed: Lastid: "<< QString::number(lastId) << endl; awards->setAwards(lastId); //Update the DXCC award status // Send to CLUBLOG if enabled if (clublogActive) { //qDebug() << "MainWindow::slotQRZReturnPressed: clublogActive TRUE" << endl; } else { //qDebug() << "MainWindow::slotQRZReturnPressed: clublogActive FALSE" << endl; } if (clublogRealTime) { //qDebug() << "MainWindow::slotQRZReturnPressed: clublogRealTime TRUE" << endl; } else { //qDebug() << "MainWindow::slotQRZReturnPressed: clublogRealTime FALSE" << endl; } if ((clublogActive) & (clublogRealTime)) { //qDebug() << "MainWindow::slotQRZReturnPressed: (Sending ClubLog) Lastid: "<< QString::number(lastId) << endl; _x = elogClublog->sendQSO(dataProxy->getClubLogRealTimeFromId(lastId)); } else { //qDebug() << "MainWindow::slotQRZReturnPressed: (No ClubLog) Lastid: "<< QString::number(lastId) << endl; } // } } logModel->select(); slotClearButtonClicked(); } } else // The QUERY string is NULL { //qDebug() << "MainWindow::slotQRZReturnPressed: queryString-NULL: " << queryString << endl; } modify = false; modifyingQSO = -1; OKButton->setText(tr("&Add")); } QString MainWindow::readDataFromUI() { //qDebug() << "MainWindow::readDataFromUI: " << endl; QString tqrz = (qrzLineEdit->text()).toUpper(); if (tqrz.length()<3) { return "NULL"; } switch (contestMode) { case CQ_WW_SSB: //return readDataFromUICQWWSSB(); break; case CQ_WW_CW: //return readDataFromUICQWWCW(); break; default: if (modify) { return readDataFromUIDXModifying(); } else { return readDataFromUIDX(); } break; } //qDebug() << "MainWindow::readDataFromUI: END" << endl; return "NULL"; } QString MainWindow::readDataFromUIDX() { //qDebug() << "MainWindow::readDataFromUIDX:" << endl; QString tqrz = (qrzLineEdit->text()).toUpper(); if (tqrz.length()<3) { return "NULL"; } QString stringQuery = "NULL"; QString aux1, aux2, stringFields, stringData; //QString aux, aux2; int tband = currentBand; int tmode = currentMode; QString tdate = (dateEdit->date()).toString("yyyy/MM/dd"); QString ttime = (timeEdit->time()).toString("hh:mm:ss"); QString trsttx = rstTXLineEdit->text(); QString trstrx = rstRXLineEdit->text(); int dxcc = world->getQRZARRLId(tqrz); int dxcc2 = getDXCCFromComboBox(); if (dxcc!=dxcc2) { QString dxccn1 = world->getEntityName(dxcc); QString dxccn2 = world->getEntityName(dxcc2); QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("KLog"), tr("You have selected an entity")+"("+dxccn2+")\n"+tr("that is different from the KLog proposed entity")+ "("+dxccn1+")\n" +tr("Push Apply to apply your selection."), QMessageBox::Apply | QMessageBox::Discard); if (ret == QMessageBox::Apply) { dxcc = dxcc2; } } int cqz = world->getEntityCqz(dxcc); int ituz = world->getEntityItuz(dxcc); aux1 = nameLineEdit->text(); if (aux1.length()>1) { stringFields = stringFields + ", name"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = (locatorLineEdit->text()).toUpper(); if ( locator->isValidLocator(aux1) ) { stringFields = stringFields + ", gridsquare"; stringData = stringData + ", '" + aux1 + "'"; } if ( (txFreqSpinBox->value()) > 0 ) { aux1 = QString::number(txFreqSpinBox->value()); if (db->isThisFreqInBand(db->getBandNameFromID2(tband), aux1) ) { stringFields = stringFields + ", freq"; stringData = stringData + ", '" + aux1 + "'"; //qDebug() << "MainWindow::readDataFromUIDX: FREQ & BAND OK" << endl; } else { //qDebug() << "MainWindow::readDataFromUIDX: FREQ & BAND NOK" << endl; } } if ( (rxFreqSpinBox->value()) > 0 ) { aux1 = QString::number(rxFreqSpinBox->value()); stringFields = stringFields + ", freq_rx"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = qthLineEdit->text(); if (aux1.length()>2) { stringFields = stringFields + ", qth"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = operatorLineEdit->text(); if (aux1.length()>2) { lastOperatorQRZ = aux1.toUpper(); stringFields = stringFields + ", operator"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = (stationCallSignLineEdit->text()).toUpper(); if (aux1.length()>2) { lastStationQRZ = aux1.toUpper(); stringFields = stringFields + ", station_callsign"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = myLocatorLineEdit->text(); if (aux1.length()>2) { lastMyLocator = aux1.toUpper(); stringFields = stringFields + ", my_gridsquare"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = commentLineEdit->text(); if (aux1.length()>0) { stringFields = stringFields + ", comment"; stringData = stringData + ", '" + aux1 + "'"; } /* aux1 = notesTextEdit->toPlainText(); if (aux1.length()>3) { //qDebug() << "MainWindow::readDataFromUIDX - Notes: " << aux1 << endl; stringFields = stringFields + ", notes"; stringData = stringData + ", '" + aux1 + "'"; } */ aux1 = qslmsgTextEdit->toPlainText(); if (aux1.length()>0) { stringFields = stringFields + ", qslmsg"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = QString::number(dxcc); if (aux1.length()>0) { stringFields = stringFields + ", dxcc"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = QString::number(cqz); if (aux1.length()>0) { stringFields = stringFields + ", cqz"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = QString::number(ituz); if (aux1.length()>0) { stringFields = stringFields + ", ituz"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = qslViaLineEdit->text(); if (aux1.length()>3) { stringFields = stringFields + ", qsl_via"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = QString::number(myPowerSpinBox->value()); if ((aux1.toDouble())>0.0) { lastPower = aux1.toDouble(); stringFields = stringFields + ", tx_pwr"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = QString::number(rxPowerSpinBox->value()); if ((aux1.toDouble())>0.0) { stringFields = stringFields + ", rx_pwr"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = iotaNumberLineEdit->text(); if ( (aux1.toInt()) > 0 ) { aux2 = iotaContinentComboBox->currentText() + "-" + aux1; aux1 = awards->checkIfValidIOTA(aux2); //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="<getSatName(); //qDebug() << "MainWindow::readDataFromUIDX: SAT1 " << aux1 << endl; if (aux1.length()>0) { stringFields = stringFields + ", sat_name"; stringData = stringData + ", '" + aux1 + "'"; } aux1 = satTabWidget->getSatMode(); if (aux1.length()>0) { stringFields = stringFields + ", sat_mode"; stringData = stringData + ", '" + aux1 + "'"; } keepSatPage = satTabWidget->getRepeatThis(); aux1 = getPropModeFromComboBox(); if ((aux1.length()>0) && (aux1 != "Not")) { stringFields = stringFields + ", prop_mode"; stringData = stringData + ", '" + aux1 + "'"; } //CLUBLOG int i = clublogComboBox->currentIndex(); //qsAux << tr("Y-Uploaded") << tr("N-Do not upload") << tr("M-Modified"); clublogQDateEdit->setDate((dateTime->currentDateTime()).date()); //qDebug() << "MainWindow::readDataFromUIDX: ClubLogDate: " << (clublogQDateEdit->date()).toString("yyyy/MM/dd") << endl; switch (i) { case 0: // Y-Yes stringFields = stringFields + ", clublog_qso_upload_status"; stringData = stringData + ", 'Y'"; stringFields = stringFields + ", clublog_qso_upload_date"; stringData = stringData + ", '" + (clublogQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 1: //N-Do not upload stringFields = stringFields + ", clublog_qso_upload_status"; stringData = stringData + ", 'N'"; break; case 2: // M-Modified stringFields = stringFields + ", clublog_qso_upload_status"; stringData = stringData + ", 'M'"; stringFields = stringFields + ", clublog_qso_upload_date"; stringData = stringData + ", '" + (clublogQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; default: //N-No //TODO: Pending to define a default value, if needed break; } //CLUBLOG i = eqslSentComboBox->currentIndex(); //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); switch (i) { case 0: // Y-Yes stringFields = stringFields + ", eqsl_qsl_sent"; stringData = stringData + ", 'Y'"; stringFields = stringFields + ", eqsl_qslsdate"; stringData = stringData + ", '" + (eqslSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 1: //N-No stringFields = stringFields + ", eqsl_qsl_sent"; stringData = stringData + ", 'N'"; break; case 2: // R-Requested stringFields = stringFields + ", eqsl_qsl_sent"; stringData = stringData + ", 'R'"; //stringFields = stringFields + ", eqsl_qslsdate"; //stringData = stringData + ", '" + (eqslSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 3: // Q-Queued stringFields = stringFields + ", eqsl_qsl_sent"; stringData = stringData + ", 'Q'"; stringFields = stringFields + ", eqsl_qslsdate"; stringData = stringData + ", '" + (eqslSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 4: // I-Ignore //qslSentQDateEdit->setEnabled(true); stringFields = stringFields + ", eqsl_qsl_sent"; stringData = stringData + ", 'I'"; stringFields = stringFields + ", eqsl_qslsdate"; stringData = stringData + ", '" + (eqslSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; default: //N-No stringFields = stringFields + ", eqsl_qsl_sent"; stringData = stringData + ", 'N'"; break; } // EQSL-RECEPTION i = eqslRecComboBox->currentIndex(); //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); switch (i) { case 0: // Y-Yes stringFields = stringFields + ", eqsl_qsl_rcvd"; stringData = stringData + ", 'Y'"; stringFields = stringFields + ", eqsl_qslrdate"; stringData = stringData + ", '" + (eqslRecQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 1: //N-No stringFields = stringFields + ", eqsl_qsl_rcvd"; stringData = stringData + ", 'N'"; break; case 2: // R-Requested stringFields = stringFields + ", eqsl_qsl_rcvd"; stringData = stringData + ", 'R'"; break; case 3: // Q-Queued stringFields = stringFields + ", eqsl_qsl_rcvd"; stringData = stringData + ", 'Q'"; stringFields = stringFields + ", eqsl_qslrdate"; stringData = stringData + ", '" + (eqslRecQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 4: // I-Ignore stringFields = stringFields + ", eqsl_qsl_rcvd"; stringData = stringData + ", 'I'"; stringFields = stringFields + ", eqsl_qslrdate"; stringData = stringData + ", '" + (eqslRecQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; default: //N-No stringFields = stringFields + ", eqsl_qsl_rcvd"; stringData = stringData + ", 'N'"; break; } // LOTW-SENT i = lotwSentComboBox->currentIndex(); //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); switch (i) { case 0: // Y-Yes stringFields = stringFields + ", lotw_qsl_sent"; stringData = stringData + ", 'Y'"; stringFields = stringFields + ", lotw_qslsdate"; stringData = stringData + ", '" + (lotwSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 1: //N-No stringFields = stringFields + ", lotw_qsl_sent"; stringData = stringData + ", 'N'"; break; case 2: // R-Requested stringFields = stringFields + ", lotw_qsl_sent"; stringData = stringData + ", 'R'"; break; case 3: // Q-Queued stringFields = stringFields + ", lotw_qsl_sent"; stringData = stringData + ", 'Q'"; stringFields = stringFields + ", lotw_qslsdate"; stringData = stringData + ", '" + (lotwSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 4: // I-Ignore stringFields = stringFields + ", lotw_qsl_sent"; stringData = stringData + ", 'I'"; stringFields = stringFields + ", lotw_qslsdate"; stringData = stringData + ", '" + (lotwSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; default: //N-No stringFields = stringFields + ", lotw_qsl_sent"; stringData = stringData + ", 'N'"; break; } // LOTW-RECEPTION //LOTW_QSLRDATE: (only valid if LOTW_RCVD is Y, I, or V) i = lotwRecComboBox->currentIndex(); //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); switch (i) { case 0: // Y-Yes stringFields = stringFields + ", lotw_qsl_rcvd"; stringData = stringData + ", 'Y'"; stringFields = stringFields + ", lotw_qslrdate"; stringData = stringData + ", '" + (lotwRecQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 1: //N-No stringFields = stringFields + ", lotw_qsl_rcvd"; stringData = stringData + ", 'N'"; break; case 2: // R-Requested stringFields = stringFields + ", lotw_qsl_rcvd"; stringData = stringData + ", 'R'"; break; case 3: // Q-Queued stringFields = stringFields + ", lotw_qsl_rcvd"; stringData = stringData + ", 'Q'"; stringFields = stringFields + ", lotw_qslrdate"; stringData = stringData + ", '" + (lotwRecQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; case 4: // I-Ignore stringFields = stringFields + ", lotw_qsl_rcvd"; stringData = stringData + ", 'I'"; stringFields = stringFields + ", lotw_qslrdate"; stringData = stringData + ", '" + (lotwRecQDateEdit->date()).toString("yyyy/MM/dd") + "'"; break; default: //N-No stringFields = stringFields + ", lotw_qsl_rcvd"; stringData = stringData + ", 'N'"; break; } // QSL SENT i = qslSentComboBox->currentIndex(); int ii = qslSentViaComboBox->currentIndex(); switch (i) { case 0: // Y-Yes stringFields = stringFields + ", qsl_sent"; stringData = stringData + ", 'Y'"; stringFields = stringFields + ", qslsdate"; stringData = stringData + ", '" + (qslSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; stringFields = stringFields + ", qsl_sent_via"; switch (ii) { case 0: //B stringData = stringData + ", 'B'"; break; case 1: //D stringData = stringData + ", 'D'"; break; case 2: //E stringData = stringData + ", 'E'"; break; case 3: //M stringData = stringData + ", 'M'"; break; default: stringData = stringData + ", 'B'"; break; } break; case 1: //N-No stringFields = stringFields + ", qsl_sent"; stringData = stringData + ", 'N'"; stringFields = stringFields + ", qsl_sent_via"; stringData = stringData + ", 'B'"; break; case 2: // R-Requested stringFields = stringFields + ", qsl_sent"; stringData = stringData + ", 'R'"; stringFields = stringFields + ", qsl_sent_via"; switch (ii) { case 0: //B stringData = stringData + ", 'B'"; break; case 1: //D stringData = stringData + ", 'D'"; break; case 2: //E stringData = stringData + ", 'E'"; break; case 3: //M stringData = stringData + ", 'M'"; break; default: stringData = stringData + ", 'B'"; break; } break; case 3: // Q-Queued stringFields = stringFields + ", qsl_sent"; stringData = stringData + ", 'Q'"; stringFields = stringFields + ", qslsdate"; stringData = stringData + ", '" + (qslSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; stringFields = stringFields + ", qsl_sent_via"; switch (ii) { case 0: //B stringData = stringData + ", 'B'"; break; case 1: //D stringData = stringData + ", 'D'"; break; case 2: //E stringData = stringData + ", 'E'"; break; case 3: //M stringData = stringData + ", 'M'"; break; default: stringData = stringData + ", 'B'"; break; } break; case 4: // I-Ignore stringFields = stringFields + ", qsl_sent"; stringData = stringData + ", 'I'"; stringFields = stringFields + ", qslsdate"; stringData = stringData + ", '" + (qslSentQDateEdit->date()).toString("yyyy/MM/dd") + "'"; stringFields = stringFields + ", qsl_sent_via"; switch (ii) { case 0: //B stringData = stringData + ", 'B'"; break; case 1: //D stringData = stringData + ", 'D'"; break; case 2: //E stringData = stringData + ", 'E'"; break; case 3: //M stringData = stringData + ", 'M'"; break; default: stringData = stringData + ", 'B'"; break; } break; default: //N-No stringFields = stringFields + ", qsl_sent"; stringData = stringData + ", 'N'"; stringFields = stringFields + ", qsl_sent_via"; stringData = stringData + ", 'B'"; break; } // QSL RECEPTION i = qslRecComboBox->currentIndex(); ii = qslRecViaComboBox->currentIndex(); switch (i) { // tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("I-Ignore") << tr("V-Verified"); case 0: // Y-Yes //QSL received date: {Y, N, R, I, V} //(only valid if QSL_RCVD is Y, I, or V) stringFields = stringFields + ", qsl_rcvd"; stringData = stringData + ", 'Y'"; stringFields = stringFields + ", qslrdate"; stringData = stringData + ", '" + (qslRecQDateEdit->date()).toString("yyyy/MM/dd") + "'"; stringFields = stringFields + ", confirmed"; stringData = stringData + ", '1'"; stringFields = stringFields + ", qsl_rcvd_via"; switch (ii) { case 0: //B stringData = stringData + ", 'B'"; break; case 1: //D stringData = stringData + ", 'D'"; break; case 2: //E stringData = stringData + ", 'E'"; break; case 3: //M stringData = stringData + ", 'M'"; break; default: stringData = stringData + ", 'B'"; break; } break; case 1: //N-No stringFields = stringFields + ", qsl_rcvd"; stringData = stringData + ", 'N'"; stringFields = stringFields + ", qsl_rcvd_via"; stringData = stringData + ", 'B'"; //stringFields = stringFields + ", confirmed"; //stringData = stringData + ", '0'"; break; case 2: // R-Requested //QSL received date //(only valid if QSL_RCVD is Y, I, or V) stringFields = stringFields + ", qsl_rcvd"; stringData = stringData + ", 'R'"; //stringFields = stringFields + ", confirmed"; //stringData = stringData + ", '0'"; stringFields = stringFields + ", qsl_rcvd_via"; switch (ii) { case 0: //B stringData = stringData + ", 'B'"; break; case 1: //D stringData = stringData + ", 'D'"; break; case 2: //E stringData = stringData + ", 'E'"; break; case 3: //M stringData = stringData + ", 'M'"; break; default: stringData = stringData + ", 'B'"; break; } break; case 3: // I-Ignore //QSL received date //(only valid if QSL_RCVD is Y, I, or V) stringFields = stringFields + ", qsl_rcvd"; stringData = stringData + ", 'I'"; stringFields = stringFields + ", qslrdate"; stringData = stringData + ", '" + (qslRecQDateEdit->date()).toString("yyyy/MM/dd") + "'"; //stringFields = stringFields + ", confirmed"; //stringData = stringData + ", '0'"; stringFields = stringFields + ", qsl_rcvd_via"; switch (ii) { case 0: //B stringData = stringData + ", 'B'"; break; case 1: //D stringData = stringData + ", 'D'"; break; case 2: //E stringData = stringData + ", 'E'"; break; case 3: //M stringData = stringData + ", 'M'"; break; default: stringData = stringData + ", 'B'"; break; } break; case 4: // V-Verified //QSL received date //(only valid if QSL_RCVD is Y, I, or V) stringFields = stringFields + ", qsl_rcvd"; stringData = stringData + ", 'V'"; stringFields = stringFields + ", qslrdate"; stringData = stringData + ", '" + (qslRecQDateEdit->date()).toString("yyyy/MM/dd") + "'"; //TODO: Check if the QSL has been received or not as this "V" could mask a received QSL as a Worked (0) //stringFields = stringFields + ", confirmed"; //stringData = stringData + ", '0'"; stringFields = stringFields + ", qsl_rcvd_via"; switch (ii) { case 0: //B stringData = stringData + ", 'B'"; break; case 1: //D stringData = stringData + ", 'D'"; break; case 2: //E stringData = stringData + ", 'E'"; break; case 3: //M stringData = stringData + ", 'M'"; break; default: stringData = stringData + ", 'B'"; break; } break; default: //N-No stringFields = stringFields + ", qsl_rcvd"; stringData = stringData + ", 'N'"; stringFields = stringFields + ", qsl_rcvd_via"; stringData = stringData + ", 'B'"; //stringFields = stringFields + ", confirmed"; //stringData = stringData + ", '0'"; break; } // The data reading finish here. Now, we prepare the data to insert into the DB if (stringFields.startsWith(", ") ) { stringFields.remove(0,2); } stringFields += ", call, bandid, modeid, qso_date, time_on, lognumber, rst_sent, rst_rcvd"; if (stringFields.startsWith(", ") ) { stringFields.remove(0,2); } if (stringData.startsWith(", ") ) { stringData.remove(0,1); } stringData.remove(0,1); stringData += QString(", '%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8'").arg(tqrz).arg(tband).arg(tmode).arg(tdate).arg(ttime).arg(QString::number(currentLog)).arg(trsttx).arg(trstrx); if (stringData.startsWith(", ") ) { stringData.remove(0,2); } stringQuery = "INSERT INTO log (" + stringFields + ") values (" + stringData +")" ; return stringQuery; } QString MainWindow::readDataFromUIDXModifying() { //qDebug() << "MainWindow::readDataFromUIDXModifying:" << endl; /* UPDATE table_name SET column1 = value1, column2 = value2...., columnN = valueN WHERE [condition]; */ QString tqrz = (qrzLineEdit->text()).toUpper(); if (tqrz.length()<3) { return "NULL"; } QString stringQuery = "NULL"; QString aux1, aux2; //QString aux, aux2; int tband = currentBand; int tmode = currentMode; QString tdate = (dateEdit->date()).toString("yyyy/MM/dd"); QString ttime = (timeEdit->time()).toString("hh:mm:ss"); QString trsttx = rstTXLineEdit->text(); QString trstrx = rstRXLineEdit->text(); int dxcc = world->getQRZARRLId(tqrz); int cqz = world->getEntityCqz(dxcc); int ituz = world->getEntityItuz(dxcc); /**/ int dxcc2 = getDXCCFromComboBox(); if (dxcc!=dxcc2) { QString dxccn1 = world->getEntityName(dxcc); QString dxccn2 = world->getEntityName(dxcc2); QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("KLog"), tr("You have selected an entity: ")+"("+dxccn2+")\n"+tr("that is different from the\nKLog proposed entity: ")+ "("+dxccn1+")\n\n" +tr("Push Apply to apply your selection."), QMessageBox::Apply | QMessageBox::Discard); if (ret == QMessageBox::Apply) { dxcc = dxcc2; } } /**/ QString updateString = "UPDATE log SET call = '" + tqrz + "', bandid = '" + QString::number(tband) + "', modeid = '" + QString::number(tmode) + "', qso_date = '" + tdate + "', time_on = '" + ttime + "', rst_sent = '" + trsttx + "', rst_rcvd = '" + trstrx + "', lognumber = '" + QString::number(currentLog) + "', "; aux1 = nameLineEdit->text(); if (aux1.length()>1) { updateString = updateString + "name = '"; updateString = updateString + aux1 + "', "; } aux1 = (locatorLineEdit->text()).toUpper(); if ( locator->isValidLocator(aux1) ) { updateString = updateString + "gridsquare = '"; updateString = updateString + aux1 + "', "; } if ( (txFreqSpinBox->value()) > 0 ) { aux1 = QString::number(txFreqSpinBox->value()); if (db->isThisFreqInBand(db->getBandNameFromID2(tband), aux1) ) { updateString = updateString + "freq = '"; updateString = updateString + aux1 + "', "; } else { } } if ( (rxFreqSpinBox->value()) > 0 ) { aux1 = QString::number(rxFreqSpinBox->value()); updateString = updateString + "freq_rx = '"; updateString = updateString + aux1 + "', "; } aux1 = qthLineEdit->text(); if (aux1.length()>2) { updateString = updateString + "qth = '"; updateString = updateString + aux1 + "', "; } aux1 = operatorLineEdit->text(); if (aux1.length()>2) { updateString = updateString + "operator = '"; updateString = updateString + aux1 + "', "; } aux1 = (stationCallSignLineEdit->text()).toUpper(); if (aux1.length()>2) { updateString = updateString + "station_callsign = '"; updateString = updateString + aux1 + "', "; } aux1 = myLocatorLineEdit->text(); if (aux1.length()>2) { updateString = updateString + "my_gridsquare = '"; updateString = updateString + aux1 + "', "; } aux1 = commentLineEdit->text(); if (aux1.length()>0) { updateString = updateString + "comment = '"; updateString = updateString + aux1 + "', "; } /* aux1 = notesTextEdit->toPlainText(); if (aux1.length()>3) { updateString = updateString + "notes = '"; updateString = updateString + aux1 + "', "; } */ aux1 = qslmsgTextEdit->toPlainText(); if (aux1.length()>0) { updateString = updateString + "qslmsg = '"; updateString = updateString + aux1 + "', "; } aux1 = QString::number(dxcc); if (aux1.length()>0) { updateString = updateString + "dxcc = '"; updateString = updateString + aux1 + "', "; } aux1 = QString::number(cqz); if (aux1.length()>0) { updateString = updateString + "cqz = '"; updateString = updateString + aux1 + "', "; } aux1 = QString::number(ituz); if (aux1.length()>0) { updateString = updateString + "ituz = '"; updateString = updateString + aux1 + "', "; } aux1 = qslViaLineEdit->text(); if (aux1.length()>3) { updateString = updateString + "qsl_via = '"; updateString = updateString + aux1 + "', "; } aux1 = QString::number(myPowerSpinBox->value()); if ((aux1.toDouble())>0.0) { updateString = updateString + "tx_pwr = '"; updateString = updateString + aux1 + "', "; } aux1 = QString::number(rxPowerSpinBox->value()); if ((aux1.toDouble())>0.0) { updateString = updateString + "rx_pwr = '"; updateString = updateString + aux1 + "', "; } 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 { updateString = updateString + "iota = '"; updateString = updateString + aux1 + "', "; } else { //qDebug() << "MainWindow::readDataFromUIDX: Modifyng IOTA NOT to be saved! Lenght="<getSatName(); //qDebug() << "MainWindow::readDataFromUIDX: SAT2 " << aux1 << endl; if (aux1.length()>0) { updateString = updateString + "sat_name = '"; updateString = updateString + aux1 + "', "; //updateString = updateString + "prop_mode = '"; //updateString = updateString + "SAT', "; } aux1 = satTabWidget->getSatMode(); if (aux1.length()>0) { updateString = updateString + "sat_mode = '"; updateString = updateString + aux1 + "', "; } aux1 = getPropModeFromComboBox(); //qDebug() << "MainWindow::readDataFromUIDX: PropMode: " << aux1 << endl; if ((aux1.length()>0) && (aux1 != "Not")) { //qDebug() << "MainWindow::readDataFromUIDX: PropMode(1): " << aux1 << endl; updateString = updateString + "prop_mode = '"; updateString = updateString + aux1 + "', "; } else if ((aux1.length()==0) || (aux1 == "Not")) { //qDebug() << "MainWindow::readDataFromUIDX: PropMode(2): " << aux1 << endl; updateString = updateString + "prop_mode = '',"; //updateString = updateString + aux1 + "', "; } else { //qDebug() << "MainWindow::readDataFromUIDX: PropMode(3): " << aux1 << endl; } //CLUBLOG int i = clublogComboBox->currentIndex(); //qsAux << tr("Y-Uploaded") << tr("N-Do not upload") << tr("M-Modified"); switch (i) { case 0: // Y-Yes updateString = updateString + "clublog_qso_upload_status = 'Y', "; updateString = updateString + "clublog_qso_upload_date = '" + (clublogQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; case 1: //N-Do not upload updateString = updateString + "clublog_qso_upload_status = 'N', "; break; case 2: // M-Modified updateString = updateString + "clublog_qso_upload_status = 'M', "; updateString = updateString + "clublog_qso_upload_date = '" + (clublogQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; default: //N-No //TODO: Pending to define a default value, if needed break; } //CLUBLOG // EQSL-SENT i = eqslSentComboBox->currentIndex(); //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); switch (i) { case 0: // Y-Yes updateString = updateString + "eqsl_qsl_sent = 'Y', "; updateString = updateString + "eqsl_qslsdate = '" + (eqslSentQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; case 1: //N-No updateString = updateString + "eqsl_qsl_sent = 'N', "; break; case 2: // R-Requested updateString = updateString + "eqsl_qsl_sent = 'R', "; break; case 3: // Q-Queued updateString = updateString + "eqsl_qsl_sent = 'Q', "; updateString = updateString + "eqsl_qslsdate = '" + (eqslSentQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; case 4: // I-Ignore updateString = updateString + "eqsl_qsl_sent = 'I', "; updateString = updateString + "eqsl_qslsdate = '" + (eqslSentQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; default: //N-No updateString = updateString + "eqsl_qsl_sent = 'N', "; break; } // EQSL-RECEPTION i = eqslRecComboBox->currentIndex(); //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("I-Ignore") << tr("V-Validated"); switch (i) { case 0: // Y-Yes updateString = updateString + "eqsl_qsl_rcvd = 'Y', "; updateString = updateString + "eqsl_qslrdate = '" + (eqslRecQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; case 1: //N-No updateString = updateString + "eqsl_qsl_rcvd = 'N', "; break; case 2: // R-Requested updateString = updateString + "eqsl_qsl_rcvd = 'R', "; break; case 3: // Q-Queued updateString = updateString + "eqsl_qsl_rcvd = 'I', "; updateString = updateString + "eqsl_qslrdate = '" + (eqslRecQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; case 4: // I-Ignore updateString = updateString + "eqsl_qsl_rcvd = 'V', "; updateString = updateString + "eqsl_qslrdate = '" + (eqslRecQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; default: //N-No updateString = updateString + "eqsl_qsl_rcvd = 'N', "; break; } // LOTW-SENT i = lotwSentComboBox->currentIndex(); //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); switch (i) { case 0: // Y-Yes updateString = updateString + "lotw_qsl_sent = 'Y', "; updateString = updateString + "lotw_qslsdate = '" + (lotwSentQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; case 1: //N-No updateString = updateString + "lotw_qsl_sent = 'N', "; break; case 2: // R-Requested updateString = updateString + "lotw_qsl_sent = 'R', "; break; case 3: // Q-Queued updateString = updateString + "lotw_qsl_sent = 'Q', "; updateString = updateString + "lotw_qslsdate = '" + (lotwSentQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; case 4: // I-Ignore updateString = updateString + "lotw_qsl_sent = 'I', "; updateString = updateString + "lotw_qslsdate = '" + (lotwSentQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; default: //N-No updateString = updateString + "lotw_qsl_sent = 'N', "; break; } // LOTW-RECEPTION //LOTW_QSLRDATE: (only valid if LOTW_RCVD is Y, I, or V) i = lotwRecComboBox->currentIndex(); //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("I-Ignore") << tr("V-Validated"); switch (i) { case 0: // Y-Yes updateString = updateString + "lotw_qsl_rcvd = 'Y', "; updateString = updateString + "lotw_qslrdate = '" + (lotwRecQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; case 1: //N-No updateString = updateString + "lotw_qsl_rcvd = 'N', "; break; case 2: // R-Requested updateString = updateString + "lotw_qsl_rcvd = 'R', "; break; case 3: // Q-Queued updateString = updateString + "lotw_qsl_rcvd = 'I', "; updateString = updateString + "lotw_qslrdate = '" + (lotwRecQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; case 4: // I-Ignore updateString = updateString + "lotw_qsl_rcvd = 'V', "; updateString = updateString + "lotw_qslrdate = '" + (lotwRecQDateEdit->date()).toString("yyyy/MM/dd") + "', "; break; default: //N-No updateString = updateString + "lotw_qsl_rcvd = 'N', "; break; } // QSL SENT //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); i = qslSentComboBox->currentIndex(); int ii = qslSentViaComboBox->currentIndex(); switch (i) { case 0: // Y-Yes updateString = updateString + "qsl_sent = 'Y', "; updateString = updateString + "qslsdate = '" + (qslSentQDateEdit->date()).toString("yyyy/MM/dd") + "', "; switch (ii) { case 0: //B updateString = updateString + "qsl_sent_via = 'B', "; break; case 1: //D updateString = updateString + "qsl_sent_via = 'D', "; break; case 2: //E updateString = updateString + "qsl_sent_via = 'E', "; break; case 3: //M updateString = updateString + "qsl_sent_via = 'M', "; break; default: updateString = updateString + "qsl_sent_via = 'B', "; break; } break; case 1: //N-No updateString = updateString + "qsl_sent = 'N', "; updateString = updateString + "qsl_sent_via = 'B', "; break; case 2: // R-Requested updateString = updateString + "qsl_sent = 'R', "; switch (ii) { case 0: //B updateString = updateString + "qsl_sent_via = 'B', "; break; case 1: //D updateString = updateString + "qsl_sent_via = 'D', "; break; case 2: //E updateString = updateString + "qsl_sent_via = 'E', "; break; case 3: //M updateString = updateString + "qsl_sent_via = 'M', "; break; default: updateString = updateString + "qsl_sent_via = 'B', "; break; } break; case 3: // Q-Queued updateString = updateString + "qsl_sent = 'Q', "; updateString = updateString + "qslsdate = '" + (qslSentQDateEdit->date()).toString("yyyy/MM/dd") + "', "; switch (ii) { case 0: //B updateString = updateString + "qsl_sent_via = 'B', "; break; case 1: //D updateString = updateString + "qsl_sent_via = 'D', "; break; case 2: //E updateString = updateString + "qsl_sent_via = 'E', "; break; case 3: //M updateString = updateString + "qsl_sent_via = 'M', "; break; default: updateString = updateString + "qsl_sent_via = 'B', "; break; } break; case 4: // I-Ignore updateString = updateString + "qsl_sent = 'I', "; updateString = updateString + "qslsdate = '" + (qslSentQDateEdit->date()).toString("yyyy/MM/dd") + "', "; switch (ii) { case 0: //B updateString = updateString + "qsl_sent_via = 'B', "; break; case 1: //D updateString = updateString + "qsl_sent_via = 'D', "; break; case 2: //E updateString = updateString + "qsl_sent_via = 'E', "; break; case 3: //M updateString = updateString + "qsl_sent_via = 'M', "; break; default: updateString = updateString + "qsl_sent_via = 'B', "; break; } break; default: //N-No updateString = updateString + "qsl_sent = 'N', "; updateString = updateString + "qsl_sent_via = 'B', "; break; } // QSL RECEPTION i = qslRecComboBox->currentIndex(); ii = qslRecViaComboBox->currentIndex(); switch (i) { //qsAux << tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("I-Ignore") << tr("V-Validated"); case 0: // Y-Yes //QSL received date: {Y, N, R, I, V} //(only valid if QSL_RCVD is Y, I, or V) updateString = updateString + "qsl_rcvd = 'Y', "; updateString = updateString + "qslrdate = '" + (qslRecQDateEdit->date()).toString("yyyy/MM/dd") + "', "; //updateString = updateString + "confirmed = '1', "; switch (ii) { case 0: //B updateString = updateString + "qsl_rcvd_via = 'B', "; break; case 1: //D updateString = updateString + "qsl_rcvd_via = 'D', "; break; case 2: //E updateString = updateString + "qsl_rcvd_via = 'E', "; break; case 3: //M updateString = updateString + "qsl_rcvd_via = 'M', "; break; default: updateString = updateString + "qsl_rcvd_via = 'B', "; break; } break; case 1: //N-No updateString = updateString + "qsl_rcvd = 'N', "; updateString = updateString + "qsl_rcvd_via = 'B', "; //updateString = updateString + "confirmed = '0', "; break; case 2: // R-Requested //QSL received date //(only valid if QSL_RCVD is Y, I, or V) updateString = updateString + "qsl_rcvd = 'R', "; //updateString = updateString + "confirmed = '0', "; switch (ii) { case 0: //B updateString = updateString + "qsl_rcvd_via = 'B', "; break; case 1: //D updateString = updateString + "qsl_rcvd_via = 'D', "; break; case 2: //E updateString = updateString + "qsl_rcvd_via = 'E', "; break; case 3: //M updateString = updateString + "qsl_rcvd_via = 'M', "; break; default: updateString = updateString + "qsl_rcvd_via = 'B', "; break; } break; case 3: // I-Ignore //QSL received date //(only valid if QSL_RCVD is Y, I, or V) updateString = updateString + "qsl_rcvd = 'I', "; //updateString = updateString + "confirmed = '0', "; switch (ii) { case 0: //B updateString = updateString + "qsl_rcvd_via = 'B', "; break; case 1: //D updateString = updateString + "qsl_rcvd_via = 'D', "; break; case 2: //E updateString = updateString + "qsl_rcvd_via = 'E', "; break; case 3: //M updateString = updateString + "qsl_rcvd_via = 'M', "; break; default: updateString = updateString + "qsl_rcvd_via = 'B', "; break; } break; case 4: // V-Verified //QSL received date //(only valid if QSL_RCVD is Y, I, or V) updateString = updateString + "qsl_rcvd = 'V', "; updateString = updateString + "qslrdate = '" + (qslRecQDateEdit->date()).toString("yyyy/MM/dd") + "', "; //updateString = updateString + "confirmed = '1', "; switch (ii) { case 0: //B updateString = updateString + "qsl_rcvd_via = 'B', "; break; case 1: //D updateString = updateString + "qsl_rcvd_via = 'D', "; break; case 2: //E updateString = updateString + "qsl_rcvd_via = 'E', "; break; case 3: //M updateString = updateString + "qsl_rcvd_via = 'M', "; break; default: updateString = updateString + "qsl_rcvd_via = 'B', "; break; } break; default: //N-No updateString = updateString + "qsl_rcvd = 'N', "; updateString = updateString + "qsl_rcvd_via = 'B', "; //updateString = updateString + "confirmed = '0', "; break; } keepSatPage = satTabWidget->getRepeatThis(); // The data reading finish here. Now, we prepare the data to insert into the DB if ( updateString.endsWith(", ") ) { updateString.chop(2); } //stringQuery = "INSERT INTO log (" + stringFields + ") values (" + stringData +")" ; // updateString = "UPDATE log SET call = '" + tqrz + "', bandid = '" + QString::number(tband) + "', modeid = '" + QString::number(tmode) + "', qso_date = '" + tdate + "', time_on = '" + ttime + "', lognumber = '" + QString::number(currentLog) + "', " + updateString; stringQuery = updateString + " WHERE id = " + "'" + QString::number(modifyingQSO) + "'"; //qDebug() << "MainWindow::readDataFromUIDXModifying: queryCreated: " << stringQuery << endl; return stringQuery; } void MainWindow::createlogPanel() { // //qDebug() << "MainWindow::createlogPanel: " << endl; logView->setModel(logModel); QString stringQuery; stringQuery = QString("SELECT * FROM log LIMIT 1"); QSqlQuery query; query.exec(stringQuery); QSqlRecord rec; rec = query.record(); // Number of columns int columns = rec.count(); for (int i=0; i < columns; i++) { logView->setColumnHidden(i, true); } QVBoxLayout *layout = new QVBoxLayout; switch (contestMode) { case CQ_WW_SSB: logLabel = new QLabel(tr("Log")); logLabel->setBuddy(logView); layout->addWidget(logLabel); layout->addWidget(logView); logPanel->setLayout(layout); logPanel->addAction(loggWinAct); logPanel->addAction(scoreeWinAct); columns = rec.indexOf("call"); logView->setColumnHidden(columns, false); columns = rec.indexOf("qso_date"); logView->setColumnHidden(columns, false); columns = rec.indexOf("time_on"); logView->setColumnHidden(columns, false); columns = rec.indexOf("bandid"); logView->setColumnHidden(columns, false); columns = rec.indexOf("modeid"); logView->setColumnHidden(columns, false); columns = rec.indexOf("rst_sent"); logView->setColumnHidden(columns, false); columns = rec.indexOf("stx"); logView->setColumnHidden(columns, false); columns = rec.indexOf("srx"); logView->setColumnHidden(columns, false); columns = rec.indexOf("rst_rcvd"); logView->setColumnHidden(columns, false); columns = rec.indexOf("points"); logView->setColumnHidden(columns, false); columns = rec.indexOf("multiplier"); logView->setColumnHidden(columns, false); break; case CQ_WW_CW: break; default: columns = rec.indexOf("qso_date"); logView->setColumnHidden(columns, false); columns = rec.indexOf("time_on"); logView->setColumnHidden(columns, false); columns = rec.indexOf("call"); logView->setColumnHidden(columns, false); columns = rec.indexOf("rst_sent"); logView->setColumnHidden(columns, false); columns = rec.indexOf("rst_rcvd"); logView->setColumnHidden(columns, false); columns = rec.indexOf("bandid"); logView->setColumnHidden(columns, false); columns = rec.indexOf("modeid"); logView->setColumnHidden(columns, false); columns = rec.indexOf("comment"); logView->setColumnHidden(columns, false); break; } logView->setItemDelegate(new QSqlRelationalDelegate(this)); logView->setSelectionMode( QAbstractItemView::SingleSelection); logView->setSelectionBehavior(QAbstractItemView::SelectRows); logView->resizeColumnsToContents(); logView->horizontalHeader()->setStretchLastSection(true); } void MainWindow::createSearchResultsPanel() { searchBoxClearButton->setToolTip(tr("Clear the searchs")); searchBoxExportButton->setToolTip(tr("Export the search result to an ADIF file")); searchBoxSelectAllButton->setToolTip(tr("Select/Unselect all the QSO of the box")); searchBoxReSearchButton->setToolTip(tr("Search in the log")); searchAllRadioButton->setToolTip(tr("Search in all logs")); searchBoxLineEdit->setToolTip(tr("Enter the QRZ to search")); searchResultsTreeWidget->setToolTip(tr("Search results")); QStringList labels; if (stationCallSignShownInSearch) { labels << tr("QRZ") << tr("Date/Time") << tr("Band") << tr("Mode") << tr("QSL Sent") << tr("QSL Rcvd") << tr("Station Callsign") << tr("Id") ; searchResultsTreeWidget->setColumnCount(8); } else { labels << tr("QRZ") << tr("Date/Time") << tr("Band") << tr("Mode") << tr("QSL Sent") << tr("QSL Rcvd") << tr("Id") ; searchResultsTreeWidget->setColumnCount(7); } searchResultsTreeWidget->setHeaderLabels(labels); //QTreeWidgetItem *item = new QTreeWidgetItem(searchResultsTreeWidget); (searchResultsTreeWidget->header())->resizeSections(QHeaderView::ResizeToContents); searchResultsTreeWidget->clear(); //searchResultsTreeWidget->collapseAll(); searchResultsTreeWidget->setSortingEnabled(true); //searchResultsTreeWidget->setItemsExpandable(false); switch (contestMode) { case CQ_WW_SSB: break; case CQ_WW_CW: break; default: break; } } void MainWindow::createScorePanel() { QVBoxLayout *scoreLayout = new QVBoxLayout; scoreLayout->addWidget(scoreTextEdit); scoreTextEdit->setPlainText("Test TEXT"); scoreWindow->setLayout(scoreLayout); } void MainWindow::createlogModel(const int _i) { /* Log_Id = 0, Log_Name = 1, Log_BandId = 2, Log_ModeId = 3, Log_DateId = 4, Log_TimeId = 5 setRelation ( int column, const QSqlRelation & relation ) model->setTable("employee"); model->setRelation(2, QSqlRelation("city", "id", "name")); The setRelation() call specifies that column 2 in table employee is a foreign key that maps with field id of table city, and that the view should present the city's name field to the user. */ //qDebug() << "MainWindow::createlogModel: " << QString::number(_i) << endl; QSqlQuery q; QString stringQuery = QString("SELECT * from log LIMIT 1"); QSqlRecord rec; // = q.record(); int nameCol; q.exec(stringQuery); q.next(); rec = q.record(); // Number of columns //qDebug() << "MainWindow::createlogModel - columns: " << QString::number(rec.count()) << endl; logModel = new QSqlRelationalTableModel(this); stringQuery = QString("lognumber='%1'").arg(_i); //qDebug() << "MainWindow::createlogModel - filter: " << stringQuery << endl; QSqlQuery query(stringQuery); logModel->setTable("log"); logModel->setFilter(stringQuery); switch (contestMode) { case CQ_WW_SSB: break; case CQ_WW_CW: break; default: nameCol = rec.indexOf("bandid"); logModel->setRelation(nameCol, QSqlRelation("band", "id", "name")); nameCol = rec.indexOf("modeid"); //logModel->setRelation(nameCol, QSqlRelation("mode", "id", "name")); logModel->setRelation(nameCol, QSqlRelation("mode", "id", "submode")); nameCol = rec.indexOf("id"); logModel->setSort(nameCol, Qt::AscendingOrder); nameCol = rec.indexOf("qso_date"); logModel->setHeaderData(nameCol, Qt::Horizontal, tr("Date")); nameCol = rec.indexOf("time_on"); logModel->setHeaderData(nameCol, Qt::Horizontal, tr("Time")); nameCol = rec.indexOf("call"); logModel->setHeaderData(nameCol, Qt::Horizontal,tr("QRZ")); nameCol = rec.indexOf("bandid"); logModel->setHeaderData(nameCol, Qt::Horizontal, tr("Band")); nameCol = rec.indexOf("modeid"); logModel->setHeaderData(nameCol, Qt::Horizontal, tr("Mode")); nameCol = rec.indexOf("rst_sent"); logModel->setHeaderData(nameCol, Qt::Horizontal, tr("RSTtx")); nameCol = rec.indexOf("rst_rcvd"); logModel->setHeaderData(nameCol, Qt::Horizontal, tr("RSTrx")); nameCol = rec.indexOf("comment"); logModel->setHeaderData(nameCol, Qt::Horizontal, tr("Comment")); break; } logModel->select(); createlogPanel(); } void MainWindow::createUICQWW() { //qDebug() << "MainWindow::createUICQWW" << endl; /* QSqlQuery query("SELECT name FROM band"); while (query.next()) { bands << query.value(0).toString(); } QSqlQuery query1("SELECT name FROM mode"); while (query1.next()) { modes << query1.value(0).toString(); } */ //bands << "10M" << "15M" << "20M" << "40M" << "80M" << "160M"; //modes << "SSB" << "CW" << "RTTY"; bandComboBox->addItems(bands); //qDebug() << "MainWindow::createUICQWW - 1-" << QString::number(modes.count()) << endl; modeComboBox->addItems(modes); qrzLineEdit->setToolTip(tr("QRZ of the QSO")); rstTXLineEdit->setToolTip(tr("TX RST")); rstRXLineEdit->setToolTip(tr("RX RST")); STXLineEdit->setToolTip(tr("TX Exchange")); SRXLineEdit->setToolTip(tr("RX Exchange")); bandComboBox->setToolTip(tr("Band of the QSO")); modeComboBox->setToolTip(tr("Mode of the QSO")); dateEdit->setToolTip(tr("Date of the QSO")); timeEdit->setToolTip(tr("Time of the QSO")); //statusBar->setToolTip(tr("Misc information")); //qsoStatusBar->setToolTip(tr("QSO information")); OKButton->setToolTip(tr("Add the QSO to the log")); //spotItButton->setToolTip(tr("Spots this QSO to the DX Cluster")); clearButton->setToolTip(tr("Clears the box")); gridGroupBox = new QGroupBox(tr("Input")); QGridLayout *layout = new QGridLayout; //updateStatusBar(tr("Ready")); //updateQSOStatusBar(tr("Ready")); rstTXLineEdit->setInputMask("990"); rstRXLineEdit->setInputMask("990"); rstTXLineEdit->setText("59"); rstRXLineEdit->setText("59"); rstTXLineEdit->setMaxLength(3); rstRXLineEdit->setMaxLength(3); QGroupBox *RSTrxgroupBox = new QGroupBox(tr("RSTrx")); RSTrxgroupBox->setFlat(true); QVBoxLayout *RSTrxvbox = new QVBoxLayout; RSTrxvbox->addWidget(rstRXLineEdit); RSTrxvbox->addStretch(1); RSTrxgroupBox->setLayout(RSTrxvbox); QGroupBox *RSTtxgroupBox = new QGroupBox(tr("RSTtx")); RSTtxgroupBox->setFlat(true); QVBoxLayout *RSTtxvbox = new QVBoxLayout; RSTtxvbox->addWidget(rstTXLineEdit); RSTtxvbox->addStretch(1); RSTtxgroupBox->setLayout(RSTtxvbox); //QGroupBox *qrzgroupBox = new QGroupBox(tr("QRZ")); qrzgroupBox = new QGroupBox(tr("QRZ")); qrzgroupBox->setFlat(true); QVBoxLayout *qrzvbox = new QVBoxLayout; qrzvbox->addWidget(qrzLineEdit); qrzvbox->addStretch(1); qrzgroupBox->setLayout(qrzvbox); QGroupBox *stxgroupBox = new QGroupBox(tr("STX")); stxgroupBox->setFlat(true); QVBoxLayout *stxvbox = new QVBoxLayout; stxvbox->addWidget(STXLineEdit); stxvbox->addStretch(1); stxgroupBox->setLayout(stxvbox); QGroupBox *srxgroupBox = new QGroupBox(tr("SRX")); srxgroupBox->setFlat(true); QVBoxLayout *srxvbox = new QVBoxLayout; srxvbox->addWidget(SRXLineEdit); srxvbox->addStretch(1); srxgroupBox->setLayout(srxvbox); QHBoxLayout *RSTLayout = new QHBoxLayout; RSTLayout->addWidget(RSTtxgroupBox); RSTLayout->addWidget(RSTrxgroupBox); RSTLayout->addWidget(stxgroupBox); RSTLayout->addWidget(srxgroupBox); QHBoxLayout *TimeLayout = new QHBoxLayout; TimeLayout->addWidget(dateEdit); TimeLayout->addWidget(timeEdit); QHBoxLayout *BandModeLayout = new QHBoxLayout; BandModeLayout->addWidget(bandComboBox); BandModeLayout->addWidget(modeComboBox); //QHBoxLayout *statusBarLayout = new QHBoxLayout; //statusBarLayout->addWidget(statusBar); //statusBarLayout->addWidget(qsoStatusBar); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(OKButton); //buttonsLayout->addWidget(spotItButton); buttonsLayout->addWidget(clearButton); QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate()); dateEdit->setDisplayFormat("yyyy/MM/dd"); timeEdit->setDisplayFormat("HH:mm:ss"); layout->addWidget(qrzgroupBox, 1, 0); layout->addLayout(RSTLayout, 1, 1); layout->addLayout(TimeLayout, 2, 0); layout->addLayout(BandModeLayout, 2, 1); layout->addLayout(buttonsLayout,3, 1); //layout->addLayout(statusBarLayout, 4, 0, 2 , -1); gridGroupBox->setLayout(layout); gridGroupBox->resize(gridGroupBox->minimumSize()); mainWidget->setLayout(layout); } void MainWindow::slotOKButtonClicked(){ //qDebug() << "MainWindow::slotOKButtonClicked: " << endl; slotQRZReturnPressed(); } void MainWindow::createActionsCommon(){ // Functional widgets connections // Return pressed = QSO ENTRY connect(qrzLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(SRXLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(STXLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(rstTXLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(rstRXLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(operatorLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(stationCallSignLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(qslViaLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(myLocatorLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(locatorLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(qthLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(nameLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(locatorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotLocatorTextChanged() ) ); connect(myLocatorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotMyLocatorTextChanged() ) ); //connect(bandComboBox, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); //connect(dateEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); //connect(timeEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); //Actions to pass the focus between QRZ / SRX connect(qrzLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotQRZTextChanged() ) ); connect(SRXLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSRXTextChanged() ) ); connect(STXLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSTXTextChanged() ) ); connect(rstTXLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotrstTXTextChanged() ) ); connect(rstRXLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotrstRXTextChanged() ) ); connect(qslViaLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotQSLViaTextChanged() ) ); connect(bandComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotBandComboBoxChanged() ) ) ; connect(modeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotModeComboBoxChanged() ) ) ; //Buttons Actions connect(OKButton, SIGNAL(clicked()), this, SLOT(slotOKButtonClicked() ) ); //connect(spotItButton, SIGNAL(clicked()), this, SLOT(slotSpotItButtonClicked() ) ); connect(clearButton, SIGNAL(clicked()), this, SLOT(slotClearButtonClicked() ) ); //LOG VIEW connect(logView, SIGNAL(customContextMenuRequested( const QPoint& ) ), this, SLOT(slotRighButtonFromLog( const QPoint& ) ) ); connect(logView, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickLog( const QModelIndex& ) ) ); // SEARCH BOX VIEW connect(searchBoxLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSearchBoxTextChanged() ) ); connect(searchAllRadioButton, SIGNAL(toggled(bool)), this, SLOT(slotSearchBoxSelectAllButtonClicked() ) ); connect(searchResultsTreeWidget, SIGNAL(customContextMenuRequested( const QPoint& ) ), this, SLOT(slotRighButtonSearch( const QPoint& ) ) ); connect(searchResultsTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotDoubleClickSearch(QTreeWidgetItem *, int))); connect(searchResultsTreeWidget, SIGNAL(itemSelectionChanged( ) ), this, SLOT(slotSearchBoxSelectionChanged( ) ) ); //connect(searchResultsTreeWidget, SIGNAL(itemEntered ( QTreeWidgetItem *, int) ), this, SLOT(slotSearchBoxOnItemChanged( QTreeWidgetItem *, int) ) ); connect(searchBoxExportButton, SIGNAL(clicked()), this, SLOT(slotSearchExportButtonClicked() ) ); connect(searchBoxClearButton, SIGNAL(clicked()), this, SLOT(slotSearchClearButtonClicked() ) ); connect(searchBoxSelectAllButton, SIGNAL(clicked()), this, SLOT(slotSearchBoxSelectAllButtonClicked() ) ); connect(searchBoxReSearchButton, SIGNAL(clicked()), this, SLOT(slotSearchBoxReSearchButtonClicked() ) ); connect(operatingYearsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotOperatingYearComboBoxChanged() ) ) ; connect(recalculateAwardsButton, SIGNAL(clicked()), this, SLOT(slotRecalculateAwardsButtonClicked() ) ); //connect(searchResultsTreeWidget, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickSearch( const QModelIndex& ) ) ); //CLUSTER //void clusterSpotToLog(const QStringList _qs); //SIGNAL dxspotclicked(const QStringList _qs) connect(dxClusterWidget, SIGNAL(dxspotclicked(QStringList)), this, SLOT(slotAnalyzeDxClusterSignal(QStringList) ) ); // CLUBLOG connect (elogClublog, SIGNAL (showMessage(QString)), this, SLOT (slotElogClubLogShowMessage(QString))); connect (elogClublog, SIGNAL (actionReturnDownload(int, int)), this, SLOT (slotElogClubLogProcessAnswer(int, int))); connect (elogClublog, SIGNAL (disableClubLogAction(bool)), this, SLOT (slotElogClubLogDisable(bool))); } void MainWindow::slotElogClubLogDisable(const bool _b) { //qDebug() << "MainWindow::slotElogClubLogDisable: " << endl; if (_b) { clublogActive = false; setupDialog->setClubLogActive(false); } else { clublogActive = true; setupDialog->setClubLogActive(true); } //TODO: Disable clublog in the klogrc file //bool FileManager::modifySetupFile(const QString& _filename, const QString _field, const QString _value) filemanager->modifySetupFile(configFileName, "ClubLogActive", "False"); } void MainWindow::slotElogClubLogShowMessage(const QString _s) { //qDebug() << "MainWindow::slotElogClubLogShowMessage: " << _s << endl; updateStatusBar(_s); } void MainWindow::slotElogClubLogProcessAnswer(const int _i, const int _qID) { //qDebug() << "MainWindow::slotElogClubLogProcessAnswer: " <setClubLogSent(_qID, "Y", (clublogQDateEdit->date()).toString("yyyy/MM/dd")); } else { dataProxy->setClubLogSent(_qID, "M", (clublogQDateEdit->date()).toString("yyyy/MM/dd")); } } void MainWindow::slotRecalculateAwardsButtonClicked() { //qDebug() << "MainWindow::recalculateAwardsButtonClicked: " << endl; awards->recalculateAwards(); showAwards(); } void MainWindow::slotExitFromSlotDialog(const int exitID) { //qDebug() << "MainWindow::slotExitFromSlotDialog: " << QString::number(exitID) << endl; if (exitID == 2) { needToEnd = true; close(); } } void MainWindow::createActionsCQWW(){ // Functional widgets connections } void MainWindow::createActionsDX(){ // Functional widgets connections connect(nameLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(qthLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(locatorLineEdit, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed() ) ); connect(iotaContinentComboBox, SIGNAL(activated ( int)), this, SLOT(slotIOTAComboBoxChanged() ) ) ; //QSL Actions connect(qslSentComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotQSLSentComboBoxChanged() ) ) ; connect(qslRecComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotQSLRecvComboBoxChanged() ) ) ; connect(eqslSentComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(sloteQSLSentComboBoxChanged() ) ) ; connect(eqslRecComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(sloteQSLRecvComboBoxChanged() ) ) ; connect(satTabWidget, SIGNAL(setPropModeSat(QString)), this, SLOT(slotSetPropMode(QString)) ) ; } bool MainWindow::checkContest(){ //qDebug() << "MainWindow::checkContest: " << QString::number(contestMode) << endl; //contestNames << "No-Contest" <<"CQ-WW-DX-SSB" << "CQ-WW-DX-CW" << "CQ-WPX-SSB" << "CQ-WPX-CW"; QStringList qs; qs.clear(); QString qsoStatus, aux; int currentEntity = world->getQRZARRLId(currentQrz); int tband = 1 + bandComboBox->currentIndex(); //int tmode = 1 + modeComboBox->currentIndex(); switch (contestMode) { case CQ_WW_SSB: //qDebug() << "MainWindow::checkContest: CQ-WW-SSB:" << QString::number(currentEntity) << "/" << SRXLineEdit->text() << "/" << QString::number(tband) << endl; if ( currentEntity < 1) { return false; } //Multiplier: qs << DX-Entity << DXCQz << DX-band; qs << QString::number(currentEntity) << SRXLineEdit->text() << QString::number(tband); if (contest->isMultiplier(qs)){ qrzgroupBox->setTitle(tr("NEW MULT")); //qsoStatus = tr("MULT"); aux = " + (M + "; qsoMultiplier = 1; }else{ //qsoStatus = tr("NO MULT"); aux.clear(); qsoMultiplier = 0; } // Points: //_qs << DX-Entity << DX-Continent qs.clear(); qs << QString::number(currentEntity) << QString::number(world->getContinentNumber(currentEntity)); qsoPoints = contest->getQSOPoints(qs); if (aux == " + (M + ") { qsoStatus = "Total: " + QString::number(contest->getTotalScore()) + aux + QString::number(qsoPoints) + " points)"; // qsoStatus + " / " + QString::number(qsoPoints) + tr(" points"); } else { qsoStatus = "Total: " + QString::number(contest->getTotalScore()) + " ( " + QString::number(qsoPoints) + " points)"; // qsoStatus + " / " + QString::number(qsoPoints) + tr(" points"); } //qDebug() << "MainWindow::checkContest Points: " << QString::number(contest->getQSOPoints(qs)) << endl; //qDebug() << "MainWindow::checkContest Continent: " << world->getQRZContinentNumber(qrzLineEdit->text()) << endl; break; case CQ_WW_CW: //qDebug() << "MainWindow::checkContest: CQ-WW-CW:" << endl; break; default: //qDebug() << "MainWindow::checkContest: Default:" << endl; break; } updateStatusBar(qsoStatus); //statusBar()->showMessage(qsoStatus); //updateQSOStatusBar(qsoStatus); return false; } void MainWindow::slotQSLViaTextChanged() { //qDebug() << "MainWindow::slotQSLViaTextChanged: " << qslViaLineEdit->text() << " / Length: " << QString::number((qslViaLineEdit->text()).size()) << endl; qslViaLineEdit->setText((qslViaLineEdit->text()).toUpper()); } 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)=='/') )) { return false; } } return true; } void MainWindow::slotQRZTextChanged() { //qDebug()<< "MainWindow::slotQRZTextChanged: " << qrzLineEdit->text() << " / Length: " << QString::number((qrzLineEdit->text()).size()) << "###### START ######" << endl; if (cleaning) { return; } if (qrzAutoChanging) { qrzAutoChanging = false; return; } 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(); //qDebug()<< "MainWindow::slotQRZTextChanged: Space detected" << endl; } qrzLineEdit->setText(((qrzLineEdit->text())).simplified()); qrzLineEdit->setText((qrzLineEdit->text()).remove(" ")); qrzLineEdit->setText((qrzLineEdit->text()).toUpper()); if (!validCharactersInCall(qrzLineEdit->text())) { infoLabel1->setText(tr("Not valid characters in the QRZ box")); InValidCharsInPrevCall = true; return; } if (((qrzLineEdit->text()).length() < 1)) { // If QRZ box is blank, Information labels should be cleared. infoLabel1->clear(); infoLabel2->clear(); slotClearButtonClicked(); return; } if ((modify) || ((qrzLineEdit->text()).length() < 1) || (qrzSmallModDontCalculate)) { //qDebug() << "MainWindow::slotQRZTextChanged: MODIFY or Lenght < 1" << endl; qrzSmallModDontCalculate=false; return; } 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(); if ((currentQrz).count('\\')){ // Replaces \ by / to ease operation. currentQrz.replace(QChar('\\'), QChar('/')); qrzLineEdit->setText(currentQrz); } currentQrz = qrzLineEdit->text(); if (cursorP>currentQrz.length()) {// A Space that has been removed without updating the cursor //qDebug()<< "MainWindow::slotQRZTextChanged: cursorP > currentQRZ.length" << endl; } else { if ((currentQrz.at(cursorP-1)).isSpace()) { previousQrz = currentQrz.remove(cursorP-1, 1); cursorP--; qrzLineEdit->setText(previousQrz); } } currentQrz = qrzLineEdit->text(); currentEntity = world->getQRZARRLId(currentQrz); selectCorrectComboBoxEntity(currentEntity); //qDebug() << "MainWindow::slotQRZTextChanged: Entity: " << QString::number(currentEntity) << endl; 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 (dx_CQz == dxE_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) { _qs << currentQrz << QString::number(currentBand) << QString::number(currentMode) << QString::number(currentLog); } else { _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 ){ SRXLineEdit->setText(QString::number(dx_CQz)); }else{ //qDebug() << "MainWindow::checkContest CQZ < 0"<< endl; } if (currentEntity>0){ updateStatusBar(world->getEntityName(currentEntity) + " - CQ: " + QString::number(dx_CQz) + " - ITU: " + QString::number(dx_ITUz)); } else { updateStatusBar(tr("Ready...")); } i = checkIfWorkedB4(currentQrz); checkContest(); break; case CQ_WW_CW: //qDebug() << "MainWindow::slotQRZTextChanged: CQ-WW-CW:" << endl; break; 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) || (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, 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 ); } else { 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; } break; } qrzSmallModDontCalculate = false; // If the text has not been modified in this method qrzLineEdit->setCursorPosition(cursorP); completeWithPreviousQSO(currentQrz); qrzAutoChanging = false; //qDebug() << "MainWindow::slotQRZTextChanged: END" << endl; } void MainWindow::slotSearchBoxReSearchButtonClicked() { slotSearchBoxTextChanged(); } /* void MainWindow::slotSearchBoxOnItemChanged( QTreeWidgetItem * item, int column) { //qDebug() << "MainWindow::slotSearchBoxOnItemChanged: " << (item->data (0, Qt::DisplayRole)).toString() << QString::number(column) << endl; //searchResultsTreeWidget //item->data (0, Qt::DisplayRole) } */ void MainWindow::slotSearchClearButtonClicked() { //qDebug() << "MainWindow::slotSearchClearButtonClicked: " << endl; searchResultsTreeWidget->clear(); searchBoxLineEdit->clear(); searchSelectAllClicked = false; qslingNeeded = false; } void MainWindow::slotSearchBoxSelectAllButtonClicked() { //qDebug() << "MainWindow::slotSearchBoxSelectAllButtonClicked: " << endl; if (searchSelectAllClicked) { //qDebug() << "MainWindow::slotSearchBoxSelectAllButtonClicked: UN-SELECTING" << endl; searchSelectAllClicked = false; searchResultsTreeWidget->clearSelection(); searchBoxSelectAllButton->setText(tr("&Select All")); } else { //qDebug() << "MainWindow::slotSearchBoxSelectAllButtonClicked: SELECTING" << endl; searchSelectAllClicked = true; searchResultsTreeWidget->selectAll(); searchBoxSelectAllButton->setText(tr("&Clear selection")); } } void MainWindow::slotSearchExportButtonClicked() { //qDebug() << "MainWindow::slotSearchExportButtonClicked: " << endl; // MARK QSOs // SAVE MARKED QSOs TO FILE // UNMARK QSOs int _qsoId = 0; int i = 0; QString stringQuery; QSqlQuery query; QTreeWidgetItem *item = searchResultsTreeWidget->topLevelItem(i); while (i <= searchResultsTreeWidget->topLevelItemCount() ) { item = searchResultsTreeWidget->topLevelItem(i); if (item == 0) { i = searchResultsTreeWidget->topLevelItemCount() + 1; //qDebug() << "MainWindow::slotSearchExportButtonClicked: ITEM = 0" << endl; } else { if (stationCallSignShownInSearch) { _qsoId = ((item)->text(7)).toInt(); } else { _qsoId = ((item)->text(6)).toInt(); } if ((item)->isSelected()) { stringQuery = QString("UPDATE log SET marked = 'X' WHERE id='%1'").arg(_qsoId); query.exec(stringQuery); //TODO: Prepare this while/query execution i++; //qDebug() << "MainWindow::slotSearchExportButtonClicked: ITEM MARKED: " << QString::number(_qsoId) << endl; } else { stringQuery = QString("UPDATE log SET marked = 'N' WHERE id='%1'").arg(_qsoId); query.exec(stringQuery); //TODO: Prepare this while/query execution i++; //qDebug() << "MainWindow::slotSearchExportButtonClicked: ITEM NOT MARKED: " << QString::number(_qsoId) << endl; } } } //qDebug() << "MainWindow::slotSearchExportButtonClicked: to Ask filename" << endl; QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), kontestDir, tr("ADIF (*.adi *.adif)")); //qDebug() << "MainWindow::slotSearchExportButtonClicked: to call save file" << endl; filemanager->adifLogExportMarked(fileName); //qDebug() << "MainWindow::slotSearchExportButtonClicked: unmarking..." << endl; //db->unMarkAllQSO(); //RECORRER EL CUADRO, MARCANDO TODOS LOS QSO EN EL LOG. DESPUES LLAMAR AL METODO QUE LO EXPORTA A UN // FICHERO // DESMARCAR. /* QTreeWidgetItem *item = searchResultsTreeWidget->itemAt(pos); int _qsoID; if (item) { // 6 is the column in the searchResultsTreeWidget where the id is saved _qsoID = ((item)->text(6)).toInt(); QString stringQuery = QString("UPDATE log SET marked = 'N' WHERE 1"); QSqlQuery query(stringQuery); //qDebug() << "MainWindow::slotQSLSentViaBureauFromLog: " << stringQuery << endl; query.exec(stringQuery); */ } void MainWindow::slotSearchBoxTextChanged() { //qDebug() << "MainWindow::slotSearchBoxTextChanged: " << searchBoxLineEdit->text() << endl; //int nameCol; QString _id, _call, _dateTime, _band, _bandid, _mode, _qsltx, _qslrx, _stationcallsign; QStringList q; bool searchAll = searchAllRadioButton->isChecked(); int i = -1; int cursorP = searchBoxLineEdit->cursorPosition(); searchBoxLineEdit->setText((searchBoxLineEdit->text()).toUpper()); if ((searchBoxLineEdit->text()).length() < 2) { searchResultsTreeWidget->clear(); return; } qslingNeeded = false; // If I am searching I am not longer looking for QSO to QSL QString theCall = searchBoxLineEdit->text(); searchResultsTreeWidget->clear(); QSqlQuery query; QString queryString, aux; if (searchAll) { queryString = QString("SELECT call, qso_date, time_on, bandid, modeid, qsl_rcvd, qsl_sent, station_callsign, id FROM log WHERE call LIKE '%%1%'").arg(theCall); } else { queryString = QString("SELECT call, qso_date, time_on, bandid, modeid, qsl_rcvd, qsl_sent, station_callsign, id FROM log WHERE call LIKE '%%1%' AND lognumber='%2'").arg(theCall).arg(currentLog); } //qDebug() << "MainWindow::slotSearchBoxTextChanged: queryString" << queryString << endl; query.exec(queryString); QSqlRecord rec = query.record(); int nameCol = -1; //qDebug() << "MainWindow::slotSearchBoxTextChanged: queryString EXECUTED!" << endl; QColor color; //QSqlRecord rec = query.record(); QFont font; font.setBold(true); while (query.next()) { if (query.isValid()) { nameCol = rec.indexOf("call"); _call= (query.value(nameCol)).toString(); //nameCol = rec.indexOf("call"); //_call= (query.value(0)).toString(); nameCol = rec.indexOf("qso_date"); _dateTime = (query.value(nameCol)).toString(); //_dateTime = (query.value(1)).toString(); nameCol = rec.indexOf("time_on"); _dateTime = _dateTime + "-" +(query.value(nameCol)).toString(); //_dateTime = _dateTime + "-" +(query.value(2)).toString(); nameCol = rec.indexOf("bandid"); _bandid = (query.value(nameCol)).toString(); //qDebug() << "MainWindow::slotSearchBoxTextChanged: band: " << QString::number((query.value(3)).toInt()) << endl; _band = dataProxy->getNameFromBandId(_bandid.toInt()); //qDebug() << "MainWindow::slotSearchBoxTextChanged: _band: " << _band << endl; nameCol = rec.indexOf("modeid"); //qDebug() << "MainWindow::slotSearchBoxTextChanged: mode: " << QString::number((query.value(nameCol)).toInt()) << endl; //_mode = dataProxy->getNameFromModeId((query.value(4)).toInt()); _mode = dataProxy->getNameFromSubModeId((query.value(nameCol)).toInt()); //_mode = query.value(4).toString(); //qDebug() << "MainWindow::slotSearchBoxTextChanged: mode(b) : " << _mode << endl; //nameCol = rec.indexOf("qsl_sent"); //_qsltx = (query.value(nameCol)).toString(); nameCol = rec.indexOf("qsl_rcvd"); _qsltx = (query.value(nameCol)).toString(); if (_qsltx.length()<1) { _qsltx = "N"; } //nameCol = rec.indexOf("qsl_rcvd"); //_qslrx = (query.value(nameCol)).toString(); nameCol = rec.indexOf("qsl_sent"); _qslrx = (query.value(nameCol)).toString(); if (_qslrx.length()<1) { _qslrx = "N"; } if (stationCallSignShownInSearch) { nameCol = rec.indexOf("station_callsign"); _stationcallsign = (query.value(nameCol)).toString(); //if (_stationcallsign.length()<3) //{ // _stationcallsign = stationQRZ; //} nameCol = rec.indexOf("id"); _id = (query.value(nameCol)).toString(); } else { nameCol = rec.indexOf("id"); _id = (query.value(nameCol)).toString(); } q.clear(); if (!manageMode) { q << _call << _bandid << "-1" << QString::number(currentLog); } else { q << _call << _bandid << _mode << QString::number(currentLog); } //QColor color = Qt::red; //color = Qt::red; //TODO: Optimize the awards->getQRZDXStatusColor because is TOO slow color = awards->getQRZDXStatusColor(q); //_mode = dataProxy->getSubModeFromId(_mode.toInt()); //_mode = db->getModeNameFromNumber(_mode.toInt()); /* awards.getQRZDXStatusColor(const QStringList _qs); // Receives: QStringList _qs; //_qs << QRZ << BandId << lognumber; */ QTreeWidgetItem *item = new QTreeWidgetItem(searchResultsTreeWidget); i = world->getQRZARRLId(_call); aux = world->getEntityName(i) + " - CQ: " + QString::number(world->getEntityCqz(i)); item->setToolTip(0, aux); item->setToolTip(1, aux); item->setToolTip(2, aux); item->setToolTip(3, aux); item->setToolTip(4, aux); item->setToolTip(5, aux); item->setToolTip(6, aux); //item->setToolTip(0, world->getQRZEntityName(_call)); item->setText(0, _call); item->setFont(0, font); item->setText(1, _dateTime); item->setText(2, _band); //qDebug() << "MainWindow::slotSearchBoxTextChanged: mode(c) : " << _mode << endl; item->setText(3, _mode); item->setText(4, _qslrx); item->setText(5, _qsltx); if (stationCallSignShownInSearch) { item->setText(6, _stationcallsign); item->setText(7, _id); item->setToolTip(7, aux); } else { item->setText(6, _id); } item->setForeground(0, QBrush(color)); } // Closes if next.isValid } // Closes While (searchResultsTreeWidget->header())->resizeSections(QHeaderView::ResizeToContents); /* if (((theCall.at(cursorP-1)).isSpace()) && (cursorP>1)) { ->setText(theCall.remove(cursorP-1, 1)); cursorP--; } */ searchBoxLineEdit->setCursorPosition(cursorP); } void MainWindow::slotSearchBoxSelectionChanged() {// Detects when a selection has been done in the search box and changes // The button to clear selection //qDebug() << "MainWindow::slotSearchBoxSelectionChanged: " << endl; if ((searchResultsTreeWidget->selectedItems()).size() > 0 ) { searchBoxSelectAllButton->setText(tr("&Clear selection")); searchSelectAllClicked = true; } else { searchBoxSelectAllButton->setText(tr("&Select All")); searchSelectAllClicked = false; } /* if (searchSelectAllClicked) { //qDebug() << "MainWindow::slotSearchBoxSelectAllButtonClicked: UN-SELECTING" << endl; searchSelectAllClicked = false; searchResultsTreeWidget->clearSelection(); searchBoxSelectAllButton->setText(tr("&Select All")); } else { //qDebug() << "MainWindow::slotSearchBoxSelectAllButtonClicked: SELECTING" << endl; searchSelectAllClicked = true; searchResultsTreeWidget->selectAll(); searchBoxSelectAllButton->setText(tr("&Clear selection")); } */ } void MainWindow::slotQRZSpacePressed() { //qDebug() << "MainWindow::slotQRZSpacePressed: " << endl; } void MainWindow::slotSRXTextChanged() { //qDebug() << "MainWindow::slotSRXTextChanged: " << SRXLineEdit->text() << endl; srx = SRXLineEdit->text(); //int i = srx.size(); if ( srx.endsWith(' ') ) { /*Remove the space and moves the focus to QRZ*/ srx = srx.simplified(); SRXLineEdit->setText(srx); qrzLineEdit->setFocus(Qt::OtherFocusReason); } } void MainWindow::slotSTXTextChanged() { //qDebug() << "MainWindow::slotSTXTextChanged: " << STXLineEdit->text() << endl; stx = STXLineEdit->text(); //int i = stx.size(); if ( stx.endsWith(' ') ) { /*Remove the space and moves the focus to QRZ*/ stx = stx.simplified(); STXLineEdit->setText(stx); SRXLineEdit->setFocus(Qt::OtherFocusReason); } } void MainWindow::slotrstTXTextChanged() { } void MainWindow::slotrstRXTextChanged() { } void MainWindow::slotSpotItButtonClicked() { if (!dxClusterWidget->isConnected()) { return; } } void MainWindow::slotClearButtonClicked() { //qDebug()() << "MainWindow::slotClearButtonClicked" << endl; cleaning = true; modify = false; OKButton->setText(tr("&Add")); modifyingQSO = -1; qrzLineEdit->clear(); qrzLineEdit->setFocus(Qt::OtherFocusReason); rstTXLineEdit->setText("59"); rstRXLineEdit->setText("59"); qthLineEdit->clear(); //qDebug() << "MainWindow::slotClearButtonClicked: - band: " << QString::number(currentBand) << endl; //qDebug() << "MainWindow::slotClearButtonClicked: - mode: " << QString::number(currentMode) << endl; bandComboBox->setCurrentIndex(bandComboBox->findText(dataProxy->getNameFromBandId(currentBand))); //qDebug() << "MainWindow::MainWindow: 12 - currentMode: " << QString::number(currentMode) << endl; modeComboBox->setCurrentIndex(modeComboBox->findText(dataProxy->getNameFromSubModeId(currentMode))); qsoPoints = 0; qsoMultiplier = 0; clublogAnswer = -1; clublogPrevQSO.clear(); switch (contestMode) { case CQ_WW_SSB: SRXLineEdit->clear(); STXLineEdit->setText( QString::number( world->getQRZCqz(stationQRZ) ) ); qrzgroupBox->setTitle(tr("QRZ")); break; case CQ_WW_CW: SRXLineEdit->clear(); STXLineEdit->setText( QString::number( world->getQRZCqz(stationQRZ) ) ); qrzgroupBox->setTitle(tr("QRZ")); break; default: SRXLineEdit->setText("59"); STXLineEdit->setText("59"); nameLineEdit->clear(); locatorLineEdit->clear(); txFreqSpinBox->setValue(0); rxFreqSpinBox->setValue(0); //freqQLCDNumber->display(0); //notesTextEdit->clear(); commentLineEdit->clear(); infoLabel1->clear(); infoLabel2->clear(); rxPowerSpinBox->setValue(0); clublogComboBox->setCurrentIndex(1); qslSentViaComboBox->setCurrentIndex(0); // has to be changed before the qslSentComboBox to avoid calling the slot qslRecViaComboBox->setCurrentIndex(0); // has to be changed before the qslRecComboBox to avoid calling the slot qslSentComboBox->setCurrentIndex(0); // has to be changed before the qslSentComboBox to avoid calling the slot qslRecComboBox->setCurrentIndex(1); // Not received qslSentComboBox->setCurrentIndex(1); // Not sent eqslSentComboBox->setCurrentIndex(1); eqslRecComboBox->setCurrentIndex(1); lotwSentComboBox->setCurrentIndex(1); lotwRecComboBox->setCurrentIndex(1); qslmsgTextEdit->clear(); qslViaLineEdit->clear(); entityNameComboBox->setCurrentIndex(0); propModeComboBox->setCurrentIndex(0); iotaContinentComboBox->setCurrentIndex(0); iotaNumberLineEdit->setText("000"); continentLabel->setText(""); prefixLabel->setText(""); cqzLabel->setText("0"); ituzLabel->setText("0"); if (!keepMyData) { myPowerSpinBox->setValue(lastPower); operatorLineEdit->setText(lastOperatorQRZ.toUpper()); stationCallSignLineEdit->setText(lastStationQRZ.toUpper()); myLocatorLineEdit->setText(lastMyLocator); } else { myPowerSpinBox->setValue(myPower); operatorLineEdit->setText(operatorQRZ.toUpper()); stationCallSignLineEdit->setText(stationQRZ.toUpper()); myLocatorLineEdit->setText(myLocator); } if (!satTabWidget->getRepeatThis()) { satTabWidget->clear(); } clearInfoFromLocators(); clearBandLabels(); //showAwards(); break; } statusBar()->clearMessage(); cleaning = false; } void MainWindow::clearBandLabels() { bandLabel1->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel2->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel3->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel4->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel5->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel6->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel7->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel8->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel9->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel10->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel11->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); bandLabel12->setStyleSheet("* { background-color: " + defaultColor.name() + "; }"); } void MainWindow::slotUpdateTime() { // //qDebug() << "MainWindow::slotUpdateTime: " << (dateTime->currentDateTime()).toString("yyyy-MM-dd - hh:mm:ss") << endl; // ((dateTime->currentDateTimeUtc()).date()).toString() //(dateTime->currentDateTime()).date() dateTime->currentDateTime(); if ( (!modify) && (realTime) ) { //dateTime->currentDateTime(); dateEdit->setDate((dateTime->currentDateTime()).date()); if (UTCTime) { timeEdit->setTime((dateTime->currentDateTime().toUTC()).time()); } else { timeEdit->setTime((dateTime->currentDateTime()).time()); } } } void MainWindow::closeEvent(QCloseEvent *event) { //qDebug() << "MainWindow::closeEvent" << endl; if (maybeSave()) { db->unMarkAllQSO(); //slotFileClose(); dataProxy->compressDB(); //db->compress(); event->accept(); } else { event->ignore(); } } bool MainWindow::maybeSave() { //qDebug() << "MainWindow::maybeSave" << endl; if ((alwaysADIF) || (DBinMemory) ) { if (needToSave) { QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("KLog"), tr("The logfile has been modified.\n" "Do you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); if (ret == QMessageBox::Save) { if (useDefaultLogFileName) { return saveFile(defaultADIFLogFile); } else { return saveFileAs(); } } else if (ret == QMessageBox::Cancel) return false; } } return true; } void MainWindow::createMenusCommon() { //qDebug() << "MainWindow::createMenusCommon" << endl; fileMenu = menuBar()->addMenu(tr("&File")); openAct = new QAction(tr("&New..."), this); fileMenu->addAction(openAct); //openAct->setShortcut(Qt::CTRL + Qt::Key_N); connect(openAct, SIGNAL(triggered()), this, SLOT(newFile())); klogFolderAct = new QAction(tr("KLog folder"), this); fileMenu->addAction(klogFolderAct); connect(klogFolderAct, SIGNAL(triggered()), this, SLOT(slotOpenKLogFolder())); openAct = new QAction(tr("&Open..."), this); fileMenu->addAction(openAct); openAct->setShortcut(Qt::CTRL + Qt::Key_O); connect(openAct, SIGNAL(triggered()), this, SLOT(openFile())); saveAct = new QAction(tr("&Save As..."), this); fileMenu->addAction(saveAct); saveAct->setShortcut(Qt::CTRL + Qt::Key_S); connect(saveAct, SIGNAL(triggered()), this, SLOT(saveFileAs())); fileMenu->addSeparator(); printLogAct = new QAction(tr("&Print Log..."), this); fileMenu->addAction(printLogAct); printLogAct->setShortcut(Qt::CTRL + Qt::Key_P); connect(printLogAct, SIGNAL(triggered()), this, SLOT(slotFilePrint())); fileMenu->addSeparator(); exitAct = new QAction(tr("E&xit"), this); fileMenu->addAction(exitAct); exitAct->setMenuRole(QAction::QuitRole); exitAct->setShortcut(Qt::CTRL + Qt::Key_X); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); toolMenu = menuBar()->addMenu(tr("&Tools")); ADIFExport = new QAction(tr("&Export to ADIF..."), this); toolMenu->addAction(ADIFExport); //ADIFExport->setMenuRole(QAction::ApplicationSpecificRole); connect(ADIFExport, SIGNAL(triggered()), this, SLOT(slotADIFExport())); ADIFExport->setToolTip(tr("Export the current log to an ADIF logfile")); ADIFExportAll = new QAction(tr("&Export all logs to ADIF..."), this); toolMenu->addAction(ADIFExportAll); //ADIFExport->setMenuRole(QAction::ApplicationSpecificRole); connect(ADIFExportAll, SIGNAL(triggered()), this, SLOT(slotADIFExportAll())); ADIFExportAll->setToolTip(tr("Export ALL the QSO coming from ALL the logs in the same logfile. QSOs will be mixed up in the same ADIF file.")); ADIFImport = new QAction(tr("&Import from ADIF..."), this); toolMenu->addAction(ADIFImport); //ADIFImport->setMenuRole(QAction::ApplicationSpecificRole); connect(ADIFImport, SIGNAL(triggered()), this, SLOT(slotADIFImport())); ADIFImport->setToolTip(tr("Import an ADIF file in the current log")); toolMenu->addSeparator(); fillQsoAct = new QAction(tr("Fill QSO data"), this); toolMenu->addAction(fillQsoAct); //fillQsoAct->setMenuRole(QAction::ApplicationSpecificRole); connect(fillQsoAct, SIGNAL(triggered()), this, SLOT(fillQSOData())); fillQsoAct->setToolTip(tr("Run the log reusing previous QSO to reuse and fill missing information in other QSO")); toolMenu->addSeparator(); findQSO2QSLAct = new QAction(tr("&Find QSO to QSL"), this); toolMenu->addAction(findQSO2QSLAct); //findQSO2QSLAct->setMenuRole(QAction::ApplicationSpecificRole); connect(findQSO2QSLAct, SIGNAL(triggered()), this, SLOT(slotToolSearchNeededQSLToSend())); findQSO2QSLAct->setToolTip(tr("Shows QSO that are needed and you should send your QSL and request the DX-QSL")); findRequestedQSLAct = new QAction(tr("Find &requested MY-QSL"), this); toolMenu->addAction(findRequestedQSLAct); //findQSO2QSLAct->setMenuRole(QAction::ApplicationSpecificRole); connect(findRequestedQSLAct, SIGNAL(triggered()), this, SLOT(slotToolSearchRequestedQSLToSend())); findRequestedQSLAct->setToolTip(tr("Shows the QSO that have requested my QSL to be sent and is still pending. You should keep this queue empty!")); findQSLPendingToReceiveAct = new QAction(tr("&Find pending to receive DX-QSL"), this); toolMenu->addAction(findQSLPendingToReceiveAct); connect(findQSLPendingToReceiveAct, SIGNAL(triggered()), this, SLOT(slotToolSearchNeededQSLPendingToReceive())); findQSLPendingToReceiveAct->setToolTip(tr("Shows the DX-QSL that has been requested or simply my QSL has been sent with no answer")); findQSLDXRequestedAct = new QAction(tr("&Find requested DX-QSL"), this); toolMenu->addAction(findQSLDXRequestedAct); connect(findQSLDXRequestedAct, SIGNAL(triggered()), this, SLOT(slotToolSearchNeededQSLRequested())); findQSLDXRequestedAct->setToolTip(tr("Shows the DX-QSL that has been requested")); ReqQSLExport = new QAction(tr("&Export Requested QSL to ADIF..."), this); toolMenu->addAction(ReqQSLExport); connect(ReqQSLExport, SIGNAL(triggered()), this, SLOT(slotRQSLExport())); ReqQSLExport->setToolTip(tr("Export all requested My-QSL QSO to an ADIF file (i.e. to import it in a QSL tag printing software)")); toolMenu->addSeparator(); downloadCTYAct = new QAction (tr("&Update CTY.CSV"), this); toolMenu->addAction(downloadCTYAct); //downloadCTYAct->setMenuRole(QAction::ApplicationSpecificRole); connect(downloadCTYAct, SIGNAL(triggered()), this, SLOT(slotUpdateCTYDAT())); downloadCTYAct->setToolTip(tr("Update the country file to have updated DX-Entity data")); toolMenu->addSeparator(); //removeAct = new QAction(tr("&Remove Entry"), this); //removeAct->setEnabled(false); //toolMenu->addAction(removeAct); //connect(removeAct, SIGNAL(triggered()), addressWidget, SLOT(removeEntry())); //connect(addressWidget, SIGNAL(selectionChanged(QItemSelection)), this, SLOT(updateActions(QItemSelection))); //viewMenu = menuBar()->addMenu(tr("&View")); setupMenu = menuBar()->addMenu(tr("&Setup")); setupAct = new QAction(tr("&Setup..."), this); setupMenu->addAction(setupAct); setupAct->setMenuRole(QAction::PreferencesRole); connect(setupAct, SIGNAL(triggered()), this, SLOT(slotSetup())); //TODO: To be added once the help dialog has been implemented helpMenu = menuBar()->addMenu(tr("&Help")); helpAct = new QAction(tr("&Help..."), this); helpMenu->addAction(helpAct); connect(helpAct, SIGNAL(triggered()), this, SLOT(slotHelpHelpAction())); aboutAct = new QAction(tr("&About..."), this); helpMenu->addAction(aboutAct); aboutAct->setMenuRole(QAction::AboutRole); connect(aboutAct, SIGNAL(triggered()), this, SLOT(slotHelpAboutAction())); aboutQtAct = new QAction(tr("About Qt..."), this); helpMenu->addAction(aboutQtAct); aboutQtAct->setMenuRole(QAction::AboutRole); connect(aboutQtAct, SIGNAL(triggered()), this, SLOT(slotAboutQt())); } void MainWindow::slotAboutQt() { QMessageBox::aboutQt(this,tr("About...")); } void MainWindow::slotHelpHelpAction() { //qDebug() << "MainWindow::slotHelpHelpAction" << endl; helpHelpDialog->exec(); } void MainWindow::slotHelpAboutAction() { //qDebug() << "MainWindow::slotHelpAboutAction " << endl; // QMessageBox::about(this, tr("About KLog"), // tr("KLog " // "Find the last release at http://jaime.robles.es/klog.")); helpAboutDialog->exec(); } void MainWindow::createMenusCQWW() { //qDebug() << "MainWindow::createMenusCQWW" << endl; /* logWinAct = new QAction(tr("&Log Window"), this); logWinAct->setCheckable(true); logWinAct->setShortcut(Qt::CTRL + Qt::Key_L); viewMenu->addAction(logWinAct); connect(logWinAct, SIGNAL(triggered()), this, SLOT(slotLogWinShow())); scoreWinAct = new QAction(tr("&Points Window"), this); scoreWinAct->setCheckable(true); scoreWinAct->setShortcut(Qt::CTRL + Qt::Key_P); viewMenu->addAction(scoreWinAct); connect(scoreWinAct, SIGNAL(triggered()), this, SLOT(slotScoreWinShow())); CabrilloExport = new QAction(tr("&Export to Cabrillo..."), this); toolMenu->addAction(CabrilloExport); connect(CabrilloExport, SIGNAL(triggered()), this, SLOT(slotCabrilloExport())); */ } void MainWindow::slotLogWinShow() { //qDebug() << "MainWindow::slotLogWinShow: " << endl; if (!(logPanel->isVisible()) ) { logWinAct->setChecked ( true ); logPanel->show(); }else { logWinAct->setChecked ( false ); logPanel->hide(); } } void MainWindow::slotScoreWinShow() { //qDebug() << "MainWindow::slotScoreWinShow: " << endl; if (!(scoreWindow->isVisible()) ) { scoreWinAct->setChecked ( true ); scoreWindow->show(); }else { scoreWinAct->setChecked ( false ); scoreWindow->hide(); } } void MainWindow::slotSetup(const int _page) { //qDebug() << "MainWindow::slotSetup - 01" << endl; if (!needToEnd) { setupDialog->setData(configFileName, softwareVersion, _page, !configured); setupDialog->exec(); if (needToEnd) { return; } else { readConfigData(); } createlogModel(currentLog); if (configured) { } else { } } defineStationCallsign(); //checkIfNewBandOrMode(); } void MainWindow::openFile() { int lastLog = currentLog; slotSetup(6); if (lastLog == currentLog) { // It seems that the user didn't really want a new log return; } logModel->select(); } bool MainWindow::saveFile(const QString _fileName) { //qDebug() << "MainWindow::saveFile: " << _fileName << endl; QString fileName = _fileName; if (fileName.endsWith(".adi", Qt::CaseInsensitive)) { //qDebug() << "MainWindow::saveFile: 1" << endl; needToSave = !(filemanager->adifLogExport(fileName, currentLog)); } else if (fileName.endsWith(".log", Qt::CaseInsensitive)) { //qDebug() << "MainWindow::saveFile: 2" << endl; needToSave = !(filemanager->cabrilloLogExport(fileName, contestMode, currentLog)); //contest->saveFileToSend(fileName); } else { //qDebug() << "MainWindow::saveFile: 3" << endl; //TODO: Message "You must select a proper file format QMessageBox msgBox; msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("Nothing has been saved. You have to select a valid file type.")); msgBox.exec(); return false; } //qDebug() << "MainWindow::saveFile: 4" << endl; return needToSave; } bool MainWindow::saveFileAs() { //qDebug() << "MainWindow::saveFileAs" << endl; //QFileDialog dialog(this); QStringList filters; filters << "ADIF files (*.adi *.adif)" << "Cabrillo files (*.log)" << "Any files (*)"; // dialog.setNameFilters(filters); /* QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "/home/jana/untitled.png", tr("Images (*.png *.xpm *.jpg)")); */ // kontestDir+"/"+defaultADIFLogFile, QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), kontestDir, tr("ADIF files (*.adi *.adif);;Cabrillo files (*.log);;Any file (*.*)")); if ( (fileName.endsWith(".adi", Qt::CaseInsensitive)) || (fileName.endsWith(".log", Qt::CaseInsensitive)) ) { useDefaultLogFileName = true; defaultADIFLogFile = fileName; return saveFile(fileName); } else if (fileName.length()==0) { // The user clicked on cancel, no msg to be shown return false; } else { //TODO: Message "You must select a proper file format QMessageBox msgBox; msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("Nothing has been saved. You have to select a valid file type.")); msgBox.exec(); return false; } return false; } void MainWindow::newFile() { //qDebug() << "MainWindow::newFile" << endl; //TODO: Ask for a confirmation to the user //TODO: Clean the DB & query.exec("VACUUM"); int lastLog = currentLog; slotSetup(6); if (lastLog == currentLog) { // It seems that the user didn't really want a new log return; } points = 0; multipliers = 0; qsoPoints = 0; qsoMultiplier = 0; logModel->select(); slotClearButtonClicked(); searchResultsTreeWidget->clear(); /* if (dataProxy->clearLog()) { } else { //TODO: An error to create a new file has ocurred. Manage it! } */ } bool MainWindow::slotOpenKLogFolder() { //qDebug() << "MainWindow::slotOpenKLogFolder: " << configFileName << endl; //configFileName = kontestDir+"/klogrc.cfg"; QString _aux = "file://" + kontestDir + ""; QString _text = tr("You can find the KLog data folder here: ") + _aux; int ret = QMessageBox::information(this, tr("KLog"), _text, QMessageBox::Ok, QMessageBox::Ok); return true; } void MainWindow::updateStatusBar(const QString statusm) { //qDebug() << "MainWindow::updateStatusBar: " << statusm << endl; statusBar()->showMessage(statusm, 2000); } bool MainWindow::readCtyFile() { return false; } void MainWindow::slotDoubleClickLog(const QModelIndex & index) { //qDebug() << "MainWindow::slotDoubleClickLog" << endl; // QSqlQuery query; //QString queryString; int row = index.row(); qsoToEdit((logModel->index(row, 0)).data(0).toInt()); } void MainWindow::slotDoubleClickSearch(QTreeWidgetItem * item, int) { //qDebug() << "MainWindow::slotDoubleClickSearch" << endl; int number = -1; if (item){ if (stationCallSignShownInSearch) { number = (item->text(7)).toInt(); } else { number = (item->text(6)).toInt(); } qsoToEdit(number); } else {} } void MainWindow::slotRighButtonSearch(const QPoint& pos) { //qDebug() << "MainWindow::slotRighButtonSearch" << endl; QTreeWidgetItem *item = searchResultsTreeWidget->itemAt(pos); int _qsoID = 0; if (item) { //qDebug() << "MainWindow::slotRighButtonSearch ITEM=true" << endl; // 6 is the column in the searchResultsTreeWidget where the id is saved if (stationCallSignShownInSearch) { //qDebug() << "MainWindow::slotRighButtonSearch stationCallSignShownInSearch = true" << endl; _qsoID = ((item)->text(7)).toInt(); //qDebug() << "MainWindow::slotRighButtonSearch QSO1: " << QString::number(_qsoID) << endl; } else { //qDebug() << "MainWindow::slotRighButtonSearch stationCallSignShownInSearch = false" << endl; _qsoID = ((item)->text(6)).toInt(); //qDebug() << "MainWindow::slotRighButtonSearch QSO2: " << QString::number(_qsoID) << endl; } //qDebug() << "MainWindow::slotRighButtonSearch QSO: " << QString::number(_qsoID) << endl; showMenuRightButtonSearchCreateActions(); //qDebug() << "MainWindow::slotRighButtonSearch -05" << endl; righButtonSearchMenu(_qsoID); //qDebug() << "MainWindow::slotRighButtonSearch -06" << endl; }else { //qDebug() << "MainWindow::slotRighButtonSearch ITEM=false" << endl; return; } //qDebug() << "MainWindow::slotRighButtonSearch: " << QString::number(_qsoID) << endl; } void MainWindow::righButtonSearchMenu(const int trow) { //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: " << QString::number(trow) << endl; bool qslReceived = isQSLReceived(trow); bool qslSent = isQSLSent(trow); QMenu menu(this); menu.addAction(delQSOFromSearchAct); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -03" << endl; delQSOFromSearchAct->setData(trow); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -04" << endl; menu.addAction(qsoToEditFromSearchAct); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -05" << endl; qsoToEditFromSearchAct->setData(trow); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -06" << endl; menu.addSeparator(); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -07" << endl; if (qslSent) { //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSLSent" << endl; } else { //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Sent" << endl; QMenu *menuSentQsl = menu.addMenu(tr("QSL Send")); menuSentQsl->addAction(qslSentViaBureauFromSearchAct); menuSentQsl->addAction(qslSentViaDirectFromSearchAct); menuSentQsl->addAction(qslSentRequestedAct); if (!qslReceived) { menuSentQsl->addAction(qslSentViaBureauMarkRcvReqFromSearchAct); menuSentQsl->addAction(qslSentViaDirectMarkRcvReqFromSearchAct); qslSentViaBureauMarkRcvReqFromSearchAct->setData(trow); qslSentViaDirectMarkRcvReqFromSearchAct->setData(trow); } qslSentViaBureauFromSearchAct->setData(trow); qslSentViaDirectFromSearchAct->setData(trow); qslSentRequestedAct->setData(trow); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -end qsl not sent" << endl; } if (qslReceived) { //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSLRec" << endl; } else { //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec" << endl; QMenu *menuRecQsl = menu.addMenu(tr("QSL Rcvd")); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 01" << endl; menuRecQsl->addAction(qslRecViaBureauFromSearchAct); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 02" << endl; menuRecQsl->addAction(qslRecViaBureauMarkReqFromSearchAct); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 03" << endl; menuRecQsl->addAction(qslRecViaDirectFromSearchAct); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 04" << endl; menuRecQsl->addAction(qslRecViaDirectMarkReqFromSearchAct); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 05" << endl; menuRecQsl->addAction(qslRecRequestedAct); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 06" << endl; qslRecViaBureauFromSearchAct->setData(trow); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 07" << endl; qslRecViaBureauMarkReqFromSearchAct->setData(trow); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 08" << endl; qslRecViaDirectFromSearchAct->setData(trow); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 09" << endl; qslRecViaDirectMarkReqFromSearchAct->setData(trow); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -QSL Not Rec - 10" << endl; qslRecRequestedAct->setData(trow); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -end qsl not rec" << endl; } //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -end qsl" << endl; menu.exec(QCursor::pos()); //qDebug() << "MainWindow::slotshowRighButtonSearchMenu: -END" << endl; } void MainWindow::slotRighButtonFromLog(const QPoint& pos) { //qDebug() << "MainWindow::slotshowRighButtonFromLog" << endl; int row = (logView->indexAt(pos)).row(); showMenuRightButtonFromLogCreateActions(); righButtonFromLogMenu(row); } void MainWindow::righButtonFromLogMenu(const int trow) { //qDebug() << "MainWindow::slotshowRighButtonFromLogMenu: " << QString::number(trow) << endl; int _qsoID = ((logModel->index(trow, 0)).data(0)).toInt(); bool qslReceived = isQSLReceived(_qsoID); bool qslSent = isQSLSent(_qsoID); QMenu menu(this); menu.addAction(delQSOFromLogAct); delQSOFromLogAct->setData(trow); menu.addAction(qsoToEditFromLogAct); qsoToEditFromLogAct->setData(trow); switch (contestMode) { case CQ_WW_SSB: break; case CQ_WW_CW: break; default: menu.addSeparator(); if (qslSent) { } else { QMenu *menuSentQsl = menu.addMenu(tr("QSL Send")); menuSentQsl->addAction(qslSentViaBureauFromLogAct); menuSentQsl->addAction(qslSentViaDirectFromLogAct); qslSentViaBureauFromLogAct->setData(trow); qslSentViaDirectFromLogAct->setData(trow); } if (qslReceived) { } else { QMenu *menuRecQsl = menu.addMenu(tr("QSL Rcvd")); menuRecQsl->addAction(qslRecViaBureauFromLogAct); menuRecQsl->addAction(qslRecViaDirectFromLogAct); qslRecViaBureauFromLogAct->setData(trow); qslRecViaDirectFromLogAct->setData(trow); } break; } menu.exec(QCursor::pos()); } void MainWindow::showMenuRightButtonSearchCreateActions() { //qDebug() << "MainWindow::showMenuRightButtonSearchCreateActions" << endl; delQSOFromSearchAct = new QAction(tr("&Delete"), this); delQSOFromSearchAct->setShortcut(Qt::CTRL + Qt::Key_D); delQSOFromSearchAct->setStatusTip(tr("Delete a QSO")); connect(delQSOFromSearchAct, SIGNAL(triggered()), this, SLOT(slotQsoDeleteFromSearch())); qsoToEditFromSearchAct = new QAction(tr("&Edit QSO"), this); qsoToEditFromSearchAct->setShortcut(Qt::CTRL + Qt::Key_E); qsoToEditFromSearchAct->setStatusTip(tr("Edit this QSO")); connect(qsoToEditFromSearchAct, SIGNAL(triggered()), this, SLOT(slotQSOToEditFromSearch())); qslSentViaBureauFromSearchAct = new QAction(tr("Via &bureau"), this); qslSentViaBureauFromSearchAct->setShortcut(Qt::CTRL + Qt::Key_B); qslSentViaBureauFromSearchAct->setStatusTip(tr("Send this QSL via bureau")); connect(qslSentViaBureauFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaBureauFromSearch() )); qslSentViaDirectFromSearchAct = new QAction(tr("D&irect"), this); qslSentViaDirectFromSearchAct->setShortcut(Qt::CTRL + Qt::Key_I); qslSentViaDirectFromSearchAct->setStatusTip(tr("Send this QSL via direct")); connect(qslSentViaDirectFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaDirectFromSearch() )); qslSentRequestedAct = new QAction(tr("&Request my QSL"), this); qslSentRequestedAct->setShortcut(Qt::CTRL + Qt::Key_R); qslSentRequestedAct->setStatusTip(tr("Mark my QSL as requested")); connect(qslSentRequestedAct, SIGNAL(triggered()), this, SLOT( slotQSLSentMarkAsRequested() )); qslSentViaDirectMarkRcvReqFromSearchAct = new QAction(tr("Via Direct && mark DX QSL as requested"), this); qslSentViaDirectMarkRcvReqFromSearchAct->setStatusTip(tr("Send this QSL via direct & mark DX QSL as requested")); connect(qslSentViaDirectMarkRcvReqFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaDirectMarkDXReqFromSearch() )); qslSentViaBureauMarkRcvReqFromSearchAct = new QAction(tr("Via Bureau && mark DX QSL as requested"), this); qslSentViaBureauMarkRcvReqFromSearchAct->setStatusTip(tr("Send this QSL via bureau & mark DX QSL as requested")); connect(qslSentViaBureauMarkRcvReqFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaBureuMarkDXReqFromSearch() )); qslRecRequestedAct = new QAction(tr("&Request the QSL"), this); //qslSentRequestedAct->setShortcut(Qt::CTRL + Qt::Key_R); qslRecRequestedAct->setStatusTip(tr("Mark the QSL as requested")); connect(qslRecRequestedAct, SIGNAL(triggered()), this, SLOT( slotQSLRecMarkAsRequested() )); qslRecViaBureauMarkReqFromSearchAct = new QAction(tr("Via bureau && mark my QSL as requested"), this); qslRecViaBureauMarkReqFromSearchAct->setStatusTip(tr("QSL received via bureau & mark my QSL as requested")); connect(qslRecViaBureauMarkReqFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaBureauMarkReqFromSearch() )); qslRecViaBureauFromSearchAct = new QAction(tr("Via bureau"), this); qslRecViaBureauFromSearchAct->setStatusTip(tr("QSL received via bureau")); //qslRecViaBureauFromSearchAct->setShortcut(Qt::CTRL + Qt::Key_R); connect(qslRecViaBureauFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaBureauFromSearch() )); qslRecViaDirectMarkReqFromSearchAct = new QAction(tr("Direc&t && mark as my QSL requested"), this); qslRecViaDirectMarkReqFromSearchAct->setStatusTip(tr("QSL received via direct & mark my QSL as requested")); connect(qslRecViaDirectMarkReqFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaDirectMarkReqFromSearch() )); qslRecViaDirectFromSearchAct = new QAction(tr("Direc&t"), this); qslRecViaBureauFromSearchAct->setStatusTip(tr("QSL received via direct")); //qslRecViaDirectFromSearchAct->setShortcut(Qt::CTRL + Qt::Key_T); connect(qslRecViaDirectFromSearchAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaDirectFromSearch() )); } void MainWindow::showMenuRightButtonFromLogCreateActions() { //qDebug() << "MainWindow::showMenuRightButtonFromLogCreateActions" << endl; //TODO: Add the shortcut ( QAction::setShorCut() ) delQSOFromLogAct = new QAction(tr("&Delete"), this); delQSOFromLogAct->setShortcut(Qt::CTRL + Qt::Key_D); delQSOFromLogAct->setStatusTip(tr("Delete a QSO")); connect(delQSOFromLogAct, SIGNAL(triggered()), this, SLOT(slotQsoDeleteFromLog())); //qslSentFromLogAct = new QAction(tr("&Send via bureay"), this); //qslSentFromLogAct->setShortcut(Qt::CTRL + Qt::Key_S); //qslSentFromLogAct->setStatusTip(tr("Send the QSL")); //connect(qslSentFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSLSentFromLog())); //qslRecFromLogAct = new QAction(tr("QSL &Received"), this); //qslRecFromLogAct->setShortcut(Qt::CTRL + Qt::Key_R); //qslRecFromLogAct->setStatusTip(tr("QSL Received")); //connect(qslRecFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSLRecFromLog())); qsoToEditFromLogAct = new QAction(tr("&Edit QSO"), this); qsoToEditFromLogAct->setShortcut(Qt::CTRL + Qt::Key_E); qsoToEditFromLogAct->setStatusTip(tr("Edit this QSO")); connect(qsoToEditFromLogAct, SIGNAL(triggered()), this, SLOT(slotQSOToEditFromLog())); qslSentViaBureauFromLogAct = new QAction(tr("Via &bureau"), this); qslSentViaBureauFromLogAct->setShortcut(Qt::CTRL + Qt::Key_B); qslSentViaBureauFromLogAct->setStatusTip(tr("Send this QSL via bureau")); connect(qslSentViaBureauFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaBureauFromLog() )); qslSentViaDirectFromLogAct = new QAction(tr("D&irect"), this); qslSentViaDirectFromLogAct->setShortcut(Qt::CTRL + Qt::Key_I); qslSentViaDirectFromLogAct->setStatusTip(tr("Send this QSL via direct")); connect(qslSentViaDirectFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLSentViaDirectFromLog() )); qslRecViaBureauFromLogAct = new QAction(tr("Via bureau"), this); qslRecViaBureauFromLogAct->setShortcut(Qt::CTRL + Qt::Key_R); qslRecViaBureauFromLogAct->setStatusTip(tr("QSL &received via bureau")); connect(qslRecViaBureauFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaBureauFromLog() )); qslRecViaDirectFromLogAct = new QAction(tr("Direct"), this); qslRecViaDirectFromLogAct->setShortcut(Qt::CTRL + Qt::Key_T); qslRecViaDirectFromLogAct->setStatusTip(tr("QSL received via direc&t")); connect(qslRecViaDirectFromLogAct, SIGNAL(triggered()), this, SLOT( slotQSLRecViaDirectFromLog() )); } void MainWindow::slotQSLSentViaBureuMarkDXReqFromSearch() { //qDebug() << "slotQSLSentViaBureuMarkDXReqFromSearch: " << (qslSentViaBureauMarkRcvReqFromSearchAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslSentViaBureauMarkRcvReqFromSearchAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = (qslSentViaBureauMarkRcvReqFromSearchAct->data()).toInt(); dataProxy->qslSentViaBureau(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd")); dataProxy->qslRecAsRequested(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd")); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } // Mark Sent, Bureau, date, update log. } void MainWindow::slotQSLSentViaDirectMarkDXReqFromSearch() { //qDebug() << "slotQSLSentViaDirectMarkDXReqFromSearch: " << (qslSentViaDirectMarkRcvReqFromSearchAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslSentViaDirectMarkRcvReqFromSearchAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = (qslSentViaDirectMarkRcvReqFromSearchAct->data()).toInt(); dataProxy->qslSentViaDirect(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd")); dataProxy->qslRecAsRequested(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd")); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } // Mark Sent, Bureau, date, update log. } void MainWindow::slotQSLSentViaBureauFromSearch() { // //qDebug() << "MainWindow::slotQSLSentViaBureauFromSearch: " << (qslSentViaBureauFromSearchAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslSentViaBureauFromSearchAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = (qslSentViaBureauFromSearchAct->data()).toInt(); qslSentViaBureau(_qsoId); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } } void MainWindow::slotQSLSentViaDirectFromSearch() { //qDebug() << "MainWindow::slotQSLSentViaDirectFromSearch: " << (qslSentViaDirectFromSearchAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslSentViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = ((qslSentViaDirectFromSearchAct->data()).toInt()); dataProxy->qslSentViaDirect(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd")); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } //qslSentViaDirect(_qsoId); } void MainWindow::slotQSLSentViaBureauFromLog() { //qDebug() << "MainWindow::slotQSLSentViaBureauFromLog: " << (qslSentViaBureauFromLogAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslSentViaBureauFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = ((logModel->index( ( (qslSentViaBureauFromLogAct->data()).toInt() ) , 0)).data(0).toInt()); qslSentViaBureau(_qsoId); } void MainWindow::slotQSLSentViaDirectFromLog() { //qDebug() << "MainWindow::slotQSLSentViaDirectFromLog: " << (qslSentViaDirectFromLogAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslSentViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = ((logModel->index( ( (qslSentViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()); dataProxy->qslSentViaDirect(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd")); } void MainWindow::qslSentViaBureau(const int _qsoId) { //qDebug() << "MainWindow::qslSentViaBureau: " << QString::number(_qsoId) << endl; dataProxy->qslSentViaBureau(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd")); } void MainWindow::slotQSLSentMarkAsRequested() { // bool qslSentAsRequested(const int _qsoId, const QString _updateDate); int _qsoId = (qslSentRequestedAct->data()).toInt(); dataProxy->qslSentAsRequested(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd")); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } } void MainWindow::slotQSLRecMarkAsRequested() { int _qsoId = (qslRecRequestedAct->data()).toInt(); dataProxy->qslRecAsRequested(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd")); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } } void MainWindow::slotQSLRecViaBureauFromLog() { //qDebug() << "MainWindow::slotQSLRecViaBureauFromLog: " << (qslRecViaBureauAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslRecViaBureauAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = ((logModel->index( ( (qslRecViaBureauFromLogAct->data()).toInt() ) , 0)).data(0).toInt()); qslRecViaBureau(_qsoId); } void MainWindow::slotQSLRecViaDirectFromLog() { //qDebug() << "MainWindow::slotQSLRecViaDirectFromLog: " << (qslRecViaDirectFromLogAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()); qslRecViaDirect(_qsoId); // Mark Sent, Bureau, date, update log. } void MainWindow::slotQSLRecViaBureauFromSearch() { //qDebug() << "MainWindow::slotQSLRecViaBureauFromLog: " << "- Id = " << QString::number( ((logModel->index( ( (qslRecViaBureauFromSearchAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = (qslRecViaBureauFromSearchAct->data()).toInt(); qslRecViaBureau(_qsoId); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } } void MainWindow::slotQSLRecViaBureauMarkReqFromSearch() { //qDebug() << "MainWindow::slotQSLRecViaBureauMarkReqFromLog: " << "- Id = " << QString::number( ((logModel->index( ( (qslRecViaBureauFromSearchAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = (qslRecViaBureauMarkReqFromSearchAct->data()).toInt(); qslRecViaBureauMarkReq(_qsoId); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } } void MainWindow::slotQSLRecViaDirectFromSearch() { //qDebug() << "MainWindow::slotQSLRecViaDirectFromLog: " << (qslRecViaDirectFromSearchAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = (qslRecViaDirectFromSearchAct->data()).toInt(); qslRecViaDirect(_qsoId); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } // Mark Sent, Bureau, date, update log. } void MainWindow::slotQSLRecViaDirectMarkReqFromSearch() { //qDebug() << "MainWindow::slotQSLRecViaDirectFromLog: " << (qslRecViaDirectFromSearchAct->data()).toString() << " - Id = " << QString::number( ((logModel->index( ( (qslRecViaDirectFromLogAct->data()).toInt() ) , 0)).data(0).toInt()) ) << endl; int _qsoId = (qslRecViaDirectMarkReqFromSearchAct->data()).toInt(); qslRecViaDirectMarkReq(_qsoId); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } // Mark Sent, Bureau, date, update log. } void MainWindow::qslRecViaBureau(const int _qsoId) { // //qDebug() << "MainWindow::qslRecViaBureau: " << QString::number(_qsoId) << "/" << (dateTime->currentDateTime()).toString("yyyy/MM/dd") << endl; //setAwards(const int _dxcc, const int _waz, const int _band, const int _mode, const int _workedOrConfirmed); dataProxy->qslRecViaBureau(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd"), false); awards->setAwards(_qsoId); //Update the DXCC award status logModel->select(); showAwards(); } void MainWindow::qslRecViaDirect(const int _qsoId) { //qDebug() << "MainWindow::qslRecViaDirect: " << QString::number(_qsoId) << endl; dataProxy->qslRecViaDirect(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd"), false); awards->setAwards(_qsoId); //setAwards(const int _dxcc, const int _waz, const int _band, const int _mode, const int _workedOrConfirmed); showAwards(); } void MainWindow::qslRecViaBureauMarkReq(const int _qsoId) { // //qDebug() << "MainWindow::qslRecViaBureau: " << QString::number(_qsoId) << "/" << (dateTime->currentDateTime()).toString("yyyy/MM/dd") << endl; //setAwards(const int _dxcc, const int _waz, const int _band, const int _mode, const int _workedOrConfirmed); dataProxy->qslRecViaBureau(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd"), true); awards->setAwards(_qsoId); //Update the DXCC award status logModel->select(); showAwards(); } void MainWindow::qslRecViaDirectMarkReq(const int _qsoId) { //qDebug() << "MainWindow::qslRecViaDirect: " << QString::number(_qsoId) << endl; dataProxy->qslRecViaDirect(_qsoId, (dateTime->currentDateTime()).toString("yyyy/MM/dd"), true); awards->setAwards(_qsoId); //setAwards(const int _dxcc, const int _waz, const int _band, const int _mode, const int _workedOrConfirmed); showAwards(); } bool MainWindow::isQSLReceived(const int _qsoId) { //qDebug() << "MainWindow::isQSLReceived: " << QString::number(_qsoId) << endl; return dataProxy->isQSLReceived(_qsoId); } bool MainWindow::isQSLSent(const int _qsoId) { //qDebug() << "MainWindow::isQSLSent: " << QString::number(_qsoId) << endl; return dataProxy->isQSLSent(_qsoId); } void MainWindow::slotQSOToEditFromLog() { //qDebug() << "slotQSOToEditFromLog: " << (qsoToEditFromLogAct->data()).toString() << endl; qsoToEdit((logModel->index((qsoToEditFromLogAct->data()).toInt(), 0)).data(0).toInt()); } void MainWindow::slotQSOToEditFromSearch() { //qDebug() << "slotQSOToEditFromSearch: " << (qsoToEditFromSearchAct->data()).toString() << endl; qsoToEdit((qsoToEditFromSearchAct->data()).toInt()); } void MainWindow::slotQsoDeleteFromLog() { //qDebug() << "MainWindow::slotQsoDeleteFromLog: " << (delQSOFromLogAct->data()).toString() << endl; QMessageBox msgBox; msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("You have requested to delete this QSO.")); msgBox.setInformativeText(tr("Are you sure?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setDefaultButton(QMessageBox::No); int ret = msgBox.exec(); int QSOid = ((logModel->index((delQSOFromLogAct->data()).toInt(), 0)).data(0)).toInt(); //qDebug() << "MainWindow::slotQsoDeleteFromLog (id): " << QString::number(QSOid) << endl; switch (ret) { case QMessageBox::Yes: //qDebug() << "MainWindow::slotQsoDeleteFromLog (id): -1" << endl; elogClublog->deleteQSO(dataProxy->getClubLogRealTimeFromId(QSOid)); //qDebug() << "MainWindow::slotQsoDeleteFromLog (id): -2"<< endl; logModel->removeRow((delQSOFromLogAct->data()).toInt()); //qDebug() << "MainWindow::slotQsoDeleteFromLog (id):-3 " << endl; slotSearchBoxTextChanged(); awards->recalculateAwards(); showAwards(); break; case QMessageBox::No: // No was clicked break; default: // should never be reached break; } } void MainWindow::slotQsoDeleteFromSearch() { //qDebug() << "MainWindow::slotQsoDeleteFromSearch: " << (delQSOFromSearchAct->data()).toString() << endl; //qDebug() << "MainWindow::slotQsoDeleteFromSearch: " << QString::number((logModel->index((delQSOFromSearchAct->data(6)).toInt(), 0)).data(0).toInt()) << endl; int QSOid = (delQSOFromSearchAct->data()).toInt(); int x = -1; QString _qrz = dataProxy->getCallFromId(QSOid); if (_qrz.length()>=3) { QString message = QString(tr("You have requested to delete the QSO with: %1")).arg(_qrz); QMessageBox msgBox; msgBox.setIcon(QMessageBox::Question); msgBox.setText(message); msgBox.setInformativeText(tr("Are you sure?")); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setDefaultButton(QMessageBox::No); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Yes: x = elogClublog->deleteQSO(dataProxy->getClubLogRealTimeFromId(QSOid)); if(dataProxy->deleteQSO(QSOid)) { logModel->select(); if(qslingNeeded) { slotToolSearchNeededQSLToSend(); } else { slotSearchBoxTextChanged(); } awards->recalculateAwards(); showAwards(); } else { //TODO: The QSO could not be removed... } break; case QMessageBox::No: // No was clicked break; default: // should never be reached break; } } else { // TODO: The QSO to be removed was not found in the log } } void MainWindow::keyPressEvent(QKeyEvent *event){ /* if (!isStarted || isPaused || curPiece.shape() == NoShape) { QFrame::keyPressEvent(event); return; } */ switch (event->key()) { case Qt::Key_Return: // ENTER PRESSED //slotQRZReturnPressed(); break; case Qt::Key_Enter: // ENTER PRESSED // slotQRZReturnPressed(); break; default: //QFrame::keyPressEvent(event); ; } } int MainWindow::checkIfWorkedB4(const QString _qrz) { //qDebug() << "MainWindow::checkIfWorkedB4: " << _qrz << endl; int i = dataProxy->isWorkedB4(_qrz, currentLog); switch (contestMode) { case CQ_WW_SSB: if (i>=0) { qrzgroupBox->setTitle(tr("DUPE")); } else { qrzgroupBox->setTitle(tr("QRZ")); } break; case CQ_WW_CW: if (i>=0) { qrzgroupBox->setTitle(tr("DUPE")); } else { qrzgroupBox->setTitle(tr("QRZ")); } break; default: break; } return i; } void MainWindow::readConfigData() { //qDebug() << "MainWindow::slotReadConfigData - 01" << endl; if (needToEnd) { return; } QFile file(configFileName); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){ //qDebug() << "MainWindow::slotReadConfigData: File not found" << configFileName << endl; if (configured ) { //qDebug() << "MainWindow::readConfigData: configured = true" << endl; } else { //qDebug() << "MainWindow::readConfigDataw: configured = false" << endl; } slotSetup(); defineStationCallsign(); return; } while (!file.atEnd()) { QByteArray line = file.readLine(); processConfigLine(line); } if ((useDefaultLogFileName) && (defaultADIFLogFile.length()>0)) { useDefaultLogFileName = true; } else { useDefaultLogFileName = false; } if (imperialSystem) { distShortLabelN->setText(tr("Miles")); distLongLabelN->setText(tr("Miles")); //distShortLabel->setText( QString::number( Km2Mile(imperialSystem, (distShortLabel->text()).toInt() )) ); //distLongLabel->setText( QString::number(Km2Mile(imperialSystem, (distLongLabel->text()).toInt()) ) ); } else { distShortLabelN->setText(tr("Km")); distLongLabelN->setText(tr("Km")); } showEntityInfo(currentEntity); lastPower = myPower; defineStationCallsign(); lastOperatorQRZ = operatorQRZ; lastStationQRZ = stationQRZ; lastMyLocator = myLocator; configured = true; awards->setColors (newOneColor.name(), neededColor.name(), workedColor.name(), confirmedColor.name(), defaultColor.name()); dxClusterWidget->setColors (newOneColor.name(), neededColor.name(), workedColor.name(), confirmedColor.name(), defaultColor.name()); dxClusterWidget->setDXClusterSpotConfig(dxClusterShowHF, dxClusterShowVHF, dxClusterShowWARC, dxClusterShowWorked, dxClusterShowConfirmed, dxClusterShowAnn, dxClusterShowWWV, dxClusterShowWCY ); initialContestModeConfiguration(); if (upAndRunning) { // Next actions will not be executed in the first run slotClearButtonClicked(); createSearchResultsPanel(); } // I need to init the CLUBLOG if (clublogActive) { elogClublog->setCredentials(clublogUser, clublogEmail, clublogPass, false); } else { } checkIfNewBandOrMode(); //qDebug() << "MainWindow::slotReadConfigData - END" << endl; } bool MainWindow::processConfigLine(const QString _line){ //qDebug() << "MainWindow::processConfigLine: " << _line << endl; QString line = _line.simplified(); //line.simplified(); QString aux; QStringList values = line.split("=", QString::SkipEmptyParts); if (line.startsWith('#')){ //qDebug() << "MainWindow::processConfigLine: notes Line!" << endl; return true; } if (!( (line.contains('=')) && (line.contains(';')))){ //qDebug() << "MainWindow::processConfigLine: Wrong Line!" << endl; return false; } QString field = (values.at(0)).toUpper(); QString value = values.at(1); int endValue = value.indexOf(';'); if (endValue>-1){ value = value.left(value.length() - (value.length() - endValue)); } if (field == "CALLSIGN"){ mainQRZ = value; }else if (field=="CQZ"){ my_CQz = value.toInt(); }else if (field=="ITUZ"){ my_ITUz = value.toInt(); }else if (field=="CONTEST"){ //qDebug() << "MainWindow::processConfigLine: CONTEST: " << endl; if (value=="CQ-WW-SSB"){ contestMode = CQ_WW_SSB; } else if (value=="CQ-WW-CW"){ contestMode = CQ_WW_CW; } else if (value=="CQ-WPX-SSB"){ contestMode = CQ_WPX_SSB; } else if (value=="CQ-WPX-CW"){ contestMode = CQ_WPX_CW; } else if (value=="CQ-WPX-RTTY"){ contestMode = CQ_WPX_RTTY; } else{ contestMode = NoContest; } }else if (field=="MODES"){ readActiveModes(value.split(", ", QString::SkipEmptyParts)); }else if (field=="BANDS"){ readActiveBands(value.split(", ", QString::SkipEmptyParts)); }else if (field=="REALTIME"){ //qDebug() << "MainWindow::processConfigLine: REALTIME: " << value.toUpper() << endl; realTime = util->trueOrFalse(value); } else if (field=="INMEMORY") { //qDebug() << "MainWindow::processConfigLine: INMEMORY: " << value.toUpper() << endl; DBinMemory = util->trueOrFalse(value); } else if (field =="DXCLUSTERSERVERTOUSE"){ aux = value; //dxfun.com:8000 if (aux.contains(':')) { dxclusterServerToConnect = (aux.split(':', QString::SkipEmptyParts)).at(0); dxclusterServerPort = ((aux.split(':', QString::SkipEmptyParts)).at(1)).toInt(); } if ((dxclusterServerToConnect.length()< 3) || (dxclusterServerPort <= 0)) { dxclusterServerToConnect = "dxfun.com"; dxclusterServerPort = 8000; } dxClusterWidget->setDXClusterServer(dxclusterServerToConnect, dxclusterServerPort); } else if(field=="POWER") { if (value.toDouble()>0.0) { myPower = value.toDouble(); } } else if (field=="USEDEFAULTNAME") { useDefaultLogFileName = util->trueOrFalse(value); } else if (field=="IMPERIALSYSTEM") { imperialSystem = util->trueOrFalse(value); } else if (field=="SENDQSLWHENREC") { sendQSLWhenRec = util->trueOrFalse(value); } else if (field=="SHOWCALLSIGNINSEARCH") { stationCallSignShownInSearch = util->trueOrFalse(value); } else if (field=="ALWAYSADIF") { alwaysADIF = util->trueOrFalse(value); } else if (field=="UTCTIME") { //qDebug() << "MainWindow::processConfigLine: UTCTIME: " << value.toUpper() <trueOrFalse(value); } else if (field=="KEEPMYDATA") { keepMyData = util->trueOrFalse(value); } else if (field=="COMPLETEWITHPREVIOUS") { completeWithPrevious = util->trueOrFalse(value); } else if (field=="DXCLUSTERSHOWHF") { dxClusterShowHF = util->trueOrFalse(value); } else if (field=="DXCLUSTERSHOWVHF") { dxClusterShowVHF = util->trueOrFalse(value); } else if (field=="DXCLUSTERSHOWWARC") { dxClusterShowWARC = util->trueOrFalse(value); } else if (field=="DXCLUSTERSHOWWORKED") { dxClusterShowWorked = util->trueOrFalse(value); } else if (field=="DXCLUSTERSHOWCONFIRMED") { dxClusterShowConfirmed = util->trueOrFalse(value); } else if (field=="DXCLUSTERSHOWANN") { dxClusterShowAnn = util->trueOrFalse(value); } else if (field=="DXCLUSTERSHOWWWV") { dxClusterShowWWV = util->trueOrFalse(value); } else if (field=="DXCLUSTERSHOWWCY") { dxClusterShowWCY = util->trueOrFalse(value); } else if (field=="DEFAULTADIFFILE") { defaultADIFLogFile = value.toLower(); } else if (field=="STATIONLOCATOR") { if ( locator->isValidLocator(value) ) { myLocator = value.toUpper(); } } else if(field=="NEWONECOLOR") { newOneColor.setNamedColor(value); } else if(field=="NEEDEDCOLOR") { neededColor.setNamedColor(value); } else if(field=="WORKEDCOLOR") { workedColor.setNamedColor(value); } else if(field=="CONFIRMEDCOLOR") { confirmedColor.setNamedColor(value); } else if(field=="DEFAULTCOLOR") { defaultColor.setNamedColor(value); }else if(field=="SELECTEDLOG") { currentLog = value.toInt(); if (dataProxy->doesThisLogExist(currentLog)) { } else { currentLog = 1; while(!dataProxy->doesThisLogExist(currentLog)) { currentLog++; } } dxClusterWidget->setCurrentLog(currentLog); //qDebug() << "MainWindow::processConfigLine: currentLog: " << value << endl; }else if(field=="CLUBLOGACTIVE") { //qDebug() << "MainWindow::processConfigLine: clublogActive: " << value << endl; clublogActive = util->trueOrFalse(value); } else if(field=="CLUBLOGREALTIME") { //qDebug() << "MainWindow::processConfigLine: clublogRealTime: " << value << endl; clublogRealTime = util->trueOrFalse(value); } else if(field=="CLUBLOGCALL") { clublogUser = value; } else if(field=="CLUBLOGPASS") { clublogPass = value; } else if(field=="CLUBLOGEMAIL") { clublogEmail = value; } else { //qDebug() << "MainWindow::processConfigLine: NONE: " << endl; } // Lines are: Option = value; return true; } /********************************************************************* ********************************************************************** ********************************************************************** ********************************************************************** ********************************************************************** ********************************************************************** ********************************************************************** **********************************************************************/ void MainWindow::checkIfNewBandOrMode() {//Checks the log to see if there is a QSO with a band/mode //that is not currently selected as active //qDebug() << "MainWindow::checkIfNewBandOrMode" << endl; // modes // bands setupDialog->checkIfNewBandOrMode(); // Update the Setup dialog with new bands or modes //qDebug() << "MainWindow::checkIfNewBandOrMode after setupDialog" << endl; QStringList bandsInLog = dataProxy->getBandsInLog(currentLog); QStringList modesInLog = dataProxy->getModesInLog(currentLog); bands << bandsInLog; QSet set = bands.toSet(); bands.clear(); bands << set.toList(); set.clear(); modes << modesInLog; set = modes.toSet(); modes.clear(); modes << set.toList(); bandComboBox->clear(); bandComboBox->addItems(bands); modeComboBox->clear(); //qDebug() << "MainWindow::checkIfNewBandOrMode - 1-" << QString::number(modeComboBox->count()) << endl; modeComboBox->addItems(modes); //qDebug() << "MainWindow::checkIfNewBandOrMode - 2-" << QString::number(modeComboBox->count()) << endl; //qDebug() << "MainWindow::checkIfNewBandOrMode END" << endl; } /********************************************************************* ********************************************************************** ********************************************************************** ********************************************************************** ********************************************************************** ********************************************************************** ********************************************************************** **********************************************************************/ void MainWindow::readActiveBands (const QStringList actives) { // Checks a "10m, 12m" QString, checks if they are valid bands and import to the // bands used in the program //qDebug() << "MainWindow::readActiveBands: " << actives << endl; QString aux; bool atLeastOne = false; //QStringList values = actives; //QStringList values = actives.split(", ", QString::SkipEmptyParts); for (int i = 0; i < actives.size() ; i++) { if (db->isValidBand(actives.at(i))) { if (!atLeastOne) { //qDebug() << "MainWindow::readActiveBands (at least One!): " << values.at(i) << endl; atLeastOne = true; bands.clear(); } aux = actives.at(i); if (aux.length()>0) { bands << aux; } //bands << actives.at(i); //qDebug() << "MainWindow::readActiveBands: " << values.at(i) << endl; } } bands.removeDuplicates(); } void MainWindow::readActiveModes (const QStringList actives) { //qDebug() << "MainWindow::readActiveModes: " << actives << endl; bool atLeastOne = false; QString aux; //QStringList values = actives.split(", ", QString::SkipEmptyParts); for (int i = 0; i < actives.size() ; i++) { if (db->isValidMode(actives.at(i), false)) { if (!atLeastOne) { atLeastOne = true; //modes.clear(); } aux = actives.at(i); if (aux.length()>0) { modes << aux; } // modes << actives.at(i); } } modes.removeDuplicates(); } void MainWindow::createData() { //qDebug() << "MainWindow::createData " << endl; } void MainWindow::createUIDX() { //qDebug() << "MainWindow::createUIDX" << endl; QStringList continents; QSqlQuery query2("SELECT shortname FROM continent"); while (query2.next()) { if (query2.isValid()) { continents << query2.value(0).toString(); } } iotaContinentComboBox->addItems(continents); iotaNumberLineEdit = new QLineEdit; iotaNumberLineEdit->setInputMask("000"); iotaNumberLineEdit->setText("000"); //bands << "10M" << "15M" << "20M" << "40M" << "80M" << "160M"; //modes << "SSB" << "CW" << "RTTY"; bandComboBox->addItems(bands); //qDebug() << "MainWindow::createUIDX - 1-" << QString::number(modes.count()) << endl; modeComboBox->addItems(modes); txFreqSpinBox->setToolTip(tr("TX Frequency in MHz")); rxFreqSpinBox->setToolTip(tr("RX Frequency in MHz")); myPowerSpinBox->setToolTip(tr("Power used for the QSO in watts")); rxPowerSpinBox->setToolTip(tr("Power used by the DX")); operatorLineEdit->setToolTip(tr("Logging operator's callsign")); stationCallSignLineEdit->setToolTip(tr("Callsign used over the air")); myLocatorLineEdit->setToolTip(tr("My QTH locator")); nameLineEdit->setToolTip(tr("Name of the DX")); qthLineEdit->setToolTip(tr("QTH of the DX")); locatorLineEdit->setToolTip(tr("Locator of the DX")); //freqQLCDNumber->setToolTip(tr("Frequency of the QSO")); qrzLineEdit->setToolTip(tr("QRZ of the QSO")); rstTXLineEdit->setToolTip(tr("TX RST")); rstRXLineEdit->setToolTip(tr("RX RST")); STXLineEdit->setToolTip(tr("TX Exchange")); SRXLineEdit->setToolTip(tr("RX Exchange")); bandComboBox->setToolTip(tr("Band of the QSO")); modeComboBox->setToolTip(tr("Mode of the QSO")); dateEdit->setToolTip(tr("Date of the QSO")); timeEdit->setToolTip(tr("Time of the QSO")); //statusBar->setToolTip(tr("Misc information")); //qsoStatusBar->setToolTip(tr("QSO information")); OKButton->setToolTip(tr("Add the QSO to the log")); //spotItButton->setToolTip(tr("Spots this QSO to the DX Cluster - This function is still not implemented")); clearButton->setToolTip(tr("Clears the box")); clublogComboBox->setToolTip(tr("Status on ClubLog")); eqslSentComboBox->setToolTip(tr("Status of the eQSL sending")); eqslRecComboBox->setToolTip(tr("Status of the eQSL reception")); lotwSentComboBox->setToolTip(tr("Status of the LotW sending")); lotwRecComboBox->setToolTip(tr("Status of the LotW reception")); clublogQDateEdit->setToolTip(tr("Date of the ClubLog upload")); eqslSentQDateEdit->setToolTip(tr("Date of the eQSL sending")); eqslRecQDateEdit->setToolTip(tr("Date of the eQSL reception")); lotwSentQDateEdit->setToolTip(tr("Date of the LotW sending")); lotwRecQDateEdit->setToolTip(tr("Date of the LotW reception")); qslSentComboBox->setToolTip(tr("Status of the QSL sending")); qslRecComboBox->setToolTip(tr("Status of the QSL reception")); qslSentViaComboBox->setToolTip(tr("QSL sending information")); qslRecViaComboBox->setToolTip(tr("QSL reception information")); qslSentQDateEdit->setToolTip(tr("Date of the QSL sending")); qslRecQDateEdit->setToolTip(tr("Date of the QSL reception")); qslmsgTextEdit->setToolTip(tr("Message of the QSL")); qslViaLineEdit->setToolTip(tr("QSL via information")); dxccConfirmedQLCDNumber->setToolTip(tr("Number of confirmed DXCC entities")); dxccWorkedQLCDNumber->setToolTip(tr("Number of worked DXCC entities")); wazConfirmedQLCDNumber->setToolTip(tr("Number of confirmed WAZ zones")); wazWorkedQLCDNumber->setToolTip(tr("Number of worked WAZ zones")); localConfirmedQLCDNumber->setToolTip(tr("Number of confirmed local references")); localWorkedQLCDNumber->setToolTip(tr("Number of worked local references")); qsoConfirmedQLCDNumber->setToolTip(tr("Number of confirmed QSO")); qsoWorkedQLCDNumber->setToolTip(tr("Number of worked QSO")); dxMarathonDXCCQLCDNumber->setToolTip(tr("Number of DXCC worked on the selected year")); dxMarathonCQQLCDNumber->setToolTip(tr("Number of CQ Zones worked on the selected year")); dxMarathonPointsQLCDNumber->setToolTip(tr("Score for the DXMarathon on the selected year")); operatingYearsComboBox->setToolTip(tr("Select the year you want to check")); infoLabel1->setToolTip(tr("Status of the DX entity")); infoLabel2->setToolTip(tr("Name of the DX entity")); entityPrimDivComboBox->setToolTip(tr("Select the primary division for this QSO")); entitySecDivComboBox->setToolTip(tr("Select the secondary division for this QSO")); entityNameComboBox->setToolTip(tr("Select the propagation mode for this current QSO")); //QGridLayout *layout = new QGridLayout; dxUpLeftInputFrame = new QFrame; //dxUpRightOutputFrame = new QFrame; //dxUpRightOutputFrame->setFrameShadow(QFrame::Raised); //dxUpRightOutputFrame->setFrameStyle(QFrame::StyledPanel); dxUpLeftTab = new QTabWidget; dxUpRightTab = new QTabWidget; dxBottonTab = new QTabWidget; //rename to botton dxUpLeftTab->setTabPosition(QTabWidget::North); dxUpRightTab->setTabPosition(QTabWidget::South); QWidget *qsoInputTabWidget = new QWidget; //QFormLayout *qsoInputTabWidgetLayout = new QFormLayout; QLabel *nameLabel = new QLabel(qsoInputTabWidget); nameLabel->setText("Name"); nameLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *qthLabel = new QLabel(qsoInputTabWidget); qthLabel->setText("QTH"); qthLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *locLabel = new QLabel(qsoInputTabWidget); locLabel->setText("Locator"); locLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *rxPowerSpinBoxLabelN = new QLabel(tr("Power(rx)")); rxPowerSpinBoxLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *rstTxLabelN = new QLabel(tr("RST(tx)")); rstTxLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *rstRxLabelN = new QLabel(tr("RST(rx)")); rstRxLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); rstTXLineEdit->setInputMask("990"); rstRXLineEdit->setInputMask("990"); rstTXLineEdit->setText("59"); rstRXLineEdit->setText("59"); rstTXLineEdit->setMaxLength(3); rstRXLineEdit->setMaxLength(3); //rstTXLineEdit->setFixedWidth(30); //rstRXLineEdit->setFixedWidth(30); QGridLayout *RSTLayout = new QGridLayout; RSTLayout->addWidget(rstTxLabelN, 0, 0); RSTLayout->addWidget(rstTXLineEdit, 1, 0); RSTLayout->addWidget(rstRxLabelN, 0, 1); RSTLayout->addWidget(rstRXLineEdit, 1, 1); //QLabel *spacerLabel = new QLabel(tr("SPACERQTH")); QHBoxLayout *qthHLayout = new QHBoxLayout; qthHLayout->addWidget(qthLabel); //qthHLayout->addSpacerItem(new QSpacerItem(50,1)); //qthHLayout->addWidget(spacerLabel); QVBoxLayout *qthLayout = new QVBoxLayout; qthLayout->addLayout(qthHLayout); qthLayout->addWidget(qthLineEdit); QVBoxLayout *rstQTHLayout = new QVBoxLayout; rstQTHLayout->addLayout(RSTLayout); rstQTHLayout->addLayout(qthLayout); QLabel *txfreqLabelN = new QLabel(tr("Freq TX")); txfreqLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *rxfreqLabelN = new QLabel(tr("Freq RX")); rxfreqLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QGridLayout *freqLayout = new QGridLayout; freqLayout->addWidget(txfreqLabelN, 0, 0); freqLayout->addWidget(rxfreqLabelN, 0, 1); freqLayout->addWidget(txFreqSpinBox, 1, 0); freqLayout->addWidget(rxFreqSpinBox, 1, 1); QVBoxLayout *locVLayout = new QVBoxLayout; locVLayout->addWidget(locLabel); locVLayout->addWidget(locatorLineEdit); //QLabel *spacerLocLabel = new QLabel(tr("SPACERLoc")); QHBoxLayout *locLayout = new QHBoxLayout; //locLayout->addSpacerItem(new QSpacerItem(50,1)); //locLayout->addWidget(spacerLocLabel); locLayout->addLayout(locVLayout); QVBoxLayout *freqLocLayout = new QVBoxLayout; freqLocLayout->addLayout(freqLayout); freqLocLayout->addLayout(locLayout); QHBoxLayout *rstfreqLayout = new QHBoxLayout; rstfreqLayout->addLayout(rstQTHLayout); rstfreqLayout->addLayout(freqLocLayout); QVBoxLayout *rxPowerLayout = new QVBoxLayout; rxPowerLayout->addWidget(rxPowerSpinBoxLabelN); rxPowerLayout->addWidget(rxPowerSpinBox); //QLabel *spacerNameLabel = new QLabel(tr("SPACERName")); QHBoxLayout *nameHLayout = new QHBoxLayout; nameHLayout->addWidget(nameLabel); //nameHLayout->addSpacerItem(new QSpacerItem(50,1)); //nameHLayout->addWidget(spacerNameLabel ); QVBoxLayout *nameLayout = new QVBoxLayout; nameLayout->addLayout(nameHLayout); nameLayout->addWidget(nameLineEdit); QVBoxLayout *rxPwrLayout = new QVBoxLayout; rxPwrLayout->addWidget(rxPowerSpinBoxLabelN); rxPwrLayout->addWidget(rxPowerSpinBox); //QLabel *spacerHBottomLabel = new QLabel(tr("SPACERHBottom")); QHBoxLayout *namePwrHLayout = new QHBoxLayout; namePwrHLayout->addLayout(nameLayout); //namePwrHLayout->addSpacerItem(new QSpacerItem(50,1)); //namePwrHLayout->addWidget(spacerHBottomLabel); namePwrHLayout->addLayout(rxPwrLayout); //QLabel *spacerBottomLabel = new QLabel(tr("SPACERBottom")); QVBoxLayout *namePwrLayout = new QVBoxLayout; //namePwrLayout->addSpacerItem(new QSpacerItem(1,50)); //namePwrLayout->addWidget(spacerBottomLabel); namePwrLayout->addLayout(namePwrHLayout); QVBoxLayout *qsoInputTabWidgetMainLayout = new QVBoxLayout; qsoInputTabWidgetMainLayout->addLayout(rstfreqLayout); qsoInputTabWidgetMainLayout->addLayout(namePwrLayout); qsoInputTabWidget->setLayout(qsoInputTabWidgetMainLayout); QWidget *qslInputTabWidget = new QWidget; QWidget *eqslInputTabWidget = new QWidget; QWidget *commentInputTabWidget = new QWidget; QWidget *othersInputTabWidget = new QWidget; QWidget *myDataInputTabWidget = new QWidget; int i = dxUpLeftTab->addTab(qsoInputTabWidget, tr("QSO")); // QSL Tab definition starts here QLabel *QSLSentLabelN = new QLabel(tr("QSL Sent")); QSLSentLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *QSLRecLabelN = new QLabel(tr("QSL Rec")); QSLRecLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *QSLViaLabelN = new QLabel(tr("QSL Via")); QSLViaLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); //entityNameComboBox = new QComboBox;entitiesList if (entitiesList.size()>1) { entitiesList.prepend("00-Not Identified (000)"); entityNameComboBox->addItems(entitiesList); } if (propModeList.size()>1) { propModeList.prepend("00 - Not - Not Identified"); propModeComboBox->addItems(propModeList); } QGridLayout *QSLLayout = new QGridLayout; QSLLayout->addWidget(QSLSentLabelN, 0, 0); QSLLayout->addWidget(QSLRecLabelN, 1, 0); QSLLayout->addWidget(QSLViaLabelN, 2, 0); QSLLayout->addWidget(qslSentComboBox, 0, 1); QSLLayout->addWidget(qslRecComboBox, 1, 1); QSLLayout->addWidget(qslViaLineEdit, 2, 1, 1, -1); QSLLayout->addWidget(qslSentQDateEdit, 0, 2); QSLLayout->addWidget(qslRecQDateEdit, 1, 2); QSLLayout->addWidget(qslSentViaComboBox, 0, 3); QSLLayout->addWidget(qslRecViaComboBox, 1, 3); qslInputTabWidget->setLayout(QSLLayout); i = dxUpLeftTab->addTab(qslInputTabWidget, tr("QSL")); // eQSL Tab definition starts here QLabel *clublogLabelN = new QLabel(tr("ClubLog")); clublogLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *eQSLSentLabelN = new QLabel(tr("eQSL Sent")); eQSLSentLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *eQSLRecLabelN = new QLabel(tr("eQSL Rec")); eQSLRecLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *lotWSentLabelN = new QLabel(tr("LotW Sent")); lotWSentLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *lotWRecLabelN = new QLabel(tr("LotW Rec")); lotWRecLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); /* QHBoxLayout *eqslSentLayout = new QHBoxLayout; eqslSentLayout->addWidget(eqslSentComboBox); eqslSentLayout->addWidget(eqslSentQDateEdit); QHBoxLayout *eqslRecLayout = new QHBoxLayout; eqslRecLayout->addWidget(eqslRecComboBox); eqslRecLayout->addWidget(eqslRecQDateEdit); QHBoxLayout *lotwSentLayout = new QHBoxLayout; lotwSentLayout->addWidget(lotwSentComboBox); lotwSentLayout->addWidget(lotwSentQDateEdit); QHBoxLayout *lotwRecLayout = new QHBoxLayout; lotwRecLayout->addWidget(lotwRecComboBox); lotwRecLayout->addWidget(lotwRecQDateEdit); QFormLayout *eqslInputTabWidgetLayout = new QFormLayout; eqslInputTabWidgetLayout->addRow(eQSLSentLabelN, eqslSentLayout); eqslInputTabWidgetLayout->addRow(eQSLRecLabelN, eqslRecLayout); eqslInputTabWidgetLayout->addRow(lotWSentLabelN, lotwSentLayout); eqslInputTabWidgetLayout->addRow(lotWRecLabelN, lotwRecLayout); */ QGridLayout *eqslInputTabWidgetLayout = new QGridLayout; eqslInputTabWidgetLayout->addWidget(clublogLabelN, 0, 0); eqslInputTabWidgetLayout->addWidget(eQSLSentLabelN, 1, 0); eqslInputTabWidgetLayout->addWidget(eQSLRecLabelN, 2, 0); eqslInputTabWidgetLayout->addWidget(lotWSentLabelN, 3, 0); eqslInputTabWidgetLayout->addWidget(lotWRecLabelN, 4, 0); eqslInputTabWidgetLayout->addWidget(clublogComboBox, 0, 1); eqslInputTabWidgetLayout->addWidget(eqslSentComboBox, 1, 1); eqslInputTabWidgetLayout->addWidget(eqslRecComboBox, 2, 1); eqslInputTabWidgetLayout->addWidget(lotwSentComboBox, 3, 1); eqslInputTabWidgetLayout->addWidget(lotwRecComboBox, 4, 1); eqslInputTabWidgetLayout->addWidget(clublogQDateEdit, 0, 2); eqslInputTabWidgetLayout->addWidget(eqslSentQDateEdit, 1, 2); eqslInputTabWidgetLayout->addWidget(eqslRecQDateEdit, 2, 2); eqslInputTabWidgetLayout->addWidget(lotwSentQDateEdit, 3, 2); eqslInputTabWidgetLayout->addWidget(lotwRecQDateEdit, 4, 2); eqslInputTabWidget->setLayout(eqslInputTabWidgetLayout); i = dxUpLeftTab->addTab(eqslInputTabWidget, tr("eQSL")); /* // NOTES tab starts here QGridLayout *notesInputTabWidgetLayout = new QGridLayout; notesInputTabWidgetLayout->addWidget(notesTextEdit, 0, 0); notesInputTabWidget->setLayout(notesInputTabWidgetLayout); i = dxUpLeftTab->addTab(notesInputTabWidget, tr("Notes")); */ // COMMENT tab starts here QGridLayout *commentInputTabWidgetLayout = new QGridLayout; commentInputTabWidgetLayout->addWidget(commentLineEdit, 0, 0); commentInputTabWidget->setLayout(commentInputTabWidgetLayout); i = dxUpLeftTab->addTab(commentInputTabWidget, tr("Comment")); entityPrimLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); entitySecLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); iotaAwardLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); entityNameLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); propModeLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); // Others Tab starts here QGridLayout *othersInputTabWidgetLayout = new QGridLayout; othersInputTabWidgetLayout->addWidget(entityNameLabel, 0, 0); othersInputTabWidgetLayout->addWidget(entityNameComboBox, 0, 1, 1, 2); othersInputTabWidgetLayout->addWidget(entityPrimLabel, 1, 0); othersInputTabWidgetLayout->addWidget(entityPrimDivComboBox, 1, 1, 1, 2); othersInputTabWidgetLayout->addWidget(entitySecLabel, 2, 0); othersInputTabWidgetLayout->addWidget(entitySecDivComboBox, 2, 1, 1, 2); othersInputTabWidgetLayout->addWidget(iotaAwardLabel, 3, 0); othersInputTabWidgetLayout->addWidget(iotaContinentComboBox, 3, 1); othersInputTabWidgetLayout->addWidget(iotaNumberLineEdit, 3, 2); othersInputTabWidgetLayout->addWidget(propModeLabel, 4, 0); othersInputTabWidgetLayout->addWidget(propModeComboBox, 4, 1, 1, 2); othersInputTabWidget->setLayout(othersInputTabWidgetLayout); i = dxUpLeftTab->addTab(othersInputTabWidget, tr("Others")); // MyData tab starts here QLabel *myPowerSpinBoxLabelN = new QLabel(tr("Power")); myPowerSpinBoxLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *operatorLabelN = new QLabel(tr("Operator")); operatorLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *stationCallSignLabelN = new QLabel(tr("Station Callsign")); stationCallSignLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *myLocatorLabelN = new QLabel(tr("My Locator")); myLocatorLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QGridLayout *myDataInputTabWidgetLayout = new QGridLayout; myDataInputTabWidgetLayout->addWidget(myPowerSpinBoxLabelN, 0, 0); myDataInputTabWidgetLayout->addWidget(operatorLabelN, 1, 0); myDataInputTabWidgetLayout->addWidget(stationCallSignLabelN, 2, 0); myDataInputTabWidgetLayout->addWidget(myLocatorLabelN, 3, 0); myDataInputTabWidgetLayout->addWidget(myPowerSpinBox, 0, 1); myDataInputTabWidgetLayout->addWidget(operatorLineEdit, 1, 1); myDataInputTabWidgetLayout->addWidget(stationCallSignLineEdit, 2, 1); myDataInputTabWidgetLayout->addWidget(myLocatorLineEdit, 3, 1); myDataInputTabWidget->setLayout(myDataInputTabWidgetLayout); i = dxUpLeftTab->addTab(myDataInputTabWidget, tr("My Data")); // MyData Tab finishes here // Sat Tab starts hre i = dxUpLeftTab->addTab(satTabWidget, tr("Satellite")); // Sat Tab finishes here QHBoxLayout *TimeLayout = new QHBoxLayout; TimeLayout->addWidget(dateEdit); TimeLayout->addWidget(timeEdit); QHBoxLayout *BandModeLayout = new QHBoxLayout; BandModeLayout->addWidget(bandComboBox); BandModeLayout->addWidget(modeComboBox); QHBoxLayout *QrzBandModeLayout = new QHBoxLayout; QrzBandModeLayout->addWidget(qrzLineEdit); QrzBandModeLayout->addLayout(BandModeLayout); qrzgroupBox = new QGroupBox(tr("QRZ")); qrzgroupBox->setFlat(true); QVBoxLayout *qrzvbox = new QVBoxLayout; //qrzvbox->addWidget(qrzLineEdit); qrzvbox->addLayout(QrzBandModeLayout); //qrzvbox->addLayout(BandModeLayout); qrzvbox->addStretch(1); qrzgroupBox->setLayout(qrzvbox); //QHBoxLayout *statusBarLayout = new QHBoxLayout; //statusBarLayout->addWidget(statusBar); //statusBarLayout->addWidget(qsoStatusBar); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(OKButton); //buttonsLayout->addWidget(spotItButton); buttonsLayout->addWidget(clearButton); QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate()); dateEdit->setDisplayFormat("yyyy/MM/dd"); timeEdit->setDisplayFormat("HH:mm:ss"); QGridLayout *dxUpLeftInputFrameLayout = new QGridLayout; dxUpLeftInputFrameLayout->addWidget(qrzgroupBox, 0, 0, 1, 0); dxUpLeftInputFrameLayout->addLayout(TimeLayout, 1, 0); //dxUpLeftInputFrameLayout->addLayout(BandModeLayout, 1, 1); dxUpLeftInputFrameLayout->addLayout(buttonsLayout,1, 1); dxUpLeftInputFrame->setLayout(dxUpLeftInputFrameLayout); QSplitter *upLeftSplitter = new QSplitter (this); upLeftSplitter->addWidget(dxUpLeftInputFrame); upLeftSplitter->addWidget(dxUpLeftTab); upLeftSplitter->setOrientation(Qt::Vertical); QVBoxLayout *dxUpRightFixLayout = new QVBoxLayout; dxUpRightFixLayout->addWidget(infoLabel1); dxUpRightFixLayout->addWidget(infoLabel2); infoLabel1->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); infoLabel2->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel1->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel2->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel3->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel4->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel5->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel6->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel7->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel8->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel9->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel10->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel11->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); bandLabel12->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *continentLabelN = new QLabel(tr("Continent")); continentLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); continentLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *prefixLabelN = new QLabel(tr("Prefix")); prefixLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); prefixLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *cqzLabelN = new QLabel(tr("CQ")); cqzLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); cqzLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *ituzLabelN = new QLabel(tr("ITU")); ituzLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); ituzLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *shortLabelN = new QLabel(tr("Short Path")); shortLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *longLabelN = new QLabel(tr("Long Path")); longLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *gradShortLabelN = new QLabel(tr("Grad")); gradShortLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); gradShortLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); distShortLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QLabel *gradLongLabelN = new QLabel(tr("Grad")); gradLongLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); gradLongLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); distShortLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); distLongLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); distLongLabel->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); QGridLayout *dxUpRightInfoTabmini1Layout = new QGridLayout; dxUpRightInfoTabmini1Layout->addWidget(continentLabelN, 0, 0); dxUpRightInfoTabmini1Layout->addWidget(continentLabel, 1, 0); dxUpRightInfoTabmini1Layout->addWidget(prefixLabelN, 0, 1); dxUpRightInfoTabmini1Layout->addWidget(prefixLabel, 1, 1); dxUpRightInfoTabmini1Layout->addWidget(cqzLabelN, 0, 2); dxUpRightInfoTabmini1Layout->addWidget(cqzLabel, 1, 2); dxUpRightInfoTabmini1Layout->addWidget(ituzLabelN, 0, 3); dxUpRightInfoTabmini1Layout->addWidget(ituzLabel, 1, 3); QGridLayout *dxUpRightInfoTabmini2Layout = new QGridLayout; dxUpRightInfoTabmini2Layout->addWidget(shortLabelN, 0, 0, 1, 0); dxUpRightInfoTabmini2Layout->addWidget(gradShortLabelN, 1, 0); dxUpRightInfoTabmini2Layout->addWidget(gradShortLabel, 1, 1); dxUpRightInfoTabmini2Layout->addWidget(distShortLabelN, 1, 2); dxUpRightInfoTabmini2Layout->addWidget(distShortLabel, 1, 3); QGridLayout *dxUpRightInfoTabmini3Layout = new QGridLayout; dxUpRightInfoTabmini3Layout->addWidget(longLabelN, 0, 0, 1, 0); dxUpRightInfoTabmini3Layout->addWidget(gradLongLabelN, 1, 0); dxUpRightInfoTabmini3Layout->addWidget(gradLongLabel, 1, 1); dxUpRightInfoTabmini3Layout->addWidget(distLongLabelN, 1, 2); dxUpRightInfoTabmini3Layout->addWidget(distLongLabel, 1, 3); QHBoxLayout *dxUpRightInfoTabmini4Layout = new QHBoxLayout; dxUpRightInfoTabmini4Layout->addLayout(dxUpRightInfoTabmini2Layout); dxUpRightInfoTabmini4Layout->addLayout(dxUpRightInfoTabmini3Layout); QWidget *infoTabWidget = new QWidget; QGridLayout *dxUpRightInfoBandsTabLayout = new QGridLayout; dxUpRightInfoBandsTabLayout->addWidget(bandLabel1, 0, 0); dxUpRightInfoBandsTabLayout->addWidget(bandLabel2, 0, 1); dxUpRightInfoBandsTabLayout->addWidget(bandLabel3, 0, 2); dxUpRightInfoBandsTabLayout->addWidget(bandLabel4, 0, 3); dxUpRightInfoBandsTabLayout->addWidget(bandLabel5, 0, 4); dxUpRightInfoBandsTabLayout->addWidget(bandLabel6, 0, 5); dxUpRightInfoBandsTabLayout->addWidget(bandLabel7, 1, 0); dxUpRightInfoBandsTabLayout->addWidget(bandLabel8, 1, 1); dxUpRightInfoBandsTabLayout->addWidget(bandLabel9, 1, 2); dxUpRightInfoBandsTabLayout->addWidget(bandLabel10, 1, 3); dxUpRightInfoBandsTabLayout->addWidget(bandLabel11, 1, 4); dxUpRightInfoBandsTabLayout->addWidget(bandLabel12, 1, 5); QVBoxLayout *dxUpRightInfoTabLayout = new QVBoxLayout; dxUpRightInfoTabLayout->addLayout(dxUpRightInfoBandsTabLayout); dxUpRightInfoTabLayout->addLayout(dxUpRightInfoTabmini1Layout); dxUpRightInfoTabLayout->addLayout(dxUpRightInfoTabmini4Layout); infoTabWidget->setLayout(dxUpRightInfoTabLayout); /* addLayout ( QLayout * layout, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 ) */ QLabel *dxMarathonTopDXCCLabelN = new QLabel(tr("DXCC")); QLabel *dxMarathonTopCQLabelN = new QLabel(tr("CQ")); QLabel *dxMarathonTopScoreLabelN = new QLabel(tr("Score")); QLabel *dxMarathonLabelN = new QLabel(tr("DX-Marathon")); dxMarathonTopDXCCLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); dxMarathonTopCQLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); dxMarathonTopScoreLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); dxMarathonLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); QWidget *searchTabWidget = new QWidget; i = dxUpRightTab->addTab(infoTabWidget, tr("Info")); QWidget *awardsTabWidget = new QWidget; QLabel *awardLabelN = new QLabel(tr("Award")); awardLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); QLabel *confirmedLabelN = new QLabel(tr("Confirmed")); confirmedLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); QLabel *workedLabelN = new QLabel(tr("Worked")); workedLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); QLabel *dxccLabelN = new QLabel(tr("DXCC")); //dxccLabelN->setAlignment(Qt::AlignVCenter| Qt::AlignCenter); dxccLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); QLabel *wazLabelN = new QLabel(tr("WAZ")); wazLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); QLabel *localLabelN = new QLabel(tr("Local")); localLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); QLabel *qsoNLabelN = new QLabel(tr("QSOs")); qsoNLabelN->setAlignment(Qt::AlignVCenter | Qt::AlignCenter); //QVBoxLayout *dxMarathonTLayout = new QVBoxLayout; //dxMarathonTLayout->addWidget(); //dxMarathonTLayout->addWidget(); QGridLayout *dxMarathonDLayout = new QGridLayout; /* dxMarathonDLayout->addWidget(dxMarathonTopDXCCLabelN, 0, 0); dxMarathonDLayout->addWidget(dxMarathonTopCQLabelN, 0, 1); dxMarathonDLayout->addWidget(dxMarathonTopScoreLabelN, 0, 2); dxMarathonDLayout->addWidget(dxMarathonDXCC, 1, 0); dxMarathonDLayout->addWidget(dxMarathonCQ, 1, 1); dxMarathonDLayout->addWidget(dxMarathonPoints, 1, 2); */ dxMarathonDLayout->addWidget(dxMarathonTopDXCCLabelN, 0, 0); dxMarathonDLayout->addWidget(dxMarathonTopCQLabelN, 0, 1); dxMarathonDLayout->addWidget(dxMarathonTopScoreLabelN, 0, 2); dxMarathonDLayout->addWidget(dxMarathonDXCCQLCDNumber, 1, 0); dxMarathonDLayout->addWidget(dxMarathonCQQLCDNumber, 1, 1); dxMarathonDLayout->addWidget(dxMarathonPointsQLCDNumber, 1, 2); QVBoxLayout *dxMarathonTLayout = new QVBoxLayout; dxMarathonTLayout->addWidget(dxMarathonLabelN); dxMarathonTLayout->addWidget(operatingYearsComboBox); QGridLayout *dxUpRightAwardsTabLayout = new QGridLayout; dxUpRightAwardsTabLayout->addWidget(awardLabelN, 0, 0); dxUpRightAwardsTabLayout->addWidget(workedLabelN, 0, 1); dxUpRightAwardsTabLayout->addWidget(confirmedLabelN, 0, 2); dxUpRightAwardsTabLayout->addWidget(dxccLabelN, 1, 0); dxUpRightAwardsTabLayout->addWidget(dxccWorkedQLCDNumber, 1, 1); dxUpRightAwardsTabLayout->addWidget(dxccConfirmedQLCDNumber, 1, 2); dxUpRightAwardsTabLayout->addWidget(wazLabelN, 2, 0); dxUpRightAwardsTabLayout->addWidget(wazWorkedQLCDNumber, 2, 1); dxUpRightAwardsTabLayout->addWidget(wazConfirmedQLCDNumber, 2, 2); dxUpRightAwardsTabLayout->addWidget(localLabelN, 3, 0); dxUpRightAwardsTabLayout->addWidget(localWorkedQLCDNumber, 3, 1); dxUpRightAwardsTabLayout->addWidget(localConfirmedQLCDNumber, 3, 2); dxUpRightAwardsTabLayout->addWidget(qsoNLabelN, 4, 0); dxUpRightAwardsTabLayout->addWidget(qsoWorkedQLCDNumber, 4, 1); dxUpRightAwardsTabLayout->addWidget(qsoConfirmedQLCDNumber, 4, 2); dxUpRightAwardsTabLayout->addLayout(dxMarathonTLayout, 5, 0); dxUpRightAwardsTabLayout->addLayout(dxMarathonDLayout, 5, 1, 1, -1); dxUpRightAwardsTabLayout->addWidget(recalculateAwardsButton, 6, 1); awardsTabWidget->setLayout(dxUpRightAwardsTabLayout); i = dxUpRightTab->addTab(awardsTabWidget, tr("Awards")); /* searchgroupBox = new QGroupBox(tr("Search")); searchgroupBox->setFlat(true); QVBoxLayout *searchvbox = new QVBoxLayout; searchvbox->addWidget(searchBoxLineEdit); searchvbox->addStretch(1); searchgroupBox->setLayout(searchvbox); */ QHBoxLayout *dxUpRightButtonsLayout = new QHBoxLayout; //dxUpRightLineAndButtonsLayout->addWidget(searchBoxLineEdit); dxUpRightButtonsLayout->addWidget(searchBoxReSearchButton); dxUpRightButtonsLayout->addWidget(searchBoxClearButton); dxUpRightButtonsLayout->addWidget(searchBoxSelectAllButton); dxUpRightButtonsLayout->addWidget(searchBoxExportButton); /* QGridLayout *dxUpRightSearchTabLayout = new QGridLayout; //dxUpRightSearchTabLayout->addWidget(searchgroupBox, 0, 0 ); //dxUpRightSearchTabLayout->addLayout(dxUpRightLineAndButtonsLayout, 0, 1 ); dxUpRightSearchTabLayout->addWidget(searchBoxLineEdit, 0, 0, -1, 0); dxUpRightSearchTabLayout->addLayout(dxUpRightButtonsLayout, 1, 0, -1, 0); dxUpRightSearchTabLayout->addWidget(searchResultsTreeWidget, 2, 0, -1, 0 ); */ QHBoxLayout *dxUpRightSearchTopLayout = new QHBoxLayout; dxUpRightSearchTopLayout->addWidget(searchBoxLineEdit); dxUpRightSearchTopLayout->addWidget(searchAllRadioButton); QVBoxLayout *dxUpRightSearchTabLayout = new QVBoxLayout; //dxUpRightSearchTabLayout->addWidget(searchgroupBox, 0, 0 ); //dxUpRightSearchTabLayout->addLayout(dxUpRightLineAndButtonsLayout, 0, 1 ); //dxUpRightSearchTabLayout->addWidget(searchBoxLineEdit); dxUpRightSearchTabLayout->addLayout(dxUpRightSearchTopLayout); dxUpRightSearchTabLayout->addLayout(dxUpRightButtonsLayout); dxUpRightSearchTabLayout->addWidget(searchResultsTreeWidget); searchTabWidget->setLayout(dxUpRightSearchTabLayout); //searchTabWidget->setLayout(dxUpRightSearchALLLayout); i = dxUpRightTab->addTab(searchTabWidget, tr("Search")); QWidget *logTabWidget = new QWidget; QWidget *dxClusterTabWidget = new QWidget; QHBoxLayout *logTabWidgetLayout = new QHBoxLayout; QHBoxLayout *dxClusterTabWidgetLayout = new QHBoxLayout; logTabWidgetLayout->addWidget(logView);// logTabWidget->setLayout(logTabWidgetLayout); dxClusterTabWidgetLayout->addWidget(dxClusterWidget); dxClusterTabWidget->setLayout(dxClusterTabWidgetLayout); i = dxBottonTab->addTab(logTabWidget, tr("Log")); i = dxBottonTab->addTab(dxClusterTabWidget, tr("DX-Cluster")); QVBoxLayout *dxUpRightLayout = new QVBoxLayout; dxUpRightLayout->addLayout(dxUpRightFixLayout); dxUpRightLayout->addWidget(dxUpRightTab); QWidget *upRightWidget = new QWidget; upRightWidget->setLayout(dxUpRightLayout); //QWidget *upLeftWidget = new QWidget; //upLeftWidget->setLayout(dxUpLeftLayout); //////////// QSplitter *upSplitter = new QSplitter (this); //upSplitter->addWidget(upLeftWidget); upSplitter->addWidget(upLeftSplitter); upSplitter->addWidget(upRightWidget); //QHBoxLayout *upperLayout = new QHBoxLayout; //upperLayout->addLayout(dxUpLeftLayout); //upperLayout->addLayout(dxUpRightLayout); //QWidget *upper = new QWidget; //upper->setLayout(upperLayout); QSplitter *splitter = new QSplitter(this); splitter->addWidget(upSplitter); splitter->addWidget(dxBottonTab); splitter->setOrientation(Qt::Vertical); QHBoxLayout *mLayout = new QHBoxLayout; mLayout->addWidget(splitter); mainWidget->setLayout(mLayout); //layout->addLayout(dxUpLeftLayout, 0, 0); //layout->addLayout(dxUpRightLayout, 0, 1); //layout->addWidget(dxBottonTab, 1, 0, 1, 2); //mainWidget->setLayout(layout); // Disabled widgets to be enabled as functionality is deployed //iotaContinentComboBox->setEnabled(false); //iotaNumberLineEdit->setEnabled(false); //myPowerSpinBox->setEnabled(false); //locatorLineEdit->setEnabled(false); //eqslSentComboBox->setEnabled(false); //eqslRecComboBox->setEnabled(false); //lotwSentComboBox->setEnabled(false); //lotwRecComboBox->setEnabled(false); eqslSentQDateEdit->setEnabled(false); eqslRecQDateEdit->setEnabled(false); lotwSentQDateEdit->setEnabled(false); lotwRecQDateEdit->setEnabled(false); //qslSentCheckBox->setEnabled(false); //qslRecCheckBox->setEnabled(false); qslSentQDateEdit->setEnabled(false); qslRecQDateEdit->setEnabled(false); qslSentViaComboBox->setEnabled(false); qslRecViaComboBox->setEnabled(false); //qslmsgTextEdit->setEnabled(false); //qslViaLineEdit->setEnabled(false); entityPrimDivComboBox->setEnabled(false); entitySecDivComboBox->setEnabled(false); entityNameComboBox->setEnabled(true); propModeComboBox->setEnabled(true); //qDebug() << "MainWindow::createUIDX - OS DETECTION" << endl; #ifdef Q_OS_WIN //qDebug() << "MainWindow::createUIDX - WINDOWS DETECTED!" << endl; //txFreqSpinBox->setFrame(true); //txFreqSpinBox->setFrameShadow(QFrame::Raised); //txFreqSpinBox->setFrameStyle(QFrame::StyledPanel); //rxFreqSpinBox->setFrameShadow(QFrame::Raised); //rxFreqSpinBox->setFrameStyle(QFrame::StyledPanel); dxUpLeftInputFrame->setFrameShadow(QFrame::Raised); dxUpLeftInputFrame->setFrameStyle(QFrame::StyledPanel); qsoNLabelN->setFrameShadow(QFrame::Raised); qsoNLabelN->setFrameStyle(QFrame::StyledPanel); wazLabelN->setFrameShadow(QFrame::Raised); wazLabelN->setFrameStyle(QFrame::StyledPanel); localLabelN->setFrameShadow(QFrame::Raised); localLabelN->setFrameStyle(QFrame::StyledPanel); dxccLabelN->setFrameShadow(QFrame::Raised); dxccLabelN->setFrameStyle(QFrame::StyledPanel); workedLabelN->setFrameShadow(QFrame::Raised); workedLabelN->setFrameStyle(QFrame::StyledPanel); confirmedLabelN->setFrameShadow(QFrame::Raised); confirmedLabelN->setFrameStyle(QFrame::StyledPanel); awardLabelN->setFrameShadow(QFrame::Raised); awardLabelN->setFrameStyle(QFrame::StyledPanel); dxMarathonTopDXCCLabelN->setFrameShadow(QFrame::Raised); dxMarathonTopCQLabelN->setFrameShadow(QFrame::Raised); dxMarathonTopScoreLabelN->setFrameShadow(QFrame::Raised); dxMarathonLabelN->setFrameShadow(QFrame::Raised); dxMarathonTopDXCCLabelN->setFrameStyle(QFrame::StyledPanel); dxMarathonTopCQLabelN->setFrameStyle(QFrame::StyledPanel); dxMarathonTopScoreLabelN->setFrameStyle(QFrame::StyledPanel); dxMarathonLabelN->setFrameStyle(QFrame::StyledPanel); continentLabel->setFrameShadow(QFrame::Raised); continentLabel->setFrameStyle(QFrame::StyledPanel); continentLabelN->setFrameShadow(QFrame::Raised); continentLabelN->setFrameStyle(QFrame::StyledPanel); prefixLabelN->setFrameShadow(QFrame::Raised); prefixLabelN->setFrameStyle(QFrame::StyledPanel); prefixLabel->setFrameShadow(QFrame::Raised); prefixLabel->setFrameStyle(QFrame::StyledPanel); cqzLabelN->setFrameShadow(QFrame::Raised); cqzLabelN->setFrameStyle(QFrame::StyledPanel); cqzLabel->setFrameShadow(QFrame::Raised); cqzLabel->setFrameStyle(QFrame::StyledPanel); ituzLabel->setFrameShadow(QFrame::Raised); ituzLabel->setFrameStyle(QFrame::StyledPanel); ituzLabelN->setFrameShadow(QFrame::Raised); ituzLabelN->setFrameStyle(QFrame::StyledPanel); shortLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); shortLabelN->setFrameShadow(QFrame::Raised); shortLabelN->setFrameStyle(QFrame::StyledPanel); longLabelN->setFrameShadow(QFrame::Raised); longLabelN->setFrameStyle(QFrame::StyledPanel); gradShortLabelN->setFrameShadow(QFrame::Raised); gradShortLabelN->setFrameStyle(QFrame::StyledPanel); gradShortLabel->setFrameShadow(QFrame::Raised); gradShortLabel->setFrameStyle(QFrame::StyledPanel); distShortLabelN->setFrameShadow(QFrame::Raised); distShortLabelN->setFrameStyle(QFrame::StyledPanel); distShortLabel->setFrameShadow(QFrame::Raised); distShortLabel->setFrameStyle(QFrame::StyledPanel); gradLongLabelN->setFrameShadow(QFrame::Raised); gradLongLabelN->setFrameStyle(QFrame::StyledPanel); gradLongLabel->setFrameShadow(QFrame::Raised); gradLongLabel->setFrameStyle(QFrame::StyledPanel); distLongLabelN->setFrameShadow(QFrame::Raised); distLongLabelN->setFrameStyle(QFrame::StyledPanel); distLongLabel->setFrameShadow(QFrame::Raised); distLongLabel->setFrameStyle(QFrame::StyledPanel); bandLabel1->setFrameShadow(QFrame::Raised); bandLabel1->setFrameStyle(QFrame::StyledPanel); bandLabel2->setFrameShadow(QFrame::Raised); bandLabel2->setFrameStyle(QFrame::StyledPanel); bandLabel3->setFrameShadow(QFrame::Raised); bandLabel3->setFrameStyle(QFrame::StyledPanel); bandLabel4->setFrameShadow(QFrame::Raised); bandLabel4->setFrameStyle(QFrame::StyledPanel); bandLabel5->setFrameShadow(QFrame::Raised); bandLabel5->setFrameStyle(QFrame::StyledPanel); bandLabel6->setFrameShadow(QFrame::Raised); bandLabel6->setFrameStyle(QFrame::StyledPanel); bandLabel7->setFrameShadow(QFrame::Raised); bandLabel7->setFrameStyle(QFrame::StyledPanel); bandLabel8->setFrameShadow(QFrame::Raised); bandLabel8->setFrameStyle(QFrame::StyledPanel); bandLabel9->setFrameShadow(QFrame::Raised); bandLabel9->setFrameStyle(QFrame::StyledPanel); bandLabel10->setFrameShadow(QFrame::Raised); bandLabel10->setFrameStyle(QFrame::StyledPanel); bandLabel11->setFrameShadow(QFrame::Raised); bandLabel11->setFrameStyle(QFrame::StyledPanel); bandLabel12->setFrameShadow(QFrame::Raised); bandLabel12->setFrameStyle(QFrame::StyledPanel); infoLabel1->setFrameShadow(QFrame::Raised); infoLabel1->setFrameStyle(QFrame::StyledPanel); infoLabel2->setFrameShadow(QFrame::Raised); infoLabel2->setFrameStyle(QFrame::StyledPanel); /* QSLViaLabelN->setFrameShadow(QFrame::Raised); QSLViaLabelN->setFrameStyle(QFrame::StyledPanel); QSLSentLabelN->setFrameShadow(QFrame::Raised); QSLSentLabelN->setFrameStyle(QFrame::StyledPanel); QSLRecLabelN->setFrameShadow(QFrame::Raised); QSLRecLabelN->setFrameStyle(QFrame::StyledPanel); eQSLSentLabelN->setFrameShadow(QFrame::Raised); eQSLSentLabelN->setFrameStyle(QFrame::StyledPanel); eQSLRecLabelN->setFrameShadow(QFrame::Raised); eQSLRecLabelN->setFrameStyle(QFrame::StyledPanel); lotWSentLabelN->setFrameShadow(QFrame::Raised); lotWSentLabelN->setFrameStyle(QFrame::StyledPanel); myPowerSpinBoxLabelN->setFrameShadow(QFrame::Raised); myPowerSpinBoxLabelN->setFrameStyle(QFrame::StyledPanel); rxPowerSpinBoxLabelN->setFrameShadow(QFrame::Raised); rxPowerSpinBoxLabelN->setFrameStyle(QFrame::StyledPanel); operatorLabelN->setFrameShadow(QFrame::Raised); operatorLabelN->setFrameStyle(QFrame::StyledPanel); stationCallSignLabelN->setFrameShadow(QFrame::Raised); stationCallSignLabelN->setFrameStyle(QFrame::StyledPanel); myLocatorLabelN->setFrameShadow(QFrame::Raised); myLocatorLabelN->setFrameStyle(QFrame::StyledPanel); lotWRecLabelN->setFrameShadow(QFrame::Raised); lotWRecLabelN->setFrameStyle(QFrame::StyledPanel); */ //nameLabel->setFrameShape(QFrame::StyledPanel); //nameLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); //nameLineEdit->setFrameShadow(QFrame::Raised); //nameLineEdit->setFrameStyle(QFrame::StyledPanel); //qthLabel->setFrameShape(QFrame::Box); //qthLabel->setFrameShadow(QFrame::Raised); //qthLabel->setFrameStyle(QFrame::StyledPanel); //qthLineEdit->setFrameShadow(QFrame::Raised); //qthLineEdit->setFrameStyle(QFrame::StyledPanel); //locLabel->setFrameShadow(QFrame::Raised); //locLabel->setFrameStyle(QFrame::StyledPanel); //locatorLineEdit->setFrameShadow(QFrame::Raised); //locatorLineEdit->setFrameStyle(QFrame::StyledPanel); //rxPowerLayout->setFrameShadow(QFrame::Raised); //rxPowerLayout->setFrameStyle(QFrame::StyledPanel); //txfreqLabelN->setFrameShadow(QFrame::Raised); //txfreqLabelN->setFrameStyle(QFrame::StyledPanel); //rxfreqLabelN->setFrameShadow(QFrame::Raised); //rxfreqLabelN->setFrameStyle(QFrame::StyledPanel); //freqLabelN->setFrameShadow(QFrame::Raised); //freqLabelN->setFrameStyle(QFrame::StyledPanel); /* nameLabel->setFrameShadow(QFrame::Raised); nameLabel->setFrameStyle(QFrame::StyledPanel); qthLabel->setFrameShadow(QFrame::Raised); qthLabel->setFrameStyle(QFrame::StyledPanel); locLabel->setFrameShadow(QFrame::Raised); locLabel->setFrameStyle(QFrame::StyledPanel); rstRxLabelN->setFrameShadow(QFrame::Raised); rstRxLabelN->setFrameStyle(QFrame::StyledPanel); rstTxLabelN->setFrameShadow(QFrame::Raised); rstTxLabelN->setFrameStyle(QFrame::StyledPanel); */ #else //qDebug() << "MainWindow::createUIDX - NO WINDOWS DETECTED!" << endl; dxUpLeftInputFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); localLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); qsoNLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); wazLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); dxccLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); workedLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); confirmedLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); awardLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); dxMarathonTopDXCCLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); dxMarathonTopCQLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); dxMarathonTopScoreLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); dxMarathonLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); continentLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); continentLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); prefixLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); prefixLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); cqzLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); cqzLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); ituzLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); ituzLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); shortLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); longLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); gradShortLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); gradShortLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); distShortLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); distShortLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); gradLongLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); distLongLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); distLongLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); gradLongLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel1->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel2->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel3->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel4->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel5->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel6->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel7->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel8->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel9->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel10->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel11->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); bandLabel12->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); infoLabel1->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); infoLabel2->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //QSLViaLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //QSLSentLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //QSLRecLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //eQSLSentLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //eQSLRecLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //lotWSentLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //myPowerSpinBoxLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //rxPowerSpinBoxLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //operatorLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //stationCallSignLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //myLocatorLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //lotWRecLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //nameLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //nameLineEdit->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //qthLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //qthLineEdit->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //locLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //locatorLineEdit->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //rxPowerLayout->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //txfreqLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //rxfreqLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //rstRxLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //rstTxLabelN->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //nameLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //qthLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); //locLabel->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); #endif } void MainWindow::slotADIFExport(){ //qDebug() << "MainWindow::slotADIFExport " << endl; QString fileName = QFileDialog::getSaveFileName(this, tr("Save ADIF File"), kontestDir, tr("ADIF (*.adi *.adif)")); filemanager->adifLogExport(fileName, currentLog); } void MainWindow::slotADIFExportAll(){ //qDebug() << "MainWindow::slotADIFExportAll " << endl; QString fileName = QFileDialog::getSaveFileName(this, tr("Save ADIF File"), kontestDir, tr("ADIF (*.adi *.adif)")); filemanager->adifLogExport(fileName, 0); } void MainWindow::slotRQSLExport() { QString fileName = QFileDialog::getSaveFileName(this, tr("Save ADIF File"), kontestDir, tr("ADIF (*.adi *.adif)")); filemanager->adifReqQSLExport(fileName); } void MainWindow::slotCabrilloExport() { //qDebug() << "MainWindow::slotCabrilloExport " << endl; QString fileName = QFileDialog::getSaveFileName(this, tr("Save Cabrillo File"), kontestDir, tr("Cabrillo (*.log)")); contest->saveFileToSend(fileName); } void MainWindow::slotADIFImport(){ //qDebug() << "MainWindow::slotADIFImport " << endl; QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), kontestDir, tr("ADIF (*.adi *.adif)")); if (fileName.isNull()) { } else { filemanager->adifReadLog(fileName, currentLog); logModel->select(); checkIfNewBandOrMode(); switch (contestMode) { case CQ_WW_SSB: break; case CQ_WW_CW: break; default: operatingYearsComboBox->addItems(dataProxy->getOperatingYears(currentLog)); //bandComboBox->setCurrentIndex(bandComboBox->findText(aux1)); awards->recalculateAwards(); showAwards(); break; } //qDebug() << "MainWindow::slotADIFImport-7" << endl; } } void MainWindow::initialContestModeConfiguration() { //qDebug() << "MainWindow::initialContestModeConfiguration: - 0" << endl; if (!configured){ //qDebug() << "MainWindow::initialContestModeConfiguration: - 01" << endl; slotSetup(); //qDebug() << "MainWindow::initialContestModeConfiguration: - 02" << endl; return; } //qDebug() << "MainWindow::initialContestModeConfiguration: - 03" << endl; QSqlQuery query; QStringList contestQS; /* QSqlQuery query("SELECT id FROM log"); QSqlRecord rec = query.record(); int nameCol; while (query.next()) { nameCol = rec.indexOf("call"); */ //qDebug() << "MainWindow::initialContestModeConfiguration: - 04" << endl; switch (contestMode) { case CQ_WW_SSB: //qDebug() << "MainWindow::initialContestModeConfiguration: - 05" << endl; defaultMode = dataProxy->getIdFromModeName("SSB"); SRXLineEdit->setInputMask("09"); STXLineEdit->setInputMask("09"); contestQS << QString::number(world->getQRZARRLId(stationQRZ)) << QString::number(world->getQRZCqz(stationQRZ)) << world->getQRZContinentNumber(stationQRZ) << world->getQRZContinentNumber("K"); contest = new ContestCQWWDXSSB(contestQS); break; case CQ_WW_CW: //qDebug() << "MainWindow::initialContestModeConfiguration: - 06" << endl; SRXLineEdit->setInputMask("09"); STXLineEdit->setInputMask("09"); contestQS << QString::number(world->getQRZARRLId(stationQRZ)) << QString::number(world->getQRZCqz(stationQRZ)) << world->getQRZContinentNumber(stationQRZ) << world->getQRZContinentNumber("K"); //contest = new ContestCQWWDXSSB(contestQS); break; default: //qDebug() << "MainWindow::initialContestModeConfiguration: - 07" << endl; break; } } void MainWindow::qsoToEdit (const int _qso) { //qDebug() << "MainWindow::qsoToEdit: " << QString::number(_qso) << endl; int nameCol; QString aux1; double testValueDouble; // Variable just to test if the value is in the appropriate range modify = true; modifyingQSO = _qso; OKButton->setText(tr("&Modify")); //TODO: Optimize the following query. Maybe the * is not needed. QString stringQuery = QString("SELECT * FROM log WHERE id ='%1' AND lognumber='%2'").arg(_qso).arg(currentLog); //qDebug() << "MainWindow::qsoToEdit: " << stringQuery << endl; QSqlQuery query(stringQuery); query.next(); if (query.isValid()) { if ((clublogActive) && (clublogRealTime)) { clublogPrevQSO = dataProxy->getClubLogRealTimeFromId(_qso); } QSqlRecord rec = query.record(); // ADD THE DATA THAT IS PRESENT IN ALL THE MODES nameCol = rec.indexOf("call"); aux1 = (query.value(nameCol)).toString(); qrzLineEdit->setText(aux1); currentQrz = aux1; currentEntity = world->getQRZARRLId(currentQrz); nameCol = rec.indexOf("qso_date"); aux1 = (query.value(nameCol)).toString(); dateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); nameCol = rec.indexOf("time_on"); aux1 = (query.value(nameCol)).toString(); timeEdit->setTime(QTime::fromString(aux1, "hh:mm:ss")); nameCol = rec.indexOf("bandid"); aux1 = (query.value(nameCol)).toString(); stringQuery = QString("SELECT name FROM band WHERE id ='%1'").arg(aux1); QSqlQuery queryAux(stringQuery); queryAux.next(); if (queryAux.isValid()) { aux1 = (queryAux.value(0)).toString(); bandComboBox->setCurrentIndex(bandComboBox->findText(aux1)); } else { bandComboBox->setCurrentIndex(bandComboBox->findText(dataProxy->getNameFromBandId(defaultBand))); //bandComboBox->setCurrentIndex(defaultBand); } nameCol = rec.indexOf("modeid"); aux1 = (query.value(nameCol)).toString(); stringQuery = QString("SELECT submode FROM mode WHERE id ='%1'").arg(aux1); queryAux.exec(stringQuery); queryAux.next(); if (queryAux.isValid()) { aux1 = (queryAux.value(0)).toString(); modeComboBox->setCurrentIndex(modeComboBox->findText(aux1)); } else { modeComboBox->setCurrentIndex(modeComboBox->findText(dataProxy->getNameFromSubModeId(defaultMode))); //modeComboBox->setCurrentIndex(defaultMode); } nameCol = rec.indexOf("rst_sent"); aux1 = (query.value(nameCol)).toString(); rstTXLineEdit->setText(aux1); nameCol = rec.indexOf("rst_rcvd"); aux1 = (query.value(nameCol)).toString(); rstRXLineEdit->setText(aux1); //qDebug() << "MainWindow::qsoToEdit: - before switch" << endl; switch (contestMode) { case CQ_WW_SSB: break; case CQ_WW_CW: break; default: //qDebug() << "MainWindow::qsoToEdit: - in default" << endl; nameCol = rec.indexOf("qsl_via"); aux1 = (query.value(nameCol)).toString(); qslViaLineEdit->setText(aux1); nameCol = rec.indexOf("qslmsg"); aux1 = (query.value(nameCol)).toString(); qslmsgTextEdit->setText(aux1); nameCol = rec.indexOf("comment"); aux1 = (query.value(nameCol)).toString(); if (aux1.length()>0) { commentLineEdit->setText(aux1); } //nameCol = rec.indexOf("notes"); //aux1 = (query.value(nameCol)).toString(); //notesTextEdit->setText(aux1); nameCol = rec.indexOf("name"); aux1 = (query.value(nameCol)).toString(); //qDebug() << "MainWindow::qsoToEdit: - NAME: " << aux1 << endl; if (aux1.length()>0) { nameLineEdit->setText(aux1); } nameCol = rec.indexOf("qth"); aux1 = (query.value(nameCol)).toString(); qthLineEdit->setText(aux1); nameCol = rec.indexOf("gridsquare"); aux1 = (query.value(nameCol)).toString(); locatorLineEdit->setText(aux1); nameCol = rec.indexOf("operator"); aux1 = (query.value(nameCol)).toString(); operatorLineEdit->setText(aux1.toUpper()); nameCol = rec.indexOf("station_callsign"); aux1 = (query.value(nameCol)).toString(); stationCallSignLineEdit->setText(aux1.toUpper()); nameCol = rec.indexOf("my_gridsquare"); aux1 = (query.value(nameCol)).toString(); myLocatorLineEdit->setText(aux1); nameCol = rec.indexOf("tx_pwr"); aux1 = (query.value(nameCol)).toString(); testValueDouble = aux1.toDouble(); if (testValueDouble >=0) { myPowerSpinBox->setValue(testValueDouble); } else { myPowerSpinBox->setValue(0.0); } nameCol = rec.indexOf("rx_pwr"); aux1 = (query.value(nameCol)).toString(); testValueDouble = aux1.toDouble(); if (testValueDouble >=0) { rxPowerSpinBox->setValue(testValueDouble); } else { rxPowerSpinBox->setValue(0.0); } nameCol = rec.indexOf("freq"); aux1 = (query.value(nameCol)).toString(); //qDebug() << "MainWindow::qsoToEdit (freq STRING):" << aux1 << endl; testValueDouble = aux1.toDouble(); //qDebug() << "MainWindow::qsoToEdit (freq):" << QString::number(testValueDouble) << endl; if ((testValueDouble >=0) && (testValueDouble <= txFreqSpinBox->maximum()) ) { txFreqSpinBox->setValue(testValueDouble); //qDebug() << "MainWindow::qsoToEdit: Freq - OverFlow " << endl; //freqQLCDNumber->display(testValueDouble); } else { //qDebug() << "MainWindow::qsoToEdit: Freq - OK " << endl; txFreqSpinBox->setValue(0); } nameCol = rec.indexOf("freq_rx"); aux1 = (query.value(nameCol)).toString(); //qDebug() << "MainWindow::qsoToEdit (freq_rx STRING):" << aux1 << endl; testValueDouble = aux1.toDouble(); //qDebug() << "MainWindow::qsoToEdit (freq_rx):" << QString::number(testValueDouble) << endl; if ((testValueDouble >=0) && (testValueDouble <= rxFreqSpinBox->maximum()) ) { rxFreqSpinBox->setValue(testValueDouble); //qDebug() << "MainWindow::qsoToEdit: Freq_RX - OverFlow " << endl; //freqQLCDNumber->display(testValueDouble); } else { //qDebug() << "MainWindow::qsoToEdit: Freq_RX - OK " << endl; rxFreqSpinBox->setValue(0); } // myPowerSpinBox->setValue(aux1.toDouble()); //QSL SENT nameCol = rec.indexOf("qsl_sent"); aux1 = (query.value(nameCol)).toString(); if ( (aux1.toUpper()) == "Y" ) { //qDebug() << "MainWindow::qsoToEdit: - QSL Sent " << endl; qslSentComboBox->setCurrentIndex( qslSentComboBox->findText(tr("Y-Yes")) ); nameCol = rec.indexOf("qslsdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { qslSentQDateEdit->setEnabled(true); //qslSentViaComboBox->setEnabled(true); qslSentQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ( (aux1.toUpper()) == "N") { qslSentComboBox->setCurrentIndex( qslSentComboBox->findText(tr("N-No") ) ); } else if ((aux1.toUpper()) == "R") { qslSentComboBox->setCurrentIndex( qslSentComboBox->findText(tr("R-Requested") ) ); } else if ((aux1.toUpper()) == "Q") { qslSentComboBox->setCurrentIndex( qslSentComboBox->findText(tr("Q-Queued")) ); nameCol = rec.indexOf("qslsdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { qslSentQDateEdit->setEnabled(true); //qslSentViaComboBox->setEnabled(true); qslSentQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ((aux1.toUpper()) =="I") { qslSentComboBox->setCurrentIndex( qslSentComboBox->findText(tr("I-Ignore")) ); nameCol = rec.indexOf("qslsdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { qslSentQDateEdit->setEnabled(true); //qslSentViaComboBox->setEnabled(true); qslSentQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else { qslSentComboBox->setCurrentIndex( qslSentComboBox->findText(tr("N-No") ) ); } nameCol = rec.indexOf("qsl_sent_via"); aux1 = (query.value(nameCol)).toString(); if ( (aux1.toUpper()) == "B" ) { qslSentViaComboBox->setCurrentIndex( qslSentViaComboBox->findText(tr("B-Bureau"))) ; } else if ( (aux1.toUpper()) == "D" ){ qslSentViaComboBox->setCurrentIndex( qslSentViaComboBox->findText(tr("D-Direct"))) ; } else if ( (aux1.toUpper()) == "E" ){ qslSentViaComboBox->setCurrentIndex( qslSentViaComboBox->findText(tr("E-Electronic"))) ; } else if ( (aux1.toUpper()) == "M" ){ qslSentViaComboBox->setCurrentIndex( qslSentViaComboBox->findText(tr("M-Manager"))) ; } else { qslSentViaComboBox->setCurrentIndex( qslSentViaComboBox->findText(tr("B-Bureau"))) ; } //QSL RECEPTION // tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("I-Ignore") << tr("V-Verified"); // tr("B-Bureau") << tr("D-Direct") << tr("E-Electronic") << tr("M-Manager"); //QSLRDATE: (only valid if QSL_RCVD is Y, I, or V) nameCol = rec.indexOf("qsl_rcvd"); aux1 = (query.value(nameCol)).toString(); if ( (aux1.toUpper()) == "Y" ) { qslRecComboBox->setCurrentIndex( qslRecComboBox->findText(tr("Y-Yes")) ); nameCol = rec.indexOf("qslrdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { qslRecQDateEdit->setEnabled(true); qslRecQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ( (aux1.toUpper()) == "N") { qslRecComboBox->setCurrentIndex( qslRecComboBox->findText(tr("N-No") ) ); } else if ((aux1.toUpper()) == "R") { qslRecComboBox->setCurrentIndex( qslRecComboBox->findText(tr("R-Requested") ) ); } else if ((aux1.toUpper()) =="I") { qslRecComboBox->setCurrentIndex( qslRecComboBox->findText(tr("I-Ignore")) ); nameCol = rec.indexOf("qslrdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { qslRecQDateEdit->setEnabled(true); qslRecQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ((aux1.toUpper()) == "V") { qslRecComboBox->setCurrentIndex( qslRecComboBox->findText(tr("V-Verified") ) ); nameCol = rec.indexOf("qslrdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { qslRecQDateEdit->setEnabled(true); qslRecQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else { qslRecComboBox->setCurrentIndex( qslRecComboBox->findText(tr("N-No") ) ); } nameCol = rec.indexOf("qsl_rcvd_via"); aux1 = (query.value(nameCol)).toString(); if ( (aux1.toUpper()) == "B" ) { qslRecViaComboBox->setCurrentIndex( qslRecViaComboBox->findText(tr("B-Bureau"))) ; } else if ( (aux1.toUpper()) == "D" ){ qslRecViaComboBox->setCurrentIndex( qslRecViaComboBox->findText(tr("D-Direct"))) ; } else if ( (aux1.toUpper()) == "E" ){ qslRecViaComboBox->setCurrentIndex( qslRecViaComboBox->findText(tr("E-Electronic"))) ; } else if ( (aux1.toUpper()) == "M" ){ qslRecViaComboBox->setCurrentIndex( qslRecViaComboBox->findText(tr("M-Manager"))) ; } else { qslRecViaComboBox->setCurrentIndex( qslRecViaComboBox->findText(tr("B-Bureau"))) ; } //TODO: BUG: When something is selected while modifying the QSL is deleted??? //CLUBLOG nameCol = rec.indexOf("clublog_qso_upload_status"); aux1 = (query.value(nameCol)).toString(); if ( (aux1.toUpper()) == "Y" ) { clublogComboBox->setCurrentIndex( clublogComboBox->findText(tr("Y-Uploaded")) ); nameCol = rec.indexOf("clublog_qso_upload_date"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { clublogQDateEdit->setEnabled(true); clublogQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ( (aux1.toUpper()) == "N") { clublogComboBox->setCurrentIndex( clublogComboBox->findText(tr("N-Do not upload")) ); } else if ( (aux1.toUpper()) == "M") { clublogComboBox->setCurrentIndex( clublogComboBox->findText(tr("M-Modified")) ); nameCol = rec.indexOf("clublog_qso_upload_date"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { clublogQDateEdit->setEnabled(true); clublogQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else { eqslSentComboBox->setCurrentIndex( eqslSentComboBox->findText(tr("N-No") ) ); } //CLUBLOG //EQSL_QSL_SENT: {Y, N, R, Q, I} // tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); //EQSL_QSLSDATE (only valid if EQSL_SENT is Y, Q, or I) nameCol = rec.indexOf("eqsl_qsl_sent"); aux1 = (query.value(nameCol)).toString(); if ( (aux1.toUpper()) == "Y" ) { eqslSentComboBox->setCurrentIndex( eqslSentComboBox->findText(tr("Y-Yes")) ); nameCol = rec.indexOf("eqsl_qslsdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { eqslSentQDateEdit->setEnabled(true); eqslSentQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ( (aux1.toUpper()) == "N") { eqslSentComboBox->setCurrentIndex( eqslSentComboBox->findText(tr("N-No") ) ); } else if ((aux1.toUpper()) == "R") { eqslSentComboBox->setCurrentIndex( eqslSentComboBox->findText(tr("R-Requested") ) ); } else if ((aux1.toUpper()) =="Q") { eqslSentComboBox->setCurrentIndex( eqslSentComboBox->findText(tr("Q-Queued")) ); nameCol = rec.indexOf("eqsl_qslsdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { eqslSentQDateEdit->setEnabled(true); eqslSentQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ((aux1.toUpper()) == "I") { eqslSentComboBox->setCurrentIndex( eqslSentComboBox->findText(tr("I-Ignore") ) ); nameCol = rec.indexOf("eqsl_qslsdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { eqslSentQDateEdit->setEnabled(true); eqslSentQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else { eqslSentComboBox->setCurrentIndex( eqslSentComboBox->findText(tr("N-No") ) ); } //E-QSL RECEPTION // tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("I-Ignore") << tr("V-Verified"); // EQSL_QSL_RCVD: {Y, N, R, I, V} // EQSL_QSLRDATE: (only valid if EQSL_RCVD is Y, I, or V) nameCol = rec.indexOf("eqsl_qsl_rcvd"); aux1 = (query.value(nameCol)).toString(); if ( (aux1.toUpper()) == "Y" ) { eqslRecComboBox->setCurrentIndex( eqslRecComboBox->findText(tr("Y-Yes")) ); nameCol = rec.indexOf("eqsl_qslrdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { eqslRecQDateEdit->setEnabled(true); eqslRecQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ( (aux1.toUpper()) == "N") { eqslRecComboBox->setCurrentIndex( eqslRecComboBox->findText(tr("N-No") ) ); } else if ((aux1.toUpper()) == "R") { eqslRecComboBox->setCurrentIndex( eqslRecComboBox->findText(tr("R-Requested") ) ); } else if ((aux1.toUpper()) =="I") { eqslRecComboBox->setCurrentIndex( eqslRecComboBox->findText(tr("I-Ignore")) ); nameCol = rec.indexOf("eqsl_qslrdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { eqslRecQDateEdit->setEnabled(true); eqslRecQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ((aux1.toUpper()) == "V") { eqslRecComboBox->setCurrentIndex( eqslRecComboBox->findText(tr("V-Verified") ) ); nameCol = rec.indexOf("eqsl_qslrdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { eqslRecQDateEdit->setEnabled(true); eqslRecQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else { eqslRecComboBox->setCurrentIndex( eqslRecComboBox->findText(tr("N-No") ) ); } //LOTW_QSL_SENT: {Y, N, R, Q, I} // tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("Q-Queued") << tr("I-Ignore"); //LOTW_QSLSDATE (only valid if LOTW_SENT is Y, Q, or I) nameCol = rec.indexOf("lotw_qsl_sent"); aux1 = (query.value(nameCol)).toString(); if ( (aux1.toUpper()) == "Y" ) { lotwSentComboBox->setCurrentIndex( lotwSentComboBox->findText(tr("Y-Yes")) ); nameCol = rec.indexOf("lotw_qslsdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { lotwSentQDateEdit->setEnabled(true); lotwSentQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ( (aux1.toUpper()) == "N") { lotwSentComboBox->setCurrentIndex( lotwSentComboBox->findText(tr("N-No") ) ); } else if ((aux1.toUpper()) == "R") { lotwSentComboBox->setCurrentIndex( lotwSentComboBox->findText(tr("R-Requested") ) ); } else if ((aux1.toUpper()) =="Q") { lotwSentComboBox->setCurrentIndex( lotwSentComboBox->findText(tr("Q-Queued")) ); nameCol = rec.indexOf("lotw_qslsdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { lotwSentQDateEdit->setEnabled(true); lotwSentQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ((aux1.toUpper()) == "I") { lotwSentComboBox->setCurrentIndex( lotwSentComboBox->findText(tr("I-Ignore") ) ); nameCol = rec.indexOf("lotw_qslsdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { lotwSentQDateEdit->setEnabled(true); lotwSentQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else { lotwSentComboBox->setCurrentIndex( lotwSentComboBox->findText(tr("N-No") ) ); } //E-QSL RECEPTION // tr("Y-Yes") << tr("N-No") << tr("R-Requested") << tr("I-Ignore") << tr("V-Verified"); // lotw_QSL_RCVD: {Y, N, R, I, V} // lotw_QSLRDATE: (only valid if lotw_RCVD is Y, I, or V) nameCol = rec.indexOf("lotw_qsl_rcvd"); aux1 = (query.value(nameCol)).toString(); if ( (aux1.toUpper()) == "Y" ) { lotwRecComboBox->setCurrentIndex( lotwRecComboBox->findText(tr("Y-Yes")) ); nameCol = rec.indexOf("lotw_qslrdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { lotwRecQDateEdit->setEnabled(true); lotwRecQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ( (aux1.toUpper()) == "N") { lotwRecComboBox->setCurrentIndex( lotwRecComboBox->findText(tr("N-No") ) ); } else if ((aux1.toUpper()) == "R") { lotwRecComboBox->setCurrentIndex( lotwRecComboBox->findText(tr("R-Requested") ) ); } else if ((aux1.toUpper()) =="I") { lotwRecComboBox->setCurrentIndex( lotwRecComboBox->findText(tr("I-Ignore")) ); nameCol = rec.indexOf("lotw_qslrdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { lotwRecQDateEdit->setEnabled(true); lotwRecQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else if ((aux1.toUpper()) == "V") { lotwRecComboBox->setCurrentIndex( lotwRecComboBox->findText(tr("V-Verified") ) ); nameCol = rec.indexOf("lotw_qslrdate"); aux1 = (query.value(nameCol)).toString(); if ( (QDate::fromString(aux1, "yyyy/MM/dd")).isValid() ) { lotwRecQDateEdit->setEnabled(true); lotwRecQDateEdit->setDate(QDate::fromString(aux1, "yyyy/MM/dd")); } } else { lotwRecComboBox->setCurrentIndex( lotwRecComboBox->findText(tr("N-No") ) ); } //qDebug() << "MainWindow::qsoToEdit: - just before IOTA" << endl; nameCol = rec.indexOf("iota"); aux1 = (query.value(nameCol)).toString(); aux1 = awards->checkIfValidIOTA(aux1); //qDebug() << "MainWindow::qsoToEdit: IOTA-CheckIfValidIOTA-1 " << aux1 << endl; if ((aux1.length())==6){ QStringList values = aux1.split("-", QString::SkipEmptyParts); //qDebug() << "MainWindow::qsoToEdit: IOTA " << aux1 << endl; iotaContinentComboBox->setCurrentIndex( iotaContinentComboBox->findText(values.at(0) ) ); iotaNumberLineEdit->setText(values.at(1)); } nameCol = rec.indexOf("sat_name"); aux1 = (query.value(nameCol)).toString(); if (aux1.length()>0) { satTabWidget->setSatName(aux1); } nameCol = rec.indexOf("sat_mode"); aux1 = (query.value(nameCol)).toString(); if (aux1.length()>1) { satTabWidget->setSatMode(aux1); } //qDebug() << "MainWindow::qsoToEdit: - in default - 100: " << QString::number(currentEntity) << endl; nameCol = rec.indexOf("dxcc"); aux1 = (query.value(nameCol)).toString(); //qDebug() << "MainWindow::qsoToEdit: Checking DXCC: " << aux1 << " - " << world->getEntityName(aux1.toInt()) << endl; if (aux1.toInt()>=1) { currentEntity = aux1.toInt(); } else { currentEntity = world->getQRZARRLId(currentQrz); } nameCol = rec.indexOf("prop_mode"); aux1 = (query.value(nameCol)).toString(); if(( propModeComboBox->findText(aux1+" -", Qt::MatchContains))>0) { propModeComboBox->setCurrentIndex( propModeComboBox->findText(aux1+" -", Qt::MatchContains)); //qDebug() << "MainWindow::qsoToEdit: Prop2: " << aux1 << endl; } showEntityInfo(currentEntity); selectCorrectComboBoxEntity(currentEntity); //qDebug() << "MainWindow::qsoToEdit: - in default - 101" << endl; QStringList _qs; //for the showStatusOfDXCC(const QStringList _qs) _qs.clear(); //TODO: The band sometimes fails here. Check if (manageMode) { // _qs << currentQrz << QString::number(bandComboBox->currentIndex()) << QString::number(modeComboBox->currentIndex()) << QString::number(currentLog); _qs << currentQrz << QString::number(dataProxy->getIdFromBandName(bandComboBox->currentText())) << QString::number(dataProxy->getIdFromBandName(modeComboBox->currentText())) << QString::number(currentLog); } else { _qs << currentQrz << QString::number(dataProxy->getIdFromBandName(bandComboBox->currentText())) << "-1" << QString::number(currentLog); } //qDebug() << "MainWindow::qsoToEdit: - in default - 104" << endl; showStatusOfDXCC(_qs); //qDebug() << "MainWindow::qsoToEdit: - in default - 105" << endl; //qDebug() << "MainWindow::qsoToEdit: - just after de IOTA" << endl; break; } // Closesthe switch (contest or default) //qDebug() << "MainWindow::qsoToEdit: - in default - 106" << endl; } //Closes the next.isValid //qDebug() << "MainWindow::qsoToEdit: - in default - END" << endl; } void MainWindow::slotIOTAComboBoxChanged() { //qDebug() << "MainWindow::slotIOTAComboBoxChanged" << endl; //iotaNumberLineEdit->setEnabled(true); } void MainWindow::slotQSLRecvComboBoxChanged(){ //qDebug() << "MainWindow::slotQSLRecvComboBoxChanged" << endl; //QSLRDATE (only valid if QSL_RCVD is Y-0, I-3, or V-4) //Y-Yes-0 //N-No-1 //R-Requested-2 //I-Ignore-3 //V-Verified-4 int i = qslRecComboBox->currentIndex(); switch (i) { case 0: qslRecQDateEdit->setEnabled(true); qslRecViaComboBox->setEnabled(true); qslRecQDateEdit->setDate((dateTime->currentDateTime()).date()); break; case 2: break; case 3: qslRecQDateEdit->setEnabled(true); break; case 4: qslRecQDateEdit->setEnabled(true); break; default: //NO qslRecQDateEdit->setEnabled(false); qslRecViaComboBox->setEnabled(false); break; } } void MainWindow::slotQSLSentComboBoxChanged(){ //qDebug() << "MainWindow::slotQSLSentComboBoxChanged" << endl; int i = qslSentComboBox->currentIndex(); //{Y, N, R, I, V} //(QSLSDATE is only valid if QSL_SENT is Y-0, Q-3, or I-4) // Y-Yes = 0 // N-No = 1 // R-Requested = 2 // Q-Queued = 3 // I-Ignore = 4 switch (i) { case 0: qslSentQDateEdit->setEnabled(true); qslSentViaComboBox->setEnabled(true); qslSentQDateEdit->setDate((dateTime->currentDateTime()).date()); break; case 2: break; case 3: qslSentQDateEdit->setEnabled(true); break; case 4: qslSentQDateEdit->setEnabled(true); break; default: //NO qslSentQDateEdit->setEnabled(false); qslSentViaComboBox->setEnabled(false); break; } } void MainWindow::sloteQSLRecvComboBoxChanged(){ //qDebug() << "MainWindow::sloteQSLRecvComboBoxChanged" << endl; //QSLRDATE (only valid if QSL_RCVD is Y-0, I-3, or V-4) //Y-Yes-0 //N-No-1 //R-Requested-2 //I-Ignore-3 //V-Verified-4 int i = eqslRecComboBox->currentIndex(); switch (i) { case 0: eqslRecQDateEdit->setEnabled(true); eqslRecQDateEdit->setDate((dateTime->currentDateTime()).date()); break; case 2: break; case 3: eqslRecQDateEdit->setEnabled(true); break; case 4: eqslRecQDateEdit->setEnabled(true); break; default: //NO eqslRecQDateEdit->setEnabled(false); break; } } void MainWindow::sloteQSLSentComboBoxChanged(){ //qDebug() << "MainWindow::sloteQSLSentComboBoxChanged" << endl; int i = eqslSentComboBox->currentIndex(); //{Y, N, R, I, V} //(QSLSDATE is only valid if QSL_SENT is Y-0, Q-3, or I-4) // Y-Yes = 0 // N-No = 1 // R-Requested = 2 // Q-Queued = 3 // I-Ignore = 4 switch (i) { case 0: eqslSentQDateEdit->setEnabled(true); eqslSentQDateEdit->setDate((dateTime->currentDateTime()).date()); break; case 2: break; case 3: eqslSentQDateEdit->setEnabled(true); break; case 4: eqslSentQDateEdit->setEnabled(true); break; default: //NO eqslSentQDateEdit->setEnabled(false); break; } } void MainWindow::showInfoFromLocators(const QString _loc1, const QString _loc2) {// Local / DX //qDebug() << "MainWindow::showInfoFromLocators: " << _loc1 << "/" << _loc2 << endl; QString lloc = _loc1.toUpper(); QString ldx = _loc2.toUpper(); if ( locator->isValidLocator(lloc) ) { if ( locator->isValidLocator(ldx) ) { int beam = locator->getBeamBetweenLocators(lloc, ldx); gradShortLabel->setText( QString::number(beam) ); if (beam >= 180) { gradLongLabel->setText( QString::number(beam -180 ) ); } else { gradLongLabel->setText( QString::number(beam + 180 ) ); } distShortLabel->setText( QString::number( locator->getDistanceBetweenLocators(lloc, ldx, imperialSystem) ) ); distLongLabel->setText( QString::number( 40000 - locator->getDistanceBetweenLocators(lloc, ldx, imperialSystem) ) ); } else { clearInfoFromLocators(); return; } } else { clearInfoFromLocators(); return ; } } void MainWindow::slotLocatorTextChanged() { //qDebug() << "MainWindow::slotLocatorTextChanged: " << locatorLineEdit->text() << endl; if ( locator->isValidLocator((locatorLineEdit->text()).toUpper()) ) { dxLocator = (locatorLineEdit->text()).toUpper(); showInfoFromLocators(myLocator, dxLocator); } else { return; } } void MainWindow::slotMyLocatorTextChanged() { //qDebug() << "MainWindow::slotMyLocatorTextChanged: " << myLocatorLineEdit->text() << endl; if ( locator->isValidLocator((myLocatorLineEdit->text()).toUpper()) ) { myLocator = (myLocatorLineEdit->text()).toUpper(); //qDebug() << "MainWindow::slotMyLocatorTextChanged: My LOCATOR CHANGED TO: " << myLocator << endl; slotLocatorTextChanged(); } else { return; } } void MainWindow::clearInfoFromLocators() { //qDebug() << "MainWindow::clearInfoFromLocators" << endl; gradShortLabel->setText( "0" ); gradLongLabel->setText( "0" ); distShortLabel->setText( "0" ); distLongLabel->setText( "0" ); } void MainWindow::showEntityInfo(const int _enti, int _cq, int _itu) { //qDebug()() << "MainWindow::showEntityInfo" << QString::number(_enti) << endl; if (_enti<=0) { return; } infoLabel2->setText(world->getEntityName(_enti)); continentLabel->setText( world->getContinentShortName(_enti) ); prefixLabel->setText( world->getEntityMainPrefix(_enti)); if ( locator->isValidLocator((locatorLineEdit->text()).toUpper()) ) { dxLocator = (locatorLineEdit->text()).toUpper(); } else { dxLocator = world->getLocator(_enti); } showInfoFromLocators (myLocator, dxLocator); int i = -1; if ((_cq>0) && (_cq<41)) { cqzLabel->setText( QString::number(_cq) ); } else { i = world->getEntityCqz(_enti); if( i > 0 ) { cqzLabel->setText( QString::number(i) ); } else { cqzLabel->setText("0"); } } if (_itu>0) { ituzLabel->setText( QString::number(_itu) ); } else { i = world->getEntityItuz(_enti); if ( i > 0 ) { ituzLabel->setText( QString::number(i) ); } else { ituzLabel->setText("0"); } } } void MainWindow::showStatusOfDXCC(const QStringList _qs) { //qDebug() << "MainWindow::showStatusOfDXC: QRZ: " << _qs.at(0) << "/ Bandid :" << _qs.at(1) << "/Modeid: " << _qs.at(2) << endl; // Receives: QStringList _qs; //_qs << QRZ << BandId << ModeId << lognumber; // Check if new one, needed, worked, confirmed // Print the infoLabel1 // Print/Color the band boxes/labels /* 0 - New One 1 - Needed 2 - Worked 3 - Confirmed */ if ((_qs.length() != 4) || (_qs.at(1) == "-1")) // is the qs valid? { clearBandLabels(); infoLabel1->setText(tr("--")); return; } // Set the status bar with the appropriate message int status = awards->getDXStatus (_qs); QString message = QString(); //qDebug() << "MainWindow::showStatusOfDXC: " << QString::number(status) << endl; message = awards->getDXStatusString(status); infoLabel1->setText(message); //Run all the bandLabel1-12 to set the appropriate color // qs.at(0) = QRZ bandLabel1->setStyleSheet(getStyleColorToLabelFromBand(bandLabel1->text(), _qs.at(0))); bandLabel2->setStyleSheet(getStyleColorToLabelFromBand(bandLabel2->text(), _qs.at(0))); bandLabel3->setStyleSheet(getStyleColorToLabelFromBand(bandLabel3->text(), _qs.at(0))); bandLabel4->setStyleSheet(getStyleColorToLabelFromBand(bandLabel4->text(), _qs.at(0))); bandLabel5->setStyleSheet(getStyleColorToLabelFromBand(bandLabel5->text(), _qs.at(0))); bandLabel6->setStyleSheet(getStyleColorToLabelFromBand(bandLabel6->text(), _qs.at(0))); bandLabel7->setStyleSheet(getStyleColorToLabelFromBand(bandLabel7->text(), _qs.at(0))); bandLabel8->setStyleSheet(getStyleColorToLabelFromBand(bandLabel8->text(), _qs.at(0))); bandLabel9->setStyleSheet(getStyleColorToLabelFromBand(bandLabel9->text(), _qs.at(0))); bandLabel10->setStyleSheet(getStyleColorToLabelFromBand(bandLabel10->text(), _qs.at(0))); bandLabel11->setStyleSheet(getStyleColorToLabelFromBand(bandLabel11->text(), _qs.at(0))); bandLabel12->setStyleSheet(getStyleColorToLabelFromBand(bandLabel12->text(), _qs.at(0))); } QString MainWindow::getStyleColorToLabelFromBand(const QString _b, const QString _q) { //qDebug() << "MainWindow::getStyleColorToLabelFromBand: " << _b << "/" << _q << endl; QStringList _qs; _qs.clear(); _qs << _q << QString::number(db->getBandIdFromName(_b)) << QString::number(-1) << QString::number(currentLog); //TODO: Check if we can know the mode and replace the -1 //qDebug() << "MainWindow::getStyleColorToLabelFromBand (Band/background-color): " << _b << (awards->getQRZDXStatusColor(_qs)).name() << endl; return "* { background-color: " + (awards->getQRZDXStatusColor(_qs)).name() + "; }"; } void MainWindow::showDXMarathonNeeded(const int _dxcc, const int _cqz, const int _year, const int _log) { //qDebug()() << "MainWindow::showDXMarathonNeeded" << endl; if ((_dxcc<=0) || (_cqz<=0)) { return; } if ( awards->isDXMarathonNeed(_dxcc, _cqz, _year, _log)) { infoLabel1->setText(infoLabel1->text()+ tr(" - Needed for DXMarathon")); } } void MainWindow::showAwards() { // Updates and show all the award status tab. //qDebug() << "MainWindow::showAwards" << endl; /* WAZ Local */ int _num = 0; QSqlQuery query; QString aux; /* aux = QString("SELECT count(id) FROM log WHERE lognumber='%1'").arg(currentLog); query.exec(aux); query.next(); if (query.isValid()) { _num = (query.value(0)).toInt(); } */ _num = dataProxy->getHowManyQSOInLog(currentLog); qsoWorkedQLCDNumber->display(_num); _num = 0; aux = QString("SELECT count(id) FROM log WHERE qsl_rcvd='Y' AND lognumber='%1'").arg(currentLog); query.exec(aux); query.next(); if (query.isValid()) { _num = (query.value(0)).toInt(); } qsoConfirmedQLCDNumber->display(_num); _num = 0; dxccWorkedQLCDNumber->display(awards->getDXCCWorked(currentLog)); _num = 0; dxccConfirmedQLCDNumber->display(awards->getDXCCConfirmed(currentLog)); _num = 0; wazWorkedQLCDNumber->display(awards->getWAZWorked(currentLog)); _num = 0; wazConfirmedQLCDNumber->display(awards->getWAZConfirmed(currentLog)); showDXMarathon(selectedYear); } void MainWindow::showDXMarathon(const int _year) { //qDebug() << "MainWindow::MainWindow::showDXMarathon: Year: " << QString::number(_year) << endl; int i = 0; i = awards->getDXMarathonDXCC(_year, currentLog); //qDebug() << "MainWindow::MainWindow::showDXMarathon: DXCC: " << QString::number(i) << endl; dxMarathonDXCCQLCDNumber->display(i); i = awards->getDXMarathonCQ(_year, currentLog); dxMarathonCQQLCDNumber->display(i); //qDebug() << "MainWindow::MainWindow::showDXMarathon: CQ: " << QString::number(i) << endl; i = awards->getDXMarathonScore(_year, currentLog); dxMarathonPointsQLCDNumber->display(i); //qDebug() << "MainWindow::MainWindow::showDXMarathon: Score: " << QString::number(i) << endl; } void MainWindow::fillQSOData() { // Updates all QSO with the dxcc, CQZ, ... if empty. //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); QSqlQuery query; query.exec(stringQuery); QSqlQuery query1; QSqlRecord rec = query.record(); int nameCol; QString aux, queryString; QString _call, _bandid, _modeid, _tdate, _ttime, _lognumber, _id, aux1, updateString, _confirmed; bool toModify = false; bool noMoreQso = false; bool sqlOK; int numberOfQsos = 0; int i = 0; /* aux = QString("SELECT count(id) FROM log WHERE lognumber='%1'").arg(currentLog); //aux = "SELECT count(id) FROM log"; query1.exec(aux); query1.next(); if (query1.isValid()) { numberOfQsos = (query1.value(0)).toInt(); } */ numberOfQsos = dataProxy->getHowManyQSOInLog(currentLog); //int progressBarPosition = 0; QProgressDialog progress(tr("Filling QSOs..."), tr("Abort filling"), 0, numberOfQsos, this); progress.setWindowModality(Qt::WindowModal); while ( (query.next()) && (!noMoreQso) ) { if (query.isValid()) { i++; toModify = false; nameCol = rec.indexOf("call"); if ( (query.value(nameCol)).isValid() ) { _call = (query.value(nameCol)).toString(); } nameCol = rec.indexOf("bandid"); if ( (query.value(nameCol)).isValid() ) { _bandid = (query.value(nameCol)).toString(); } nameCol = rec.indexOf("modeid"); if ( (query.value(nameCol)).isValid() ) { _modeid = (query.value(nameCol)).toString(); } nameCol = rec.indexOf("qso_date"); if ( (query.value(nameCol)).isValid() ) { _tdate = (query.value(nameCol)).toString(); } nameCol = rec.indexOf("time_on"); if ( (query.value(nameCol)).isValid() ) { _ttime = (query.value(nameCol)).toString(); } nameCol = rec.indexOf("lognumber"); if ( (query.value(nameCol)).isValid() ) { _lognumber = (query.value(nameCol)).toString(); } nameCol = rec.indexOf("confirmed"); if ( (query.value(nameCol)).isValid() ) { _confirmed = (query.value(nameCol)).toString(); } nameCol = rec.indexOf("id"); if ( (query.value(nameCol)).isValid() ) { _id = (query.value(nameCol)).toString(); } //qDebug() << "MainWindow::fillQSOData: ID: " << _id << endl; //TODO: Prepare this query updateString = "UPDATE log SET call = '" + _call + "', bandid = '" + _bandid + "', modeid = '" + _modeid + "', qso_date = '" + _tdate + "', time_on = '" + _ttime + "', lognumber = '" + _lognumber + "', confirmed = '" + _confirmed + "'"; nameCol = rec.indexOf("cqz"); if (( (query.value(nameCol)).toString()).length() < 1 ) { aux1 = QString::number(world->getQRZCqz(_call)); updateString = updateString + ", cqz='" + aux1 + "'"; toModify = true; } else { } nameCol = rec.indexOf("ituz"); if (( (query.value(nameCol)).toString()).length() < 1 ) { aux1 = QString::number( world->getQRZItuz(_call) ); updateString = updateString + ", ituz='" + aux1 + "'"; toModify = true; } else {} //qDebug() << "MainWindow::fillQSOData: DXCC" << endl; nameCol = rec.indexOf("dxcc"); if (( (query.value(nameCol)).toString()).length() < 1 ) { aux1 = QString::number(world->getQRZARRLId(_call) ); //qDebug() << "MainWindow::fillQSOData: DXCC proposed: " << aux1 << endl; if (aux1.toInt()>0) { updateString = updateString + ", dxcc='" + aux1 + "'"; toModify = true; //qDebug() << "MainWindow::fillQSOData: DXCC: " << aux1 << endl; } else { //qDebug() << "MainWindow::fillQSOData: no DXCC identified" << endl; } } else { //qDebug() << "MainWindow::fillQSOData: DXCC already existed" << endl; } //qDebug() << "MainWindow::fillQSOData1: " << updateString << endl; if (toModify) { updateString = updateString + " WHERE id = " + "'" + _id + "'"; //qDebug() << "MainWindow::fillQSOData2: " << updateString << endl; sqlOK = query1.exec(updateString); if (sqlOK) { //qDebug() << "MainWindow::fillQSOData: sqlOK=True" << endl; } else { //qDebug() << "MainWindow::fillQSOData: sqlOK=False" << endl; } } else { updateString.clear(); } aux = tr("Filling QSOs...\n QSO: ") + QString::number(i) + "/" + QString::number(numberOfQsos); progress.setLabelText(aux); progress.setValue(i); if ( progress.wasCanceled() ) { //qDebug() << "MainWindow::fillQSOData3: " << endl; noMoreQso = true; } } // Closes the next.isValid } // Closes the While } void MainWindow::slotUpdateCTYDAT() { //qDebug() << "MainWindow::slotUpdateCTYDAT" << endl; downloadcty->download(); } void MainWindow::slotWorldReload() { //qDebug() << "MainWindow::slotWorldReload" << endl; //TODO: world.recreate returns a boolean, so it is possible to manage the errors world->recreate(kontestDir); } void MainWindow::slotFilePrint() { //qDebug() << "MainWindow::slotFilePrint" << endl; QPrinter printer; QString aux; QSqlQuery query, query1; int row = 0; int _numberOfQsos = 0; bool cancelPrinting = false; /* aux = QString("SELECT count(id) FROM log WHERE lognumber='%1'").arg(currentLog); //aux = "SELECT count(id) FROM log"; query.exec(aux); query.next(); if (query.isValid()) { _numberOfQsos = (query.value(0)).toInt(); } */ _numberOfQsos = dataProxy->getHowManyQSOInLog(currentLog); QTextCursor cursor(doc); QTextTable *textTable = cursor.insertTable(1, 9); QTextBlockFormat centerAlignment; centerAlignment.setAlignment(Qt::AlignCenter); QTextTableFormat tableFormat; tableFormat.setHeaderRowCount(1); tableFormat.setCellPadding(5); tableFormat.setAlignment(Qt::AlignCenter); textTable->setFormat(tableFormat); //The first row is the header cursor = textTable->cellAt(row, 0).firstCursorPosition(); cursor.setBlockFormat(centerAlignment); cursor.insertText(tr("Number")); cursor = textTable->cellAt(row, 1).firstCursorPosition(); cursor.insertText(tr("Date")); cursor = textTable->cellAt(row, 2).firstCursorPosition(); cursor.insertText(tr("Time")); cursor = textTable->cellAt(row, 3).firstCursorPosition(); cursor.insertText(tr("QRZ")); cursor = textTable->cellAt(row, 4).firstCursorPosition(); cursor.insertText(tr("RSTtx")); cursor = textTable->cellAt(row, 5).firstCursorPosition(); cursor.insertText(tr("RSTrx")); cursor = textTable->cellAt(row, 6).firstCursorPosition(); cursor.insertText(tr("Band")); cursor = textTable->cellAt(row, 7).firstCursorPosition(); cursor.insertText(tr("Mode")); cursor = textTable->cellAt(row, 8).firstCursorPosition(); cursor.insertText(tr("Comment")); int nameCol = 0; //int qsoPerPage = 25; //int maxPages = (int)(Klog::number / qsoPerPage)+1; // To print just 10 QSO per page //int printedSoFar = 0; //int page = 1; printer.setOrientation(QPrinter::Landscape); // For testing, the log will be printed landscape. printer.setDocName(stationQRZ+"-log"); QPrintDialog printDialog(&printer, this); printDialog.setWindowTitle(tr("Print Log")); if (printDialog.exec() == QDialog::Accepted) { int _qsos = 0; QProgressDialog progress(tr("Printing the log..."), tr("Abort printing"), 0, _numberOfQsos, this); progress.setMaximum(_numberOfQsos); progress.setWindowModality(Qt::WindowModal); QString stringQuery = QString("SELECT id, qso_date, time_on, call, rst_sent, rst_rcvd, bandid, modeid, comment FROM log WHERE lognumber='%1'").arg(currentLog); query.exec(stringQuery); QSqlRecord rec = query.record(); while ((query.next()) && (!cancelPrinting)) { if (query.isValid()) { textTable->appendRows(1); row++; _qsos++; aux = tr("Printing the log...\n QSO: ") + QString::number(_qsos) + "/" + QString::number(_numberOfQsos); progress.setLabelText(aux); progress.setValue(_qsos); nameCol = rec.indexOf("id"); cursor = textTable->cellAt(row, 0).firstCursorPosition(); cursor.insertText((query.value(nameCol)).toString()); nameCol = rec.indexOf("qso_date"); cursor = textTable->cellAt(row, 1).firstCursorPosition(); cursor.insertText((query.value(nameCol)).toString()); nameCol = rec.indexOf("time_on"); cursor = textTable->cellAt(row, 2).firstCursorPosition(); cursor.insertText((query.value(nameCol)).toString()); nameCol = rec.indexOf("call"); cursor = textTable->cellAt(row, 3).firstCursorPosition(); cursor.insertText((query.value(nameCol)).toString()); nameCol = rec.indexOf("rst_sent"); cursor = textTable->cellAt(row, 4).firstCursorPosition(); cursor.insertText((query.value(nameCol)).toString()); nameCol = rec.indexOf("rst_rcvd"); cursor = textTable->cellAt(row, 5).firstCursorPosition(); cursor.insertText((query.value(nameCol)).toString()); nameCol = rec.indexOf("bandid"); aux = (query.value(nameCol)).toString(); stringQuery = QString("SELECT name FROM band WHERE id='%1'").arg(aux); query1.exec(stringQuery); query1.next(); if (query1.isValid()) { cursor = textTable->cellAt(row, 6).firstCursorPosition(); cursor.insertText((query1.value(0)).toString()); } nameCol = rec.indexOf("modeid"); aux = (query.value(nameCol)).toString(); aux = dataProxy->getNameFromSubModeId(aux.toInt()); if (aux.length()>1) { cursor = textTable->cellAt(row, 7).firstCursorPosition(); cursor.insertText((query1.value(0)).toString()); } //stringQuery = QString("SELECT name FROM mode WHERE id='%1'").arg(aux); //query1.exec(stringQuery); //query1.next(); //if (query1.isValid()) //{ // cursor = textTable->cellAt(row, 7).firstCursorPosition(); // cursor.insertText((query1.value(0)).toString()); //} nameCol = rec.indexOf("comment"); aux = (query.value(nameCol)).toString(); if ((aux.length())>0) { cursor = textTable->cellAt(row, 8).firstCursorPosition(); cursor.insertText(aux); } } if ( progress.wasCanceled() ) { cancelPrinting = true; } } progress.setValue(_numberOfQsos); if (!cancelPrinting) { doc->print(&printer); } } } //UPDATE CTY.CSV //UPDATE CTY.CSV void MainWindow::slotToolSearchRequestedQSLToSend() { //qDebug() << "MainWindow::slotToolSearchRequestedQSLToSend" << endl; slotToolSearchQSL(1); //return; } void MainWindow::slotToolSearchNeededQSLToSend() { //qDebug() << "MainWindow::slotToolSearchQSLToSend - TO PREPARE THE QUERY and optimize the function" << endl; slotToolSearchQSL(0); /* return; int nameCol = -1; QString _call, _dateTime, _band, _mode, _freq, _qsltx, _qslrx, _id, _stationcallsign; QFont font; font.setBold(true); QColor color; QStringList q; QString stringQuery = ("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';"); searchResultsTreeWidget->clear(); QSqlQuery query(stringQuery); QSqlRecord rec = query.record(); if (!query.exec()) { //TODO: Control the error!! } else { while(query.next()) { if (query.isValid()) { QTreeWidgetItem *item = new QTreeWidgetItem(searchResultsTreeWidget); nameCol = rec.indexOf("call"); _call= (query.value(nameCol)).toString(); nameCol = rec.indexOf("qso_date"); _dateTime = (query.value(nameCol)).toString(); nameCol = rec.indexOf("time_on"); _dateTime = _dateTime + "-" +(query.value(nameCol)).toString(); nameCol = rec.indexOf("bandid"); _freq = (query.value(nameCol)).toString(); _band = db->getBandNameFromNumber( _freq.toInt() ); nameCol = rec.indexOf("modeid"); _mode = db->getModeNameFromNumber( (query.value(nameCol)).toInt() ); //qDebug() << "MainWindow::slotToolSearchQSLToSend: mode " << QString::number((query.value(nameCol)).toInt()) << endl; nameCol = rec.indexOf("qsl_sent"); _qsltx = (query.value(nameCol)).toString(); if (_qsltx.length()<1) { _qsltx = "N"; } nameCol = rec.indexOf("qsl_rcvd"); _qslrx = (query.value(nameCol)).toString(); if (_qslrx.length()<1) { _qslrx = "N"; } if (stationCallSignShownInSearch) { nameCol = rec.indexOf("station_callsign"); _stationcallsign = (query.value(nameCol)).toString(); if (_stationcallsign.length()<3) { _stationcallsign = stationQRZ; } } nameCol = rec.indexOf("id"); _id= (query.value(nameCol)).toString(); q.clear(); q << _call << _freq << _mode << QString::number(currentLog); //q << _call << _freq << "-1" << QString::number(currentLog); color = awards->getQRZDXStatusColor(q); //color = workedColor; item->setText(0, _call); //item->setFont(0,font); item->setText(1, _dateTime); item->setText(2, _band); item->setText(3, _mode); item->setText(4, _qslrx); item->setText(5, _qsltx); if (stationCallSignShownInSearch) { item->setText(7, _stationcallsign); item->setText(7, _id); } else { item->setText(6, _id); } item->setForeground(0, QBrush(color)); } else { //TODO: Check what is happening here! } } qslingNeeded = true; dxUpRightTab->setCurrentIndex(2); //dxUpRightTab->setCurrentWidget(2); //searchBoxLineEdit->setFocus(Qt::OtherFocusReason); } */ } void MainWindow::slotToolSearchNeededQSLPendingToReceive() { //qDebug() << "MainWindow::slotToolSearchNeededQSLPendingToReceive " << endl; // QSL RCVD requested or // QSL Sent Y and qsl_rcvd!=Y AND qsl_rcvd!=I //select call from log where (qsl_sent='Y' and qsl_rcvd!='Y' and qsl_rcvd!='I') OR //QString stringQuery = QString("SELECT call FROM log where (qsl_sent='Y' AND qsl_rcvd!='Y' AND qsl_rcvd!='I') OR qsl_rcvd='R'"); slotToolSearchQSL(2); } void MainWindow::slotToolSearchNeededQSLRequested() { // Requested DX QSL slotToolSearchQSL(3); } void MainWindow::slotToolSearchQSL(const int actionQSL) { //qDebug() << "MainWindow::slotToolSearchQSL: " << QString::number(actionQSL) << " - LogNumber: " << QString::number(currentLog) << endl; // 2 means QSL_RCVD = 'R' QString stringQuery = QString(); QString message = QString(); QString aux = QString(); int i = -1; switch (actionQSL) { case 0://void slotToolSearchNeededQSLToSend(); //aux = QString("SELECT count(id) FROM log WHERE 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() //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; } int nameCol = -1; QString _call, _dateTime, _band, _mode, _freq, _qsltx, _qslrx, _id, _stationcallsign; QFont font; font.setBold(true); QColor color; QStringList q; searchResultsTreeWidget->clear(); QSqlQuery query(stringQuery); QSqlRecord rec = query.record(); if (!query.exec()) { //qDebug() << "MainWindow::slotToolSearchQSL: Query ERROR" << endl; //TODO: Control the error!! } else { updateStatusBar(message); // updating the status bar while(query.next()) { if (query.isValid()) { QTreeWidgetItem *item = new QTreeWidgetItem(searchResultsTreeWidget); //aux = world->getQRZEntityName(_call); i = world->getQRZARRLId(_call); aux = world->getEntityName(i) + " - CQ: " + QString::number(world->getEntityCqz(i)); item->setToolTip(0, aux); item->setToolTip(1, aux); item->setToolTip(2, aux); item->setToolTip(3, aux); item->setToolTip(4, aux); item->setToolTip(5, aux); item->setToolTip(6, aux); nameCol = rec.indexOf("call"); _call= (query.value(nameCol)).toString(); nameCol = rec.indexOf("qso_date"); _dateTime = (query.value(nameCol)).toString(); nameCol = rec.indexOf("time_on"); _dateTime = _dateTime + "-" +(query.value(nameCol)).toString(); nameCol = rec.indexOf("bandid"); _freq = (query.value(nameCol)).toString(); _band = db->getBandNameFromNumber( _freq.toInt() ); nameCol = rec.indexOf("modeid"); _mode = dataProxy->getSubModeFromId((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"); _qsltx = (query.value(nameCol)).toString(); if (_qsltx.length()<1) { _qsltx = "N"; } nameCol = rec.indexOf("qsl_rcvd"); _qslrx = (query.value(nameCol)).toString(); if (_qslrx.length()<1) { _qslrx = "N"; } if (stationCallSignShownInSearch) { //qDebug() << "MainWindow::slotToolSearchQSL: stationCallSign "<< endl; nameCol = rec.indexOf("station_callsign"); if (((query.value(nameCol)).toString()).length()>=3) { _stationcallsign = (query.value(nameCol)).toString(); } else { _stationcallsign.clear(); } } nameCol = rec.indexOf("id"); _id= (query.value(nameCol)).toString(); q.clear(); if (!manageMode) { q << _call << _freq << "-1" << QString::number(currentLog); } else { q << _call << _freq << _mode << QString::number(currentLog); } color = awards->getQRZDXStatusColor(q); item->setText(0, _call); item->setText(1, _dateTime); item->setText(2, _band); item->setText(3, _mode); item->setText(4, _qsltx); item->setText(5, _qslrx); if (stationCallSignShownInSearch) { item->setText(6, _stationcallsign); item->setText(7, _id); item->setToolTip(7, aux); } else { item->setText(6, _id); } item->setForeground(0, QBrush(color)); } else { //TODO: Check what is happening here! } } //qslingNeeded = true; dxUpRightTab->setCurrentIndex(2); } } //DX-CLUSTER - DXCLUSTER void MainWindow::slotAnalyzeDxClusterSignal(QStringList ql) { //qDebug() << "MainWindow::slotAnalyzeDxClusterSignal: 1: " << ql.at(0) <<"/1: " << ql.at(1) << "/2: " << ql.at(2) << endl; QStringList qls; qls.clear(); QString _mode = "-1"; if (!manageMode) { _mode = "-1"; } if (ql.length()==3) { if ((ql.at(2)) == "double") { clusterSpotToLog(ql.at(0), ql.at(1)); } else if ((ql.at(2)) == "selected") { showEntityInfo( world->getQRZARRLId(ql.at(0)) ); // Becareful, he Frecuency arrives in KHz instead of bandid!! // db.getBandFromFreq expects a MHz! //(ql.at(1)).toDouble() 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 //qls << QRZ << BandId << ModeId << lognumber; showStatusOfDXCC(qls); } else { } } else { // Signal was not properly emited } } double MainWindow::checkFreqRanges(double _f) { if ( (_f > 0) && (_f <= txFreqSpinBox->maximum())) { return _f; } else { return 0; } return 0; } //void MainWindow::clusterSpotToLog(const QStringList _qs) void MainWindow::clusterSpotToLog(const QString _call, const QString _freq) { //qDebug() << "MainWindow::clusterSpotToLog: " << _call <<"/" << _freq << endl; QString _aux; double _freqN = (_freq.toDouble()) / 1000; qrzLineEdit->setText(_call); //qrzLineEdit->setText(_qs.at(0)); txFreqSpinBox->setValue(checkFreqRanges(_freqN)); //freqQLCDNumber->display(_freqN); _aux = QString::number(_freqN); //qDebug() << "MainWindow::clusterSpotToLog - Freq: " << _aux << endl; 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); //qDebug() << "MainWindow::clusterSpotToLog - Band: " << _aux << endl; QSqlQuery query(_aux); query.next(); if (query.isValid()) { _aux = (query.value(0)).toString(); bandComboBox->setCurrentIndex(bandComboBox->findText(_aux)); } else { bandComboBox->setCurrentIndex(bandComboBox->findText(dataProxy->getNameFromBandId(defaultBand))); //bandComboBox->setCurrentIndex(defaultBand); } } //DX-CLUSTER - DXCLUSTER void MainWindow::updateQSLRecAndSent() { //qDebug() << "MainWindow::updateQSLRecAndSent " << endl; // Checks the log to fill all the qsl_rcvd and qsl_sent QSqlQuery query, query1; QString queryString, aux, idT; int nameCol=0; queryString = QString("SELECT id, qsl_rcvd, qsl_sent FROM log WHERE lognumber='%1'").arg(currentLog); query.exec(queryString); QSqlRecord rec = query.record(); while (query.next()) { if (query.isValid()) { nameCol = rec.indexOf("id"); idT = (query.value(nameCol)).toString(); //qDebug() << "MainWindow::updateQSLRecAndSent: " << idT << endl; // {Y, N, R, I, V} nameCol = rec.indexOf("qsl_rcvd"); aux = (query.value(nameCol)).toString(); if ( (aux != "Y") && (aux != "N") && (aux != "R") && (aux != "I") && (aux != "V") ) {//QSL_RCVD nameCol = rec.indexOf("qsl_sent"); aux = (query.value(nameCol)).toString(); //{Y, N, R, Q, I} if ( (aux != "Y") && (aux != "N") && (aux != "R") && (aux != "Q") && (aux != "I") ) {//QSL_SENT queryString = QString("UPDATE log SET qsl_rcvd='N' qsl_sent='N' WHERE id='%1'").arg(idT); query1.exec(queryString); } else { queryString = QString("UPDATE log SET qsl_rcvd='N' WHERE id='%1'").arg(idT); query1.exec(queryString); } } else {//QSL_SENT nameCol = rec.indexOf("qsl_sent"); aux = (query.value(nameCol)).toString(); //{Y, N, R, Q, I} if ( (aux != "Y") && (aux != "N") && (aux != "R") && (aux != "Q") && (aux != "I") ) {//QSL_SENT queryString = QString("UPDATE log SET qsl_sent='N' WHERE id='%1'").arg(idT); query1.exec(queryString); } else { } } } } } void MainWindow::selectCorrectComboBoxEntity(const int _ent) {// Select the appropriate entity in the ComboBox //qDebug() << "MainWindow::selectCorrectEntity: " << QString::number(_ent) << "/" << world->getEntityMainPrefix(_ent) << endl; if (_ent<=0) { entityNameComboBox->setCurrentIndex(0); return; } QString pref = QString(); //pref = world->getEntityMainPrefix(_ent); pref = world->getEntityName(_ent); //int indexC = entityNameComboBox->findText(pref, Qt::MatchContains); int indexC = entityNameComboBox->findText("("+QString::number(_ent)+")", Qt::MatchContains); //qDebug() << "MainWindow::selectCorrectEntity: " << pref << "/" << QString::number(indexC) << endl; entityNameComboBox->setCurrentIndex(indexC); } int MainWindow::getDXCCFromComboBox() { //qDebug() << "MainWindow::getDXCCFromComboBox" << endl; QString pref = (entityNameComboBox->currentText()).split('-').at(0); //qDebug() << "MainWindow::getDXCCFromComboBox: " << pref << "/" << QString::number(world->getQRZARRLId(pref))<< endl; return world->getQRZARRLId(pref); } void MainWindow::slotOperatingYearComboBoxChanged() { //qDebug() << "MainWindow::slotOperatingYearComboBoxChanged: " << operatingYearsComboBox->currentText() << endl; selectedYear = (operatingYearsComboBox->currentText()).toInt(); showDXMarathon(selectedYear); } void MainWindow::defineStationCallsign() { //qDebug() << "MainWindow::defineStationCallsign (currentLog): " << QString::number(currentLog) << endl; QString logQRZ; logQRZ = dataProxy->getStationCallSignFromLog(currentLog); //qDebug() << "MainWindow::defineStationCallsign (logQrz): " << logQRZ << endl; if (world->checkQRZValidFormat(logQRZ)) { stationQRZ = logQRZ; } else { stationQRZ = mainQRZ; } lastStationQRZ = stationQRZ; //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; if ( (_s.toUpper()) == "TRUE") { return true; } else { return false; } return false; } */ void MainWindow::slotSetPropMode(const QString _p) { //qDebug() << "MainWindow::slotSetPropMode: " << _p << endl; if(modify) { return; } int indexC = propModeComboBox->findText(" - " + _p + " - ", Qt::MatchContains); propModeComboBox->setCurrentIndex(indexC); } QString MainWindow::getPropModeFromComboBox() { QString _pm = QString(); //qDebug() << "MainWindow::getPropModeFromComboBox:" << propModeComboBox->currentText() << endl; _pm = (((propModeComboBox->currentText()).split('-')).at(1)).simplified(); //qDebug() << "MainWindow::getPropModeFromComboBox: " << _pm << endl; if (_pm == "Not") { return QString(); } return _pm; } void MainWindow::completeWithPreviousQSO(const QString _call) { //qDebug() << "MainWindow::completeWithPreviousQSO" << endl; //This function completes: Name, QTH, Locator, Entity, Iota if ((!completeWithPrevious) || (_call.length()<=0) || (dataProxy->isWorkedB4(_call, -1)<=0)) //if ( (_call.length()<=0) || (dataProxy->isWorkedB4(_call, -1)<=0)) { if (completedWithPreviousName) { nameLineEdit->clear(); completedWithPreviousName = false; nameLineEdit->setPalette(palBlack); } if (completedWithPreviousQTH) { qthLineEdit->clear(); completedWithPreviousQTH = false; qthLineEdit->setPalette(palBlack); } if (completedWithPreviousLocator) { locatorLineEdit->clear(); completedWithPreviousLocator = false; locatorLineEdit->setPalette(palBlack); } if (completedWithPreviousIOTA) { iotaContinentComboBox->setCurrentIndex(0); iotaNumberLineEdit->setText("000"); completedWithPreviousIOTA = false; iotaNumberLineEdit->setPalette(palBlack); } if (completedWithPreviousQSLVia) { qslViaLineEdit->clear(); completedWithPreviousQSLVia = false; qslViaLineEdit->setPalette(palBlack); } return; } QString aux = QString(); aux = dataProxy->getNameFromQRZ(_call); if ((aux.length()>=0) && ((nameLineEdit->text()).length()<=0) ) { nameLineEdit->setPalette(palRed); completedWithPreviousName = true; nameLineEdit->setText(aux); } else if (completedWithPreviousName) { nameLineEdit->clear(); completedWithPreviousName = false; nameLineEdit->setPalette(palBlack); } else { } aux = dataProxy->getQTHFromQRZ(_call); if ((aux.length()>=0) && ((qthLineEdit->text()).length()<=0) ) { qthLineEdit->setPalette(palRed); completedWithPreviousQTH = true; qthLineEdit->setText(aux); } else if (completedWithPreviousQTH) { qthLineEdit->clear(); completedWithPreviousQTH = false; qthLineEdit->setPalette(palBlack); } aux = dataProxy->getLocatorFromQRZ(_call); if ((aux.length()>=0) && ((locatorLineEdit->text()).length()<=0) ) { locatorLineEdit->setPalette(palRed); locatorLineEdit->setText(aux); completedWithPreviousLocator=true; } else if (completedWithPreviousLocator) { locatorLineEdit->clear(); completedWithPreviousLocator = false; locatorLineEdit->setPalette(palBlack); } aux = dataProxy->getIOTAFromQRZ(_call); if ((aux.length()>=0) && ((iotaNumberLineEdit->text()).length()<=0) ) { aux = awards->checkIfValidIOTA(aux); if ((aux.length())==6){ QStringList values = aux.split("-", QString::SkipEmptyParts); iotaContinentComboBox->setCurrentIndex( iotaContinentComboBox->findText(values.at(0) ) ); iotaNumberLineEdit->setPalette(palRed); iotaNumberLineEdit->setText(values.at(1)); completedWithPreviousIOTA=true; } else if (completedWithPreviousIOTA) { iotaContinentComboBox->setCurrentIndex(0); iotaNumberLineEdit->setPalette(palBlack); iotaNumberLineEdit->setText("000"); completedWithPreviousName = false; } } else if (completedWithPreviousIOTA) { iotaContinentComboBox->setCurrentIndex(0); iotaNumberLineEdit->setPalette(palBlack); iotaNumberLineEdit->setText("000"); completedWithPreviousIOTA = false; } aux = dataProxy->getQSLViaFromQRZ(_call); if ((aux.length()>=0) && ((qslViaLineEdit->text()).length()<=0) ) { qslViaLineEdit->setPalette(palRed); qslViaLineEdit->setText(aux); completedWithPreviousQSLVia=true; } else if (completedWithPreviousQSLVia) { qslViaLineEdit->clear(); completedWithPreviousQSLVia = false; qslViaLineEdit->setPalette(palBlack); } } klog-0.9.2.2/INSTALL-linux0000644000076700000620000000065012627126144012760 0ustar staffFollow these steps to build KLog. 1. Check if you have the necessary include files to compile QT5 applications. - Qt - http://qt-project.org/ - CMake - http://wiki.qtcentre.org/index.php?title=Compiling%5FQt4%5Fapps%5Fwith%5FCMake 2.- Generate the Makefile qmake PREFIX=/usr/local klog.pro 5. Make everything. make 5.5 (JUST FOR INFORMATION) You will find the klog executable in the sources folder. klog-0.9.2.2/tips-for-devel.txt0000644000076700000620000000046512627126144014177 0ustar staffSQLite http://www.w3schools.com/sql/default.asp Transfer or populate sqlite table to another table INSERT INTO TABLE2 (COL1, COL2, COL3) SELECT COL1, COL4, COL7 FROM TABLE1 Select only different DXCC select count (distinct dxcc) from log DELETED ENTITIES: http://www.ng3k.com/Dxcc/dxccde.html klog-0.9.2.2/filemanager.cpp0000644000076700000620000053512712627126144013564 0ustar staff/*************************************************************************** filemanager.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "filemanager.h" #include FileManager::FileManager() { //qDebug() << "FileManager::FileManager()" << endl; util = new Utilities; ignoreUnknownAlways = false; world = new World(); awards = new Awards(); db = new DataBase(0); //db->createConnection(); //db->createBandModeMaps(); kontestVersion=""; 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; util = new Utilities; kontestDir = _kontestDir; ignoreUnknownAlways = false; world = new World(kontestDir); awards = new Awards(); db = new DataBase(0); //db->createBandModeMaps(); kontestVersion=""; 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; util = new Utilities; kontestDir = _kontestDir; ignoreUnknownAlways = false; world = new World(kontestDir); awards = new Awards(); db = new DataBase(0); //db->createBandModeMaps(); kontestVersion = _softVersion; dataProxy = new DataProxy_SQLite(); noMoreQso = false; util = new Utilities(); hashLogs.clear(); //preparedQuery = new QSqlQuery; } FileManager::~FileManager() { } bool FileManager::checkADIFValidFormat(const QStringList _qs) { QStringList qs = _qs; if (qs.size()!= 2) { //qDebug() << "FileManager::checkADIFValidFormat-0 (not two) " << endl; return false; } QString q0 = qs.at(0); QString q1 = qs.at(1); //qDebug() << "FileManager::checkADIFValidFormat: " << qs.at(0) << endl; //qDebug() << "FileManager::checkADIFValidFormat: " << qs.at(1) << endl; int len = 0; int i = (qs.at(0)).count(":"); if (i == 2) { // DATE:8:D / 20141020 len = (q0.section(':', 1, 1)).toInt(); } else if (i == 1) { // DATE:8 / 20141020 len = (q0.section(':', 1, 1)).toInt(); } else { //qDebug() << "FileManager::checkADIFValidFormat-1 " << endl; return false; } //i = (qs.at(0)).indexOf(":"); //i = (qs.at(0)).length() - i -1; //qDebug() << "i = " << QString::number(i) << "/" << qs.at(0) << endl; //len = ( (qs.at(0)).right(i)).toInt(); //qDebug() << "len = " << QString::number(len) << endl; if ( (q1).length() != len ) { //qDebug() << "FileManager::checkADIFValidFormat-2: " << (qs.at(1)) << " - " << QString::number((qs.at(1)).length()) << "/" << QString::number(len) << endl; return false; } if (len <= 0) { //qDebug() << "FileManager::checkADIFValidFormat-3 " << endl; return false; } //qDebug() << "FileManager::checkADIFValidFormat-4 (true)" << endl; return true; } bool FileManager::adifLogExport(const QString& _fileName, const int _logN) { //qDebug() << "FileManager::adifLogExport" << endl; return adifLogExportToFile(_fileName, _logN, false, false); } bool FileManager::adifLogExportToFile(const QString& _fileName, const int _logN, bool justMarked, bool _qslRequested ) { // If _logN = 0, then we will export ALL the logs. //qDebug() << "FileManager::adifLogExportToFile: " << _fileName << endl; bool exportJustMarkedQSO = justMarked; bool marked = false; bool exportOnlyQSLRequested = _qslRequested; bool haveMode = false; QFile file(_fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return false; QTextStream out(&file); QString aux1, aux2, queryString, bandst, bandrxst; // bandst & bandrxst are to check if the band is properly defined int nameCol = 0; QSqlQuery query1; int numberOfQsos = 0; int currentQso = 0; //bool noMoreQso = false; int step = 1; bool propsat=false; // Just to check if we have added the prop_mode needed by LOTW when SAT QSO //bool bandOK = false; // Just to check if the band is properly defined bool exportAll = false; if (_logN <=0) { exportAll = true; } else { exportAll = false; } bandst = QString(); bandrxst = QString(); if (exportJustMarkedQSO) { //TODO: Count the marked QSO and adjust the numberOfQsos numberOfQsos = 0; QSqlQuery query; if (exportAll) { queryString = QString("SELECT marked FROM log"); } else { queryString = QString("SELECT marked FROM log WHERE lognumber='%1'").arg(_logN); } query.exec(queryString); QSqlRecord rec = query.record(); while ( (query.next())) { if (query.isValid()) { nameCol = rec.indexOf("marked"); aux1 = (query.value(nameCol)).toString(); if (aux1 == "X") { numberOfQsos++; } else { } } else { } } //qDebug() << "FileManager::adifLogExportToFile - numberOfQsos = " << QString::number(numberOfQsos)<< endl; } else { if (exportAll) { aux1 = "SELECT count(id) FROM log"; } else { aux1 = QString("SELECT count(id) FROM log WHERE lognumber='%1'").arg(_logN); } query1.exec(aux1); query1.next(); if (query1.isValid()) { numberOfQsos = (query1.value(0)).toInt(); } //qDebug() << "FileManager::adifLogExportToFile - numberOfQsos = " << QString::number(numberOfQsos)<< endl; } //qDebug() << "FileManager::adifLogExportToFile END - numberOfQsos = " << QString::number(numberOfQsos) << endl; step = util->getProgresStepForDialog(numberOfQsos); //step = getProgresStepForDialog(numberOfQsos); QProgressDialog progress(tr("Writing ADIF file..."), tr("Abort writing"), 0, numberOfQsos, this); progress.setMaximum(numberOfQsos); progress.setWindowModality(Qt::ApplicationModal); out << "ADIF v2.2.7 Export from KLog\nhttp://jaime.robles.es/klog\n" << kontestVersion << "\nKLOG" << endl; out << "" << QString::number(numberOfQsos) << endl; QDateTime dateTime = (QDateTime::currentDateTime()).toUTC(); out << "" << dateTime.toString("yyyyMMdd-hhmm") << endl; out << "" << endl; if (exportAll) { queryString = QString("SELECT * FROM log"); } else { queryString = QString("SELECT * FROM log WHERE lognumber='%1'").arg(_logN); } QSqlQuery query; query.exec(queryString); //QSqlQuery query("SELECT * FROM log"); QSqlRecord rec = query.record(); while ( (query.next()) && (!noMoreQso) ) { marked = false; if (query.isValid()) { if (exportJustMarkedQSO == true) { nameCol = rec.indexOf("marked"); aux1 = (query.value(nameCol)).toString(); if (aux1 == "X") { //qDebug() << "FileManager::adifLogExportToFile: MARKED: " << aux1 << endl; currentQso++; nameCol = rec.indexOf("call"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile: " << QString::number(nameCol) << "/" << aux1 << endl; out << "" << aux1<< " "; nameCol = rec.indexOf("qso_date"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("qso_date_off"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("time_on"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile-time_on: " << aux1 << endl; if ( ((aux1.length()) == 5) || ((aux1.length()) == 8) ){ aux1.remove(QChar(':'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("time_off"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length()) == 5) || ((aux1.length()) == 7) ){ aux1.remove(QChar(':'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("bandid"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); aux1 = db->getBandNameFromID2(aux1.toInt()); out << "" << aux1 << " "; bandst = aux1; /* queryString = QString("SELECT name FROM band WHERE id='%1'").arg(aux1); query1.exec(queryString); query1.next(); if (query1.isValid()) { aux1 = (query1.value(0)).toString(); out << "" << aux1 << " "; } */ nameCol = rec.indexOf("band_rx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( (0 < aux1.toInt()) && (aux1.toInt() < 30) && (aux1.length()>0) ) { aux1 = db->getBandNameFromID2(aux1.toInt()); out << "" << aux1 << " "; bandrxst = aux1; /* queryString = QString("SELECT name FROM band WHERE id='%1'").arg(aux1); query1.exec(queryString); query1.next(); if (query1.isValid()) { aux1 = (query1.value(0)).toString(); out << "" << aux1 << " "; } */ } nameCol = rec.indexOf("modeid"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); // get SubModeId to check if it is the same or not from modeid aux2 = dataProxy->getSubModeFromId(aux1.toInt()); aux1 = db->getModeNameFromID2(aux1.toInt()); if (aux1.length()>1) { haveMode = true; out << "" << aux1 << " "; } if ((aux1 != aux2) && (aux2.length()>1)) { haveMode = true; out << "" << aux2 << " "; } nameCol = rec.indexOf("srx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0) { out << "" << aux1 << " "; } nameCol = rec.indexOf("srx_string"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("stx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("stx_string"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("cqz"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())>0) && (0 < aux1.toInt()) && (aux1.toInt() < CQZones+1) ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ituz"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())>0) && (0 < aux1.toInt()) && (aux1.toInt() < ITUZones+1) ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("dxcc"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; //qDebug() << "FileManager::adifLogExportToFile: DXCC " << aux1 << endl; } nameCol = rec.indexOf("address"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("age"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("cnty"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("comment"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("a_index"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ant_az"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ant_el"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ant_path"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("arrl_sect"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("checkcontest"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("class"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("contacted_op"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("contest_id"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("points"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("multiplier"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("country"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("credit_submitted"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("credit_granted"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("distance"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("eq_call"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("email"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ if (aux1.contains("@") && (aux1.contains("."))) { out << "" << aux1 << " "; } } nameCol = rec.indexOf("eqsl_qslrdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("eqsl_qslsdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("eqsl_qsl_rcvd"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && (aux1!="N") ) { out << "" << aux1 << " "; } nameCol = rec.indexOf("eqsl_qsl_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && (aux1!="N") ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("force_init"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("freq"); aux1 = (query.value(nameCol)).toString(); //qDebug() << "FileManager::adifLogExportToFile FREQ1: " << aux1 << endl; aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ //TODO: Check if the Band is correctly defined. BAND Wins and freq is lost if not correct if (db->isThisFreqInBand(bandst, aux1)) { out << "" << aux1 << " "; } } nameCol = rec.indexOf("freq_rx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ //TODO: Check if the Band is correctly defined. BAND Wins and freq is lost if not correct if (db->isThisFreqInBand(bandrxst, aux1)) { out << "" << aux1 << " "; } } nameCol = rec.indexOf("gridsquare"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_gridsquare"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("iota"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile (IOTA): " << aux1 << endl; if (((aux1.length())>=4) && ((aux1.length())<=6)){ //if ((aux1.length())==6){ out << "" << aux1 << " "; } nameCol = rec.indexOf("iota_island_id"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile (IOTA_ID): " << aux1 << endl; if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_iota"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if (((aux1.length())>=4) && ((aux1.length())<=6)){ //if ((aux1.length())==6){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_iota_island_id"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("k_index"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("lat"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("lon"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_lat"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_lon"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("lotw_qslrdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("lotw_qslsdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("lotw_qsl_rcvd"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && (aux1!="N") ) { out << "" << aux1 << " "; } nameCol = rec.indexOf("lotw_qsl_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && (aux1!="N") ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("clublog_qso_upload_date"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("clublog_qso_upload_status"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && ((aux1!="Y") || (aux1!="N") || (aux1!="M")) ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("max_bursts"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ms_shower"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_city"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_cnty"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_country"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_cq_zone"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_name"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("name"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("operator"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("station_callsign"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("owner_callsign"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_rig"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_sig"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_sig_info"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_state"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("state"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_street"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("notes"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ aux1.replace("\n", "---"); out << "" << aux1 << " "; } nameCol = rec.indexOf("nr_bursts"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("nr_pings"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("pfx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("precedence"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("public_key"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qslmsg"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qslrdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("qslsdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("qsl_rcvd"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if (((aux1.length())==1) && (aux1!="N") ){ out << "" << aux1 << " "; nameCol = rec.indexOf("qsl_rcvd_via"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())==1){ out << "" << aux1 << " "; } } nameCol = rec.indexOf("qsl_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if (((aux1.length())==1) && (aux1!="N") ){ out << "" << aux1 << " "; nameCol = rec.indexOf("qsl_sent_via"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())==1) { out << "" << aux1 << " "; } } nameCol = rec.indexOf("qsl_via"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qso_complete"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qso_random"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qth"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("rst_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("rst_rcvd"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("rx_pwr"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if (((aux1.length())>0) && (aux1.toDouble()>0) ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("tx_pwr"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())>0) && (aux1.toDouble()>0)) { out << "" << aux1 << " "; } nameCol = rec.indexOf("prop_mode"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>1){ out << "" << aux1 << " "; propsat = true; } nameCol = rec.indexOf("sat_mode"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("sat_name"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; if (!propsat) { out << "SAT "; } } nameCol = rec.indexOf("sfi"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("sig"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("swl"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ten_ten"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("web"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } if (exportAll) { nameCol = rec.indexOf("lognumber"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } } out << " " << endl; } else { //qDebug() << "FileManager::adifLogExportToFile: NOT MARKED" << endl; //marked = false; // Find something that bypass the while without breaking it all } } else { if(exportOnlyQSLRequested) { nameCol = rec.indexOf("qsl_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( aux1 !="R" ) { goto EndOfWhile; } } currentQso++; nameCol = rec.indexOf("call"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile: " << QString::number(nameCol) << "/" << aux1 << endl; out << "" << aux1 << " "; nameCol = rec.indexOf("qso_date"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("qso_date_off"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("time_on"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile-time_on: " << aux1 << endl; if ( ((aux1.length()) == 5) || ((aux1.length()) == 8) ){ aux1.remove(QChar(':'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("time_off"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length()) == 5) || ((aux1.length()) == 7) ){ aux1.remove(QChar(':'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("bandid"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); aux1 = db->getBandNameFromID2(aux1.toInt()); out << "" << aux1 << " "; bandst = aux1; /* aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); queryString = QString("SELECT name FROM band WHERE id='%1'").arg(aux1); query1.exec(queryString); query1.next(); if (query1.isValid()) { aux1 = (query1.value(0)).toString(); out << "" << aux1 << " "; } */ nameCol = rec.indexOf("band_rx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( (0 < aux1.toInt()) && (aux1.toInt() < 30) && (aux1.length()>0) ){ aux1 = db->getBandNameFromID2(aux1.toInt()); out << "" << aux1 << " "; bandrxst = aux1; /*queryString = QString("SELECT name FROM band WHERE id='%1'").arg(aux1); query1.exec(queryString); query1.next(); if (query1.isValid()) { aux1 = (query1.value(0)).toString(); out << "" << aux1 << " "; } */ } nameCol = rec.indexOf("modeid"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); // get SubModeId to check if it is the same or not from modeid aux2 = dataProxy->getSubModeFromId(aux1.toInt()); aux1 = db->getModeNameFromID2(aux1.toInt()); if (aux1.length()>1) { out << "" << aux1 << " "; haveMode = true; } if ((aux1 != aux2) && (aux2.length()>1)) { haveMode = true; out << "" << aux2 << " "; } nameCol = rec.indexOf("srx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("srx_string"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("stx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("stx_string"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("cqz"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())>0) && (0 < aux1.toInt()) && (aux1.toInt() < CQZones+1) ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ituz"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())>0) && (0 < aux1.toInt()) && (aux1.toInt() < ITUZones+1) ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("dxcc"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //if ((aux1.length())>0){ if ( ((aux1.length())>0) && (0 < aux1.toInt()) && (aux1.toInt() < DXCCEntities + 5) ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("address"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("age"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("cnty"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("comment"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("a_index"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ant_az"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ant_el"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ant_path"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("arrl_sect"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("checkcontest"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("class"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("contacted_op"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("contest_id"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("points"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("multiplier"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("country"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("credit_submitted"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("credit_granted"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("distance"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("eq_call"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("email"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0) { if (aux1.contains("@") && (aux1.contains("."))) { out << "" << aux1 << " "; } } nameCol = rec.indexOf("eqsl_qslrdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("eqsl_qslsdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("eqsl_qsl_rcvd"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && (aux1!="N") ) { out << "" << aux1 << " "; } nameCol = rec.indexOf("eqsl_qsl_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && (aux1!="N") ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("force_init"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("freq"); aux1 = (query.value(nameCol)).toString(); //qDebug() << "FileManager::adifLogExportToFile FREQ1: " << aux1 << endl; aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile FREQ2: " << aux1 << endl; if ((aux1.length())>0){ if (db->isThisFreqInBand(bandst, aux1)) { out << "" << aux1 << " "; } } nameCol = rec.indexOf("freq_rx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ if (db->isThisFreqInBand(bandst, aux1)) { out << "" << aux1 << " "; } } nameCol = rec.indexOf("gridsquare"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_gridsquare"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("iota"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile (IOTA2): " << aux1 << endl; if (((aux1.length())>=4) && ((aux1.length())<=6)){ //if ((aux1.length())==6){ out << "" << aux1 << " "; } nameCol = rec.indexOf("iota_island_id"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile (IOTA_ID2): " << aux1 << endl; if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_iota"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if (((aux1.length())>=4) && ((aux1.length())<=6)){ //if ((aux1.length())==6){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_iota_island_id"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("k_index"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("lat"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("lon"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_lat"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_lon"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("lotw_qslrdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("lotw_qslsdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("lotw_qsl_rcvd"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && (aux1!="N") ) { out << "" << aux1 << " "; } nameCol = rec.indexOf("lotw_qsl_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && (aux1!="N") ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("clublog_qso_upload_date"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("clublog_qso_upload_status"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())==1) && ((aux1!="Y") || (aux1!="N") || (aux1!="M")) ){ out << "" << aux1 << " "; } nameCol = rec.indexOf("max_bursts"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ms_shower"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_city"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_cnty"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_country"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_cq_zone"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_name"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("name"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("operator"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("station_callsign"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("owner_callsign"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_rig"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_sig"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_sig_info"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_state"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("state"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("my_street"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("notes"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("nr_bursts"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("nr_pings"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("pfx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("precedence"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("prop_mode"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>1){ out << "" << aux1 << " "; } nameCol = rec.indexOf("public_key"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qslmsg"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qslrdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("qslsdate"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); out << "" << aux1 << " "; } nameCol = rec.indexOf("qsl_rcvd"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if (((aux1.length())==1) && (aux1!="N") ){ out << "" << aux1 << " "; nameCol = rec.indexOf("qsl_rcvd_via"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())==1){ out << "" << aux1 << " "; } } nameCol = rec.indexOf("qsl_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if (((aux1.length())==1) && (aux1!="N") ){ out << "" << aux1 << " "; nameCol = rec.indexOf("qsl_sent_via"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())==1) { out << "" << aux1 << " "; } } nameCol = rec.indexOf("qsl_via"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qso_complete"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qso_random"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("qth"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("rst_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("rst_rcvd"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("rx_pwr"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if (((aux1.length())>0) && (aux1.toDouble()>0)){ out << "" << aux1 << " "; } nameCol = rec.indexOf("tx_pwr"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( ((aux1.length())>0) && (aux1.toDouble()>0)) { out << "" << aux1 << " "; } nameCol = rec.indexOf("sat_mode"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("sat_name"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("sfi"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("sig"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("swl"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("ten_ten"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } nameCol = rec.indexOf("web"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } if (exportAll) { nameCol = rec.indexOf("lognumber"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } } out << " " << endl; using namespace std; EndOfWhile: ; } if (( (currentQso % step )== 0) ) { // To update the speed I will only show the progress once each X QSOs aux1 = tr("Writing ADIF file...\n QSO: ") + QString::number(currentQso) + "/" + QString::number(numberOfQsos); progress.setLabelText(aux1); progress.setValue(currentQso); } if ( progress.wasCanceled() ) { noMoreQso = true; } else {} } // Closes the isValid else {} } //Closes the While progress.setValue(numberOfQsos); if (noMoreQso) { //TODO: Remove the file (_fileName) file.remove(); return true; } else { return false; } return true; } bool FileManager::cabrilloLogExport(const QString& _fileName, const int _contestType, const int logNconst) { //qDebug() << "FileManager::cabrilloLogExport" << endl; return cabrilloLogExportToFile(_fileName, logNconst); } bool FileManager::cabrilloLogExportCQWWToFile(const QString& _fileName, const int logNconst) { //qDebug() << "FileManager::cabrilloLogExportCQWWToFile" << _fileName, endl; /* START-OF-LOG: ARRL-SECTION: CALLSIGN: N6TW CATEGORY: SINGLE-OP ALL LOW CLAIMED-SCORE: CLUB: CONTEST: CQ-WW-SSB NAME: ADDRESS: ADDRESS: OPERATORS: [required for multi-op stations] SOAPBOX: [add lines if needed] SOAPBOX: QSO: 3799 PH 2000-11-26 0711 N6TW 59 03 K9QZO 59 04 0 QSO: 14256 PH 2000-11-26 0711 N6TW 59 03 P29AS 59 28 0 QSO: 21250 PH 2000-11-26 0711 N6TW 59 03 4S7TWG 59 22 0 QSO: 28530 PH 2000-11-26 0711 N6TW 59 03 JT1FAX 59 23 0 QSO: 7250 PH 2000-11-26 0711 N6TW 59 03 WA6MIC 59 03 0 END-OF-LOG: This is a template for the QSO portion of the log. --------info sent------- -------info rcvd-------- QSO: freq mo date time call rst exch call rst exch t QSO: ***** ** yyyy-mm-dd nnnn ************* nnn ****** ************* nnn ****** n QSO: 3799 PH 2000-11-26 0711 N6TW 59 03 JT1Z 59 23 0 000000000111111111122222222223333333333444444444455555555556666666666777777777788 123456789012345678901234567890123456789012345678901234567890123456789012345678901 Official Categories This is the list of categories the robot will accept. This will assure we get your category correct and avoid the errors of previous years CATEGORY: SINGLE-OP ALL HIGH CATEGORY: SINGLE-OP 160M HIGH CATEGORY: SINGLE-OP 80M HIGH CATEGORY: SINGLE-OP 40M HIGH CATEGORY: SINGLE-OP 20M HIGH CATEGORY: SINGLE-OP 15M HIGH CATEGORY: SINGLE-OP 10M HIGH CATEGORY: SINGLE-OP ALL LOW CATEGORY: SINGLE-OP 160M LOW CATEGORY: SINGLE-OP 80M LOW CATEGORY: SINGLE-OP 40M LOW CATEGORY: SINGLE-OP 20M LOW CATEGORY: SINGLE-OP 15M LOW CATEGORY: SINGLE-OP 10M LOW CATEGORY: SINGLE-OP ALL QRP CATEGORY: SINGLE-OP 160M QRP CATEGORY: SINGLE-OP 80M QRP CATEGORY: SINGLE-OP 40M QRP CATEGORY: SINGLE-OP 20M QRP CATEGORY: SINGLE-OP 15M QRP CATEGORY: SINGLE-OP 10M QRP CATEGORY: SINGLE-OP-ASSISTED ALL CATEGORY: SINGLE-OP-ASSISTED 160M CATEGORY: SINGLE-OP-ASSISTED 80M CATEGORY: SINGLE-OP-ASSISTED 40M CATEGORY: SINGLE-OP-ASSISTED 20M CATEGORY: SINGLE-OP-ASSISTED 15M CATEGORY: SINGLE-OP-ASSISTED 10M CATEGORY: MULTI-ONE CATEGORY: MULTI-TWO CATEGORY: MULTI-MULTI CATEGORY: CHECKLOG */ QFile file(_fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return false; QTextStream out(&file); QString aux1, queryString; int nameCol = 0; QSqlQuery query, query1; int numberOfQsos = 0; int currentQso = 0; int currentLog = logNconst; bool noMoreQso = false; queryString = QString("SELECT count(id) FROM log WHERE lognumber='%1'").arg(currentLog); query.exec(queryString); query.next(); if (query.isValid()) { numberOfQsos = (query.value(0)).toInt(); } QProgressDialog progress(tr("Writing Cabrillo file..."), tr("Abort writing"), 0, numberOfQsos, this); progress.setMaximum(numberOfQsos); progress.setWindowModality(Qt::WindowModal); out << "START-OF-LOG:" << endl; out << "ARRL-SECTION: " << endl; out << "CALLSIGN:" << endl; out << "CATEGORY:" << endl; out << "CLAIMED-SCORE:" << endl; out << "CLUB: " << endl; out << "CONTEST:" << endl; out << "NAME: " << endl; out << "ADDRESS:" << endl; out << "ADDRESS:" << endl; out << "ADDRESS:" << endl; out << "ADDRESS:" << endl; out << "OPERATORS:" << endl; out << "SOAPBOX:" << endl; out << "SOAPBOX:" << endl; out << "SOAPBOX:" << endl; out << "SOAPBOX:" << endl; //TODO: When the software supports several log, this should be taken into account in the following query. queryString = "SELECT freq, bandid, modeid, qso_date, time_on, station_callsign, rst_sent, rst_rcvd, call, stx FROM log"; query.exec(queryString); QSqlRecord rec = query.record(); while ( (query.next()) && (!noMoreQso) ) { if (query.isValid()) { /* This is a template for the QSO portion of the log. --------info sent------- -------info rcvd-------- QSO: freq mo date time call rst exch call rst exch t QSO: ***** ** yyyy-mm-dd nnnn ************* nnn ****** ************* nnn ****** n QSO: 3799 PH 2000-11-26 0711 N6TW 59 03 JT1Z 59 23 0 000000000111111111122222222223333333333444444444455555555556666666666777777777788 123456789012345678901234567890123456789012345678901234567890123456789012345678901 */ currentQso++; out << "QSO: " << endl; nameCol = rec.indexOf("freq"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << aux1.rightJustified(5, ' ', true) << " "; } else // if we dont have the freq but the band { nameCol = rec.indexOf("bandid"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); queryString = QString("SELECT cabrillo FROM band WHERE id='%1'").arg(aux1); query1.exec(queryString); query1.next(); if (query1.isValid()) { aux1 = (query1.value(0)).toString(); out << aux1.rightJustified(5, ' ', true) << " "; } else { // if we dont even have the band, we add the freq "00000" out << "00000" << " "; } } nameCol = rec.indexOf("modeid"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); queryString = QString("SELECT cabrillo FROM mode WHERE id='%1'").arg(aux1); query1.exec(queryString); query1.next(); if (query1.isValid()) { aux1 = (query1.value(0)).toString(); out << aux1 << " "; } else { out << "NO" << " "; } //yyyy-mm-dd nameCol = rec.indexOf("qso_date"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length()) == 10){ aux1.replace(QChar('/'), QChar('-'), Qt::CaseInsensitive); out << aux1 << " "; } else { out << "0000-00-00" << " "; } nameCol = rec.indexOf("time_on"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); //qDebug() << "FileManager::adifLogExportToFile-time_on: " << aux1 << endl; if ( ((aux1.length()) == 5) || ((aux1.length()) == 8) ){ aux1.remove(QChar(':'), Qt::CaseInsensitive); //out << aux1.resize(2) << " "; } else { out << "0000" << " "; } nameCol = rec.indexOf("station_callsign"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ( (0 <= aux1.length()) && (aux1.length() <= 14) ) { out << aux1.rightJustified(13, ' ', true) << " "; } else { out << QString("NOCAL").rightJustified(13, ' ', true) << " "; } nameCol = rec.indexOf("rst_sent"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << aux1.rightJustified(3, ' ', true) << " "; } nameCol = rec.indexOf("call"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((0 <= aux1.length()) && (aux1.length() <= 14) ) { out << aux1.rightJustified(13, ' ', true) << " "; } else { out << QString("NOCAL").rightJustified(13, ' ', true) << " "; } nameCol = rec.indexOf("rst_rcvd"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << aux1.rightJustified(3, ' ', true) << " "; } nameCol = rec.indexOf("stx"); aux1 = (query.value(nameCol)).toString(); aux1 = util->checkAndFixASCIIinADIF(aux1); if ((aux1.length())>0){ out << "" << aux1 << " "; } } else { } } // END OF WHILE out << "END-OF-LOG:" << endl; file.close(); return true; } bool FileManager::cabrilloLogExportToFile(const QString& _fileName, const int logNconst) { //qDebug() << "FileManager::cabrilloLogExportToFile" << endl; //TODO: Message "You must select a proper file format QMessageBox msgBox; msgBox.setWindowTitle(tr("KLog: Cabrillo Log Export not implemented")); msgBox.setText(tr("I am sorry but the Cabrillo Export To File feature has still not been implemented.")); msgBox.exec(); return false; } bool FileManager::printQs(const QString _q, const QStringList _line){ QStringList qs = _line; for (int i = 0; i'); //qDebug() << "FileManager::adifCheckMoreThanOneLog: data.0: " << data.at(0) << endl; //qDebug() << "FileManager::adifCheckMoreThanOneLog: data.1: " << data.at(1) << endl; if (firstLog) { log1 = (data.at(1)).toInt(); firstLog = false; } else { if (log1 == (data.at(1)).toInt()) {} else { file.close(); return true; } } } } } } //qDebug() << "FileManager::adifCheckMoreThanOneLog: JUST ONE!" << aux << endl; file.close(); return false; } */ bool FileManager::adifReadLog(const QString& tfileName, const int logN) { //qDebug() << "FileManager::adifReadLog:" << tfileName << endl; //int n = 0; QSqlDatabase db = QSqlDatabase::database(); //int maxLogs = dataProxy->getNumberOfManagedLogs(); // To manage several logs bool sqlOK = true; QStringList queries = QStringList(); queries.clear(); QSqlQuery query; QStringList fields, qsToPass, qsAux; QStringList currentQSOfields = QStringList(); fields.clear(); qsToPass.clear(); qsAux.clear(); QString fieldToAnalyze = QString(); QString fileName = tfileName; QString line = QString(); QString aux = QString(); QString auxString = QString(); QString _band = QString(); bool inHeader = true; bool EOR = false; bool noMoreQso = false; bool preparedQBool = false; qint64 pos; //Position in the file int i = 0; //Aunxiliar variable int numberOfQsos = 0; int step = 1; int errorCode = -1; int qsosInTransaction = 0; bool ignoreErrorCode19 = false; QFile file( fileName ); //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)) { //qDebug() << "FileManager::adifReadLog File not found" << fileName << endl; return false; } bool hasEOH = false; pos = file.pos(); while ( !file.atEnd() ) { line = (file.readLine()).toUpper(); numberOfQsos = numberOfQsos + line.count("EOR>"); if ((line.count("")>0) && (!hasEOH)) { hasEOH = true; } } //qDebug() << "FileManager::adifReadLog QSOs found: " << QString::number(numberOfQsos) << endl; QProgressDialog progress(tr("Reading ADIF file..."), tr("Abort reading"), 0, numberOfQsos, this); /*progress.setWindowModality(Qt::WindowModal);*/ progress.setWindowModality(Qt::ApplicationModal); progress.setVisible(true); progress.setValue(0); progress.setMaximum(numberOfQsos); step = util->getProgresStepForDialog(numberOfQsos); //step = getProgresStepForDialog(numberOfQsos); //qDebug() << "FileManager::adifReadLog (STEP)/Number: " << QString::number(step) << "/" << QString::number(numberOfQsos) << endl; //qDebug() << "FileManager::adifReadLog (number & step: " << QString::number(numberOfQsos % step) << endl; file.seek(pos); /* Optional header information may be included before the actual data in the file. To include optional header info, the first character of the file must be something other than <. Any amount of header info of any value except may be included. The header info must be terminated with . Any number of characters of any value except < may follow . The first < after is the start of the first field of the first data record in the file. */ //Read HEADER line = file.readLine().trimmed().toUpper(); if ( (!(line.startsWith('<'))) && (inHeader) ) { // The file has a header line.clear(); // We should finish the if with real data in "line" or a clear one. while ( inHeader && hasEOH) { line = file.readLine().trimmed().toUpper(); if (line.contains("")) { inHeader = false; line.clear(); //TODO: Maybe this clearing deletes a line that may have data... } } pos = file.pos(); } else if (!(line.startsWith('<'))) { // The file does not have any header. // Reading the first QSO... /* Cases: 1.- One big line with several QSO 2.- One QSO uses several lines. 3.- Last line of one QSO includes data of the next one */ inHeader = true; while (inHeader) { pos = file.pos(); line = file.readLine().trimmed().toUpper(); if ( (line.startsWith('<')) ) { inHeader = false; line.clear(); //TODO: Maybe this clearing deletes a line that may have data... } } } file.seek(pos); // START reading QSO data... //qDebug() << "FileManager::adifReadLog: QSO data reading started..." << endl; preparedQuery.prepare( "INSERT INTO log (call, qso_date, bandid, modeid, time_on, time_off, srx, stx, srx_string, stx_string, qso_date_off, band_rx, rst_sent, rst_rcvd, cqz, ituz, dxcc, address, age, cnty, comment, a_index, ant_az, ant_el, ant_path, arrl_sect, checkcontest, class, contacted_op, contest_id, country, credit_submitted, credit_granted, distance, eq_call, email, eqsl_qslrdate, eqsl_qslsdate, eqsl_qsl_rcvd, eqsl_qsl_sent, force_init, freq, freq_rx, gridsquare, my_gridsquare, iota, iota_island_id, my_iota, my_iota_island_id, k_index, lat, lon, my_lat, my_lon, lotw_qslrdate, lotw_qslsdate, lotw_qsl_rcvd, lotw_qsl_sent, clublog_qso_upload_date, clublog_qso_upload_status, max_bursts, ms_shower, my_city, my_cnty, my_country, my_cq_zone, my_name, name, operator, station_callsign, owner_callsign, my_rig, my_sig, my_sig_info, my_state, state, my_street, notes, nr_bursts, nr_pings, pfx, precedence, prop_mode, public_key, qslmsg, qslrdate, qslsdate, qsl_rcvd, qsl_sent, qsl_rcvd_via, qsl_sent_via, qsl_via, qso_complete, qso_random, qth, rx_pwr, tx_pwr, sat_mode, sat_name, sfi, sig, swl, ten_ten, web, points, multiplier, lognumber) VALUES (:call, :qso_date, :bandid, :modeid, :time_on, :time_off, :srx, :stx, :srx_string, :stx_string, :qso_date_off, :band_rx, :rst_sent, :rst_rcvd, :cqz, :ituz, :dxcc, :address, :age, :cnty, :comment, :a_index, :ant_az, :ant_el, :ant_path, :arrl_sect, :checkcontest, :class, :contacted_op, :contest_id, :country, :credit_submitted, :credit_granted, :distance, :eq_call, :email, :eqsl_qslrdate, :eqsl_qslsdate, :eqsl_qsl_rcvd, :eqsl_qsl_sent, :force_init, :freq, :freq_rx, :gridsquare, :my_gridsquare, :iota, :iota_island_id, :my_iota, :my_iota_island_id, :k_index, :lat, :lon, :my_lat, :my_lon, :lotw_qslrdate, :lotw_qslsdate, :lotw_qsl_rcvd, :lotw_qsl_sent, :clublog_qso_upload_date, :clublog_qso_upload_status, :max_bursts, :ms_shower, :my_city, :my_cnty, :my_country, :my_cq_zone, :my_name, :name, :operator, :station_callsign, :owner_callsign, :my_rig, :my_sig, :my_sig_info, :my_state, :state, :my_street, :notes, :nr_bursts, :nr_pings, :pfx, :precedence, :prop_mode, :public_key, :qslmsg, :qslrdate, :qslsdate, :qsl_rcvd, :qsl_sent, :qsl_rcvd_via, :qsl_sent_via, :qsl_via, :qso_complete, :qso_random, :qth, :rx_pwr, :tx_pwr, :sat_mode, :sat_name, :sfi, :sig, :swl, :ten_ten, :web, :points, :multiplier, :lognumber)" ); if (db.transaction()) { //qDebug() << "FileManager::adifReadLog: Transaction Opened" << endl; } else { //qDebug() << "FileManager::adifReadLog: Transaction NOT Opened" << endl; } //file.seek(pos); fields.clear(); // while ( (!file.atEnd() ) && (!noMoreQso) && (sqlOK)) while ((!noMoreQso) && (sqlOK)) { if (!file.atEnd()) { line.clear(); line.append(file.readLine().trimmed().toUpper()); //line.append(file.readLine().toUpper()); // TODO: Check if we should remove extra spaces,tabs and so on... //qDebug() << "FileManager::adifReadLog-line:" << line << endl; //fields.clear(); //TODO: Check if I should clear fields... I think I should not because I could loose data if a line contains data after an fields << line.split("<", QString::SkipEmptyParts); } //TODO: Check what happens //qDebug() << "FileManager::adifReadLog START fields" << endl; qsToPass.clear(); auxString.clear(); foreach (aux, fields) { aux = aux.trimmed(); if ( (aux.contains('>')) && (auxString.length() > 0) ) { //qsToPass << auxString + aux; qsToPass.last() = qsToPass.last() + auxString; //qDebug() << "FileManager::adifReadLog Modified in qsToPass: " << qsToPass.last() << endl; qsToPass << aux.trimmed(); //qDebug() << "FileManager::adifReadLog Added to qsToPass: " << aux.trimmed() << endl; auxString.clear(); } else if (( aux.contains('>')) && (auxString.length() <= 0) ) { qsToPass << aux.trimmed(); } else { auxString = auxString + "-" + aux.trimmed(); //qDebug() << "FileManager::adifReadLog auxString: " << auxString << endl; } //qDebug() << "FileManager::adifReadLog fields: " << aux << endl; } //qDebug() << "FileManager::adifReadLog-W-1" << endl; if (auxString.length()>0) { //qDebug() << "FileManager::adifReadLog auxString2: " << auxString << endl; qsToPass.last() = qsToPass.last() + auxString.trimmed(); } //qDebug() << "FileManager::adifReadLog END fields" << endl; //qDebug() << "FileManager::adifReadLog Mod: " << qsToPass.join("/") << endl; //qDebug() << "FileManager::adifReadLog END2 fields" << endl; fields = qsToPass; if (fields.contains("EOR>")) // We are going to add a QSO to the log... prepare the Query! { //qDebug() << "FileManager::adifReadLog: fields contains EOR>" << endl; preparedQuery.bindValue( ":lognumber", logN); while ( (!EOR) && (!fields.isEmpty()) ) { //qDebug() << "FileManager::adifReadLog-W-2" << endl; fieldToAnalyze = (fields.takeFirst()).trimmed(); if ( fieldToAnalyze.contains("EOR>") ) { //qDebug() << "FileManager::adifReadLog-W-2.1" << endl; currentQSOfields << fieldToAnalyze; preparedQBool = processQsoReadingADIF(currentQSOfields, logN, keepLogsInFile, hashLogs); if (preparedQBool) { //qDebug() << "FileManager::adifReadLog: preparedQBool = true" << endl; } else { //qDebug() << "FileManager::adifReadLog: preparedQBool = false" << endl; } } else { //qDebug() << "FileManager::adifReadLog: Not contains EOR" << endl; if ((!fieldToAnalyze.contains('>')) && (currentQSOfields.length()>0)) { //qDebug() << "FileManager::adifReadLog: Contains > & currentsQSOfields.length>0" << endl; auxString = currentQSOfields.at(currentQSOfields.length()-1); auxString = auxString + "\n" + fieldToAnalyze; //currentQSOfields.at(currentQSOfields.length()) = auxString; fieldToAnalyze = auxString; } currentQSOfields << fieldToAnalyze; EOR = false; } } sqlOK = preparedQuery.exec(); //qDebug() << "FileManager::adifReadLog: executedQuery1: " << preparedQuery.executedQuery() << endl; if (!sqlOK) { //qDebug() << "FileManager::adifReadLog: (0) LastQuery: " << preparedQuery.lastQuery() << endl; //qDebug() << "FileManager::adifReadLog: (0) LastError-data: " << preparedQuery.lastError().databaseText() << endl; //qDebug() << "FileManager::adifReadLog: (0) LastError-driver: " << preparedQuery.lastError().driverText() << endl; //qDebug() << "FileManager::adifReadLog: (0) LastError-n: " << QString::number(preparedQuery.lastError().number() ) << endl; } else { //qDebug() << "FileManager::adifReadLog: executedQuery1 with NO ERROR " << endl; } queryPreparation(logN); // to clear Values //qDebug() << "FileManager::adifReadLog: executedQuery2: " << preparedQuery.executedQuery() << endl; //qDebug() << "FileManager::adifReadLog: LastQuery2: " << preparedQuery.lastQuery() << endl; if (( (i % step ) == 0) ) { // To update the speed I will only show the progress once each X QSOs //qDebug() << "FileManager::adifReadLog: MOD 0 - i = " << QString::number(i) << endl; aux = tr("Importing ADIF file...\n QSO: ") + QString::number(i) + "/" + QString::number(numberOfQsos); progress.setLabelText(aux); progress.setValue(i); } else { //qDebug() << "FileManager::adifReadLog: Mod: "<< QString::number(i) << " mod " << QString::number(step) << " = " << QString::number(i % step) << endl; } if ( progress.wasCanceled() ) { noMoreQso = true; } else {} progress.setValue(i); i++; if (sqlOK) { currentQSOfields.clear(); //qDebug() << "FileManager::adifReadLog: (1) in While sqlOK (QSO added) = TRUE" << endl; } else { errorCode = preparedQuery.lastError().number(); //qDebug() << "FileManager::adifReadLog: QSO DUPE" << endl; //qDebug() << "FileManager::adifReadLog: (1) LastQuery: " << preparedQuery.lastQuery() << endl; //qDebug() << "FileManager::adifReadLog: (1) LastError-data: " << preparedQuery.lastError().databaseText() << endl; //qDebug() << "FileManager::adifReadLog: (1) LastError-driver: " << preparedQuery.lastError().driverText() << endl; //qDebug() << "FileManager::adifReadLog: (1) LastError-n: " << QString::number(preparedQuery.lastError().number() ) << endl; if ((errorCode == 19) && (!ignoreErrorCode19)) { // There are some repeated QSO QMessageBox msgBox; 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); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Yes: // Yes was clicked //qDebug() << "FileManager::adifReadLog: (1) clicked YES" << endl; sqlOK = true; break; case QMessageBox::YesToAll: // Yes was clicked //qDebug() << "FileManager::adifReadLog: (1) clicked YES to ALL" << endl; ignoreErrorCode19 = true; sqlOK = true; break; case QMessageBox::No: // No Save was clicked //qDebug() << "FileManager::adifReadLog: (1) clicked NO" << endl; sqlOK = false; break; default: // should never be reached sqlOK = true; //qDebug() << "FileManager::adifReadLog: (1) default" << endl; break; } //; } else if((errorCode == 19) && (ignoreErrorCode19)) { sqlOK = true; //qDebug() << "FileManager::adifReadLog: errorCode=19 && ignoreErrorCode19" << endl; } else { //qDebug() << "FileManager::adifReadLog: (2) LastQuery: " << preparedQuery.lastQuery() << endl; //qDebug() << "FileManager::adifReadLog: (2) LastError-data: " << preparedQuery.lastError().databaseText() << endl; //qDebug() << "FileManager::adifReadLog: (2) LastError-driver: " << preparedQuery.lastError().driverText() << endl; //qDebug() << "FileManager::adifReadLog: (2) LastError-n: " << QString::number(preparedQuery.lastError().number() ) << endl; QMessageBox msgBox; aux = tr("An unexpected error ocurred while importing. Please send this code to the developer for analysis: "); msgBox.setText(aux + "FM-1 #" + QString::number(errorCode) ); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Ok: // Yes was clicked sqlOK = false; //qDebug() << "FileManager::adifReadLog: (2) I have just set sqlOK=False (1)" << endl; break; default: // should never be reached sqlOK = false; //qDebug() << "FileManager::adifReadLog: (2) I have just set sqlOK=False (2)" << endl; break; } } } //qDebug() << "FileManager::adifReadLog: qsosInTransaction: " << QString::number(qsosInTransaction) << endl; if ((qsosInTransaction>=step*10) && (qsosInTransaction>200) ) { qsosInTransaction = 0; if (db.commit()) { //qDebug() << "FileManager::adifReadLog: MIDcommit OK: " << QString::number(i) << endl; if (db.transaction()) { //qDebug() << "FileManager::adifReadLog: MIDTransaction Opened" << endl; } else { //qDebug() << "FileManager::adifReadLog: MIDTransaction NOT Opened" << endl; } } else { //qDebug() << "FileManager::adifReadLog: MIDcommit NOK: " << QString::number(i) << endl; errorCode = preparedQuery.lastError().number(); QMessageBox msgBox; aux = tr("An error ocurred while importing. No data will be imported. Please send this code to the developer for analysis: "); msgBox.setText(aux + "FM-2 #" + QString::number(errorCode)); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Ok: // Yes was clicked sqlOK = false; noMoreQso = true; //qDebug() << "FileManager::adifReadLog: I have just set sqlOK=False (3)" << endl; break; default: // should never be reached sqlOK = false; //qDebug() << "FileManager::adifReadLog: I have just set sqlOK=False (4)" << endl; break; } if (db.rollback()) { //qDebug() << "FileManager::adifReadLog: MIDcommit NOK: Rolledback" << endl; } else { //TODO: Check the error if db.rollback returns false //qDebug() << "FileManager::adifReadLog: MIDcommit NOK: Roleback returned FALSE¿?" << endl; } } } else { qsosInTransaction++; } } // END of if (fields.contains("EOR>")) // We are going to add a QSO to the log... ! else { if (file.atEnd()) { noMoreQso = true; } //qDebug() << "FileManager::adifReadLog: fields DOES NOT contains EOR>" << endl; } //TODO: Check how to stop the importing process } // END OF WHILE if (noMoreQso) { //qDebug() << "FileManager::adifReadLog: noMoreQso = true" << endl; } else { //qDebug() << "FileManager::adifReadLog: noMoreQso = false" << endl; } if (sqlOK) { //qDebug() << "FileManager::adifReadLog: sqlOK = true" << endl; } else { //qDebug() << "FileManager::adifReadLog: sqlOK = false" << endl; } if (sqlOK) { if (db.commit()) { //qDebug() << "FileManager::adifReadLog: Last commit OK" << endl; } else { errorCode = preparedQuery.lastError().number(); QMessageBox msgBox; aux = tr("An error ocurred while importing. No data will be imported. Please send this code to the developer for analysis: "); msgBox.setText(aux + "FM-3 #" + QString::number(errorCode)); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Ok: // Yes was clicked sqlOK = false; //qDebug() << "FileManager::adifReadLog: I have just set sqlOK=False (5)" << endl; break; default: // should never be reached sqlOK = false; //qDebug() << "FileManager::adifReadLog: I have just set sqlOK=False (6)" << endl; break; } if (db.rollback()) { } else { //TODO: Check the error if db.rollback returns false } } } else { //qDebug() << "FileManager::adifReadLog: sqlOK = NOK" << endl; } progress.setValue(numberOfQsos); //qDebug() << "FileManager::adifReadLog END " << endl; return true; } bool FileManager::processQsoReadingADIF(const QStringList _line, const int logNumber, const bool _keepLogsInFile, QHash &_logs) { //qDebug() << "FileManager::processQsoReadingADIF: log: " << QString::number(logNumber) << endl; //qDebug() << "FileManager::processQsoReadingADIF: log: " << _line.at(0) << endl; //qDebug() << "FileManager::processQsoReadingADIF: " << _line.join("/") << endl; //QHash &hashLogs = _logs; //QFile &file = _f; int i = -1; QDate date; QTime time; QStringList qs = _line; QStringList oneField; QString field, data; QSqlQuery query; //confirmed = 0; // 0 means worked, 1 means confirmed QString queryString, stringFields, stringData; //int lastId; int dxcc = 0; int cqz = 0; int ituz = 0; //int i; // Aux value QString aux; // Aux string QString aux2, aux3; QString qrzCall = ""; QString submode = QString(); bool bandRXDef = false; int bandi = -1; int bandrxi = -1; bool rstRXr = false; bool rstTXr = false; //KLog does not understand (and will not import) a QSO without these fields bool haveCall = false; bool haveBand = false; bool haveMode = false; bool haveSubMode = false; bool haveTime = false; bool haveDate = false; //bool ret; int lenght = 0; //int currentLog = logNumber; //qDebug() << "FileManager::processQsoReadingADIF" << QString::number(qs.size()) << "/" << QString::number(logNumber) << endl; //TODO: To remove the next line, it was just to measure the time it takes. ignoreUnknownAlways = true; QString str; //preparedQuery.bindValue( ":confirmed", '0' ); //qDebug() << "FileManager::processQsoReadingADIF: Entering the foreach" << endl; foreach (str, qs) { //qDebug() << "FileManager::processQsoReadingADIF: " << str << endl; if ( !( (str.contains(":")) && (str.contains(">")) ) ) { //qDebug() << "FileManager::processQsoReadingADIF: NOT (contains : and >): " << str << endl; } else { //qDebug() << "FileManager::processQsoReadingADIF: (contains : and >): " << str << endl; oneField = str.split(">", QString::SkipEmptyParts); //qDebug() << "FileManager::processQsoReadingADIF: (oneField)" << oneField << endl; if (checkADIFValidFormat(oneField)) { i = (qs.at(0)).count(":"); field = (oneField.at(0)).trimmed(); // Needs to be cleared FIELD:4:D data = (oneField.at(1)).trimmed(); data = util->checkAndFixASCIIinADIF(data); if (i == 2) { // DATE:8:D / 20141020 lenght = (field.section(':', 1, 1)).toInt(); field = field.section(':', 0, 0); } else if (i == 1) { // DATE:8 / 20141020 lenght = (field.section(':', 1, 1)).toInt(); field = field.section(':', 0, 0); } else { //qDebug() << "FileManager::checkADIFValidFormat-1 " << endl; //return false; } //field = oneField.at(0).trimmed(); //data = oneField.at(1).trimmed(); //lenght = field.indexOf(":"); //field = field.left(lenght); //qDebug() << "FileManager::processQsoReadingADIF (field/data): " << field << "/" << data << endl; if (field == "CALL") { qrzCall = data; preparedQuery.bindValue( ":call", data ); haveCall = true; //qDebug() << "FileManager::processQsoReadingADIF-CALL:" << data << endl; } else if (field == "QSO_DATE") { //qDebug() << "FileManager::processQsoReadingADIF-QSO_DATE:" << data << endl; preparedQuery.bindValue( ":qso_date", (date.fromString(data, "yyyyMMdd")).toString("yyyy/MM/dd") ); haveDate = true; } else if (field == "BAND") { //preparedQuery.bindValue( ":bandid", data ); i = db->getBandIDFromName2(data); if (i>=0) { preparedQuery.bindValue( ":bandid", i ); haveBand = true; bandi = i; //qDebug() << "FileManager::processQsoReadingADIF-Band: " << data << "/" << QString::number(i) << endl; } else { //qDebug() << "FileManager::processQsoReadingADIF-Band - Wrong band: " << data << "/" << QString::number(i) << endl; } /* queryString = QString("SELECT id FROM band WHERE name ='%1'").arg(data); query.exec(queryString); query.next(); if (query.isValid()) { preparedQuery.bindValue( ":bandid", query.value(0).toInt() ); //qDebug() << "FileManager::bprocessQsoReadingADIF-Band: " << data << endl; } */ } else if (field == "MODE") { i = dataProxy->getSubModeIdFromSubMode(data); // get modeid if (i>=0) { { if (!haveSubMode) { preparedQuery.bindValue( ":modeid", i ); haveMode = true; haveSubMode = true; } } } } else if (field == "SUBMODE") { i = dataProxy->getSubModeIdFromSubMode(data); if (i>=0) { preparedQuery.bindValue( ":modeid", i ); haveSubMode = true; haveMode=true; //submode = data; } } else if (field == "SRX") { preparedQuery.bindValue( ":srx", data ); //qDebug() << "FileManager::bprocessQsoReadingADIF-srx: " << data << endl; } else if (field == "STX") { preparedQuery.bindValue( ":stx", data ); //qDebug() << "FileManager::bprocessQsoReadingADIF-stx: " << data << endl; } else if (field == "TIME_ON") { if (data.length() == 4) { data = data + "00"; } preparedQuery.bindValue( ":time_on", (time.fromString(data,"hhmmss")).toString("hh:mm:ss") ); haveTime = true; aux3 = (time.fromString(data,"hhmmss")).toString("hh:mm:ss"); //qDebug() << "FileManager::bprocessQsoReadingADIF-time_on: " << (time.fromString(data,"hhmmss")).toString("hh:mm:ss") << endl; } else if (field == "QSO_DATE_OFF") { preparedQuery.bindValue( ":qso_date_off", (date.fromString(data, "yyyyMMdd")).toString("yyyy/MM/dd") ); } else if (field == "BAND_RX") { i = db->getBandIDFromName2(data); if (i>=0) { preparedQuery.bindValue( ":band_rx", i ); bandRXDef = true; bandrxi = i; } /* queryString = QString("SELECT id FROM band WHERE name ='%1'").arg(data); query.exec(queryString); query.next(); if (query.isValid()) { preparedQuery.bindValue( ":band_rx", query.value(0).toInt() ); } */ } else if (field == "TIME_OFF") { if (data.length() == 4) { data = data + "00"; } preparedQuery.bindValue( ":time_off", (time.fromString(data,"hhmmss")).toString("hh:mm:ss") ); } else if (field == "RST_SENT") { preparedQuery.bindValue( ":rst_sent", data ); rstTXr = true; } else if (field == "RST_RCVD") { //qDebug() << "FileManager::bprocessQsoReadingADIF-rst_rcvd: " << data << endl; preparedQuery.bindValue( ":rst_rcvd", data ); rstRXr = true; } else if (field == "SRX_STRING") { preparedQuery.bindValue( ":srx_string", data ); } else if (field == "STX_STRING") { preparedQuery.bindValue( ":stx_string", data ); } else if (field == "CQZ") { preparedQuery.bindValue( ":cqz", data.toInt() ); cqz = data.toInt(); } else if (field == "ITUZ") { preparedQuery.bindValue( ":ituz", data.toInt() ); ituz = data.toInt(); } else if (field == "DXCC") { dxcc = data.toInt(); preparedQuery.bindValue( ":dxcc", data.toInt() ); } else if (field == "ADDRESS") { preparedQuery.bindValue( ":address", data ); } else if (field == "AGE") { preparedQuery.bindValue( ":age", data.toInt() ); } else if (field == "CNTY") { preparedQuery.bindValue( ":cnty", data ); } else if (field == "COMMENT") { preparedQuery.bindValue( ":comment", data ); } else if (field == "A_INDEX") { preparedQuery.bindValue( ":a_index", data.toInt() ); } else if (field == "ANT_AZ") { preparedQuery.bindValue( ":ant_az", data.toInt() ); } else if (field == "ANT_EL") { preparedQuery.bindValue( ":ant_el", data.toInt() ); } else if (field == "ANT_PATH") { preparedQuery.bindValue( ":ant_path", data.toInt() ); } else if (field == "ARRL_SECT") { preparedQuery.bindValue( ":arrl_sect", data.toInt() ); } else if (field == "CHECKCONTEST") { preparedQuery.bindValue( ":checkcontest", data ); } else if (field == "CLASS") { preparedQuery.bindValue( ":class", data ); } else if (field == "CONTACTED_OP") { preparedQuery.bindValue( ":contacted_op", data ); } else if (field == "CONTEST_ID") { preparedQuery.bindValue( ":contest_id", data ); } else if (field == "COUNTRY") { preparedQuery.bindValue( ":country", data ); } else if (field == "CREDIT_SUBMITTED") { preparedQuery.bindValue( ":credit_submitted", data ); } else if (field == "CREDIT_GRANTED") { preparedQuery.bindValue( ":credit_granted", data ); } else if (field == "DISTANCE") { preparedQuery.bindValue( ":distance", data.toInt() ); } else if (field == "EQ_CALL") { preparedQuery.bindValue( ":eq_call", data ); } else if (field == "EMAIL") { if (data.contains("@") && (data.contains("."))) { preparedQuery.bindValue( ":email", data ); } } else if (field == "EQSL_QSLRDATE") { preparedQuery.bindValue( ":eqsl_qslrdate", (date.fromString(data, "yyyyMMdd")).toString("yyyy/MM/dd") ); } else if (field == "EQSL_QSLSDATE") { preparedQuery.bindValue( ":eqsl_qslsdate", (date.fromString(data, "yyyyMMdd")).toString("yyyy/MM/dd") ); } else if (field == "EQSL_QSL_RCVD") { preparedQuery.bindValue( ":eqsl_qsl_rcvd", data ); } else if (field == "EQSL_QSL_SENT") { preparedQuery.bindValue( ":eqsl_qsl_sent", data ); } else if (field == "FORCE_INIT") { preparedQuery.bindValue( ":force_init", data.toInt() ); } else if (field == "FREQ") { //qDebug() << "FileManager::processQsoReadingADIF -FREQ: " << QString::number(data.toDouble()) << endl; preparedQuery.bindValue( ":freq", data.toDouble() ); if (haveBand) { if (db->isThisFreqInBand(db->getBandNameFromNumber(bandi), data)) { preparedQuery.bindValue( ":freq", data.toDouble() ); } else { // IF band is defined but not the same than freq, Band wins } } else { preparedQuery.bindValue( ":freq", data.toDouble() ); i = dataProxy->getBandIdFromFreq(data.toDouble()); if (i>=0) { preparedQuery.bindValue( ":bandid", i ); haveBand = true; //qDebug() << "FileManager::processQsoReadingADIF-Band: " << data << "/" << QString::number(i) << endl; } } } else if (field == "FREQ_RX") { //haveBand = true; //bandi = i; //i = db->getBandIDFromName2(data); if (bandRXDef) { if (db->isThisFreqInBand(db->getBandNameFromNumber(bandrxi), data)) { preparedQuery.bindValue( ":freq_rx", data.toDouble() ); } else { // IF band is defined but not the same than freq, Band wins } } else { preparedQuery.bindValue( ":freq_rx", data.toDouble() ); } } else if (field == "GRIDSQUARE") { preparedQuery.bindValue( ":gridsquare", data ); } else if (field == "MY_GRIDSQUARE") { preparedQuery.bindValue( ":my_gridsquare", data ); } else if (field == "IOTA") { //qDebug() << "FileManager::processQsoReadingADIF (IOTA): " << data << endl; data = awards->checkIfValidIOTA(data); /* if (data.length()==4) //EU-1 { data.insert(3, "00"); } else if (data.length()==5) //EU-01 { data.insert(3, "0"); } */ if (data.length() == 6) { preparedQuery.bindValue( ":iota", data ); } } else if (field == "IOTA_ISLAND_ID") { preparedQuery.bindValue( ":iota_island_id", data ); } else if (field == "MY_IOTA") { /* if (data.length()==4) //EU-1 { data.insert(3, "00"); } else if (data.length()==5) //EU-01 { data.insert(3, "0"); } */ data = awards->checkIfValidIOTA(data); if (data.length() == 6) { preparedQuery.bindValue( ":my_iota", data ); } } else if (field == "MY_IOTA_ISLAND_ID") { preparedQuery.bindValue( ":my_iota_island_id", data ); } else if (field == "K_INDEX") { preparedQuery.bindValue( ":k_index", data.toInt() ); } else if (field == "LAT") { preparedQuery.bindValue( ":lat", data ); } else if (field == "LON") { preparedQuery.bindValue( ":lon", data ); } else if (field == "MY_LAT") { preparedQuery.bindValue( ":my_lat", data ); } else if (field == "MY_LON") { preparedQuery.bindValue( ":my_lon", data ); } else if (field == "LOTW_QSLRDATE") { preparedQuery.bindValue( ":lotw_qslrdate", (date.fromString(data, "yyyyMMdd")).toString("yyyy/MM/dd") ); } else if (field == "LOTW_QSLSDATE") { preparedQuery.bindValue( ":lotw_qslsdate", (date.fromString(data, "yyyyMMdd")).toString("yyyy/MM/dd") ); } else if (field == "LOTW_QSL_RCVD") { preparedQuery.bindValue( ":lotw_qsl_rcvd", data ); } else if (field == "LOTW_QSL_SENT") { preparedQuery.bindValue( ":lotw_qsl_sent", data ); } else if (field == "CLUBLOG_QSO_UPLOAD_DATE") { preparedQuery.bindValue( ":clublog_qso_upload_date", (date.fromString(data, "yyyyMMdd")).toString("yyyy/MM/dd") ); } else if (field == "CLUBLOG_QSO_UPLOAD_STATUS") { preparedQuery.bindValue( ":clublog_qso_upload_status", data ); } else if (field == "MAX_BURSTS") { preparedQuery.bindValue( ":max_bursts", data.toInt() ); } else if (field == "MS_SHOWER") { preparedQuery.bindValue( ":ms_shower", data ); } else if (field == "MY_CITY") { preparedQuery.bindValue( ":my_city", data ); } else if (field == "MY_CNTY") { preparedQuery.bindValue( ":my_cnty", data ); } else if (field == "MY_COUNTRY") { preparedQuery.bindValue( ":my_country", data.toInt() ); } else if (field == "MY_CQ_ZONE") { preparedQuery.bindValue( ":my_cq_zone", data.toInt() ); } else if (field == "MY_NAME") { preparedQuery.bindValue( ":my_name", data ); } else if (field == "NAME") { preparedQuery.bindValue( ":name", data ); } else if (field == "OPERATOR") { preparedQuery.bindValue( ":operator", data ); } else if (field == "STATION_CALLSIGN") { preparedQuery.bindValue( ":station_callsign", data ); } else if (field == "OWNER_CALLSIGN") { preparedQuery.bindValue( ":owner_callsign", data ); } else if (field == "MY_RIG") { preparedQuery.bindValue( ":my_rig", data ); } else if (field == "MY_SIG") { preparedQuery.bindValue( ":my_sig", data ); } else if (field == "MY_SIG_INFO") { preparedQuery.bindValue( ":my_sig_info", data ); } else if (field == "MY_STATE") { preparedQuery.bindValue( ":my_state", data ); } else if (field == "STATE") { preparedQuery.bindValue( ":state", data ); } else if (field == "MY_STREET") { preparedQuery.bindValue( ":my_street", data ); } else if (field == "NOTES") { preparedQuery.bindValue( ":notes", data ); } else if (field == "NR_BURSTS") { preparedQuery.bindValue( ":nr_bursts", data.toInt() ); } else if (field == "NR_PINGS") { preparedQuery.bindValue( ":nr_pings", data.toInt() ); } else if (field == "PFX") { preparedQuery.bindValue( ":pfx", data ); } else if (field == "PRECEDENCE") { preparedQuery.bindValue( ":precedence", data ); } else if (field == "PROP_MODE") { preparedQuery.bindValue( ":prop_mode", data ); } else if (field == "PUBLIC_KEY") { preparedQuery.bindValue( ":public_key", data ); } else if (field == "QSLMSG") { preparedQuery.bindValue( ":qslmsg", data ); } else if (field == "QSLRDATE") { preparedQuery.bindValue( ":qslrdate", (date.fromString(data, "yyyyMMdd")).toString("yyyy/MM/dd") ); } else if (field == "QSLSDATE") { preparedQuery.bindValue( ":qslsdate", (date.fromString(data, "yyyyMMdd")).toString("yyyy/MM/dd") ); } else if (field == "QSL_RCVD") { preparedQuery.bindValue( ":qsl_rcvd", data ); //preparedQuery.bindValue( ":confirmed", '1' ); } else if (field == "QSL_SENT") { preparedQuery.bindValue( ":qsl_sent", data ); } else if (field == "QSL_RCVD_VIA") { preparedQuery.bindValue( ":qsl_rcvd_via", data ); } else if (field == "QSL_SENT_VIA") { preparedQuery.bindValue( ":qsl_sent_via", data ); } else if (field == "QSL_VIA") { //qDebug() << "FileManager::bprocessQsoReadingADIF-QSL_VIA: " << data << endl; if (data == "BUREAU") // This comprobation is to "correct" old logs, mainly from KLog // comming from older ADIF files { preparedQuery.bindValue( ":qsl_sent_via", 'B' ); } else if ( (data == "B") || (data == "D") || (data == "E") )// M Deprecated value from ADIF 304 { preparedQuery.bindValue( ":qsl_via", data ); } else { // If values are not valid, are not imported. //TODO: Send an error to the user to show that there was an invalid field } } else if (field == "QSO_COMPLETE") { preparedQuery.bindValue( ":qso_complete", data ); } else if (field == "QSO_RANDOM") { preparedQuery.bindValue( ":qso_random", data.toInt() ); } else if (field == "QTH") { preparedQuery.bindValue( ":qth", data ); } else if (field == "RX_PWR") { //qDebug() << "FileManager::bprocessQsoReadingADIF-rx_pwr: " << data << endl; preparedQuery.bindValue( ":rx_pwr", data.toDouble() ); } else if (field == "TX_PWR") { //qDebug() << "FileManager::bprocessQsoReadingADIF-tx_pwr: " << data << endl; preparedQuery.bindValue( ":tx_pwr", data.toDouble() ); } else if (field == "SAT_MODE") { preparedQuery.bindValue( ":sat_mode", data ); } else if (field == "SAT_NAME") { preparedQuery.bindValue( ":sat_name", data ); } else if (field == "SFI") { preparedQuery.bindValue( ":sfi", data.toInt() ); } else if (field == "SIG") { preparedQuery.bindValue( ":sig", data ); } else if (field == "SWL") { preparedQuery.bindValue( ":swl", data.toInt() ); } else if (field == "TEN_TEN") { preparedQuery.bindValue( ":ten_ten", data.toInt() ); } else if (field == "WEB") { preparedQuery.bindValue( ":web", data ); } else if (field == "APP_KLOG_POINTS") //Importing own ADIF fields { preparedQuery.bindValue( ":points", data.toInt() ); } else if (field == "APP_KLOG_MULTIPLIER") //Importing own ADIF fields { preparedQuery.bindValue( ":multiplier", data.toInt() ); } 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) /* 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 { preparedQuery.bindValue( ":points", data.toInt() ); } else { } } else { //qDebug() << "FileManager::processQsoReadingADIF (field) CheckAdif FALSE: " << field << endl; } } } //preparedQuery.bindValue( ":lognumber", i); //qDebug() << "FileManager::processQsoReadingADIF: logNumber: " << QString::number(logNumber) << endl; // if ((haveSubMode) && (!haveMode)) // { // We can guess the mode from a submode! // preparedQuery.bindValue( ":mode", dataProxy->getIdFromModeName(dataProxy->getModeFromSubMode(submode)) ); // haveMode = true; // } if (!(haveBand && haveCall && haveMode && haveTime && haveDate )) { aux2 = tr ("This QSO is not including the minimum data to consider a QSO as valid!.\n\n\nPlease edit the ADIF file and make sure that it include at least:\n\nCALL, QSO_DATE, TIME_ON, BAND and MODE.\n\nThis QSO had:\n"); if (!haveBand) { aux2 = aux2 + tr(" - The band missing and the following call: ") + qrzCall + ".\n"; //aux2 = "Band missing " + qrzCall + " "; } if (!haveCall) { aux2 = aux2 + tr(" - The call missing but was done at this time: ") + aux3 + ".\n"; //aux2 = "Call missing " + aux3 + " "; } if (!haveMode) { aux2 = aux2 + tr(" - The mode missing and the following call: ") + qrzCall + ".\n"; //aux2 = "Mode missing " + qrzCall + " "; } if (!haveDate) { aux2 = aux2 + tr(" - The date missing and the following call: ") + qrzCall + ".\n"; //aux2 = "Date missing " + qrzCall + " "; } if (!haveTime) { aux2 = aux2 + tr(" - The time missing and the following call: ") + qrzCall + ".\n"; //aux2 = "Time missing " + qrzCall + " "; } aux2 = aux2 + tr("\n\nDo you want to continue with the current file?"); //qDebug() << "FileManager::processQsoReadingADIF - Missing fields: " << aux2 << endl; QMessageBox msgBox; msgBox.setWindowTitle(tr("KLog: Not all required data found!")); //msgBox.setText(tr("This QSO is not including the minimum data to consider a QSO as valid!.\n\n\nPlease edit the ADIF file and make sure that it include at least:\n\nCALL, QSO_DATE, TIME_ON, BAND and MODE.\n\nDo you want to continue with the current file?")); msgBox.setText(aux2); msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); msgBox.setIcon(QMessageBox::Warning); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Yes: // Yes was clicked break; case QMessageBox::Cancel: noMoreQso = true; break; default: // should never be reached break; } } if ((!rstTXr) && (!rstTXDefault)) { QMessageBox msgBox; aux = tr("This log seems to lack of RST-TX information.\n\nClick on Yes to add a default 59 to all QSO with a similar problem.\n\nIf you select NO, the QSO may not be imported."); msgBox.setWindowTitle(tr("KLog: No RST TX found!")); msgBox.setText(aux); msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No); msgBox.setDefaultButton(QMessageBox::Yes); msgBox.setIcon(QMessageBox::Warning); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Yes: // Yes was clicked rstTXDefault = true; break; default: // should never be reached rstTXDefault = false; break; } } if ((!rstRXr) && (!rstRXDefault)) { QMessageBox msgBox; aux = tr("This log seems to lack of RST-RX information.\n\nClick on Yes to add a default 59 to all QSO with a similar problem.\n\nIf you select NO, the QSO may not be imported."); msgBox.setText(aux); msgBox.setWindowTitle(tr("KLog: No RST RX found!")); msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No); msgBox.setDefaultButton(QMessageBox::Yes); msgBox.setIcon(QMessageBox::Warning); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Yes: // Yes was clicked rstRXDefault = true; break; default: // should never be reached rstRXDefault = false; break; } } if ((!rstTXr) && (rstTXDefault)) { preparedQuery.bindValue( ":rst_sent", "59" ); } if ((!rstRXr) && (rstRXDefault)) { preparedQuery.bindValue( ":rst_rcvd", "59" ); } preparedQuery.bindValue( ":lognumber", logNumber); return true; } void FileManager::queryPreparation(const int _logN) { //qDebug() << "FileManager::queryPreparation log: " << QString::number(_logN) << endl; //Prepares the query, ALL fields to default except lognumber, as may change... preparedQuery.bindValue( ":lognumber", _logN); preparedQuery.bindValue( ":qso_date", "" ); preparedQuery.bindValue( ":time_on", "" ); preparedQuery.bindValue( ":call", "" ); preparedQuery.bindValue( ":bandid", "" ); preparedQuery.bindValue( ":modeid", "" ); preparedQuery.bindValue( ":stx", "" ); preparedQuery.bindValue( ":srx", "" ); preparedQuery.bindValue( ":qso_date_off", ""); preparedQuery.bindValue( ":band_rx", ""); preparedQuery.bindValue( ":time_off", ""); preparedQuery.bindValue( ":rst_sent", "" ); preparedQuery.bindValue( ":rst_rcvd", "" ); preparedQuery.bindValue( ":srx_string", ""); preparedQuery.bindValue( ":stx_string", ""); preparedQuery.bindValue( ":cqz", ""); preparedQuery.bindValue( ":ituz", ""); preparedQuery.bindValue( ":dxcc", ""); preparedQuery.bindValue( ":address", ""); preparedQuery.bindValue( ":age", ""); preparedQuery.bindValue( ":cnty", ""); preparedQuery.bindValue( ":comment", ""); preparedQuery.bindValue( ":a_index", ""); preparedQuery.bindValue( ":ant_az", ""); preparedQuery.bindValue( ":ant_el", ""); preparedQuery.bindValue( ":ant_path", ""); preparedQuery.bindValue( ":arrl_sect", ""); preparedQuery.bindValue( ":checkcontest", ""); preparedQuery.bindValue( ":class", ""); preparedQuery.bindValue( ":contacted_op", ""); preparedQuery.bindValue( ":contest_id", ""); preparedQuery.bindValue( ":country", ""); preparedQuery.bindValue( ":credit_submitted", ""); preparedQuery.bindValue( ":credit_granted", ""); preparedQuery.bindValue( ":distance", ""); preparedQuery.bindValue( ":eq_call", ""); preparedQuery.bindValue( ":email", ""); preparedQuery.bindValue( ":eqsl_qslrdate", ""); preparedQuery.bindValue( ":eqsl_qslsdate", ""); preparedQuery.bindValue( ":eqsl_qsl_rcvd", ""); preparedQuery.bindValue( ":eqsl_qsl_sent", ""); preparedQuery.bindValue( ":force_init", ""); preparedQuery.bindValue( ":freq", ""); preparedQuery.bindValue( ":freq_rx", ""); preparedQuery.bindValue( ":gridsquare", ""); preparedQuery.bindValue( ":my_gridsquare", ""); preparedQuery.bindValue( ":iota", ""); preparedQuery.bindValue( ":iota_island_id", ""); preparedQuery.bindValue( ":my_iota", ""); preparedQuery.bindValue( ":my_iota_island_id", ""); preparedQuery.bindValue( ":k_index", ""); preparedQuery.bindValue( ":lat", ""); preparedQuery.bindValue( ":lon", ""); preparedQuery.bindValue( ":my_lat", ""); preparedQuery.bindValue( ":my_lon", ""); preparedQuery.bindValue( ":lotw_qslrdate", ""); preparedQuery.bindValue( ":lotw_qslsdate", ""); preparedQuery.bindValue( ":lotw_qsl_rcvd", ""); preparedQuery.bindValue( ":lotw_qsl_sent", ""); preparedQuery.bindValue( ":clublog_qso_upload_date", ""); preparedQuery.bindValue( ":clublog_qso_upload_status", ""); preparedQuery.bindValue( ":max_bursts", ""); preparedQuery.bindValue( ":ms_shower", ""); preparedQuery.bindValue( ":my_city", ""); preparedQuery.bindValue( ":my_cnty", ""); preparedQuery.bindValue( ":my_country", ""); preparedQuery.bindValue( ":my_cq_zone", ""); preparedQuery.bindValue( ":my_name", ""); preparedQuery.bindValue( ":name", ""); preparedQuery.bindValue( ":operator", ""); preparedQuery.bindValue( ":station_callsign", ""); preparedQuery.bindValue( ":owner_callsign", ""); preparedQuery.bindValue( ":my_rig", ""); preparedQuery.bindValue( ":my_sig", ""); preparedQuery.bindValue( ":my_sig_info", ""); preparedQuery.bindValue( ":my_state", ""); preparedQuery.bindValue( ":state", ""); preparedQuery.bindValue( ":my_street", ""); preparedQuery.bindValue( ":notes", ""); preparedQuery.bindValue( ":nr_bursts", ""); preparedQuery.bindValue( ":nr_pings", ""); preparedQuery.bindValue( ":pfx", ""); preparedQuery.bindValue( ":precedence", ""); preparedQuery.bindValue( ":prop_mode", ""); preparedQuery.bindValue( ":public_key", ""); preparedQuery.bindValue( ":qslmsg", ""); preparedQuery.bindValue( ":qslrdate", ""); preparedQuery.bindValue( ":qslsdate", ""); preparedQuery.bindValue( ":qsl_rcvd", ""); preparedQuery.bindValue( ":qsl_sent", ""); preparedQuery.bindValue( ":qsl_rcvd_via", ""); preparedQuery.bindValue( ":qsl_sent_via", ""); preparedQuery.bindValue( ":qsl_via", ""); preparedQuery.bindValue( ":qso_complete", ""); preparedQuery.bindValue( ":qso_random", ""); preparedQuery.bindValue( ":qth", ""); preparedQuery.bindValue( ":rx_pwr", 0.0); preparedQuery.bindValue( ":tx_pwr", 0.0); preparedQuery.bindValue( ":sat_mode", ""); preparedQuery.bindValue( ":sat_name", ""); preparedQuery.bindValue( ":sfi", ""); preparedQuery.bindValue( ":sig", ""); preparedQuery.bindValue( ":swl", ""); preparedQuery.bindValue( ":ten_ten", ""); preparedQuery.bindValue( ":web", ""); preparedQuery.bindValue( ":points", ""); preparedQuery.bindValue( ":multiplier", ""); } /* bool FileManager::readAdif(const QString& tfileName, const int logN) { //qDebug() << "FileManager::readAdif: " << tfileName << endl; QString line = QString(); QString fileName = tfileName; QString fieldToAnalyze = QString(); QString auxString = QString(); bool inHeader = true; QStringList fields = QStringList(); // Data extracted from a log file line QStringList currentQSOfields = QStringList(); // All the data of ONE QSO bool noMoreQso = false; bool EOR = false; // If we find the EOR, it means that the current QSO is ready to go! //int i = 0; // Index to run the fields QFile file( fileName ); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //qDebug() << "FileManager::readAdif File not found" << fileName << endl; return false; } //Read HEADER line = file.readLine().toUpper(); if ( (!(line.startsWith('<'))) && (inHeader) ) { // The file has a header line.clear(); // We should finish the if with real data in "line" or a clear one. while ( inHeader ) { line = file.readLine().trimmed().toUpper(); if (line.contains("")) { inHeader = false; line.clear(); //TODO: Maybe this clearing deletes a line that may have data... } } } else { // The file does not have any header. // Reading the first QSO... // Cases: // 1.- One big line with several QSO // 2.- One QSO uses several lines. // 3.- Last line of one QSO includes data of the next one inHeader = false; } fields.clear(); while ( (!file.atEnd() ) && (!noMoreQso) ) { line.clear(); line.append(file.readLine().trimmed().toUpper()); //line.append(file.readLine().toUpper()); // TODO: Check if we should remove extra spaces,tabs and so on... //qDebug() << "FileManager::readAdif-line:" << line << endl; //fields.clear(); //TODO: Check if I should clear fields... I think I should not because I could loose data if a line contains data after an fields << line.split("<", QString::SkipEmptyParts); while ( (!EOR) && (!fields.isEmpty()) ) { fieldToAnalyze = (fields.takeFirst()); if ( fieldToAnalyze.contains("EOR>") ) { currentQSOfields << fieldToAnalyze; processQsoReadingADIF(currentQSOfields, logN); currentQSOfields.clear(); EOR = true; } else { //qDebug() << "FileManager::readAdif: Not contains EOR" << endl; if ((!fieldToAnalyze.contains('>')) && (currentQSOfields.length()>0)) { auxString = currentQSOfields.at(currentQSOfields.length()-1); auxString = auxString + "\n" + fieldToAnalyze; fieldToAnalyze = auxString; } currentQSOfields << fieldToAnalyze; } } } return true; } */ bool FileManager::adifReqQSLExport(const QString& _fileName) { return adifLogExportToFile(_fileName, false, true); } bool FileManager::modifySetupFile(const QString& _filename, QString _field, const QString _value) { //qDebug() << "FileManager::modifySetupFile" << endl; QFile file(_filename); if (!file.open(QIODevice::ReadWrite | QIODevice::Text)){ //qDebug() << "FileManager::modifySetupFile File not found" << _filename << endl; return false; } QTemporaryFile tmp; if (!tmp.open()) { //qDebug() << "FileManager::modifySetupFile- Temp file not opened" << endl; return false; } QString line = QString(); QTextStream in(&file); QTextStream out(&tmp); qint64 pos1 = in.pos(); qint64 pos2 = out.pos(); out << in.readAll(); in.seek(pos1); out.seek(pos2); while (!out.atEnd()) { line = out.readLine(); //qDebug() << "FileManager::modifySetupFile- Temp file: " << line << endl; if (line.startsWith(_field)) { in << _field << "=" << _value << ";" << endl; } else { in << line << endl; } } return true; } 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'); //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; } klog-0.9.2.2/klog.pro0000644000076700000620000000456512627126144012261 0ustar staff# ------------------------------------------------- # Project created by QtCreator 2011-04-23T14:06:58 # ------------------------------------------------- QT += core \ gui \ sql \ network \ widgets greaterThan(QT_MAJOR_VERSION, 4) { QT *= printsupport QT += widgets } unix { macx:TARGET = KLog # QMAKE_LFLAGS += -F/Library/Frameworks # LIBS += -framework TheFramework # SOURCES += windowinfo_mac.cpp else:# SOURCES += windowinfo_x11.cpp TARGET = klog } else:TARGET = klog # greaterThan(QT_MAJOR_VERSION, 4): QT += widgets core gui sql network # TARGET = klog CONFIG += app_bundle CONFIG += static TEMPLATE = app SOURCES += main.cpp \ setupdialog.cpp \ mainwindow.cpp \ world.cpp \ logwindow.cpp \ filemanager.cpp \ contest.cpp \ contest_cqwwdxssb.cpp \ database.cpp \ dataproxy.cpp \ dataproxy_sqlite.cpp \ downloadcty.cpp \ dxcluster.cpp \ setuppagebandsmodes.cpp \ setuppagemisc.cpp \ locator.cpp \ awards.cpp \ setuppageuserdata.cpp \ setuppagedxcluster.cpp \ setuppagecolors.cpp \ setuppagelogs.cpp \ helphelpdialog.cpp \ helpaboutdialog.cpp \ setuppageworldeditor.cpp \ setupentitydialog.cpp \ startwizard.cpp \ mainwindowsattab.cpp \ awarddxmarathon.cpp \ setuppagelogsnew.cpp \ setuppageclublog.cpp \ elogclublog.cpp \ utilities.cpp HEADERS += setupdialog.h \ mainwindow.h \ world.h \ logwindow.h \ filemanager.h \ contest.h \ database.h \ setuppagebandsmodes.h \ setuppagemisc.h \ locator.h \ dxcluster.h \ awards.h \ setuppageuserdata.h \ setuppagedxcluster.h \ setuppagecolors.h \ contest_cqwwdxssb.h \ setuppagelogs.h \ helphelpdialog.h \ helpaboutdialog.h \ setuppageworldeditor.h \ setupentitydialog.h \ startwizard.h \ downloadcty.h \ dataproxy.h \ dataproxy_sqlite.h \ mainwindowsattab.h \ awarddxmarathon.h \ setuppagelogsnew.h \ setuppageclublog.h \ elogclublog.h \ utilities.h OTHER_FILES += TODO \ README-DEVEL \ tips-for-devel.txt \ INSTALL.txt \ INSTALL-linux \ INSTALL-win.txt \ Changelog \ INSTALL-osx.txt \ NEWS \ klog.1 \ COPYING \ AUTHORS \ README TRANSLATIONS = translations/klog_es.ts \ translations/klog_ca.ts CODECFORTR = UTF-8 FORMS += klog-0.9.2.2/locator.cpp0000644000076700000620000002630212627126144012743 0ustar staff/*************************************************************************** locator.cpp - description ------------------- begin : vie feb 7 2003 copyright : (C) 2003 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "locator.h" #include Locator::Locator(){ ideg = 0; imin = 0; isec = 0; } Locator::~Locator(){ } bool Locator::isValidLocator(const QString& tlocator){ /* -------------- Subroutine ----------------------- Check valid locator (VALID: AA00AA -> RR99XX Input : char *locator = 4 or 6 characters word wide locator. returned value == -1 No error. (Valid locator). returned value == 0 Error. (Invalid locator). Note: also string "END" is considered a valid locator, but returned value is -2. ------------------------------------------------- */ //qDebug() << "Locator::isValidLocator: " << tlocator << endl; int lenght_of_locator; testLocator ="A"; testLocator = tlocator.toUpper(); lenght_of_locator = testLocator.length(); if (lenght_of_locator == 4){ testLocator = testLocator +"LM"; lenght_of_locator = 6; } if (lenght_of_locator != 6) { return false; }else{ theChar = testLocator.at(0); if (!theChar.isLetter()){ //First letter is not a valid letter return false; } if ((theChar<'A') && (theChar>'R') ){ //First letter is not a valid letter return false; } theChar = testLocator.at(1); if (!theChar.isLetter()){ //Second letter is not a valid letter return false; } if ((theChar<'A') && (theChar>'R') ){ //Second letter is not a valid letter return false; } theChar = testLocator.at(2); if (!theChar.isDigit()){ //Second letter is not a number return false; } theChar = testLocator.at(3); if (!theChar.isDigit()){ //Second letter is not a number return false; } theChar = testLocator.at(4); if (!theChar.isLetter()){ //First letter is not a valid letter return false; } if ((theChar<'A') && (theChar>'X') ){ //First letter is not a valid letter return false; } theChar = testLocator.at(5); if (!theChar.isLetter()){ //Second letter is not a valid letter return false; } if ((theChar<'A') && (theChar>'X') ){ //Second letter is not a valid letter return false; } } return true; } double Locator::getLat(const QString& tlocator){ //qDebug() << "Locator::getLat: " << tlocator; if (!isValidLocator(tlocator)) { return 0.0; } if (tlocator.length() == 2) { return (((tlocator.at(1)).toLatin1() - 65) * 10) - 90; } if (tlocator.length() == 4) { return (((tlocator.at(1)).toLatin1() - 65) * 10) + ((tlocator.at(3)).toLatin1() - 48) - 90; } else if (tlocator.length()== 6) { return (((tlocator.at(1)).toLatin1() - 65) * 10) + ((tlocator.at(3)).toLatin1() - 48) + (((tlocator.at(5)).toLatin1() - 65 + 0.5) / 24) - 90; } else { return 0.0; } } double Locator::getLon(const QString& tlocator) { //qDebug() << "Locator::getLon: " << tlocator; if (!isValidLocator(tlocator)) { return 0.0; } if (tlocator.length() == 2) { return (((tlocator.at(0)).toLatin1() - 65) * 20) - 180; } if (tlocator.length() == 4) { return (((tlocator.at(0)).toLatin1() - 65) * 20) + (((tlocator.at(2)).toLatin1() - 48) * 2) - 180; } else if (tlocator.length()== 6) { return (((tlocator.at(0)).toLatin1() - 65) * 20) + (((tlocator.at(2)).toLatin1() - 48) * 2) + (((tlocator.at(4)).toLatin1() - 65 + 0.5) / 12) - 180; } else { return 0.0; } } int Locator::getBeam(const double lon1, const double lat1, const double lon2, const double lat2){ double lon_a,lat_a,lon_b,lat_b, bearing; //qDebug() << "Locator::getBeam1: " << QString::number(lon1) << "/" << QString::number(lat1) << endl; //qDebug() << "Locator::getBeam2: " << QString::number(lon2) << "/" << QString::number(lat2) << endl; lon_a=lon1*PI/180; // Convert degrees to radians lat_a=lat1*PI/180; lon_b=lon2*PI/180; lat_b=lat2*PI/180; //earing_Distance( double lon_a, double lat_a, /* Lon/Lat of point A */ // double lon_b, double lat_b, /* Lon/Lat of point B */ // double *bearing, double *distance )/* From A to B */ //{ double gc_arc, cos_gc_arc, /* Great circle arc A to B */ cos_bearing, sin_bearing, /* cos/sin of bearing A to B */ lon_diff; /* Difference in longitude of B from A */ /* Longitude differnce of B from A */ lon_diff = lon_b - lon_a; /* Calculate great circle distance A to B */ cos_gc_arc = cos(lon_diff)*cos(lat_a)*cos(lat_b) + sin(lat_a)*sin(lat_b); gc_arc = acos( cos_gc_arc ); /* Distance in km */ // *distance = eradius * gc_arc; /* Calculate bearing A to B */ cos_bearing = sin(lat_b) - sin(lat_a) * cos_gc_arc; sin_bearing = sin(lon_diff) * cos(lat_a) * cos(lat_b); bearing = atan2(sin_bearing, cos_bearing); /* Correct negative (anticlockwise) bearings */ if( bearing < 0.0 ) { bearing = (2*PI) + bearing; } bearing = 360 - (180/PI*bearing); bearing = 360 - bearing; //qDebug() << "Locator::getBeam: " << QString::number(bearing) << endl; /* Convert to degrees */ return (int)bearing; } int Locator::getDistance(const double lon1, const double lat1, const double lon2, const double lat2, const bool _imperialSystem){ //http://en.wikipedia.org/wiki/Haversine_formula //qDebug() << "Locator::getDistanceKilometres: MyPos("<< QString::number(lon1) << "/" // << QString::number(lat1) << ") - DxPos(" << QString::number(lon2) << "/" << QString::number(lat2) << ")" << endl; double lo1,la1,lo2,la2; // TODO: Is it needed to check if the longitude and latitude are correct and/or between the magins? // if (!( (checkCoords(lon1, lat1) ) && (checkCoords(lon2, lat2)) )) // return 0; lo1=lon1* DEG_TO_RAD; // Convert degrees to radians la1=lat1* DEG_TO_RAD; lo2=lon2* DEG_TO_RAD; la2=lat2* DEG_TO_RAD; if (!_imperialSystem){ //qDebug() << "Locator::getDistance (Km): " << QString::number((int)(acos(cos(la1)*cos(lo1)*cos(la2)*cos(lo2)+cos(la1)*sin(lo1)*cos(la2)*sin(lo2)+sin(la1)*sin(la2)) * EARTH_RADIUS)) << endl; return (int)(acos(cos(la1)*cos(lo1)*cos(la2)*cos(lo2)+cos(la1)*sin(lo1)*cos(la2)*sin(lo2)+sin(la1)*sin(la2)) * EARTH_RADIUS); }else{ // In milles //qDebug() << "Locator::getDistance (Milles): " << QString::number(((int)(acos(cos(la1)*cos(lo1)*cos(la2)*cos(lo2)+cos(la1)*sin(lo1)*cos(la2)*sin(lo2)+sin(la1)*sin(la2)) * EARTH_RADIUS))* 0.62137) << endl; return ((int)(acos(cos(la1)*cos(lo1)*cos(la2)*cos(lo2)+cos(la1)*sin(lo1)*cos(la2)*sin(lo2)+sin(la1)*sin(la2)) * EARTH_RADIUS)) * 0.62137; } } bool Locator::checkCoords(const double lon1, const double lat1){ //qDebug() << "Locator::checkCoords" ; // Checks if a coordinates is correct. if ((lat1 > 90.0 || lat1 < -90.0) && (lon1 > 180.0 || lon1 < -180.0)){ return true; }else{ return false; } } QString Locator::getLocator(const double lon1, const double lat1) const{ /* -------------- Subroutine ----------------------- Calculate locator from longitude and latitude Input : lon = Longitude in decimal degrees (+ = West; - = East). lat = Latitude in decimal degrees (+ = North; - = South). Output: locator = 6 characters world wide locator. ------------------------------------------------- */ //qDebug() << "Locator::getLocator: (" << QString::number(lon1) << "/" << QString::number(lat1) << ")" << endl; QString locat = ""; //NO locator double lo, la; int alo,bla,clo,dla,elo,fla; lo=(-lon1+180)/20; la = (lat1+90)/10; alo=(int)floor(lo); bla=(int)floor(la); lo=(lo-(double)alo)*10; la=(la-(double)bla)*10; clo = (int)floor(lo); dla = (int)floor(la); elo = (int)floor((lo-(double)clo)*24); fla = (int)floor((la-(double)dla)*24); //TODO: Test if locators are calculated correctly. // generation function has been changed because of the QT4 migration locat = locat + QChar(alo+'A'); locat = locat + QChar(bla+'A'); locat = locat + QChar(clo+'0'); locat = locat + QChar(dla+'0'); locat = locat + QChar(elo+'A'); locat = locat + QChar(fla+'A'); // locat.at(0)=QChar(alo+'A'); // locat.at(1)=QChar(bla+'A'); // locat.at(2)=QChar(clo+'0'); // locat.at(3)=QChar(dla+'0'); // locat.at(4)=QChar(elo+'A'); // locat.at(5)=QChar(fla+'A'); return locat; } void Locator::degTodms(const double deg){ double temp; double ddeg; ddeg = 0; ddeg += 1.0/7200.0; /* Round-up to 0.5 sec */ ideg = (int)ddeg; temp = ( deg - (double)ideg ) * 60.0; imin = (int)temp; temp = ( temp - (double)imin ) * 60.0; isec = (int)(temp); } double Locator::dmsTodeg (int deg, int min, int sec){ return (double)deg + (double)min/60.0 + (double)sec/3600.0; } int Locator::getBeamBetweenLocators (const QString& tlocator1, const QString& tlocator2) { //qDebug() << "Locator::getBeamBetweenLocators: " << tlocator1 << "/" << tlocator2 << endl; if ( !(isValidLocator(tlocator1) && isValidLocator(tlocator2) ) ) { return -1; } else { double lon1 = getLon(tlocator1); double lon2 = getLon(tlocator2); double lat1 = getLat(tlocator1); double lat2 = getLat(tlocator2); return getBeam(lon1, lat1, lon2, lat2); } } int Locator::getDistanceBetweenLocators (const QString& tlocator1, const QString& tlocator2, const bool _imperialSystem) { if ( !(isValidLocator(tlocator1) && isValidLocator(tlocator2) ) ) { return -1; } else { double lon1 = getLon(tlocator1); double lon2 = getLon(tlocator2); double lat1 = getLat(tlocator1); double lat2 = getLat(tlocator2); return getDistance(lon1, lat1, lon2, lat2, _imperialSystem); //return getBeam(lon1, lat1, lon2, lat2); } } klog-0.9.2.2/startwizard.h0000644000076700000620000000624412627126144013326 0ustar staff#ifndef STARTWIZARD_H #define STARTWIZARD_H #include #include #include //#include #include #include #include #include #include "downloadcty.h" class FileOrMemoryPage; class CTYPage; class StartWizard : public QWizard { Q_OBJECT public: enum { Page_Intro, Page_Lic, Page_Mem, Page_CTY }; StartWizard(const QString _kontestDir, const QString _softVersion, QWidget *parent = 0); void setVersion(QString tversion); //~StartWizard(); protected: private slots: void slotCancelWizard(); void slotRunInMemory(bool checked); void slotButtonFinishedClicked(); //void fin(); private: FileOrMemoryPage *fileOrMemoryPage; CTYPage *ctyPage; QString version; bool inMemory; QString kontestDir; }; class IntroPage : public QWizardPage { Q_OBJECT public: IntroPage(QWidget *parent = 0); int nextId() const; private: QLabel *topLabel; QTextEdit *welcomeBrowser; }; class LicPage : public QWizardPage { Q_OBJECT public: LicPage(QWidget *parent = 0); void setNextButtonActive(const bool _active); int nextId() const; private: QLabel *topLabel; QTextEdit *licenseBrowser; QCheckBox *aceptLicCheckBox; }; /* class FileOrMemoryPage : public QWizardPage { Q_OBJECT public: FileOrMemoryPage(QWidget *parent = 0); int nextId() const; //int nextId() const; private slots: void slotRunningModeSelectedFile(bool checked); void slotRunningModeSelectedMemory(bool checked); signals: void exeInMemory(const bool mem); private: bool downloadCTYFile(); QLabel *topLabel; QRadioButton *memoryRadioButton; QRadioButton *fileRadioButton; bool runInMemory; }; */ class CTYPage : public QWizardPage { Q_OBJECT public: CTYPage(const QString _kontestDir, const QString _version, QWidget *parent = 0); void updateProgress (qint64 v,qint64 t); private slots: /* void slotCTYCheckButtonTogled(int state); void slotDownloadCTY(bool checked); void slotDownloadFinished(); void slotValueReturnedFromDownload(int value); void slotDownloadButtonClicked(); */ void slotUpdateDownloadProgress(qint64 received, qint64 total); void slotDownloadButtonClicked(); void slotIgnoreDownloadButtonClicked(); void slotDownloadFinished(const int ret); void slotDownloadError(const int ret); signals: void downloadTheFileSignal(const bool mem); private: bool prepareTheDownload(); bool doTheDownload(); //bool isComplete(); bool downloadCTYFile, CTYFileDownloaded; int downloadValueResult; //QString kontestDir; int total; //bool completed; DownLoadCTY *dl; QLabel *topLabel; QTextEdit *ctyBrowser; QCheckBox *downloadCTYCheckBox; QProgressBar *progressBar; QPushButton *downloadButton, *ignoreDownloadButton; QCheckBox *hiddenCheckBox; }; #endif // STARTWIZARD_H klog-0.9.2.2/setuppagelogsnew.cpp0000644000076700000620000007646412627126144014712 0ustar staff/*************************************************************************** setuppagelogsnew.h - description ------------------- begin : feb 2015 copyright : (C) 2015 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ // // This class implements the Dialog to add a new log // #include "setuppagelogsnew.h" SetupPageLogsNew::SetupPageLogsNew(QWidget *parent) { dataProxy = new DataProxy_SQLite(); editing = false; checking = false; bCass = false; bCOp = false; bCMo = false; bCPo = false; bCBa = false; bCOv = false; bCTy = false; logData.clear(); stationCallsignFilled = false; operatorsFilled = true; stationCallsign = QString(); operators = QString(); comment = QString(); dateString = QString(); typeContest = 0; contestCatMode = 0; contestCatOperators = 0; contestCatAssisted = 0; contestCatPower = 0; contestCatBands = 0; contestBands = 0; contestCatOverlay = 0; typeContestSelected = 0; typeConteststr = QString(); stationCallsignLineEdit = new QLineEdit; operatorsLineEdit = new QLineEdit; dateEdit = new QDateEdit; dateEdit->setDate(QDate::currentDate ()); commentLineEdit = new QLineEdit; typeComboBox = new QComboBox; contestCatModeComboBox = new QComboBox; contestCatOperatorsComboBox = new QComboBox; contestCatAssistedComboBox = new QComboBox; contestCatPowerComboBox = new QComboBox; contestCatBandsComboBox = new QComboBox; contestBandsComboBox = new QComboBox; contestCatOverlayComboBox = new QComboBox; contestCatModeComboBox = new QComboBox; catAsLabel = new QLabel(); typeLabel = new QLabel(); catOpLabel = new QLabel(); catModeLabel = new QLabel(); catPowerLabel = new QLabel(); catBandsLabel = new QLabel(); overlayLabel = new QLabel(); validCats = new QLabel(); dateLabel = new QLabel(tr("&Date")); stationCallsignLabel = new QLabel(tr("&Station Callsign")); operatorsLabel = new QLabel(tr("&Operators")); commentLabel = new QLabel(tr("Comm&ent")); okButton = new QPushButton(tr("&Ok"), this); cancelButton = new QPushButton(tr("&Cancel"), this); createWidget(); isThereAnyNotManagedLog(); okButton->setEnabled(false); } void SetupPageLogsNew::createWidget() { //qDebug() << "SetupPageLogsNew::createWidget" << endl; stationCallsignLabel->setWordWrap(true); operatorsLabel->setWordWrap(true); commentLabel->setWordWrap(true); dateLabel->setBuddy(dateEdit); stationCallsignLabel->setBuddy(stationCallsignLineEdit); operatorsLabel->setBuddy(operatorsLineEdit); commentLabel->setBuddy(commentLineEdit); catAsLabel->setBuddy(contestCatAssistedComboBox); typeLabel->setBuddy(typeComboBox); catOpLabel->setBuddy(contestCatOperatorsComboBox); catModeLabel->setBuddy(contestCatModeComboBox); catPowerLabel->setBuddy(contestCatPowerComboBox); catBandsLabel->setBuddy(contestCatBandsComboBox); overlayLabel->setBuddy(contestCatOverlayComboBox); validCats->setText(tr("Select categories")); validCats->setWordWrap(true); stationCallsignLineEdit->setToolTip(tr("Callsign used for this log")); operatorsLineEdit->setToolTip(tr("Comma separated list of operators: callsign1, callsign2")); dateEdit->setToolTip(tr("Start date of this log")); commentLineEdit->setToolTip(tr("Add a comment about this log")); typeLabel->setText(tr("&Type of Operation")); typeLabel->setWordWrap(true); //nameLabel->setWordWrap(true); dateLabel->setWordWrap(true); typeComboBox->setToolTip(tr("Select the kind of operation for this log")); QStringList _qs; _qs.clear(); _qs.append(dataProxy->getContestNames()); typeComboBox->addItems(_qs); //qDebug() << "SetupPageLogsNew::createWidget - contestNames: " << _qs.at(0) << endl; catModeLabel->setText(tr("&Mode Category")); catModeLabel->setWordWrap(true); contestCatModeComboBox->setToolTip(tr("Select the mode category")); _qs.clear(); _qs.append(dataProxy->getContestCat(6)); contestCatModeComboBox->addItems(_qs); //QLabel *catOpLabel = new QLabel(tr("Operators Category")); catOpLabel->setText(tr("O&perators Category")); catOpLabel->setWordWrap(true); contestCatOperatorsComboBox->setToolTip(tr("Select the operators category")); _qs.clear(); _qs.append(dataProxy->getContestCat(1)); contestCatOperatorsComboBox->addItems(_qs); catAsLabel->setText(tr("&Assisted Category")); catOpLabel->setWordWrap(true); contestCatAssistedComboBox->setToolTip(tr("Select the assisted category")); _qs.clear(); _qs.append(dataProxy->getContestCat(2)); contestCatAssistedComboBox->addItems(_qs); //QLabel *catPowerLabel = new QLabel(tr("Power Category")); catPowerLabel->setText(tr("Po&wer Category")); catPowerLabel->setWordWrap(true); contestCatPowerComboBox->setToolTip(tr("Select the power category")); _qs.clear(); _qs.append(dataProxy->getContestCat(3)); contestCatPowerComboBox->addItems(_qs); //QLabel *catBandsLabel = new QLabel(tr("Bands Category")); catBandsLabel->setText(tr("&Bands Category")); catBandsLabel->setWordWrap(true); contestCatBandsComboBox->setToolTip(tr("Select the bands category")); _qs.clear(); _qs.append(dataProxy->getContestCat(4)); contestCatBandsComboBox->addItems(_qs); overlayLabel->setText(tr("O&verlay")); overlayLabel->setWordWrap(true); contestCatOverlayComboBox->setToolTip(tr("Select the Overlay category")); _qs.clear(); _qs.append(dataProxy->getContestOverlays()); contestCatOverlayComboBox->addItems(_qs); connect(stationCallsignLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotStationCallSignTextChanged() ) ); connect(operatorsLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotOperatorsTextChanged() ) ); connect(typeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotTypeComboBoxChanged() ) ) ; connect(contestCatModeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatModeComboBoxChanged() ) ) ; connect(contestCatAssistedComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatAssistedComboBoxChanged() ) ) ; connect(contestCatOperatorsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatOperatorsComboBoxChanged() ) ) ; connect(contestCatPowerComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatPowerComboBoxChanged() ) ) ; connect(contestCatBandsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatBandsComboBoxChanged() ) ) ; connect(contestCatOverlayComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatOverlayComboBoxChanged() ) ) ; //connect(typeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotTypeComboBoxChanged() ) ) ; //connect(contestCatModeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatModeComboBoxChanged() ) ) ; //connect(contestCatAssistedComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatAssistedComboBoxChanged() ) ) ; //connect(contestCatOperatorsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatOperatorsComboBoxChanged() ) ) ; //connect(contestCatPowerComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatPowerComboBoxChanged() ) ) ; //connect(contestCatBandsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatBandsComboBoxChanged() ) ) ; //connect(contestCatOverlayComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatOverlayComboBoxChanged() ) ) ; connect(contestBandsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotBandsComboBoxChanged() ) ) ; //connect(contestCatModeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatModeComboBoxChanged() ) ) ; connect(okButton,SIGNAL(clicked()), this, SLOT(slotOKButtonClicked() ) ); connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCancelButtonClicked() ) ); QGridLayout *callsLayout = new QGridLayout; // Widget, row, column callsLayout->addWidget(stationCallsignLabel, 0, 0); callsLayout->addWidget(stationCallsignLineEdit, 0, 1); callsLayout->addWidget(dateLabel, 1, 0); callsLayout->addWidget(dateEdit, 1, 1); callsLayout->addWidget(operatorsLabel, 2, 0); callsLayout->addWidget(operatorsLineEdit, 2, 1); callsLayout->addWidget(typeLabel, 3, 0); callsLayout->addWidget(typeComboBox, 3, 1); callsLayout->addWidget(catModeLabel, 4, 0); callsLayout->addWidget(contestCatModeComboBox, 4, 1); callsLayout->addWidget(catOpLabel, 5, 0); callsLayout->addWidget(contestCatOperatorsComboBox, 5, 1); callsLayout->addWidget(catAsLabel, 6, 0); callsLayout->addWidget(contestCatAssistedComboBox, 6, 1); callsLayout->addWidget(catPowerLabel, 7, 0); callsLayout->addWidget(contestCatPowerComboBox, 7, 1); callsLayout->addWidget(catBandsLabel, 8, 0); callsLayout->addWidget(contestCatBandsComboBox, 8, 1); callsLayout->addWidget(contestBandsComboBox, 8, 2); callsLayout->addWidget(commentLabel, 9, 0); callsLayout->addWidget(commentLineEdit, 9, 1); callsLayout->addWidget(overlayLabel, 10, 0); callsLayout->addWidget(contestCatOverlayComboBox, 10, 1); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(validCats); buttonsLayout->addSpacerItem(new QSpacerItem(10,0,QSizePolicy::Expanding,QSizePolicy::Maximum)); buttonsLayout->addWidget(okButton); buttonsLayout->addWidget(cancelButton); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(callsLayout); mainLayout->addLayout(buttonsLayout); setLayout(mainLayout); //page->setLayout(callsLayout); } void SetupPageLogsNew::slotOperatorsTextChanged() { //qDebug() << "SetupPageLogsNew::slotOperatorsTextChanged" << endl; // connect(stationCallsignLineEdit, SIGNAL(textChanged(QString)), this, SLOT( ) ); if ((operatorsLineEdit->text()).length()<1) { return; } int cursorP = operatorsLineEdit->cursorPosition(); QString currentQrz = operatorsLineEdit->text(); if ((currentQrz.at(cursorP-1)).isSpace()) { currentQrz = currentQrz.remove(cursorP-1, 1); cursorP--; operatorsLineEdit->setText(currentQrz); } operatorsLineEdit->setText(((operatorsLineEdit->text())).simplified()); operatorsLineEdit->setText((operatorsLineEdit->text()).toUpper()); operatorsLineEdit->setCursorPosition(cursorP); if (currentQrz.length()>=3) {//TODO: Add a check of the format (comma separated) operatorsFilled= true; } } void SetupPageLogsNew::slotStationCallSignTextChanged() { //qDebug() << "SetupPageLogsNew::slotStationCallSignTextChanged" << endl; // connect(stationCallsignLineEdit, SIGNAL(textChanged(QString)), this, SLOT( ) ); if ((stationCallsignLineEdit->text()).length()<1) { showNOK(); return; } int cursorP = stationCallsignLineEdit->cursorPosition(); QString currentQrz = stationCallsignLineEdit->text(); if ((currentQrz.at(cursorP-1)).isSpace()) { currentQrz = currentQrz.remove(cursorP-1, 1); cursorP--; stationCallsignLineEdit->setText(currentQrz); } stationCallsignLineEdit->setText(((stationCallsignLineEdit->text())).simplified()); stationCallsignLineEdit->setText((stationCallsignLineEdit->text()).toUpper()); stationCallsignLineEdit->setCursorPosition(cursorP); if (currentQrz.length()>=3) { stationCallsignFilled = true; } showOK(); } void SetupPageLogsNew::slotTypeComboBoxChanged() { //qDebug() << "SetupPageLogsNew::slotTypeComboBoxChanged" << endl; // connect(typeComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotTypeComboBoxChanged() ) ) ; contestCatMode = contestCatModeComboBox->currentIndex(); contestCatBands = contestCatBandsComboBox->currentIndex(); contestCatPower = contestCatPowerComboBox->currentIndex(); contestCatOperators = contestCatOperatorsComboBox->currentIndex(); contestCatAssisted = contestCatAssistedComboBox->currentIndex(); typeContestSelected = typeComboBox->currentIndex(); contestCatOverlay= contestCatOverlayComboBox->currentIndex(); typeContest = getSelectedTypeContest(); if (typeContest < 0) { typeLabel->setStyleSheet("QLabel {color : red; }"); validCats->setText(tr("Categories not OK")); validCats->setStyleSheet("QLabel {color : red; }"); okButton->setEnabled(false); } else { typeLabel->setStyleSheet("QLabel {color : black; }"); showOK(); } } void SetupPageLogsNew::slotCatAssistedComboBoxChanged() { //qDebug() << "SetupPageLogs:slotCatAssistedComboBoxChanged: " << QString::number(contestCatAssistedComboBox->currentIndex()) << endl; //connect(contestCatAssistedComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatAssistedComboBoxChanged() ) ) ; contestCatMode = contestCatModeComboBox->currentIndex(); contestCatBands = contestCatBandsComboBox->currentIndex(); contestCatPower = contestCatPowerComboBox->currentIndex(); contestCatOperators = contestCatOperatorsComboBox->currentIndex(); contestCatAssisted = contestCatAssistedComboBox->currentIndex(); typeContestSelected = typeComboBox->currentIndex(); contestCatOverlay= contestCatOverlayComboBox->currentIndex(); typeContest = getSelectedTypeContest(); if (typeContest < 0) { catAsLabel->setStyleSheet("QLabel {color : red; }"); showNOK(); } else { catAsLabel->setStyleSheet("QLabel {color : black; }"); showOK(); } } void SetupPageLogsNew::slotCatOperatorsComboBoxChanged() { //qDebug() << "SetupPageLogsNew::slotCatOperatorsComboBoxChanged(): " << QString::number(contestCatOperatorsComboBox->currentIndex()) << endl; contestCatMode = contestCatModeComboBox->currentIndex(); contestCatBands = contestCatBandsComboBox->currentIndex(); contestCatPower = contestCatPowerComboBox->currentIndex(); contestCatOperators = contestCatOperatorsComboBox->currentIndex(); contestCatAssisted = contestCatAssistedComboBox->currentIndex(); typeContestSelected = typeComboBox->currentIndex(); contestCatOverlay= contestCatOverlayComboBox->currentIndex(); typeContest = getSelectedTypeContest(); if (typeContest < 0) { catOpLabel->setStyleSheet("QLabel {color : red; }"); showNOK(); } else { catOpLabel->setStyleSheet("QLabel {color : black; }"); showOK(); } } void SetupPageLogsNew::slotCatPowerComboBoxChanged() { //qDebug() << "SetupPageLogsNew::slotCatPowerComboBoxChanged(): " << QString::number(contestCatPowerComboBox->currentIndex()) << endl; //connect(contestCatPowerComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatPowerComboBoxChanged() ) ) ; contestCatMode = contestCatModeComboBox->currentIndex(); contestCatBands = contestCatBandsComboBox->currentIndex(); contestCatPower = contestCatPowerComboBox->currentIndex(); contestCatOperators = contestCatOperatorsComboBox->currentIndex(); contestCatAssisted = contestCatAssistedComboBox->currentIndex(); typeContestSelected = typeComboBox->currentIndex(); contestCatOverlay= contestCatOverlayComboBox->currentIndex(); typeContest = getSelectedTypeContest(); if (typeContest < 0) { catPowerLabel->setStyleSheet("QLabel {color : red; }"); showNOK(); } else { catPowerLabel->setStyleSheet("QLabel {color : black; }"); showOK(); } } void SetupPageLogsNew::slotCatBandsComboBoxChanged() { //qDebug() << "SetupPageLogsNew::slotCatBandsComboBoxChanged(): " << QString::number(contestCatBandsComboBox->currentIndex()) << endl; //connect(contestCatBandsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotCatBandsComboBoxChanged() ) ) ; contestCatMode = contestCatModeComboBox->currentIndex(); contestCatBands = contestCatBandsComboBox->currentIndex(); contestCatPower = contestCatPowerComboBox->currentIndex(); contestCatOperators = contestCatOperatorsComboBox->currentIndex(); contestCatAssisted = contestCatAssistedComboBox->currentIndex(); typeContestSelected = typeComboBox->currentIndex(); contestCatOverlay= contestCatOverlayComboBox->currentIndex(); typeContest = getSelectedTypeContest(); if (typeContest < 0) { catBandsLabel->setStyleSheet("QLabel {color : red; }"); showNOK(); } else { catBandsLabel->setStyleSheet("QLabel {color : black; }"); showOK(); } } void SetupPageLogsNew::slotBandsComboBoxChanged() { //qDebug() << "SetupPageLogsNew::slotBandsComboBoxChanged(): " << QString::number(contestBandsComboBox->currentIndex()) << endl; //connect(contestBandsComboBox, SIGNAL(currentIndexChanged ( int)), this, SLOT(slotBandsComboBoxChanged() ) ) ; } void SetupPageLogsNew::slotCatOverlayComboBoxChanged() { //qDebug() << "SetupPageLogsNew::slotCatOverlayComboBoxChanged(): " << QString::number(contestCatOverlayComboBox->currentIndex()) << endl; contestCatMode = contestCatModeComboBox->currentIndex(); contestCatBands = contestCatBandsComboBox->currentIndex(); contestCatPower = contestCatPowerComboBox->currentIndex(); contestCatOperators = contestCatOperatorsComboBox->currentIndex(); contestCatAssisted = contestCatAssistedComboBox->currentIndex(); typeContestSelected = typeComboBox->currentIndex(); contestCatOverlay= contestCatOverlayComboBox->currentIndex(); typeContest = getSelectedTypeContest(); //qDebug() << "SetupPageLogsNew::slotCatOverlayComboBoxChanged(): typeContest = " << QString::number(typeContest) << endl; if (typeContest < 0) { overlayLabel->setStyleSheet("QLabel {color : red; }"); showNOK(); } else { overlayLabel->setStyleSheet("QLabel {color : black; }"); showOK(); } } void SetupPageLogsNew::slotCatModeComboBoxChanged() { //qDebug() << "SetupPageLogsNew::slotCatModeComboBoxChanged(): " << QString::number(contestCatModeComboBox->currentIndex()) << endl; contestCatMode = contestCatModeComboBox->currentIndex(); contestCatBands = contestCatBandsComboBox->currentIndex(); contestCatPower = contestCatPowerComboBox->currentIndex(); contestCatOperators = contestCatOperatorsComboBox->currentIndex(); contestCatAssisted = contestCatAssistedComboBox->currentIndex(); typeContestSelected = typeComboBox->currentIndex(); contestCatOverlay= contestCatOverlayComboBox->currentIndex(); typeContest = getSelectedTypeContest(); //qDebug() << "SetupPageLogsNew::slotCatModeComboBoxChanged(): " << QString::number(typeContest) << endl; if (typeContest < 0) { catModeLabel->setStyleSheet("QLabel {color : red; }"); showNOK(); } else { catModeLabel->setStyleSheet("QLabel {color : black; }"); showOK(); } } void SetupPageLogsNew::slotOKButtonClicked() { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked" << endl; stationCallsign = stationCallsignLineEdit->text(); if (stationCallsign.length()<3) { QMessageBox msgBox; msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("You need to enter a valid QRZ in the Station Callsign box.\nThe log will not be opened.")); msgBox.exec(); return; } operators = operatorsLineEdit->text(); comment = commentLineEdit->text(); dateString = dateEdit->date().toString("yyyy/MM/dd"); //typeContest, contestCatOperators, contestCatAssisted, contestCatPower, //contestCatBands, contestCatOverlay, contestCatMode if (typeComboBox->isEnabled()) { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked ENA: type" << endl; typeContestSelected = typeComboBox->currentIndex(); typeConteststr = typeComboBox->currentText(); } else { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked NOT ENA: type" << endl; typeContestSelected = 0; typeConteststr = QString(); } if (contestCatModeComboBox->isEnabled()) { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked ENA: mode" << endl; contestCatMode = contestCatModeComboBox->currentIndex(); } else { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked NOT ENA: mode" << endl; contestCatMode = 0; } if (contestCatOperatorsComboBox->isEnabled()) { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked ENA: oper" << endl; contestCatOperators = contestCatOperatorsComboBox->currentIndex(); } else { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked NOT ENA: oper" << endl; contestCatOperators = 0; } if (contestCatAssistedComboBox->isEnabled()) { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked ENA: ass" << endl; contestCatAssisted = contestCatAssistedComboBox->currentIndex(); } else { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked NOT ENA: ass" << endl; contestCatAssisted = 0; } if (contestCatPowerComboBox->isEnabled()) { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked ENA: pwr" << endl; contestCatPower = contestCatPowerComboBox->currentIndex(); //qDebug() << "SetupPageLogsNew::slotOkButtonClicked ENA: pwr - " << contestCatPowerComboBox->currentText() << endl; } else { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked NOT ENA: pwr" << endl; contestCatPower = 0; } if (contestCatBandsComboBox->isEnabled()) { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked ENA: Cbands" << endl; contestCatBands = contestCatBandsComboBox->currentIndex(); } else { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked NOT ENA: Cbands" << endl; contestCatBands = 0; } if (contestBandsComboBox->isEnabled()) { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked ENA: bands" << endl; contestBands = contestBandsComboBox->currentIndex(); } else { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked NOT ENA: bands" << endl; contestBands = 0; } if (contestCatOverlayComboBox->isEnabled()) { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked ENA: over" << endl; contestCatOverlay = contestCatOverlayComboBox->currentIndex(); } else { //qDebug() << "SetupPageLogsNew::slotOkButtonClicked NOT ENA: over" << endl; contestCatOverlay = 0; } //typeContest, contestCatOperators, contestCatAssisted, contestCatPower, //contestCatBands, contestCatOverlay, contestCatMode typeContest = getSelectedTypeContest(); if (typeContest < 0) { QMessageBox msgBox; msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("You selected an invalid combination.\nThe log will not be opened.")); msgBox.exec(); } else { gatherAndSend(); close(); } } void SetupPageLogsNew::gatherAndSend() { //qDebug() << "SetupPageLogsNew::gatherAndSend: " << typeConteststr << endl; logData.clear(); logData << stationCallsign << operators << comment << dateString << typeConteststr << QString::number(contestCatMode) << QString::number(contestCatOperators) << QString::number(contestCatAssisted) << QString::number(contestCatPower) << QString::number(contestCatBands) << QString::number(contestBands) << QString::number(contestCatOverlay) << QString::number(typeContest); //logData << QString::number(typeContest) // Update the SetupPageLogs::slotAnalyzeNewLogData if you add or remove any field (Today 12) emit newLogData(logData); } void SetupPageLogsNew::slotCancelButtonClicked() { //qDebug() << "SetupPageLogsNew::slotCancelButtonClicked" << endl; logData.clear(); close(); } QStringList SetupPageLogsNew::getValidCatOptions(const int _currentCat, const int _higherCat) {// currentCat is the current category and highercat is the category we want to know the information // being: // 1 - contestcatoperator // 2 - contestcatassisted // 3 - contestcatpower // 4 - contestcatband // 5 - contestcatoverlay // 6 - contestcatmode //qDebug() << "SetupPageLogsNew::getValidCatOptions: " << QString::number(_currentCat) <<"/"<< QString::number(_higherCat) << endl; //return dataProxy->getValidCatOptions(_currentCat, _higherCat); } bool SetupPageLogsNew::isThereAnyNotManagedLog() { //qDebug() << "SetupPageLogsNew::isThereAnyNotManagedLog" << endl; QSqlQuery query; if (query.exec("SELECT DISTINCT lognumber FROM log WHERE lognumber!=1")) { while (query.next()) { //qDebug() << "SetupPageLogsNew::isThereAnyNotManagedLog en el while" << endl; if (query.isValid()) { //qDebug() << "SetupPageLogsNew::isThereAnyNotManagedLog - Log found!: " << QString::number((query.value(0)).toInt()) << endl; } else { //qDebug() << "SetupPageLogsNew::isThereAnyNotManagedLog Not valid!" << endl; } //qDebug() << "SetupPageLogsNew::isThereAnyNotManagedLog en el while - FINAL" << endl; } //qDebug() << "SetupPageLogsNew::isThereAnyNotManagedLog tras el while" << endl; } //qDebug() << "SetupPageLogsNew::isThereAnyNotManagedLog END" << endl; } void SetupPageLogsNew::setStationCallSign(const QString _st) { stationCallsign = _st; stationCallsignLineEdit->setText(stationCallsign.toUpper()); } void SetupPageLogsNew::setOperators(const QString _st) { operators = _st; operatorsLineEdit->setText(operators.toUpper()); } void SetupPageLogsNew::setComment(const QString _st) { comment = _st; commentLineEdit->setText(comment.toUpper()); } void SetupPageLogsNew::setDateString(const QString _st) { dateString = _st; dateEdit->setDate(QDate::fromString(dateString, "yyyy/MM/dd")); } void SetupPageLogsNew::setType(const QString _st) { typeConteststr = _st; //typeConteststr = typeComboBox->currentText(); typeComboBox->setCurrentIndex(typeComboBox->findText(typeConteststr, Qt::MatchExactly)); //findText ( const QString & text, Qt::MatchFlags flags = static_cast ( Qt::MatchExactly | Qt::MatchCaseSensitive ) ) const } void SetupPageLogsNew::setCMode(const int _n) { contestCatMode = _n; contestCatModeComboBox->setCurrentIndex(contestCatMode); } void SetupPageLogsNew::setCOperators(const int _n) { contestCatOperators = _n; contestCatOperatorsComboBox->setCurrentIndex(contestCatOperators); } void SetupPageLogsNew::setCAssisted(const int _n) { contestCatAssisted = _n; contestCatAssistedComboBox->setCurrentIndex(contestCatAssisted); } void SetupPageLogsNew::setCPower(const int _n) { contestCatPower = _n; contestCatPowerComboBox->setCurrentIndex(contestCatPower); } void SetupPageLogsNew::setCBands(const int _n) { contestCatBands = _n; contestCatBandsComboBox->setCurrentIndex(contestCatBands); } void SetupPageLogsNew::setBands(const int _n) { contestBands = _n; contestBandsComboBox->setCurrentIndex(contestBands); } void SetupPageLogsNew::setCOverlay(const int _n) { contestCatOverlay = _n; contestCatOverlayComboBox->setCurrentIndex(contestCatOverlay); } void SetupPageLogsNew::setEditing(const bool b) { editing = b; } int SetupPageLogsNew::getSelectedTypeContest() { //qDebug() << "SetupPageLogsNew::getSelectedTypeContest: " << endl; //is/contest/catoperator/catassisted/catpower/catband/catoverlay/catmode int i = dataProxy->getContestTypeN(typeContestSelected, contestCatOperators, contestCatAssisted, contestCatPower, contestCatBands, contestCatOverlay, contestCatMode); //qDebug() << "SetupPageLogsNew::getSelectedTypeContest: " << QString::number(i) << endl; return i; } void SetupPageLogsNew::setTypeN(const int _n) { //qDebug() << "SetupPageLogsNew::setTypeN: " << QString::number(_n) << endl; typeContestSelected = _n; fillWithType(typeContestSelected); } void SetupPageLogsNew::fillWithType(const int _n) { //qDebug() << "SetupPageLogsNew::fillWithType - n = " << QString::number(_n) << endl; typeContestSelected = _n; QStringList contestData; contestData << dataProxy->getDataFromContestType(_n); //qDebug() << "SetupPageLogsNew::fillWithType-1 (length = " << QString::number(contestData.length()) << ")" << endl; if (contestData.length()== 8) { //qDebug() << "SetupPageLogsNew::fillWithType-2" << endl; setCOperators ((contestData.at(1)).toInt()); setCAssisted ((contestData.at(2)).toInt()); setCPower ((contestData.at(3)).toInt()); setCOverlay ((contestData.at(4)).toInt()); setCMode ((contestData.at(5)).toInt()); setType(contestData.at(6)); setCBands((contestData.at(7)).toInt()); //qDebug() << "SetupPageLogsNew::fillWithType: " << contestData.at(6) << endl; } else { //qDebug() << "SetupPageLogsNew::fillWithType-3" << endl; return; } } void SetupPageLogsNew::updateAllCats() { //qDebug() << "SetupPageLogsNew::updateAllCats" << endl; contestCatMode = contestCatModeComboBox->currentIndex(); contestCatBands = contestCatBandsComboBox->currentIndex(); contestCatPower = contestCatPowerComboBox->currentIndex(); contestCatOperators = contestCatOperatorsComboBox->currentIndex(); contestCatAssisted = contestCatAssistedComboBox->currentIndex(); typeContestSelected = typeComboBox->currentIndex(); contestCatOverlay= contestCatOverlayComboBox->currentIndex(); typeContest = getSelectedTypeContest(); } void SetupPageLogsNew::showOK() { validCats->setText(tr("Categories OK")); validCats->setStyleSheet("QLabel {color : black; }"); okButton->setEnabled(true); } void SetupPageLogsNew::showNOK() { validCats->setText(tr("Categories not OK")); validCats->setStyleSheet("QLabel {color : red; }"); okButton->setEnabled(false); } klog-0.9.2.2/dxcluster.cpp0000644000076700000620000006313412627126144013321 0ustar staff/*************************************************************************** dxcluster.cpp - description ------------------- begin : oct 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "dxcluster.h" DXClusterWidget::DXClusterWidget(QWidget *parent) : QWidget(parent) { //qDebug() << "DXClusterWidget::DXClusterWidget" << endl; awards = new Awards(); dataProxy = new DataProxy(); initClass(); } void DXClusterWidget::initClass() { dxClusterConnected = false; dxClusterAlreadyConnected = false; showhf = true; showvhf = true; showwarc = true; showworked = true; showconfirmed = true; showann = true; showwwv = true; showwcy = true; currentLog = 0; } DXClusterWidget::DXClusterWidget(const QString &clusterToConnect, const int portToConnect, QWidget *parent) : QWidget(parent) { //qDebug() << "DXClusterWidget::DXClusterWidget" << clusterToConnect << QString::number(portToConnect) << endl; initClass(); server = clusterToConnect; port = portToConnect; dxSpotColor.setNamedColor("slategrey"); //defaultColor.setNamedColor("slategrey"); //neededColor.setNamedColor("slategrey"); //workedColor.setNamedColor("slategrey"); //confirmedColor.setNamedColor("slategrey"); //newOneColor.setNamedColor("slategrey"); world = new World(); awards = new Awards(); dataProxy = new DataProxy_SQLite(); tcpSocket = new QTcpSocket(this); dxClusterListWidget = new QListWidget(); inputCommand = new QLineEdit; sendButton = new QPushButton; clearButton = new QPushButton; inputCommand->setDisabled(true); inputCommand->setToolTip(tr("Click on Connect to connect to the DX-Cluster server")); dxClusterListWidget->setMouseTracking(true); sendButton->setText(tr("Connect")); clearButton->setText(tr("Clear")); QHBoxLayout *bottonLayout = new QHBoxLayout; bottonLayout->addWidget(inputCommand); bottonLayout->addWidget(sendButton); bottonLayout->addWidget(clearButton); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(dxClusterListWidget); layout->addLayout(bottonLayout); setLayout(layout); connect(sendButton , SIGNAL(clicked()), this, SLOT(slotClusterSendToServer()) ); connect(inputCommand, SIGNAL(textChanged(QString)), this, SLOT(slotClusterInputTextChanged()) ); //connect(searchResultsTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotDoubleClickSearch(QTreeWidgetItem *, int))); connect(dxClusterListWidget, SIGNAL(itemDoubleClicked ( QListWidgetItem *)), this, SLOT(slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetItem * )) ); connect(dxClusterListWidget, SIGNAL(itemEntered ( QListWidgetItem *)), this, SLOT(slotClusterDXClusterWidgetItemEntered( QListWidgetItem * )) ); connect(dxClusterListWidget, SIGNAL(itemSelectionChanged()), this, SLOT(slotClusterDXClusterWidgetItemSelected() ) ); //void QListWidget::itemDoubleClicked ( QListWidgetItem * item ) [signal] // TO BE DELETED addData(); } void DXClusterWidget::addData() { //qDebug() << "DXClusterWidget::addData " << endl; dxClusterSpotItem * item = new dxClusterSpotItem(dxClusterListWidget, tr("Click on connect to connect to the DX-Cluster"), awards->getDefaultColor()); } DXClusterWidget::~DXClusterWidget() { //qDebug() << "DXClusterWidget::~DXClusterWidget" << endl; } void DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetItem * item ) { //qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: " << endl; QStringList ql; ql.clear(); if (item) { ql = readItem(item); if (ql.length()==2) { ql << "double"; emit dxspotclicked(ql); } else { } } else { } } void DXClusterWidget::connectToDXCluster() { //qDebug() << "DXClusterWidget::connectToDXCluster" << endl; if (dxClusterConnected) { //qDebug() << "DXClusterWidget::connectToDXCluster: - Already connected!!" << endl; return; // If we are connected we don't want to start another connection } connect(tcpSocket, SIGNAL(connected()), SLOT(slotClusterSocketConnected()) ); connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(slotClusterDataArrived() )); connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotClusterDisplayError(QAbstractSocket::SocketError))); connect(tcpSocket, SIGNAL(disconnected()), SLOT(slotClusterSocketConnectionClosed()) ); connect(inputCommand, SIGNAL(returnPressed()), this, SLOT(slotClusterSendToServer()) ); connect(clearButton, SIGNAL(clicked()), this, SLOT(slotClusterClearLineInput()) ); tcpSocket->connectToHost( server, port ); dxClusterListWidget->setSortingEnabled (false); dxClusterSpotItem * item = new dxClusterSpotItem(dxClusterListWidget, tr("Trying to connect to the server\n"), awards->getDefaultColor()); } void DXClusterWidget::slotClusterDisplayError(QAbstractSocket::SocketError socketError) { //qDebug() << "DXClusterWidget:displayError:" << endl; switch (socketError) { case QAbstractSocket::RemoteHostClosedError: break; case QAbstractSocket::HostNotFoundError: QMessageBox::warning(this, tr("KLog DXCluster"), tr("The host was not found. Please check:\n\n" "- your network connection;\n" "- the host name and port settings.")); break; case QAbstractSocket::ConnectionRefusedError: QMessageBox::warning(this, tr("KLog DXCluster"), tr("The connection was refused by the peer. " "Make sure the DXCluster server is running, " "and check that the host name and port " "settings are correct.")); break; default: QMessageBox::warning(this, tr("KLog DXCluster"), tr("The following error occurred: %1.") .arg(tcpSocket->errorString())); } } bool DXClusterWidget::checkIfNeedsToBePrinted(const QString _dxCall, int const _band, const int _mode) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: " << _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl; QStringList qs; qs.clear(); qs << _dxCall << QString::number(_band) << QString::number(_mode) << QString::number(currentLog); //bool isConfirmed = false; bool status = awards->isThisSpotConfirmed (qs); //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: Status: " << _dxCall << "/" << QString::number(status); if (!showconfirmed) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is confirmed? ("<< QString::number(status)<< ")" << endl; if (status) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: It is confirmed: DON'T' print: " << _dxCall <<"/" << dataProxy->getNameFromBandId(_band) << endl; return false; } } if (!showhf) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is HF?" << endl; if (dataProxy->isHF(_band)) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: Not showing HF but... is it WARC?" << endl; if ( (showwarc) && dataProxy->isWARC(_band) ) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: Not showing HF but... is WARC, print!" << endl; return true; } //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is HF: DON'T print: "<< _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl; return false; } else { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is NOT HF" << endl; } } if (!showwarc) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is WARC?" << endl; if (dataProxy->isWARC(_band)) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is WARC, DON'T print: "<< _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl; return false; } else { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is NOT WARC" << endl; } } if (!showvhf) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is VHF?" << endl; if (dataProxy->isVHF(_band)) { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is VHF, DON'T print: "<< _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl; return false; } else { //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is NOT VHF " << endl; } } //qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: returns TRUE and will be printed: " << _dxCall << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< endl; return true; } void DXClusterWidget::setCurrentLog(const int _log) { currentLog = _log; } void DXClusterWidget::slotClusterDataArrived() { //qDebug() << "DXClusterWidget::slotClusterDataArrived" << endl; QStringList qs; QString dxClusterString; QString dxCall; QString dxFrequency; QString spotBand; spotBand = "-1"; bool isADXSpot = false; while ( tcpSocket->canReadLine() ) { dxClusterString = tcpSocket->readLine(); dxClusterString = dxClusterString.trimmed(); QStringList tokens = dxClusterString.split(" ", QString::SkipEmptyParts); if (tokens.size()<2){ return; } // It is a "DX de SP0TTER FREC DXCALL" //0 = DX, 1 = de, 2 = spotter, 3 = Freq, 4 = dxcall, 5 = comment //qDebug() << "DXClusterWidget::slotClusterDataArrived: " << "DXCLUSTER->" << dxClusterString << "\nTOKENS: " << tokens << endl; if ((tokens[0] == "DX") && (tokens[1] == "de")) { //qDebug() << "******************** DXClusterWidget::slotClusterDataArrived: DX DE" << endl; isADXSpot = true; QString spotter = tokens[2]; spotter.truncate(spotter.size() - 1); dxFrequency = tokens[3]; // Convert KHz to MHz... //dxFrequency = QString::number(abs (dxFrequency.toFloat())/1000); dxFrequency = QString::number( (dxFrequency.toFloat())/1000); // spotBand = QString::number(dataProxy->getBandIdFromFreq( dxFrequency.toDouble() ) ); dxCall = tokens[4]; qs.clear(); //spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) ); qs << dxCall << spotBand << "-1" << QString::number(currentLog) ; dxSpotColor = awards->getQRZDXStatusColor(qs); if (awards->isDXMarathonNeed(world->getQRZARRLId(dxCall), world->getQRZCqz(dxCall), QDateTime::currentDateTime().date().year(), currentLog)) { dxClusterString = dxClusterString + " ### Needed for DXMarathon - " + QString::number(QDateTime::currentDateTime().date().year()) + " ###"; } //qDebug() << "DX de ->" << "Spotter: " << spotter << "Freq: "<< dxFrequency << "DX: " << dxCall << endl; } else if ((tokens[0] == "To") && (tokens[1] == "ALL")) { //qDebug() << "DXClusterWidget::slotClusterDataArrived: TO ALL" << endl; dxSpotColor = awards->getDefaultColor(); } else if ( (dxClusterString.length()>=5) && (world->checkQRZValidFormat(tokens[1])) && (tokens[0]!="login:")) { // Freq / DXCall / Date // time //_qs << QRZ << Freq in MHz << lognumber; //qDebug() << "DXClusterWidget::slotClusterDataArrived: LENGTH >= 5" << endl; //qDebug() << "DXClusterWidget::slotClusterDataArrived: token0=" << tokens[0] << " / token1=" << tokens[1] << endl; isADXSpot = true; dxCall = tokens[1]; dxFrequency = tokens[0]; dxFrequency = QString::number( (dxFrequency.toFloat())/1000); qs.clear(); spotBand = QString::number(dataProxy->getBandIdFromFreq( dxFrequency.toDouble() ) ); qs << dxCall << spotBand << "-1" << QString::number(currentLog) ; dxSpotColor = awards->getQRZDXStatusColor(qs); if (awards->isDXMarathonNeed(world->getQRZARRLId(dxCall), world->getQRZCqz(dxCall), QDateTime::currentDateTime().date().year(), currentLog)) { dxClusterString = dxClusterString + " ### Needed for DXMarathon - " + QString::number(QDateTime::currentDateTime().date().year()) + " ###"; } } else { //qDebug() << "DXClusterWidget::slotClusterDataArrived: DEFAULT" << endl; dxSpotColor = awards->getDefaultColor(); } // qs.clear(); //spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) ); //qs << dxCall << spotBand << "0"; //dxSpotColor = awards->getQRZDXStatusColor(qs); //qDebug() << "DXClusterWidget::slotClusterDataArrived: Call/dxSpotColor: " << dxCall <<"/"<< dxSpotColor.name() << endl; //dxClusterSpotItem * item = new dxClusterSpotItem(dxClusterListWidget, dxClusterString, dxSpotColor); //TODO: Change the "-1" by the mode if (!checkIfNeedsToBePrinted(dxCall, spotBand.toInt(), -1)) { //qDebug() << "DXClusterWidget::slotClusterDataArrived - Not to be printed!: " << dxCall << endl; return; } QListWidgetItem *item = new QListWidgetItem(); item->setForeground(QBrush(dxSpotColor)); item->setText(dxClusterString); dxClusterListWidget->insertItem(0,item); //dxClusterListWidget->insertItem(0,item); //QListWidgetItem *item = new QListWidgetItem(); //item->setForeground(QBrush(awards->getQRZDXStatusColor(qs))); //item->setText(dxClusterString); //dxClusterListWidget->insertItem(0,item); } //qDebug() << "--------------------- DXClusterWidget::slotClusterDataArrived: " << dxClusterString << endl; //qDebug() << "DXClusterWidget::slotClusterDataArrived: " << dxClusterString << endl; } void DXClusterWidget::slotClusterSocketConnected() { //qDebug() << "DXClusterWidget::slotClusterSocketConnected" << endl; QListWidgetItem *item = new QListWidgetItem(); item->setForeground(QBrush(awards->getDefaultColor())); item->setText(tr("Connected to server")); dxClusterListWidget->insertItem(0,item); // dxClusterSpotItem * item = new dxClusterSpotItem(dxclusterListWidget, i18n("Connected to server"), awards->getDefaultColor()); dxClusterConnected = true; inputCommand->setFocus(Qt::OtherFocusReason); if (( dxClusterConnected ) && (!dxClusterAlreadyConnected) ){ bool ok; QString callsignText = QInputDialog::getText(this, tr("KLog message"), tr("Enter your callsign to connect to the cluster:"), QLineEdit::Normal, "", &ok); QString passwordText = QInputDialog::getText(this, tr("KLog message"), tr("Enter your password to connect to the cluster:\n(Just hit enter for no password)"), QLineEdit::Normal, "", &ok); QTextStream os(tcpSocket); if ( callsignText.length() > 2 && ok ) { os << callsignText << "\n"; //TODO: Check the DXCluster answer and enter the password if needed. sendButton->setText(tr("Disconnect")); clearButton->setText(tr("Clear")); dxClusterAlreadyConnected = true; } else { os << tr("Not logged on, you may to enter your callsign again.") << "\n"; dxClusterAlreadyConnected = false; } inputCommand->setEnabled(true); inputCommand->setToolTip(tr("Enter here the commands to be sent to the DX-Cluster server")); } } void DXClusterWidget::slotClusterSocketConnectionClosed() { //qDebug() << "DXClusterWidget::slotClusterSocketConnectionClosed" << endl; QListWidgetItem *item = new QListWidgetItem(); item->setForeground(QBrush(awards->getDefaultColor())); item->setText(tr("Connection closed by the server")); dxClusterListWidget->insertItem(0,item); dxClusterConnected = false; dxClusterAlreadyConnected = false; sendButton->setText(tr("Connect")); inputCommand->setDisabled(true); inputCommand->setToolTip(tr("Click on Connect to connect to the DX-Cluster server")); //connect(inputCommand, SIGNAL(returnPressed()), this, SLOT(slotClusterSendToServer()) ); disconnect (inputCommand, SIGNAL(returnPressed()), this, SLOT(slotClusterSendToServer()) ); } void DXClusterWidget::slotClusterSendToServer() { //qDebug() << "DXClusterWidget::slotClusterSendToServer()" << endl; if (!dxClusterConnected) { connectToDXCluster(); return; // If we try to connect... } if ( inputCommand ->text().length() < 1 ) { //qDebug() << "DXClusterWidget::slotClusterSendToServer() - Vacio..." << endl; QTextStream os(tcpSocket); os << "bye\n"; return; } // write to the server QTextStream os(tcpSocket); os << inputCommand ->text() << "\n"; inputCommand ->clear(); } void DXClusterWidget::slotClusterClearLineInput() { //qDebug() << "DXClusterWidget::slotClusterClearLineInput" << endl; if ( ((inputCommand->text()).length()) <= 0 ) { if ( dxClusterConnected ) { QTextStream os(tcpSocket); os << "bye\n"; } else { } } else { inputCommand->clear(); } } void DXClusterWidget::slotClusterInputTextChanged() { //qDebug() << "DXClusterWidget::slotClusterInputTextChanged" << endl; if ( ((inputCommand->text()).length()) <= 0 ) { sendButton->setText(tr("Disconnect")); clearButton->setText(tr("Clear")); } else if (dxClusterConnected) { sendButton->setText(tr("Send")); clearButton->setText(tr("Clear")); } else {} } void DXClusterWidget::setColors (const QString _newOne, const QString _needed, const QString _worked, const QString _confirmed, const QString _default) { //qDebug() << "DXClusterWidget::setColors: " << _newOne << "/" << _needed << "/" << _worked << "/" << _confirmed << "/" << _default << endl; // Just to pass the colors to the awards class awards->setColors(_newOne, _needed, _worked, _confirmed, _default); } void DXClusterWidget::setDXClusterSpotConfig(bool _showhf, bool _showvhf, bool _showwarc, bool _showworked, bool _showconfirmed, bool _showann, bool _showwwv, bool _showwcy ) { //qDebug() << "DXClusterWidget::setDXClusterSpotConfig " << endl; showhf = _showhf; showvhf = _showvhf; showwarc = _showwarc; showworked = _showworked; showconfirmed = _showconfirmed; showann = _showann; showwwv = _showwwv; showwcy = _showwcy; } void DXClusterWidget::slotClusterDXClusterWidgetItemSelected() { //qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemSelected " << endl; QListWidgetItem * item = dxClusterListWidget->currentItem(); QStringList ql; ql.clear(); ql = readItem(item); if (ql.length()==2) { ql << "selected"; emit dxspotclicked(ql); } else { } } void DXClusterWidget::slotClusterDXClusterWidgetItemEntered( QListWidgetItem * item ) { //qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemEntered" << endl; /* This code comes from slotClusterDXClusterWidgetItemDoubleClicked */ QString tip; tip.clear(); QStringList ql; ql.clear(); if (item) { ql = readItem(item); if (ql.length()==2) { tip = world->getQRZEntityName(ql.at(0)); item->setToolTip(tip); } else { } } else { } } bool DXClusterWidget::isConnected() { return dxClusterConnected; } QStringList DXClusterWidget::readItem(QListWidgetItem * item) { //qDebug() << "DXClusterWidget::readItem" << endl; QStringList fields; QString dxClusterString; //int currentEntity; QString dxCallsign, dxFreq; bool FirstFrecOK; if (item) { fields.clear(); dxClusterString = ((item->data(0)).toString()).simplified(); fields << dxClusterString.split(" "); (fields.at(0)).toFloat(&FirstFrecOK); // Just to see if the first string is a frecuency if ( (fields.at(0) == "DX" ) && (fields.at(1) == "de" ) ) { // DX de EA4TV: 21200.1 EA0JC The comment 1550 if ( world->getQRZARRLId(fields.at(4))> 0 ) { //qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: ARRLid: " << QString::number(world->getQRZARRLId(fields.at(4))) << endl; dxCallsign = (fields.at(4)).toUpper(); (fields.at(3)).toFloat(&FirstFrecOK); if (FirstFrecOK) { // The frecuency is valid dxFreq = fields.at(3); fields.clear(); //TODO: Change FREQ into bandId fields << dxCallsign << dxFreq; return fields; } else { // the frecuency is not a number! dxCallsign.clear(); dxFreq.clear(); fields.clear(); } } else { // The call is not from a valid country // TODO: if it is from a new entity/prefix it would not work. //qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: Entity not valid" << endl; dxCallsign.clear(); dxFreq.clear(); fields.clear(); } } //else if (( isAFrecuency(fields.at(0) ) ) && ( isACall(fields.at(1)) ) ) else if ( (((fields.at(0)).toFloat()) > 0.0 )&& ( world->getQRZARRLId(fields.at(1))> 0 ) ) { // 14205.0 EA0JC 5-Mar-2012 1500Z dxCallsign = (fields.at(1)).toUpper(); dxFreq = fields.at(0); fields.clear(); fields << dxCallsign << dxFreq; return fields; } else { dxCallsign.clear(); dxFreq.clear(); fields.clear(); } } else { // No Item } return fields; } void DXClusterWidget::setDXClusterServer(const QString &clusterToConnect, const int portToConnect) { server = clusterToConnect; port = portToConnect; //qDebug() << "DXClusterWidget::setDXClusterServer: " << server << ":"<< QString::number(port) << endl; } /*************************************************************************** ** This is an auxiliary class intended to provide color to the DX-Cluster ** ** spots. ** ** It may be moved to a self .h & .cpp archives ** ****************************************************************************/ dxClusterSpotItem::dxClusterSpotItem( QListWidget *parent, const QString& spot, const QColor& color ) : QListWidgetItem( parent ){ //qDebug() << "dxClusterSpotItem::dxClusterSpotItem - Constructor" << endl; spotColor = color; setText(spot); // Experimenting with fonts for the cluster QFont f("Helvetica"); f.setFixedPitch(true); setFont(f); } dxClusterSpotItem::~dxClusterSpotItem() { //qDebug() << "dxClusterSpotItem::dxClusterSpotItem - Destructor" << endl; } klog-0.9.2.2/helphelpdialog.cpp0000644000076700000620000000333212627126144014257 0ustar staff#include "helphelpdialog.h" HelpHelpDialog::HelpHelpDialog(const QString tversion) { //http://www.gnu.org/licenses/gpl.txt QString text; QString _version = tversion; text = "

KLog " + _version + tr("

By EA4TV - 2002-2015


KLog is a free logging software for hamradio operators.

Please know that this is an BETA release and it may contain many bugs.
Backup your data before using this software!


KLog has been fully rewritten from the 0.6.2 to be able to provide a cross-platform application that runs in the main operating systems (Linux, OSX & Windows) and provide new functionalities that KLog was not providing.

Find more information and latest release at
http://jaime.robles.es/klog

Author: Jaime Robles, EA4TV
jaime@robles.es"); textBrowser = new QTextBrowser; textBrowser->setOpenLinks(true); textBrowser->setOpenExternalLinks(true); textBrowser->setHtml(text); QPushButton *acceptButton = new QPushButton(tr("Ok")); textBrowser->setOpenExternalLinks(true); //textBrowser->setHTML(url); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(acceptButton); /// QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(textBrowser); mainLayout->addLayout(buttonsLayout); setLayout(mainLayout); setWindowTitle(tr("Help")); /// connect(acceptButton, SIGNAL(clicked()), this, SLOT(slotAcceptButtonClicked())); } HelpHelpDialog::~HelpHelpDialog() { } void HelpHelpDialog::slotAcceptButtonClicked() { accept(); } klog-0.9.2.2/world.h0000644000076700000620000001234212627126144012073 0ustar staff#ifndef WORLD_H #define WORLD_H /*************************************************************************** world.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include #include #include #include #include #include #include #include #include #include #include "locator.h" #include "dataproxy.h" #include "dataproxy_sqlite.h" //#include "awards.h" class QStringList; enum { Entity_Name = 1, Entity_Continent = 2 }; class World : public QWidget { //friend class Awards; Q_OBJECT public: World(); World(const QString _kontestDir); World(const QString _kontestDir, const QString _kontestVer); ~World(); bool create(const QString _kontestDir); bool recreate(const QString _kontestDir); QString getQRZEntityName(const QString _qrz); QString getEntityName(const int _entityN); QString getQRZEntityMainPrefix(const QString _qrz); QString getEntityMainPrefix(const int _entityN); QString getQRZContinentNumber(const QString _qrz); // Returns the continent id number int getContinentNumber(const int _enti); // Returns the continent id number QString getQRZContinentShortName(const QString _qrz); // Returns the continent shortName (EU, AF, ...) QString getContinentShortName(const int _enti); QString getQRZLocator(const QString _qrz); // Returns the entity locator QString getLocator(const int _entityN); // Returns the entity locator double getQRZLongitude(const QString _qrz); // Returns the longitude of the Entity double getLongitude(const int _enti); // Returns the longitude of the Entity double getQRZLatitude(const QString _qrz); // Returns the latitude of the Entity double getLatitude(const int _enti); // Returns the latitude of the Entity 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); 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); QString getQRZEntityPrefixes(const QString _qrz); QString getEntityPrefixes(const int _enti); bool checkQRZValidFormat(const QString _qrz); QStringList getEntitiesNames(); private slots: private: int getPrefixId(const QString _qrz); bool readCTYDAT(); bool readCTYCSV(); QStringList processLine(const QString _line); QStringList processLineP(const QString _line, const int _processingEntity); void createWorldModel(); QStringList readZones(const QString &pref, const int _cq, const int _itu); QString changeSlashAndFindPrefix(const QString _qrz); // Changes the \ into / and find the country prefix int progressBarPosition; bool created; QString kontestDir, kontestVersion; int cqz, ituz, numberOfEntities; QString entityName; QString currentPrefix; // Used in the progressBar bool ret; QStringList list, prefixAndZones; QString continentName, prefix; int continentId; double lat, lon, utc; //QString line; //bool readingDataOfAnEntity; int nullValue; QSqlRelationalTableModel *worldModel; //QProgressBar *progressBar; Locator *locator; DataProxy *dataProxy; //Awards *awards; }; #endif // WORLD_H klog-0.9.2.2/downloadcty.cpp0000644000076700000620000001316712627126144013634 0ustar staff#include "downloadcty.h" #include #include #include #include #include DownLoadCTY::DownLoadCTY(const QString _kontestDir, const QString _klogVersion) : QObject(0) { //qDebug() << "DownLoadCTY::DownLoadCTY(): " << _kontestDir << endl; url = new QUrl; kontestDir = _kontestDir; result = -1; // Error unknown manager = new QNetworkAccessManager; request = new QNetworkRequest; //request->setUrl(QUrl("http://www.country-files.com/cty/cty.csv")); request->setUrl(QUrl("http://www.country-files.com/bigcty/cty.csv")); QString ver = "KLog"+_klogVersion; QByteArray str; str.clear(); str.append(ver); //str.append(_klogVersion); //request.setUrl(QUrl("http://qt.nokia.com")); request->setRawHeader("User-Agent", str); //request->setHeader(QNetworkRequest::UserAgentHeader, str); //qDebug() << "DownLoadCTY::DownLoadCTY() - UserAgent: " << request->rawHeader("QNetworkRequest::UserAgentHeader") << endl; QObject::connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(slotDownloadFinished(QNetworkReply*))); } DownLoadCTY::~DownLoadCTY() { //qDebug() << "DownLoadCTY::~DownLoadCTY" << endl; } void DownLoadCTY::slotDownloadFinished(QNetworkReply *reply) { //qDebug() << "DownLoadCTY::slotDownloadFinished" << endl; QUrl url = reply->url(); //qDebug() << "DownLoadCTY::slotDownloadFinished - URL: " << url.toString() << endl; QMessageBox msgBox; QString aux; aux.clear(); if (reply->error()) { //fprintf(stderr, "Download of %s failed: %s\n", // url.toEncoded().constData(), // qPrintable(reply->errorString())); //errorCode = query.lastError().number(); msgBox.setIcon(QMessageBox::Warning); aux = tr("Download of the CTY.CSV failed with the following error code: "); msgBox.setText(aux + reply->errorString()); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); } else { QString filename = saveFileName(url); if (saveToDisk(filename, reply)) { msgBox.setIcon(QMessageBox::Information); aux = tr("Download of the CTY.CSV done."); msgBox.setText(aux); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); emit actionReturnDownload(QNetworkReply::NoError); } //printf("Download of %s succeeded (saved to %s)\n", // url.toEncoded().constData(), qPrintable(filename)); } reply->deleteLater(); emit done(); } int DownLoadCTY::download() { //qDebug() << "DownLoadCTY::download..." << endl; manager->get(*request); return 1; } void DownLoadCTY::slotDownloadProgress(qint64 received, qint64 total) { //qDebug() << "DownLoadCTY::slotDownloadProgress: " << endl; //qDebug() << "DownLoadCTY::downloadProgress: " << QString::number(received) << "/" << QString::number(total) << endl; //qDebug() << received << total; emit actionShowProgres(received, total); } void DownLoadCTY::slotErrorManagement(QNetworkReply::NetworkError networkError) { //qDebug() << "DownLoadCTY::slotErrorManagement: " << QString::number(networkError) << endl; result = networkError; if (result == QNetworkReply::NoError) { //qDebug() << "DownLoadCTY::downloadFinished: No error" << endl; } else if (result == QNetworkReply::HostNotFoundError) { //qDebug() << "DownLoadCTY::downloadFinished: Host not found" << endl; } else { //qDebug() << "DownLoadCTY::downloadFinished: ERROR: " << QString::number(result) << endl; } actionError(result); } QString DownLoadCTY::saveFileName(const QUrl &url) { //qDebug() << "DownLoadCTY::saveFileName" << endl; QString path = url.path(); QString basename = QFileInfo(path).fileName(); QMessageBox msgBox; QString aux; aux.clear(); if (basename.isEmpty()) basename = "download"; if (QFile::exists(basename)) { msgBox.setIcon(QMessageBox::Warning); aux = tr("There is already a CTY.CSV file in the folder but it will be replaced with the new one."); msgBox.setText(aux); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); // already exists, don't overwrite //int i = 0; //basename += '.'; //while (QFile::exists(basename + QString::number(i))) // ++i; //basename += QString::number(i); } return basename; } bool DownLoadCTY::saveToDisk(const QString &filename, QIODevice *data) { //qDebug() << "DownLoadCTY::saveToDisk: " << filename << endl; QFile file(filename); QMessageBox msgBox; QString aux; aux.clear(); if (!file.open(QIODevice::WriteOnly)) { msgBox.setIcon(QMessageBox::Warning); aux = tr("Could not open ") + filename + tr(" for writing."); msgBox.setText(aux); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); //fprintf(stderr, "Could not open %s for writing: %s\n", // qPrintable(filename), // qPrintable(file.errorString())); return false; } file.write(data->readAll()); file.close(); return true; } klog-0.9.2.2/world.cpp0000644000076700000620000014160012627126144012426 0ustar staff/*************************************************************************** world.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "world.h" /* QHash worldPrefixes; To insert a (key, value) pair into the hash, you can use operator[](): hash["EA"] = 130; hash["EA6"] = 131; hash["EA8"] = 132; */ World::World() { //qDebug() << "World::World(0)" << endl; worldModel = new QSqlRelationalTableModel(this); numberOfEntities = 0; progressBarPosition = 0; kontestDir = ""; kontestVersion = ""; locator = new Locator(); created = false; dataProxy = new DataProxy_SQLite(); //awards = new Awards(); } World::World(const QString _kontestDir) { //qDebug() << "World::World(1): Dir" << _kontestDir << endl; kontestDir = _kontestDir; kontestVersion = ""; worldModel = new QSqlRelationalTableModel(this); numberOfEntities = 0; 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; kontestDir = _kontestDir; kontestVersion = _kontestVer; worldModel = new QSqlRelationalTableModel(this); //qDebug() << "World::World(2): 1" << endl; numberOfEntities = 0; progressBarPosition = 0; created = false; //qDebug() << "World::World(2): 2" << endl; locator = new Locator(); //qDebug() << "World::World(2): 3" << endl; dataProxy = new DataProxy_SQLite(); //qDebug() << "World::World(2): 4" << endl; } World::~World() { //qDebug() << "World::~World" << endl; } bool World::recreate(const QString _kontestDir) { //qDebug() << "World::recreate: " << _kontestDir << endl; QSqlQuery query; if (query.exec("DELETE FROM entity")) { //qDebug() << "World::recreate: BORRADO entity" << endl; if (query.exec("DELETE FROM prefixesofentity")) { //qDebug() << "World::recreate: BORRADO prefixesofentity" << endl; return create(_kontestDir); } else {//TODO: Manage the query error //qDebug() << "World::recreate: FALLO AL BORRAR prefixesofentity" << endl; return false; } } else {//TODO: Manage the query error //qDebug() << "World::recreate: FALLO AL BORRAR entity" << endl; return false; } //qDebug() << "World::recreate: FIN..." << endl; return false; } bool World::create(const QString _kontestDir) { //qDebug() << "World::create: " << _kontestDir << endl; kontestDir = _kontestDir; //qDebug() << "World::create: 2 " << kontestDir << endl; //if (readCTYDAT()) if (readCTYCSV()) { created = true; //qDebug() << "World::create: TRUE" << endl; }else { created = false; //qDebug() << "World::create: FALSE" << endl; } return created; } void World::createWorldModel() { worldModel->setTable("entity"); worldModel->setRelation(Entity_Continent, QSqlRelation("continent", "id", "shortname")); worldModel->setSort(Entity_Name, Qt::AscendingOrder); worldModel->setHeaderData(Entity_Name, Qt::Horizontal, tr("Entity")); worldModel->setHeaderData(Entity_Continent, Qt::Horizontal, tr("Continent")); worldModel->select(); } QStringList World::processLine(const QString _line) { //qDebug() << "World::processLine: received: " << _line << endl; //QString queryString; QStringList aa; QString line; line = (_line).simplified(); if ((line).count('\'')) // Replaces ' by _ //The error comes from "Cote d'Ivoire" that breaks the SQL { line.replace(QChar('\''), QChar('_')); } //qDebug() << "World::processLine: Received: " << line << endl; //QSqlQuery query1; nullValue=-1; if ( (line.count(':') == 8 ) ) // First line of an Entity { //United States: 05: 08: NA: 43.00: 87.90: 5.0: K: //qDebug() << "World::processLine first: " << line << endl; numberOfEntities++; list.clear(); list << line.split(':'); entityName = list[0]; cqz = list[1].toInt(); ituz = list[2].toInt(); continentName = (list[3]).simplified(); continentId=-1; lat = list[4].toDouble(); lon = list[5].toDouble(); utc = ((list[6]).simplified()).toDouble(); prefix = list[7]; currentPrefix = prefix; 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; //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) <getCQzFromEntity(currentEntity); _ituz = dataProxy->getITUzFromEntity(currentEntity); line = line.remove(';'); if (line.count(',') == 0) // Only one prefix in the final line { prefixAndZones = readZones(line, _cqz, _ituz); //aa.clear(); aa << prefixAndZones.at(0) << QString::number(currentEntity) << prefixAndZones.at(1) << prefixAndZones.at(2); //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; } else // More than just one prefix in the final line { //qDebug() << "World::processLineP Query (MORE one final)(line):" << line << endl; _list.clear(); _list << line.split(','); aa.clear(); //queryString.clear(); for (int i = 0; i < _list.size(); ++i) { // PROCESS THE LINE //qDebug() << "World::processLineP LastLine prefixes" << _list.at(i) << endl; //readZones returns a QStringList: prefix, CQz, ITUz prefixAndZones = readZones(_list.at(i), _cqz, _ituz); //aa.clear(); aa << prefixAndZones.at(0) << QString::number(currentEntity) << prefixAndZones.at(1) << prefixAndZones.at(2); //return aa; } //qDebug() << "World::processLineP: END" <getCQzFromEntity(currentEntity); _ituz = dataProxy->getITUzFromEntity(currentEntity); if (line.endsWith(',')) { line.chop(1); } if ((line.split(',')).size() == 1) // Only one prefix in the middle line { // Not usual, added this check for sanity reasons only //qDebug() << "World::processLine Query: (only one middle) " << endl; line = line.remove(','); 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; return aa; } else { //qDebug() << "World::processLine Query: (MORE than one middle) " << endl; list.clear(); list << line.split(','); //queryString.clear(); aa.clear(); for (int i = 0; i < list.size(); ++i) { // PROCESS THE LINE prefixAndZones = readZones(list[i], _cqz, _ituz); aa << prefixAndZones.at(0) << QString::number(currentEntity) << prefixAndZones.at(1) << prefixAndZones.at(2); //ret = query.exec(queryString); } //qDebug() << "World::processLine Query: " << queryString << endl; } } //aa.clear(); return aa; } 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; QStringList result; int cq = _cq; int itu = _itu; QString azone; QString aux = pref; if (aux.startsWith("=")){ 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(); //qDebug() << "World::readZones (ITU)-2: " << azone.left(azone.indexOf(']')) << endl; aux = aux.left(aux.indexOf('[')); //qDebug() << "World::readZones (ITU): " << pref << "/" << QString::number(itu) << "/" << aux << endl; } 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; return result; } int World::getPrefixId(const QString _qrz) { //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; if (_qrz.length() < 1) { return -1; } int entityID = 0; //int iaux1, iaux2; //QString prefixl, prefixr; //QString queryString; //QSqlQuery query; QString aux = changeSlashAndFindPrefix((_qrz).toUpper()); //query.prepare("SELECT dxcc FROM prefixesofentity WHERE prefix==:prefix"); //QSqlDatabase::database().transaction(); while ((entityID <= 0) && (aux.length()>=1) ) { entityID = dataProxy->getDXCCFromPrefix(aux); //qDebug() << "World::getPrefixId: in the while" << aux << " = " << QString::number(entityID) << endl; if (entityID<=0) { aux.chop(1); } } //QSqlDatabase::database().commit(); //qDebug() << "World::getPrefixId: " << _qrz << QString::number(entityID) << endl; return entityID; } QString World::getQRZEntityName(const QString _qrz) { //qDebug() << "World::getQRZEntityName: " << _qrz << endl; if (_qrz.length() < 1 ) { return ""; } //QString queryString; //QSqlQuery query; int prefixIDNumber = getPrefixId(_qrz); return getEntityName(prefixIDNumber); /* queryString = "SELECT dxcc FROM prefixesofentity WHERE id=='" + QString::number(prefixIDNumber) +"'"; //qDebug() << "World::getQRZEntityName: queryString-1: " << queryString << endl; query.exec(queryString); query.next(); if (query.isValid()) { prefixIDNumber = (query.value(0)).toInt(); } else { prefixIDNumber = -1; } //qDebug() << "World::getQRZEntityName: " <<_qrz << " = " << (query.value(0)).toString() << endl; queryString = "SELECT name FROM entity WHERE dxcc=='" + QString::number(prefixIDNumber) +"'"; //qDebug() << "World::getQRZEntityName: queryString-2: " << queryString << endl; query.exec(queryString); query.next(); //qDebug() << "World::getQRZEntityName end: " << _qrz << " = " << (query.value(0)).toString() << endl; if (query.isValid()){ return (query.value(0)).toString(); }else{ return ""; } return ""; */ } QString World::getEntityName(const int _entityN) { int prefixIDNumber = _entityN; if (prefixIDNumber<=0) { return ""; } return dataProxy->getEntityNameFromId(prefixIDNumber); /* QString queryString; QSqlQuery query; queryString = QString("SELECT name FROM entity WHERE (mainprefix NOT LIKE '*%') AND dxcc='%1'").arg(prefixIDNumber); //queryString = "SELECT name FROM entity WHERE dxcc=='" + QString::number(prefixIDNumber) +"'"; //qDebug() << "World::getEntityName: queryString-2: " << queryString << endl; query.exec(queryString); query.next(); if (query.isValid()){ return (query.value(0)).toString(); }else{ return ""; } return ""; */ } int World::getQRZCqz(const QString _qrz) { //qDebug() << "World::getQRZCqz: " << _qrz << endl; 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); } int World::getQRZItuz(const QString _qrz) { //qDebug() << "World::getQRZItuz: " << _qrz << endl; if (_qrz.length() < 1 ) { return -1; } 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 ) { return -1; } return dataProxy->getCQzFromEntity(_enti); /* QSqlQuery query; QString queryString; //queryString = QString("SELECT cqz FROM prefixesofentity WHERE (mainprefix NOT LIKE '*%') AND dxcc='%1'").arg(prefixIDNumber); queryString = "SELECT cqz FROM prefixesofentity WHERE dxcc=='" + QString::number(_enti) +"'"; query.exec(queryString); query.next(); //qDebug() << "World::getEntityCqz: " << QString::number(_enti) << " = " << (query.value(0)).toInt() << endl; if (query.isValid()){ return (query.value(0)).toInt(); }else{ return -1; } return -1; */ } int World::getEntityItuz(const int _enti) { if (_enti < 1 ) { return -1; } return dataProxy->getITUzFromEntity(_enti); /* QSqlQuery query; QString queryString; queryString = "SELECT ituz FROM prefixesofentity WHERE dxcc=='" + QString::number(_enti) +"'"; query.exec(queryString); query.next(); //qDebug() << "World::getEntityItuz: " << QString::number(_enti) << " = " << (query.value(0)).toInt() << endl; if (query.isValid()){ return (query.value(0)).toInt(); }else{ return -1; } return -1; */ } int World::getQRZARRLId(const QString _qrz) { //qDebug() << "World::getQRZARRLId" << _qrz << endl; if (_qrz.length() < 1 ) { return -1; } //QSqlQuery query; //QString queryString; int prefixIdNumber = getPrefixId(_qrz); return prefixIdNumber; } QString World::getQRZEntityMainPrefix(const QString _qrz) { if (_qrz.length() < 1 ) { return ""; } int i = getQRZARRLId(_qrz); return getEntityMainPrefix(i); //QString queryString; //QSqlQuery query; /* queryString = "SELECT mainprefix FROM entity WHERE dxcc=='" + QString::number(i) +"'"; if (!query.exec(queryString)) { return ""; } else { query.next(); //qDebug() << "World::getQRZEntityMainPrefix(id/qrz): " << QString::number(i) << "/" <<_qrz << " = " << (query.value(0)).toString() << endl; if (query.isValid()){ return (query.value(0)).toString(); } else { return ""; } } return ""; */ } QString World::getEntityMainPrefix(const int _entityN) { if (_entityN <= 0 ) { return ""; } return dataProxy->getEntityMainPrefix(_entityN); /* QString queryString; QSqlQuery query; queryString = QString("SELECT mainprefix FROM entity WHERE (mainprefix NOT LIKE '*%') AND dxcc='%1'").arg(_entityN); //queryString = "SELECT mainprefix FROM entity WHERE dxcc=='" + QString::number(_entityN) +"'"; if (!query.exec(queryString)) { return ""; } else { query.next(); if (query.isValid()){ return (query.value(0)).toString(); }else{ return ""; } } 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) +"'"; if (!query.exec(queryString)) { return false; } else { query.next(); if (query.isValid()){ return true; }else{ return false; } } return false; */ } bool World::isNewEntity(const int _entityN) { if (_entityN <= 0) { return false; } return dataProxy->isNewEntity(_entityN); /* QString queryString; QSqlQuery query; 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; */ } QString World::getQRZContinentShortName(const QString _qrz) { //qDebug() << "World::getQRZContinentShortName: " << _qrz << endl; //QString continentNumber = getQRZContinentNumber (_qrz); return getContinentShortName (getQRZARRLId(_qrz)); } QString World::getContinentShortName(const int _enti) { //qDebug() << "World::getQRZContinentShortName: " << QString::number(_enti) << endl; //QString continentNumber = QString::number(_enti); if ( _enti < 0 ) { 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); //queryString = "SELECT continent FROM entity WHERE dxcc=='" + continentNumber +"'"; if (!query.exec(queryString)) { return "--"; } else { query.next(); if ( !(query.isValid()) ) { //qDebug() << "World::getQRZContinentShortName: NO VALID" << endl; return "--"; }else{ //qDebug() << "World::getQRZContinentShortName: VALID" << endl; return (query.value(0)).toString(); } } return "--"; */ } QString World::getQRZContinentNumber(const QString _qrz) { //qDebug() << "World::getQRZContinentNumber: " << _qrz << endl; 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) +"'"; if (!query.exec(queryString)) { return "-1"; } else { query.next(); if ( !(query.isValid()) ) { //qDebug() << "World::getQRZContinentNumber(qrz/i/Cont): NO VALID" << endl; return "-1"; }else{ //qDebug() << "World::getQRZContinentNumber(qrz/i/Cont): VALID" << endl; a = (query.value(0)).toString(); } //qDebug() << "World::getQRZContinentNumber(qrz/i/Cont): " <<_qrz << "/" << QString::number(i) << "/" << a << endl; return a; } return "-1"; */ } int World::getContinentNumber(const int _enti) { //qDebug() << "World::getQRZContinentNumber: " << QString::number(_enti) << endl; if (_enti <= 0) { return -1; } return dataProxy->getContinentIdFromEntity(_enti); /* int a = -1; QString queryString; QSqlQuery query; int i = _enti; 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) +"'"; if (!query.exec(queryString)) { return -1; } else { query.next(); if ( !(query.isValid()) ) { return -1; }else{ a = (query.value(0)).toInt(); queryString = "SELECT id FROM continent where shortname=='" + query.value(0).toString() + "'"; if (query.exec(queryString)) { query.next(); if(query.isValid()) { return query.value(0).toInt(); } else { // Value not valid return -1; } } else { // Error in the query return -1; } } return a; } return -1; */ } double World::getQRZLongitude(const QString _qrz) { int i = getQRZARRLId(_qrz); return dataProxy->getLongitudeFromEntity(i); /* QString queryString; QSqlQuery query; queryString = "SELECT longitude FROM entity WHERE dxcc=='" + QString::number(i) +"'"; if (!query.exec(queryString)) { return 0.0; } else { query.next(); if ( !(query.isValid()) ) { //qDebug() << "World::getQRZLongitude: NO VALID" << endl; return 0.0; }else{ //qDebug() << "World::getQRZLongitude: VALID" << endl; return (query.value(0)).toDouble(); } } return 0.0; */ } double World::getLongitude(const int _enti) { if (_enti <= 0) { return 0.0; } return dataProxy->getLongitudeFromEntity(_enti); /* QString queryString; QSqlQuery query; int i = _enti; queryString = "SELECT longitude FROM entity WHERE dxcc=='" + QString::number(i) +"'"; if (!query.exec(queryString)) { return 0.0; } else { query.next(); if ( !(query.isValid()) ) { //qDebug() << "World::getQRZLongitude: NO VALID" << endl; return 0.0; }else{ //qDebug() << "World::getQRZLongitude: VALID" << endl; return (query.value(0)).toDouble(); } } return 0.0; */ } double World::getQRZLatitude(const QString _qrz) { int i = getQRZARRLId(_qrz); return dataProxy->getLatitudeFromEntity(i); /* QString queryString; QSqlQuery query; queryString = "SELECT latitude FROM entity WHERE dxcc=='" + QString::number(i) +"'"; if (!query.exec(queryString)) { return 0.0; } else { query.next(); if ( !(query.isValid()) ) { //qDebug() << "World::getQRZLatitud: NO VALID" << endl; return 0.0; }else{ //qDebug() << "World::getQRZLatitud: VALID" << endl; return (query.value(0)).toDouble(); } } return 0.0; */ } double World::getLatitude(const int _enti) { if (_enti <= 0) { return 0.0; } return dataProxy->getLatitudeFromEntity(_enti); /* QString queryString; QSqlQuery query; int i = _enti; queryString = "SELECT latitude FROM entity WHERE dxcc=='" + QString::number(i) +"'"; if (!query.exec(queryString)) { return 0.0; } else { query.next(); if ( !(query.isValid()) ) { //qDebug() << "World::getQRZLatitud: NO VALID" << endl; return 0.0; }else{ //qDebug() << "World::getQRZLatitud: VALID" << endl; return (query.value(0)).toDouble(); } } return 0.0; */ } QString World::getQRZLocator(const QString _qrz) { if (_qrz.length() < 1) { return ""; } return locator->getLocator(getQRZLongitude(_qrz), getQRZLatitude(_qrz)); } QString World::getLocator(const int _enti) { if (_enti <= 0) { return ""; } return locator->getLocator(getLongitude(_enti), getLatitude(_enti)); } /* int World::getBandIdFromFreq(const QString fr) { //qDebug() << "World::getBandIdFromFreq: " << fr << endl; //Freq should be in MHz QSqlQuery query; QString queryString = QString("SELECT id FROM band WHERE lower <= '%1' and upper >= '%2'").arg(fr).arg(fr); //qDebug() << "World::getBandIdFromFreq query: " << queryString << endl; if (!query.exec(queryString)) { return -1; } else { query.next(); int b=-1; if (query.isValid()) { b = (query.value(0)).toInt(); //qDebug() << "World::getBandIdFromFreq value: " << QString::number(b) << endl; //return (query.value(0)).toInt(); return b; } else { //qDebug() << "World::getBandIdFromFreq value not valid!!" << endl; return -1; } } return -1; } */ QString World::getQRZEntityPrefixes(const QString _qrz) { int i = getQRZARRLId(_qrz); return dataProxy->getEntityMainPrefix(i); /* QString result; result = ""; QString queryString; QSqlQuery query; 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 ""; */ } bool World::readCTYDAT() { //qDebug() << "World::readCTYDAT(): " << kontestDir << endl; QString tq; QString fileName; qint64 beginingOfFile; int numberOfLines = 0; int errorCode = -1; //int ii = 0; //bool ret; #ifdef Q_OS_WIN //qDebug() << "WINDOWS DETECTED!" << endl; fileName = kontestDir + "/cty.dat"; #else //qDebug() << "NO WINDOWS" << endl; fileName = kontestDir + "/cty.dat"; #endif QFile file( fileName ); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //qDebug() << "World::readCTYDAT() File not found: " << fileName << endl; return false; } else { // //qDebug() << "World::readCTYDAT() File found: " << fileName << endl; } beginingOfFile = file.pos(); while (!file.atEnd()) { if ( (file.readLine()).contains(':') ) { numberOfEntities++; } numberOfLines++; } //qDebug() << "World::readCTYDAT() - numberOfEntities: " << QString::number(numberOfEntities) << endl; // The file is readed twice: 1: Main entity data; 2: prefixes. // Starts with main data: file.seek(beginingOfFile); progressBarPosition = 0; QProgressDialog progress(tr("Reading cty.dat..."), tr("Abort reading"), 0, numberOfLines, this); progress.setWindowModality(Qt::ApplicationModal); numberOfEntities = 0; // Reset this variable to reuse it and assign the "dxcc" to the entities (temp solution) QSqlQuery query; query.prepare("INSERT INTO entity (id, name, cqz, ituz, continent, latitude, longitude, utc, dxcc, mainprefix)" "VALUES (?, ?,?, ?, ?, ?, ?, ?, ?, ?)"); QSqlDatabase::database().transaction(); QStringList stringList; while (!file.atEnd()) { progress.setValue(progressBarPosition); progressBarPosition++; if (progress.wasCanceled()) break; stringList.clear(); stringList << processLine(file.readLine()); if (stringList.size()==9 ) { query.addBindValue(QVariant(QVariant::Int)); query.addBindValue(stringList.at(0)); query.addBindValue(stringList.at(1)); query.addBindValue(stringList.at(2)); query.addBindValue(stringList.at(3)); query.addBindValue(stringList.at(4)); query.addBindValue(stringList.at(5)); query.addBindValue(stringList.at(6)); query.addBindValue(stringList.at(7)); query.addBindValue(stringList.at(8)); if (query.exec()) { //qDebug() << "World::readCTYDAT(): Entity data added" << endl; } else if (errorCode == 19) { } else { errorCode = query.lastError().number(); /* //qDebug() << "World::readCTYDAT(): Entity data NOT added" << endl; //qDebug() << "World::readCTYDAT(): LastQuery: " << query.lastQuery() << endl; //qDebug() << "World::readCTYDAT(): LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "World::readCTYDAT(): LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "World::readCTYDAT(): LastError-n: " << QString::number(query.lastError().number() ) << endl; */ } // To remove all the data before the next entity addition. query.bindValue( ":name", "" ); query.bindValue( ":cqz", "" ); query.bindValue( ":ituz", "" ); query.bindValue( ":continent", "" ); query.bindValue( ":latitude", "" ); query.bindValue( ":longitude", "" ); query.bindValue( ":utc", "" ); query.bindValue( ":dxcc", "-1" ); query.bindValue( ":mainprefix", "" ); } //qDebug() << "World::readCTYDAT() tq: " << tq << endl; progress.setLabelText("Reading cty.dat ... \nNow reading " + currentPrefix + " data"); //qDebug() << "World::readCTYDAT() - progressBarPosition: " << QString::number(progressBarPosition) << endl; } QSqlDatabase::database().commit(); query.prepare("INSERT INTO prefixesofentity (id, prefix, dxcc, cqz, ituz) VALUES (?, ?, ?, ?, ?)"); QSqlDatabase::database().transaction(); // Finish the main data // Start with prefixes: file.seek(beginingOfFile); int k; int cEntity=0; // Controls the current entity that is being processed progressBarPosition = 0; while (!file.atEnd()) { progress.setValue(progressBarPosition); progressBarPosition++; if (progress.wasCanceled()) break; stringList.clear(); stringList << processLineP(file.readLine(), cEntity); if (stringList.size()==1){ cEntity = (stringList.at(0)).toInt(); }else{ } k = 0; for (int i = 0; i < (stringList.size() / 4); i++){ query.addBindValue(QVariant(QVariant::Int)); currentPrefix = stringList.at(k); for (int j = 0; j <= 3; j++) { //qDebug() << "World::readCTYDAT(): FOR-4" << endl; query.addBindValue(stringList.at(k)); k++; //qDebug() << "World::readCTYDAT(): stringList.at(" << QString::number(i) << "): " << stringList.at(i) << endl; } query.exec(); } //currentPrefix = getQRZEntityMainPrefix(cEntity); progress.setLabelText("Reading cty.dat ... \nNow reading " + currentPrefix + " data"); } QSqlDatabase::database().commit(); progress.setValue(numberOfLines); return true; } bool World::readCTYCSV() { //qDebug() << "World::readCTYCSV(): " << kontestDir << endl; QString tq; QString fileName; qint64 beginingOfFile; int numberOfLines = 0; int errorCode = -1; //int ii = 0; //bool ret; #ifdef Q_OS_WIN //qDebug() << "WINDOWS DETECTED!" << endl; fileName = kontestDir + "/cty.csv"; #else //qDebug() << "NO WINDOWS" << endl; fileName = kontestDir + "/cty.csv"; #endif QFile file( fileName ); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //qDebug() << "World::readCTYCSV() File not found: " << fileName << endl; return false; } else { //qDebug() << "World::readCTYCSV() File found: " << fileName << endl; } beginingOfFile = file.pos(); while (!file.atEnd()) { if ( (file.readLine()).contains(';') ) { numberOfEntities++; } numberOfLines++; } //qDebug() << "World::readCTYCSV() - numberOfEntities: " << QString::number(numberOfEntities) << endl; // The file is readed twice: 1: Main entity data; 2: prefixes. // Starts with main data: file.seek(beginingOfFile); progressBarPosition = 0; QProgressDialog progress(tr("Reading cty.csv..."), tr("Abort reading"), 0, numberOfLines, this); progress.setWindowModality(Qt::ApplicationModal); numberOfEntities = 0; // Reset this variable to reuse it and assign the "dxcc" to the entities (temp solution) QSqlQuery query; QSqlQuery queryP; query.prepare("INSERT INTO entity (id, name, cqz, ituz, continent, latitude, longitude, utc, dxcc, mainprefix)" "VALUES (?, ?,?, ?, ?, ?, ?, ?, ?, ?)"); queryP.prepare("INSERT INTO prefixesofentity (id, prefix, dxcc, cqz, ituz) VALUES (?, ?, ?, ?, ?)"); QSqlDatabase::database().transaction(); QStringList stringList, stringListPrefixes, stringListProcessedPrefix; while (!file.atEnd()) { progress.setValue(progressBarPosition); progressBarPosition++; if (progress.wasCanceled()) break; stringList.clear(); stringListPrefixes.clear(); // // 9Y,Trinidad & Tobago,90,SA,9,11,10.38,61.28,4.0,9Y 9Z; // 5A,Libya,436,AF,34,38,27.20,-16.60,-2.0,5A; // MainPref / Name / dxcc / Cont / CQ / ITU / LAT / LON / -UTC / prefixes // 0 1 2 3 4 5 6 7 8 9 tq = file.readLine().simplified(); tq = tq.trimmed(); tq.remove(QChar(';'), Qt::CaseInsensitive); stringList << tq.split(','); if (stringList.size()>=8 ) { //(id, name, cqz, ituz, continent, latitude, longitude, utc, dxcc, mainprefix) query.addBindValue(QVariant(QVariant::Int)); query.addBindValue(stringList.at(1)); // name query.addBindValue(stringList.at(4)); // CQ query.addBindValue(stringList.at(5)); // ITU query.addBindValue(stringList.at(3)); // Cont query.addBindValue(stringList.at(6)); // Lat query.addBindValue(stringList.at(7)); // Lon query.addBindValue(stringList.at(8)); // UTC query.addBindValue(stringList.at(2)); // dxcc query.addBindValue(stringList.at(0)); // Mainprefix //qDebug() << "World::readCTYCSV(): Entity name: " << stringList.at(1) << endl; //qDebug() << "World::readCTYCSV(): Entity cqz: " << stringList.at(4) << endl; //qDebug() << "World::readCTYCSV(): Entity ituz: " << stringList.at(5) << endl; //qDebug() << "World::readCTYCSV(): Entity cont: " << stringList.at(3) << endl; //qDebug() << "World::readCTYCSV(): Entity lat: " << stringList.at(6) << endl; //qDebug() << "World::readCTYCSV(): Entity lon: " << stringList.at(7) << endl; //qDebug() << "World::readCTYCSV(): Entity UTC: " << stringList.at(8) << endl; //qDebug() << "World::readCTYCSV(): Entity ARRL: " << stringList.at(2) << endl; //qDebug() << "World::readCTYCSV(): Entity Pref: " << stringList.at(0) << endl; if (query.exec()) { //qDebug() << "World::readCTYDAT(): Entity data added" << endl; } else if (errorCode == 19) {} else { errorCode = query.lastError().number(); //qDebug() << "World::readCTYCSV(): Entity data NOT added" << endl; //qDebug() << "World::readCTYCSV(): LastQuery: " << query.lastQuery() << endl; //qDebug() << "World::readCTYCSV(): LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "World::readCTYCSV(): LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "World::readCTYCSV(): LastError-n: " << QString::number(query.lastError().number() ) << endl; } if (stringList.size()>8) { tq = stringList.at(9); stringListPrefixes << tq.split(' '); tq = stringListPrefixes.last(); QString prefAux = QString(); 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 // (id, prefix, dxcc, cqz, ituz) //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(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(stringListProcessedPrefix.at(1)); queryP.addBindValue(stringListProcessedPrefix.at(2)); if (queryP.exec()) { //qDebug() << "World::readCTYCSV(): Prefix added: " << stringListPrefixes.at(i) << endl; } else if (errorCode == 19) {} else { errorCode = query.lastError().number(); //qDebug() << "World::readCTYCSV(): Prefix data NOT added" << endl; //qDebug() << "World::readCTYCSV(): Prefix LastQuery: " << query.lastQuery() << endl; //qDebug() << "World::readCTYCSV(): Prefix LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "World::readCTYCSV(): Prefix LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "World::readCTYCSV(): Prefix LastError-n: " << QString::number(query.lastError().number() ) << endl; } } } } //qDebug() << "World::readCTYCSV() tq: " << tq << endl; progress.setLabelText("Reading cty.csv ... \nNow reading " + currentPrefix + " data"); //qDebug() << "World::readCTYCSV() - progressBarPosition: " << QString::number(progressBarPosition) << endl; } QSqlDatabase::database().commit(); progress.setValue(numberOfLines); return true; } QString World::changeSlashAndFindPrefix(const QString _qrz) { //qDebug() << "World::changeSlashAndFindPrefix: -" << _qrz <<"-" << endl; int iaux1, iaux2; QString aux = _qrz.toUpper(); if ((aux).count('\\')) // Replaces \ by / to ease operation. { aux.replace(QChar('\\'), QChar('/')); } else { return aux; } if (aux.count('/')) // / found! Checking different options { if (aux.endsWith("/") ) { // We look for calls ending in slash "/" or "\" aux.remove(aux.length()-1,1); } iaux1 = aux.indexOf('/'); //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){ iaux2 = -iaux2; } if ( iaux1 < iaux2 ) { //Like in F/EA4TV, we can simply take the first part as the prefix aux = aux.left(iaux1); } else { aux = aux.right(iaux2 -1); } } return aux; } bool World::checkQRZValidFormat(const QString _qrz) { //qDebug() << "World::checkQRZValidFormat: -" << _qrz <<"-" << endl; QString aux = changeSlashAndFindPrefix(_qrz.toUpper()); if (aux.length()<3) { return false; } // The format of a Call is defined here: // http://en.wikipedia.org/wiki/ITU_prefix_%28amateur_stations%29 //bool prefixEnded = false; //int callLength = _qrz.length(); int sepPos = 0; int barPos = aux.indexOf('/'); QString prefix = QString(); QString suffix = QString(); QString separator = QString(); // If barPos > 0 we have a complex call like F/EA4TV QCharRef c = aux[aux.length()-1]; if ( c.isDigit() && (barPos<=0) ) { return false; } prefix = prefix + aux.at(0); if ( ( aux.at(1) ).isDigit() ) { // W3 A6 if ((aux.at(2)).isDigit() ) { // A60 prefix = prefix + aux.at(1); separator = aux.at(2); sepPos = 2; } else { // W3A separator = aux.at(1); sepPos = 1; } } else { // EA 3D 2M if ((aux.at(2)).isDigit() ) { // EA0 prefix = prefix + aux.at(1); separator = aux.at(2); sepPos = 2; } else { // 3DA if (aux.length() < 4) { prefix = prefix + aux.at(2); return false; } if ((aux.at(3)).isDigit()) { // 3DA0 prefix = prefix + aux.at(1); prefix = prefix + aux.at(2); separator = aux.at(3); sepPos = 3; if (aux.length() < 5) { // 3DA0 prefix = prefix + aux.at(3); return false; } } else { return false; } } } for (int i = sepPos+1; i < aux.length(); i++) { 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; return true; } QStringList World::getEntitiesNames() { //qDebug() << "World::getEntitiesNames" << endl; return dataProxy->getEntitiesNames(); } klog-0.9.2.2/contest_cqwwdxssb.h0000644000076700000620000000771712627126144014542 0ustar staff#ifndef CONTESTCQWWDXSSB_H #define CONTESTCQWWDXSSB_H /*************************************************************************** contestcqwwdxssb.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include #include #include #include #include #include #include "contest.h" class ContestCQWWDXSSB : public Contest { public: ContestCQWWDXSSB(); ContestCQWWDXSSB(const QStringList _qs); ~ContestCQWWDXSSB(); bool isMultiplier(const QStringList _qs); // Receives: QStringList _qs; //_qs << DX-Entity << DXCQz << DX-band; int getQSOPoints(const QStringList _qs); // Receives: QStringList _qs; //_qs << DX-Entity << DX-Continent bool saveFileToSend(const QString& _fileName); int getTotalScore(); int getMultipliers(); int getPoints(); // NA in the constructor is North America for scoring purposes private: QString myEntity, myCQz, myContinent, NA, thiscontest, mycategory, arrlSection, stationQrz, claimedScore, name, address, operators, soapbox, club, createdby; bool isValidCQz(const QString _cqz); bool isValidEntity(const QString _ent); }; /* V. MULTIPLIER: Two types of multiplier will be used. A multiplier of one (1) for each different zone contacted on each band. A multiplier of one (1) for each different country contacted on each band. Stations are permitted to contact their own country and zone for multiplier credit. The CQ Zone Map, DXCC country list, WAE country list, and WAC boundaries are standards. Maritime mobile stations count only for a zone multiplier. VI. POINTS: Contacts between stations on different continents are worth three (3) points. Contacts between stations on the same continent but different countries, one (1) point. Exception: For North American stations only, contacts between stations within the North American boundaries count two (2) points. Contacts between stations in the same country are permitted for zone or country multiplier credit but have zero (0) point value. VII. SCORING: All stations: the final score is the result of the total QSO points multiplied by the sum of your zone and country multipliers. Example: 1000 QSO points 100 multiplier (30 Zones + 70 Countries) = 100,000 (final score). */ #endif // CONTESTCQWWDXSSB_H klog-0.9.2.2/README0000644000076700000620000000165012627126144011453 0ustar staffKLog is an updated version of KLog The objective of KLog is to provide a free software that runs in Linux, OSX and Windows. KLog will provide hamradio contest and DX logging support. Check http://jaime.robles.es for news & updates. Please join the mailing list at: - Users: https://lists.nongnu.org/mailman/listinfo/klog-users - Developers: https://lists.nongnu.org/mailman/listinfo/klog-devel If you are a native in a language different than English or Spanish, please consider helping us translating KLog into your native language. Please contact me at jaimeNOMORESPAMrobles.es (change "NOMORESPAM" by @). Read the INSTALL.txt for installation purposes. Read the changelog (windows users, rename to changelog.txt) to see the changes from one version to another. Read README-DEVEL.txt if you want to help with KLog development. Please send all your suggestions & bug reports. I hope you enjoy KLog! 73 de Jaime, EA4TV klog-0.9.2.2/startwizard.cpp0000644000076700000620000015330112627126144013656 0ustar staff#include "startwizard.h" //#include StartWizard::StartWizard(const QString _kontestDir, const QString _softVersion, QWidget *parent) : QWizard(parent) { //qDebug() << "StartWizard::StartWizard: v=" << QString::number(_softVersion) << endl; //licAcepted = false; version = _softVersion; kontestDir = _kontestDir; inMemory = true; //fileOrMemoryPage = new FileOrMemoryPage(); ctyPage = new CTYPage(kontestDir, version); setWizardStyle(QWizard::AeroStyle); setPage(Page_Intro, new IntroPage); setPage(Page_Lic, new LicPage); //setPage(Page_Mem, new FileOrMemoryPage); setPage(Page_CTY, ctyPage); setStartId(Page_Intro); QAbstractButton* finishButton = this->button(QWizard::FinishButton); QAbstractButton* cancelButton = this->button(QWizard::CancelButton); connect(finishButton, SIGNAL(clicked()), this, SLOT(slotButtonFinishedClicked())); disconnect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect(cancelButton, SIGNAL( clicked() ), this, SLOT( slotCancelWizard() ) ); //connect(fileOrMemoryPage, SIGNAL(exeInMemory(bool)), this, SLOT(slotRunInMemory(bool) ) ); //connect(ctyPage, SIGNAL(downloadTheFileSignal(bool)), this, SLOT(slotDownloadCTY(bool) ) ); QList layout; layout << QWizard::Stretch << QWizard::BackButton << QWizard::CancelButton << QWizard::NextButton << QWizard::FinishButton; setButtonLayout(layout); setWindowTitle(tr("KLog - The free hamradio logging software")); } void StartWizard::setVersion(QString tversion) { version = tversion; } /*void StartWizard::slotUpdateDownloadProgress(qint64 received, qint64 total) { //qDebug() << "StartWizard::slotUpdateDownloadProgress: " << QString::number(received) << "/" << QString::number(total) << endl; ctyPage->updateProgress(received, total); } */ /* void StartWizard::slotDownloadFinished() { //qDebug() << "StartWizard::slotDownloadFinished" << endl; //close(); } */ void StartWizard::slotCancelWizard() { if( QMessageBox::question( this, trUtf8( "Quit Setup" ), trUtf8( "Setup is not complete yet. Are you sure you want to quit setup?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { // allow cancel reject(); } } void StartWizard::slotRunInMemory(bool checked) { if (checked) { inMemory = true; } else { inMemory = false; } } void StartWizard::slotButtonFinishedClicked() { //qDebug() << "StartWizard::slotButtonFinishedClicked " << endl; if (inMemory) { setResult(1); //qDebug() << "StartWizard::slotButtonFinishedClicked: done 1 " << endl; } else { //qDebug() << "StartWizard::slotButtonFinishedClicked: done 2 " << endl; setResult(2); } } /* bool StartWizard::doTheDownload() { //qDebug() << "StartWizard::doTheDownload" << endl; int downloading = 1; int i = 0; int ret; QMessageBox msgBox; QString str; msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setDefaultButton(QMessageBox::Yes); i = dl->download(); if (downloadValueResult == 0) { return true; } return false; } void StartWizard::slotValueReturnedFromDownload(int value) { //qDebug() << "StartWizard::slotValueReturnedFromDownload: " << QString::number(value) << endl; downloadValueResult = value; //close(); } */ IntroPage::IntroPage(QWidget *parent) : QWizardPage(parent) { setTitle(tr("Welcome to KLog!")); topLabel = new QLabel(tr("Welcome to KLog! " "You need to agree the License before starting using this software")); topLabel->setWordWrap(true); welcomeBrowser = new QTextEdit; welcomeBrowser->setReadOnly(true); QString welcometxt = tr(" \ Welcome to KLog \ \

It looks to be the first time you run KLog in this computer.

\

KLog is a free hamradio logging software that is able to run in Linux, OSX and Windows. It is designed to provide general \ purpose, DX logging and contest logging.

\

It support ADIF and Cabrillo file formats import and export, QSL managing support and many other features...

\

Before you can start using KLog, you will be asked to: \

    \
  • Agree the terms of the license
  • \
  • Define how do you prefer to run KLog
  • \
  • Enter your call, CQ zone, ... and main configuration.
  • \
\

\

Enjoy KLog and contact the development team if you have any suggestion!

\

73 de EA4TV

\ "); welcomeBrowser->setHtml(welcometxt); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(welcomeBrowser); setLayout(layout); } int IntroPage::nextId() const { return StartWizard::Page_Lic; } LicPage::LicPage(QWidget *parent) : QWizardPage(parent) { setTitle(tr("KLog License agreement")); //setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark.png")); topLabel = new QLabel(tr("Welcome to KLog!" "You need to agree the License before starting using this software")); topLabel->setWordWrap(true); licenseBrowser = new QTextEdit; licenseBrowser->setReadOnly(true); QString gplLic = "" "GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)" "" "" "

GNU GENERAL PUBLIC LICENSE

" "

Version 3, 29 June 2007

" "

Copyright (c) 2007 Free Software Foundation, Inc.

" "

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

" "

Preamble

" "

The GNU General Public License is a free, copyleft license for software and other kinds of works.

" "

The licenses for most software and other practical works are designed " "to take away your freedom to share and change the works. By contrast, " "the GNU General Public License is intended to guarantee your freedom to " "share and change all versions of a program--to make sure it remains free " "software for all its users. We, the Free Software Foundation, use the " "GNU General Public License for most of our software; it applies also to " "any other work released this way by its authors. You can apply it to " "your programs, too.

" "

When we speak of free software, we are referring to freedom, not " "price. Our General Public Licenses are designed to make sure that you " "have the freedom to distribute copies of free software (and charge for " "them if you wish), that you receive source code or can get it if you " "want it, that you can change the software or use pieces of it in new " "free programs, and that you know you can do these things.

" "

To protect your rights, we need to prevent others from denying you " "these rights or asking you to surrender the rights. Therefore, you have " "certain responsibilities if you distribute copies of the software, or if " "you modify it: responsibilities to respect the freedom of others.

" "

For example, if you distribute copies of such a program, whether " "gratis or for a fee, you must pass on to the recipients the same " "freedoms that you received. You must make sure that they, too, receive " "or can get the source code. And you must show them these terms so they " "know their rights.

" "

Developers that use the GNU GPL protect your rights with two steps: " "(1) assert copyright on the software, and (2) offer you this License " "giving you legal permission to copy, distribute and/or modify it.

" "

For the developers' and authors' protection, the GPL clearly explains " "that there is no warranty for this free software. For both users' and " "authors' sake, the GPL requires that modified versions be marked as " "changed, so that their problems will not be attributed erroneously to " "authors of previous versions.

" "

Some devices are designed to deny users access to install or run " "modified versions of the software inside them, although the manufacturer " "can do so. This is fundamentally incompatible with the aim of " "protecting users' freedom to change the software. The systematic " "pattern of such abuse occurs in the area of products for individuals to " "use, which is precisely where it is most unacceptable. Therefore, we " "have designed this version of the GPL to prohibit the practice for those " "products. If such problems arise substantially in other domains, we " "stand ready to extend this provision to those domains in future versions " "of the GPL, as needed to protect the freedom of users.

" "

Finally, every program is threatened constantly by software patents." "States should not allow patents to restrict development and use of " "software on general-purpose computers, but in those that do, we wish to " "avoid the special danger that patents applied to a free program could " "make it effectively proprietary. To prevent this, the GPL assures that " "patents cannot be used to render the program non-free.

" "

The precise terms and conditions for copying, distribution and " "modification follow.

" "

TERMS AND CONDITIONS

" "

0. Definitions.

" "

This License refers to version 3 of the GNU General Public License.

" "

Copyright also means copyright-like laws that apply to other kinds of " "works, such as semiconductor masks.

" "

The Program refers to any copyrightable work licensed under this " "License. Each licensee is addressed as you. Licensees and " "recipients may be individuals or organizations.

" "

To modify a work means to copy from or adapt all or part of the work " "in a fashion requiring copyright permission, other than the making of an " "exact copy. The resulting work is called a modified version of the " "earlier work or a work based on the earlier work.

" "

A covered work means either the unmodified Program or a work based " "on the Program.

" "

To propagate a work means to do anything with it that, without " "permission, would make you directly or secondarily liable for " "infringement under applicable copyright law, except executing it on a " "computer or modifying a private copy. Propagation includes copying, " "distribution (with or without modification), making available to the " "public, and in some countries other activities as well.

" "

To convey a work means any kind of propagation that enables other " "parties to make or receive copies. Mere interaction with a user through " "a computer network, with no transfer of a copy, is not conveying.

" "

An interactive user interface displays Appropriate Legal Notices " "to the extent that it includes a convenient and prominently visible " "feature that (1) displays an appropriate copyright notice, and (2) " "tells the user that there is no warranty for the work (except to the " "extent that warranties are provided), that licensees may convey the " "work under this License, and how to view a copy of this License. If " "the interface presents a list of user commands or options, such as a " "menu, a prominent item in the list meets this criterion.

" "

1. Source Code.

" "

The source code for a work means the preferred form of the work " "for making modifications to it. Object code means any non-source " "form of a work.

" "

A Standard Interface means an interface that either is an official " "standard defined by a recognized standards body, or, in the case of " "interfaces specified for a particular programming language, one that " "is widely used among developers working in that language.

" "

The System Libraries of an executable work include anything, other " "than the work as a whole, that (a) is included in the normal form of " "packaging a Major Component, but which is not part of that Major " "Component, and (b) serves only to enable use of the work with that " "Major Component, or to implement a Standard Interface for which an " "implementation is available to the public in source code form. A " "Major Component, in this context, means a major essential component " "(kernel, window system, and so on) of the specific operating system " "(if any) on which the executable work runs, or a compiler used to " "produce the work, or an object code interpreter used to run it.

" "

The Corresponding Source for a work in object code form means all " "the source code needed to generate, install, and (for an executable " "work) run the object code and to modify the work, including scripts to " "control those activities. However, it does not include the work's " "System Libraries, or general-purpose tools or generally available free " "programs which are used unmodified in performing those activities but " "which are not part of the work. For example, Corresponding Source " "includes interface definition files associated with source files for " "the work, and the source code for shared libraries and dynamically " "linked subprograms that the work is specifically designed to require, " "such as by intimate data communication or control flow between those " "subprograms and other parts of the work.

" "

The Corresponding Source need not include anything that users " "can regenerate automatically from other parts of the Corresponding " "Source.

" "

The Corresponding Source for a work in source code form is that " "same work.

" "

2. Basic Permissions.

" "

All rights granted under this License are granted for the term of " "copyright on the Program, and are irrevocable provided the stated " "conditions are met. This License explicitly affirms your unlimited " "permission to run the unmodified Program. The output from running a " "covered work is covered by this License only if the output, given its " "content, constitutes a covered work. This License acknowledges your " "rights of fair use or other equivalent, as provided by copyright law.

" "

You may make, run and propagate covered works that you do not " "convey, without conditions so long as your license otherwise remains " "in force. You may convey covered works to others for the sole purpose " "of having them make modifications exclusively for you, or provide you " "with facilities for running those works, provided that you comply with " "the terms of this License in conveying all material for which you do " "not control copyright. Those thus making or running the covered works " "for you must do so exclusively on your behalf, under your direction " "and control, on terms that prohibit them from making any copies of " "your copyrighted material outside their relationship with you.

" "

Conveying under any other circumstances is permitted solely under " "the conditions stated below. Sublicensing is not allowed; section 10 " "makes it unnecessary.

" "

3. Protecting Users' Legal Rights From Anti-Circumvention Law.

" "

No covered work shall be deemed part of an effective technological " "measure under any applicable law fulfilling obligations under article " "11 of the WIPO copyright treaty adopted on 20 December 1996, or " "similar laws prohibiting or restricting circumvention of such " "measures.

" "

When you convey a covered work, you waive any legal power to forbid " "circumvention of technological measures to the extent such circumvention " "is effected by exercising rights under this License with respect to " "the covered work, and you disclaim any intention to limit operation or " "modification of the work as a means of enforcing, against the work's " "users, your or third parties' legal rights to forbid circumvention of " "technological measures.

" "

4. Conveying Verbatim Copies.

" "

You may convey verbatim copies of the Program's source code as you " "receive it, in any medium, provided that you conspicuously and " "appropriately publish on each copy an appropriate copyright notice; " "keep intact all notices stating that this License and any " "non-permissive terms added in accord with section 7 apply to the code; " "keep intact all notices of the absence of any warranty; and give all " "recipients a copy of this License along with the Program.

" "

You may charge any price or no price for each copy that you convey, " "and you may offer support or warranty protection for a fee.

" "

5. Conveying Modified Source Versions.

" "

You may convey a work based on the Program, or the modifications to " "produce it from the Program, in the form of source code under the " "terms of section 4, provided that you also meet all of these conditions:

" "
    " "
  • a) The work must carry prominent notices stating that you modified" "it, and giving a relevant date.
  • " "
  • b) The work must carry prominent notices stating that it is " "released under this License and any conditions added under section " "7. This requirement modifies the requirement in section 4 to " "keep intact all notices.
  • " "
  • c) You must license the entire work, as a whole, under this " "License to anyone who comes into possession of a copy. This " "License will therefore apply, along with any applicable section 7 " "additional terms, to the whole of the work, and all its parts, " "regardless of how they are packaged. This License gives no " "permission to license the work in any other way, but it does not " "invalidate such permission if you have separately received it.
  • " "
  • d) If the work has interactive user interfaces, each must display " "Appropriate Legal Notices; however, if the Program has interactive " "interfaces that do not display Appropriate Legal Notices, your " "work need not make them do so.
  • " "
" "

A compilation of a covered work with other separate and independent " "works, which are not by their nature extensions of the covered work, " "and which are not combined with it such as to form a larger program, " "in or on a volume of a storage or distribution medium, is called an " "aggregate if the compilation and its resulting copyright are not " "used to limit the access or legal rights of the compilation's users " "beyond what the individual works permit. Inclusion of a covered work " "in an aggregate does not cause this License to apply to the other " "parts of the aggregate.

" "

6. Conveying Non-Source Forms.

" "

You may convey a covered work in object code form under the terms " "of sections 4 and 5, provided that you also convey the " "machine-readable Corresponding Source under the terms of this License, " "in one of these ways:

" "
    " "
  • a) Convey the object code in, or embodied in, a physical product " "(including a physical distribution medium), accompanied by the " "Corresponding Source fixed on a durable physical medium " "customarily used for software interchange.
  • " "
  • b) Convey the object code in, or embodied in, a physical product " "(including a physical distribution medium), accompanied by a " "written offer, valid for at least three years and valid for as " "long as you offer spare parts or customer support for that product " "model, to give anyone who possesses the object code either (1) a " "copy of the Corresponding Source for all the software in the " "product that is covered by this License, on a durable physical " "medium customarily used for software interchange, for a price no " "more than your reasonable cost of physically performing this " "conveying of source, or (2) access to copy the " "Corresponding Source from a network server at no charge.
  • " "
  • c) Convey individual copies of the object code with a copy of the " "written offer to provide the Corresponding Source. This " "alternative is allowed only occasionally and noncommercially, and " "only if you received the object code with such an offer, in accord " "with subsection 6b.
  • " "
  • d) Convey the object code by offering access from a designated " "place (gratis or for a charge), and offer equivalent access to the " "Corresponding Source in the same way through the same place at no " "further charge. You need not require recipients to copy the " "Corresponding Source along with the object code. If the place to " "copy the object code is a network server, the Corresponding Source " "may be on a different server (operated by you or a third party) " "that supports equivalent copying facilities, provided you maintain " "clear directions next to the object code saying where to find the " "Corresponding Source. Regardless of what server hosts the " "Corresponding Source, you remain obligated to ensure that it is " "available for as long as needed to satisfy these requirements.
  • " "
  • e) Convey the object code using peer-to-peer transmission, provided " "you inform other peers where the object code and Corresponding " "Source of the work are being offered to the general public at no " "charge under subsection 6d.
  • " "
" "

A separable portion of the object code, whose source code is excluded " "from the Corresponding Source as a System Library, need not be " "included in conveying the object code work.

" "

A User Product is either (1) a consumer product, which means any " "tangible personal property which is normally used for personal, family, " "or household purposes, or (2) anything designed or sold for incorporation " "into a dwelling. In determining whether a product is a consumer product, " "doubtful cases shall be resolved in favor of coverage. For a particular " "product received by a particular user, normally used refers to a " "typical or common use of that class of product, regardless of the status " "of the particular user or of the way in which the particular user " "actually uses, or expects or is expected to use, the product. A product " "is a consumer product regardless of whether the product has substantial " "commercial, industrial or non-consumer uses, unless such uses represent " "the only significant mode of use of the product.

" "

Installation Information for a User Product means any methods, " "procedures, authorization keys, or other information required to install " "and execute modified versions of a covered work in that User Product from " "a modified version of its Corresponding Source. The information must " "suffice to ensure that the continued functioning of the modified object " "code is in no case prevented or interfered with solely because " "modification has been made.

" "

If you convey an object code work under this section in, or with, or " "specifically for use in, a User Product, and the conveying occurs as " "part of a transaction in which the right of possession and use of the " "User Product is transferred to the recipient in perpetuity or for a " "fixed term (regardless of how the transaction is characterized), the " "Corresponding Source conveyed under this section must be accompanied " "by the Installation Information. But this requirement does not apply " "if neither you nor any third party retains the ability to install " "modified object code on the User Product (for example, the work has " "been installed in ROM).

" "

The requirement to provide Installation Information does not include a " "requirement to continue to provide support service, warranty, or updates " "for a work that has been modified or installed by the recipient, or for " "the User Product in which it has been modified or installed. Access to a " "network may be denied when the modification itself materially and " "adversely affects the operation of the network or violates the rules and " "protocols for communication across the network.

" "

Corresponding Source conveyed, and Installation Information provided, " "in accord with this section must be in a format that is publicly " "documented (and with an implementation available to the public in " "source code form), and must require no special password or key for " "unpacking, reading or copying.

" "

7. Additional Terms.

" "

Additional permissions are terms that supplement the terms of this " "License by making exceptions from one or more of its conditions. " "Additional permissions that are applicable to the entire Program shall " "be treated as though they were included in this License, to the extent " "that they are valid under applicable law. If additional permissions " "apply only to part of the Program, that part may be used separately " "under those permissions, but the entire Program remains governed by " "this License without regard to the additional permissions.

" "

When you convey a copy of a covered work, you may at your option " "remove any additional permissions from that copy, or from any part of " "it. (Additional permissions may be written to require their own " "removal in certain cases when you modify the work.) You may place " "additional permissions on material, added by you to a covered work, " "for which you have or can give appropriate copyright permission.

" "

Notwithstanding any other provision of this License, for material you " "add to a covered work, you may (if authorized by the copyright holders of " "that material) supplement the terms of this License with terms:

" "
    " "
  • a) Disclaiming warranty or limiting liability differently from the " " terms of sections 15 and 16 of this License; or
  • " "
  • b) Requiring preservation of specified reasonable legal notices or " "author attributions in that material or in the Appropriate Legal " "Notices displayed by works containing it; or
  • " "
  • c) Prohibiting misrepresentation of the origin of that material, or " "requiring that modified versions of such material be marked in " "reasonable ways as different from the original version; or
  • " "
  • d) Limiting the use for publicity purposes of names of licensors or " "authors of the material; or
  • " "
  • e) Declining to grant rights under trademark law for use of some " "trade names, trademarks, or service marks; or
  • " "
  • f) Requiring indemnification of licensors and authors of that " "material by anyone who conveys the material (or modified versions of " "it) with contractual assumptions of liability to the recipient, for " "any liability that these contractual assumptions directly impose on " "those licensors and authors.
  • " "
" "

All other non-permissive additional terms are considered further " "restrictions within the meaning of section 10. If the Program as you " "received it, or any part of it, contains a notice stating that it is " "governed by this License along with a term that is a further " "restriction, you may remove that term. If a license document contains " "a further restriction but permits relicensing or conveying under this " "License, you may add to a covered work material governed by the terms " "of that license document, provided that the further restriction does " "not survive such relicensing or conveying.

" "

If you add terms to a covered work in accord with this section, you " "must place, in the relevant source files, a statement of the " "additional terms that apply to those files, or a notice indicating " "where to find the applicable terms.

" "

Additional terms, permissive or non-permissive, may be stated in the " "form of a separately written license, or stated as exceptions; " "the above requirements apply either way.

" "

8. Termination.

" "

You may not propagate or modify a covered work except as expressly " "provided under this License. Any attempt otherwise to propagate or " "modify it is void, and will automatically terminate your rights under " "this License (including any patent licenses granted under the third " "paragraph of section 11).

" "

However, if you cease all violation of this License, then your " "license from a particular copyright holder is reinstated (a) " "provisionally, unless and until the copyright holder explicitly and " "finally terminates your license, and (b) permanently, if the copyright " "holder fails to notify you of the violation by some reasonable means " "prior to 60 days after the cessation.

" "

Moreover, your license from a particular copyright holder is " "reinstated permanently if the copyright holder notifies you of the " "violation by some reasonable means, this is the first time you have " "received notice of violation of this License (for any work) from that " "copyright holder, and you cure the violation prior to 30 days after " "your receipt of the notice.

" "

Termination of your rights under this section does not terminate the " "licenses of parties who have received copies or rights from you under " "this License. If your rights have been terminated and not permanently " "reinstated, you do not qualify to receive new licenses for the same " "material under section 10.

" "

9. Acceptance Not Required for Having Copies.

" "

You are not required to accept this License in order to receive or " "run a copy of the Program. Ancillary propagation of a covered work " "occurring solely as a consequence of using peer-to-peer transmission " "to receive a copy likewise does not require acceptance. However, " "nothing other than this License grants you permission to propagate or " "modify any covered work. These actions infringe copyright if you do " "not accept this License. Therefore, by modifying or propagating a " "covered work, you indicate your acceptance of this License to do so.

" "

10. Automatic Licensing of Downstream Recipients.

" "

Each time you convey a covered work, the recipient automatically " "receives a license from the original licensors, to run, modify and " "propagate that work, subject to this License. You are not responsible " "for enforcing compliance by third parties with this License.

" "

An entity transaction is a transaction transferring control of an " "organization, or substantially all assets of one, or subdividing an " "organization, or merging organizations. If propagation of a covered " "work results from an entity transaction, each party to that " "transaction who receives a copy of the work also receives whatever " "licenses to the work the party's predecessor in interest had or could " "give under the previous paragraph, plus a right to possession of the " "Corresponding Source of the work from the predecessor in interest, if " "the predecessor has it or can get it with reasonable efforts.

" "

You may not impose any further restrictions on the exercise of the " "rights granted or affirmed under this License. For example, you may" "not impose a license fee, royalty, or other charge for exercise of " "rights granted under this License, and you may not initiate litigation " "(including a cross-claim or counterclaim in a lawsuit) alleging that " "any patent claim is infringed by making, using, selling, offering for " "sale, or importing the Program or any portion of it.

" "

11. Patents.

" "

A contributor is a copyright holder who authorizes use under this " "License of the Program or a work on which the Program is based. The " "work thus licensed is called the contributor's contributor version.

" "

A contributor's essential patent claims are all patent claims " "owned or controlled by the contributor, whether already acquired or " "hereafter acquired, that would be infringed by some manner, permitted " "by this License, of making, using, or selling its contributor version, " "but do not include claims that would be infringed only as a " "consequence of further modification of the contributor version. For " "purposes of this definition, control includes the right to grant " "patent sublicenses in a manner consistent with the requirements of " "this License.

" "

Each contributor grants you a non-exclusive, worldwide, royalty-free " "patent license under the contributor's essential patent claims, to " "make, use, sell, offer for sale, import and otherwise run, modify and " "propagate the contents of its contributor version.

" "

In the following three paragraphs, a patent license is any express " "agreement or commitment, however denominated, not to enforce a patent " "(such as an express permission to practice a patent or covenant not to " "sue for patent infringement). To grant such a patent license to a " "party means to make such an agreement or commitment not to enforce a " "patent against the party.

" "

If you convey a covered work, knowingly relying on a patent license, " "and the Corresponding Source of the work is not available for anyone " "to copy, free of charge and under the terms of this License, through a " "publicly available network server or other readily accessible means, " "then you must either (1) cause the Corresponding Source to be so " "available, or (2) arrange to deprive yourself of the benefit of the " "patent license for this particular work, or (3) arrange, in a manner " "consistent with the requirements of this License, to extend the patent " "license to downstream recipients. Knowingly relying means you have " "actual knowledge that, but for the patent license, your conveying the " "covered work in a country, or your recipient's use of the covered work " "in a country, would infringe one or more identifiable patents in that " "country that you have reason to believe are valid.

" "

If, pursuant to or in connection with a single transaction or " "arrangement, you convey, or propagate by procuring conveyance of, a " "covered work, and grant a patent license to some of the parties " "receiving the covered work authorizing them to use, propagate, modify " "or convey a specific copy of the covered work, then the patent license " "you grant is automatically extended to all recipients of the covered " "work and works based on it.

" "

A patent license is discriminatory if it does not include within " "the scope of its coverage, prohibits the exercise of, or is " "conditioned on the non-exercise of one or more of the rights that are " "specifically granted under this License. You may not convey a covered " "work if you are a party to an arrangement with a third party that is " "in the business of distributing software, under which you make payment " "to the third party based on the extent of your activity of conveying " "the work, and under which the third party grants, to any of the " "parties who would receive the covered work from you, a discriminatory " "patent license (a) in connection with copies of the covered work " "conveyed by you (or copies made from those copies), or (b) primarily " "for and in connection with specific products or compilations that " "contain the covered work, unless you entered into that arrangement, " "or that patent license was granted, prior to 28 March 2007.

" "

Nothing in this License shall be construed as excluding or limiting " "any implied license or other defenses to infringement that may " "otherwise be available to you under applicable patent law.

" "

12. No Surrender of Others' Freedom.

" "

If conditions are imposed on you (whether by court order, agreement or " "otherwise) that contradict the conditions of this License, they do not " "excuse you from the conditions of this License. If you cannot convey a " "covered work so as to satisfy simultaneously your obligations under this " "License and any other pertinent obligations, then as a consequence you may " "not convey it at all. For example, if you agree to terms that obligate you " "to collect a royalty for further conveying from those to whom you convey " "the Program, the only way you could satisfy both those terms and this " "License would be to refrain entirely from conveying the Program.

" "

13. Use with the GNU Affero General Public License.

" "

Notwithstanding any other provision of this License, you have " "permission to link or combine any covered work with a work licensed " "under version 3 of the GNU Affero General Public License into a single " "combined work, and to convey the resulting work. The terms of this " "License will continue to apply to the part which is the covered work, " "but the special requirements of the GNU Affero General Public License, " "section 13, concerning interaction through a network will apply to the " "combination as such.

" "

14. Revised Versions of this License.

" "

The Free Software Foundation may publish revised and/or new versions of " "the GNU General Public License from time to time. Such new versions will " "be similar in spirit to the present version, but may differ in detail to " "address new problems or concerns.

" "

Each version is given a distinguishing version number. If the " "Program specifies that a certain numbered version of the GNU General " "Public License or any later version applies to it, you have the " "option of following the terms and conditions either of that numbered " "version or of any later version published by the Free Software " "Foundation. If the Program does not specify a version number of the " "GNU General Public License, you may choose any version ever published " "by the Free Software Foundation.

" "

If the Program specifies that a proxy can decide which future " "versions of the GNU General Public License can be used, that proxy's " "public statement of acceptance of a version permanently authorizes you " "to choose that version for the Program.

" "

Later license versions may give you additional or different " "permissions. However, no additional obligations are imposed on any" "author or copyright holder as a result of your choosing to follow a " "later version.

" "

15. Disclaimer of Warranty.

" "

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY " "APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT " "HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM AS IS WITHOUT WARRANTY " "OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, " "THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR " "PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM " "IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF " "ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

" "

16. Limitation of Liability.

" "

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING " "WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS " "THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY " "GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE " "USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF " "DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD " "PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), " "EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF " "SUCH DAMAGES.

" "

17. Interpretation of Sections 15 and 16.

" "

If the disclaimer of warranty and limitation of liability provided " "above cannot be given local legal effect according to their terms, " "reviewing courts shall apply local law that most closely approximates " "an absolute waiver of all civil liability in connection with the " "Program, unless a warranty or assumption of liability accompanies a " "copy of the Program in return for a fee.

" "

END OF TERMS AND CONDITIONS

" ""; licenseBrowser->setHtml(gplLic); aceptLicCheckBox = new QCheckBox(tr("I agree to the terms of the license")); aceptLicCheckBox->setToolTip(tr("You need to accept the terms of the license before using KLog")); registerField("licAgreement*", aceptLicCheckBox); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(licenseBrowser); layout->addWidget(aceptLicCheckBox); setLayout(layout); } int LicPage::nextId() const { return StartWizard::Page_CTY; //return StartWizard::Page_Mem; } void LicPage::setNextButtonActive(const bool _active) { } /* FileOrMemoryPage::FileOrMemoryPage(QWidget *parent) : QWizardPage(parent) { runInMemory = false; setTitle(tr("File or Memory")); //setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark.png")); topLabel = new QLabel(tr("Please select whether you prefer to run the DB in memory or in a file:" "
    " "
  • Running KLog in memory will be much faster, specially when managing several thousands of QSOs.
  • " "
  • Running KLog in a file will be much secure and you will not be forced to save the file before exiting or opening the logfile when starting KLog.
  • " "
" "Please know that in this version this feature is still not fully-implemented so KLog will run in file.")); topLabel->setWordWrap(true); memoryRadioButton = new QRadioButton(tr("Run KLog DB in &memory")); fileRadioButton = new QRadioButton(tr("Run KLog DB in a &file")); //memoryRadioButton->setChecked(true); memoryRadioButton->setChecked(false); fileRadioButton->setChecked(true); memoryRadioButton->setToolTip(tr("Recommended for day-to-day logging")); fileRadioButton->setToolTip(tr("Recommended for contest logging")); connect( memoryRadioButton, SIGNAL(toggled(bool) ), this, SLOT(slotRunningModeSelectedMemory(bool))); connect( fileRadioButton, SIGNAL(toggled(bool) ), this, SLOT(slotRunningModeSelectedFile(bool))); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(topLabel); layout->addWidget(memoryRadioButton); layout->addWidget(fileRadioButton); setLayout(layout); } void FileOrMemoryPage::slotRunningModeSelectedFile(bool checked) { if (checked) { exeInMemory(false); } } void FileOrMemoryPage::slotRunningModeSelectedMemory(bool checked) { if (checked) { exeInMemory(true); } } int FileOrMemoryPage::nextId() const { return StartWizard::Page_CTY; } */ CTYPage::CTYPage(const QString _kontestDir, const QString _version, QWidget *parent) : QWizardPage(parent) { //completed = false; dl = new DownLoadCTY(_kontestDir, _version); QObject::connect(dl, SIGNAL(actionReturnDownload(int)), this, SLOT(slotDownloadFinished(int))); QObject::connect(dl, SIGNAL(actionShowProgres(qint64,qint64)), this, SLOT(slotUpdateDownloadProgress(qint64,qint64))); QObject::connect(dl, SIGNAL(actionError(int)), this, SLOT(slotDownloadError(int))); setTitle(tr("Country data download")); topLabel = new QLabel(tr("KLog needs the country data...")); topLabel->setWordWrap(true); progressBar = new QProgressBar; progressBar->setEnabled(false); downloadButton = new QPushButton(tr("&Download")); ignoreDownloadButton = new QPushButton(tr("&Ignore")); // downloadButton.setText(tr("Download")); connect(downloadButton, SIGNAL(clicked()), this, SLOT(slotDownloadButtonClicked() ) ); connect(ignoreDownloadButton, SIGNAL(clicked()), this, SLOT(slotIgnoreDownloadButtonClicked() ) ); hiddenCheckBox = new QCheckBox(); registerField("downloadSelection*", hiddenCheckBox); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addWidget(progressBar); buttonLayout->addWidget(downloadButton); buttonLayout->addWidget(ignoreDownloadButton); ctyBrowser = new QTextEdit; ctyBrowser->setReadOnly(true); QString st = tr("Country data needed"); QString gplLic = ""; gplLic = gplLic+st+"

"; st = tr("KLog uses the CTY.CSV file (from http://www.country-files.com/) to get the DXCC information."); gplLic = gplLic + st + "

"; st = tr("You need to download the cty.csv file if you want KLog to show you the countries, locator, ... of the QSO you do."); gplLic = gplLic + st + "

"; st = tr("Click on Download to download just now."); gplLic = gplLic+st+"

"; ctyBrowser->setHtml(gplLic); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(ctyBrowser); layout->addLayout(buttonLayout); setLayout(layout); } void CTYPage::slotUpdateDownloadProgress(qint64 received, qint64 total) { //qDebug() << "CTYPage::slotUpdateDownloadProgress: " << QString::number(received) << "/" << QString::number(total) << endl; progressBar->setMaximum(total); progressBar->setValue(received); } void CTYPage::slotDownloadButtonClicked() { //qDebug() << "CTYPage::slotDownloadButtonClicked" << endl; progressBar->setEnabled(true); dl->download(); //completed = true; } void CTYPage::slotIgnoreDownloadButtonClicked() { //qDebug() << "CTYPage::slotIgnoreDownloadButtonClicked" << endl; //ignoreDownloadButton->setChecked(true); hiddenCheckBox->setChecked(true); progressBar->setEnabled(false); //completed = true; } void CTYPage::slotDownloadFinished(const int ret) { //qDebug() << "CTYPage::slotDownloadFinished: " << QString::number(ret) << endl; if (ret == QNetworkReply::NoError) // No error { hiddenCheckBox->setChecked(true); progressBar->setEnabled(false); progressBar->setValue(progressBar->maximum()); //hiddenCheckBox->setChecked(true); //qDebug() << "CTYPage::slotDownloadFinished: (no error): " << QString::number(ret) << endl; } else if (ret == -1) // File could not be created! { //qDebug() << "CTYPage::slotDownloadFinished: (file could not be created): " << QString::number(ret) << endl; } else { //qDebug() << "CTYPage::slotDownloadFinished: (another result): " << QString::number(ret) << endl; } } void CTYPage::slotDownloadError(const int ret) { //qDebug() << "CTYPage::slotDownloadError: " << QString::number(ret) << endl; int errorCode = ret; int i; progressBar->setValue(0); progressBar->setEnabled(false); if(errorCode == QNetworkReply::NoError) { } else if(errorCode == QNetworkReply::HostNotFoundError) { i = QMessageBox::warning(this, tr("KLog"), tr("I can't find the host. Please check your network and try again\n" "Do you want to try again?"), QMessageBox::Retry | QMessageBox::Ignore); if (i == QMessageBox::Retry) { slotDownloadButtonClicked(); } else { slotDownloadFinished(-1); } } else { //TODO: Add a message showing the error that has occur. errorString()? } } klog-0.9.2.2/locator.h0000644000076700000620000000636012627126144012412 0ustar staff/*************************************************************************** locator.h - description ------------------- begin : vie feb 7 2003 copyright : (C) 2003 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #ifndef LOCATOR_H #define LOCATOR_H #include #include const double PI = 3.141592654; //http://en.wikipedia.org/wiki/Pi const bool LATITUDE = false; const bool LONGITUDE = true; const double EARTH_RADIUS = 6371; //http://en.wikipedia.org/wiki/Earth_radius const bool RADIAN = 180.0/PI; const double DEG_TO_RAD = PI/180.0; const double KM_IN_A_MILE = 1.609344; class Locator{ public: Locator(); ~Locator(); bool isValidLocator(const QString& tlocator); double getLat(const QString& tlocator); double getLon(const QString& tlocator); QString getLocator(const double lon1, const double lat1) const; int getBeam(const double lon1, const double lat1, const double lon2, const double lat2); int getBeamBetweenLocators (const QString& tlocator1, const QString& tlocator2); int getDistance(const double lon1, const double lat1, const double lon2, const double lat2, const bool _imperialSystem); int getDistanceBetweenLocators (const QString& tlocator1, const QString& tlocator2, const bool _imperialSystem); //int getDistanceMilles(const double lon1, const double lat1, const double lon2, const double lat2); void degTodms(const double deg); double dmsTodeg (int deg, int min, int sec); bool checkCoords(const double lon1, const double lat1); private: //bool valid; QString myLocator; QString testLocator; QString otherLocator; QChar theChar; //double my_lon, my_lat, other_lon, other_lat, beam, testNumb; int ideg, imin, isec; }; #endif klog-0.9.2.2/mainwindowsattab.h0000644000076700000620000000516512627126144014324 0ustar staff#ifndef MAINWINDOWSATTAB_H #define MAINWINDOWSATTAB_H /*************************************************************************** mainwindowsattab.h - description ------------------- begin : jan 2015 copyright : (C) 2015 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ // // This class implement the tab of the mainwindow that supports Satellites // #include #include class MainWindowSatTab : public QWidget { Q_OBJECT public: explicit MainWindowSatTab(QWidget *parent = 0); ~MainWindowSatTab(); QString getSatName(); void setSatName(const QString _t); QString getSatMode(); void setSatMode(const QString _t); bool getRepeatThis(); void setRepeatThis(const bool _t); void clear(); signals: void setPropModeSat(const QString _p); public slots: private slots: void satNameTextChanged(); void satModeTextChanged(); private: void createUI(); QLineEdit *satNameLineEdit, *satModeLineEdit; QRadioButton *keepThisDataForNextQSORadiobutton; //QComboBox *satNameComboBox, *satModeComboBox; QStringList satNames, satModes; }; #endif // MAINWINDOWSATTAB_H klog-0.9.2.2/setuppageclublog.h0000644000076700000620000000553612627126144014320 0ustar staff#ifndef SETUPPAGECLUBLOG_H #define SETUPPAGECLUBLOG_H /*************************************************************************** setuppclublog.h - description ------------------- begin : apt 2015 copyright : (C) 2015 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include class SetupPageClubLog : public QWidget { Q_OBJECT public: SetupPageClubLog(QWidget *parent=0); ~SetupPageClubLog(); void setEmail(const QString c); void setPassword(const QString c); void setCallsign(const QString c); void setClubLog(const QString _s); void setClubLogRealTime(const QString _s); void setUseStationCall(const QString _s); QString getEmail(); QString getPassword(); QString getCallsign(); QString getClubLog(); QString getClubLogRealTime(); QString getUseQSOStationCallsign(); private slots: void slotClubLogActive(bool _s); void slotUseStationCall(bool _s); private: //QString defaultFileName; QCheckBox *sendInRealTimeCheckBox, *clubLogActiveCheckBox, *useQSOStationCallCheckBox; QLineEdit *passwordLineEdit, *emailLineEdit, *callLineEdit; QString call, email, pass; QLabel *callLabel, *passwordLabel, *emailLabel; bool clubLogActive; //QPushButton *fileNameButton; }; #endif // SETUPPAGECOLORS_H klog-0.9.2.2/contest.h0000644000076700000620000000445112627126144012425 0ustar staff#ifndef CONTEST_H #define CONTEST_H /*************************************************************************** contest.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include #include #include //#include class Contest { public: Contest(); Contest(const QStringList _qs); ~Contest(); virtual bool isMultiplier(const QStringList _qs); virtual int getQSOPoints(const QStringList _qs); virtual bool saveFileToSend(const QString& _fileName); virtual int getTotalScore(); virtual int getMultipliers(); virtual int getPoints(); private: int points; int multipliers; }; #endif // CONTEST_H klog-0.9.2.2/filemanager.h0000644000076700000620000001065512627126144013223 0ustar staff#ifndef FILEMANAGER_H #define FILEMANAGER_H /*************************************************************************** filemanager.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include //#include #include #include #include #include #include #include #include #include #include #include "world.h" #include "awards.h" #include "database.h" #include "dataproxy.h" #include "dataproxy_sqlite.h" #include "utilities.h" enum { CQZones = 40, ITUZones = 90, DXCCEntities = 521 // http://www.adif.org/adif302.htm#Country%20Codes }; class FileManager : public QWidget { Q_OBJECT public: FileManager(); FileManager(const QString _kontestDir); FileManager(const QString _kontestDir, const QString _softVersion, DataBase _db); ~FileManager(); //bool readAdif(const QString& tfileName, const int logN); bool adifReadLog(const QString& tfileName, const int logN); bool adifLogExport(const QString& _fileName, const int _logN); bool adifLogExportMarked(const QString& _fileName); bool adifReqQSLExport(const QString& _fileName); 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); 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 bool _keepLogsInFile, QHash &_logs); void queryPreparation(const int _logN); bool checkADIFValidFormat(const QStringList _qs); DataBase *db; //float softwareVersion; DataProxy *dataProxy; Utilities *util; bool rstTXDefault, rstRXDefault; // If true and a log is not including RST, 59 is automatically added bool printQs(const QString _q, const QStringList _line); //int confirmed; QString kontestDir; QString kontestVersion; //QProgressBar *progressBar; bool ignoreUnknownAlways; // When importing ADIF, ignore all unknown fields. bool noMoreQso; World *world; Awards *awards; QSqlQuery preparedQuery; QHash hashLogs; // to create different logs when importing a ADIF file }; #endif // FILEMANAGER_H klog-0.9.2.2/setuppagemisc.cpp0000644000076700000620000003000012627126144014137 0ustar staff/*************************************************************************** setuppagemisc.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include "setuppagemisc.h" //TODO: The defaultFileName QString can be removed and used the content of defaultFileNameLineEdit // instead. It is easy to change but the code would not be so clear... Think about this. :-) SetupPageMisc::SetupPageMisc(QWidget *parent) : QWidget(parent){ //qDebug() << "SetupPageMisc::SetupPageMisc" << endl; // bandsWidget = new QWidget; //TODO: To be removed when the defaultDir is saved in the config file #ifdef Q_OS_WIN //qDebug() << "WINDOWS DETECTED!" << endl; kontestDir = QDir::homePath()+"/klog"; // We create the \klog for the logs and data defaultFileName = kontestDir+"/klog.adi"; #else //qDebug() << "NO WINDOWS DETECTED!" << endl; kontestDir = QDir::homePath()+"/.klog"; // We create the ~/.klog for the logs and data defaultFileName = kontestDir+"/klog.adi"; #endif imperialCheckBox = new QCheckBox(tr("&Imperial system"), this); //dbInMemory = new QCheckBox(tr("DB in &Memory"), this); realTimeCheckbox = new QCheckBox(tr("&Log in real time"), this); UTCCheckbox = new QCheckBox(tr("&Time in UTC"), this); alwaysADIFCheckBox = new QCheckBox(tr("&Save ADIF on exit"), this); useDefaultName = new QCheckBox(tr("Use this &default filename"), this); sendQSLWhenRecCheckBox = new QCheckBox(tr("Mark &QSO to send QSL when QSL is received"), this); completeWithPreviousCheckBox = new QCheckBox(tr("Complete QSO with previous data")); sendQSLWhenRecCheckBox->setToolTip(tr("QSOs will be marked to be pending to send the QSL if the DX QSL is received and you have not sent your.")); showStationCallWhenSearchCheckBox = new QCheckBox(tr("Show the Station &Callsign used in the search box"), this); showStationCallWhenSearchCheckBox->setToolTip(tr("The search box will show also the callsign on the air to do the QSO.")); keepMyDataCheckBox = new QCheckBox(tr("&Reset to My Data for all QSO"), this); keepMyDataCheckBox->setToolTip(tr("All the data from the My Data tab will be used or data from the previous QSO will be maintained.")); imperialCheckBox ->setToolTip(tr("Check it for Imperial system (Miles instead of Kilometres).")); //dbInMemory->setToolTip(tr("Working in memory (vs in file) is much quicker but you will need to save the ADIF file each time you exit KLog.")); realTimeCheckbox->setToolTip(tr("Select to use real time.")); UTCCheckbox->setToolTip(tr("Select to use UTC time.")); alwaysADIFCheckBox->setToolTip(tr("Select if you want to save to ADIF on exit.")); useDefaultName->setToolTip(tr("Select to use the following name for the logfile and not being asked for it anymore.")); completeWithPreviousCheckBox->setToolTip(tr("Complete the current QSO with previous QSO data.")); defaultFileNameLineEdit = new QLineEdit; defaultFileNameLineEdit->setToolTip(tr("This is the default file where ADIF will be saved.")); defaultFileNameLineEdit->setReadOnly(true); defaultFileNameLineEdit->setText(defaultFileName); defaultFileNameLineEdit->setEnabled(false); useDefaultName->setChecked(true); alwaysADIFCheckBox->setChecked(true); showStationCallWhenSearchCheckBox->setChecked(true); keepMyDataCheckBox->setChecked(true); completeWithPreviousCheckBox->setChecked(false); fileNameButton = new QPushButton; fileNameButton->setToolTip(tr("Click to change the default ADIF file")); //TODO: Add an icon "open" to this pushbutton QHBoxLayout *fileLayout = new QHBoxLayout; fileLayout->addWidget(useDefaultName); fileLayout->addWidget(defaultFileNameLineEdit); fileLayout->addWidget(fileNameButton); defaultFileNameLineEdit->setEnabled(true); fileNameButton->setEnabled(true); UTCCheckbox->setChecked(true); realTimeCheckbox->setChecked(true); //showStationCallWhenSearchCheckBox->setChecked(true); QHBoxLayout *timeLayout = new QHBoxLayout; timeLayout->addWidget(UTCCheckbox); timeLayout->addWidget(realTimeCheckbox); QHBoxLayout *dataLayout = new QHBoxLayout; dataLayout->addWidget(keepMyDataCheckBox); dataLayout->addWidget(completeWithPreviousCheckBox); //QHBoxLayout *fileOptLayout = new QHBoxLayout; //fileOptLayout->addWidget(useDefaultName); //fileOptLayout->addWidget(alwaysADIFCheckBox); QVBoxLayout *mainLayout = new QVBoxLayout; //mainLayout->addWidget(dbInMemory); mainLayout->addLayout(fileLayout); mainLayout->addWidget(alwaysADIFCheckBox); //mainLayout->addWidget(useDefaultName); //mainLayout->addLayout(fileOptLayout); //mainLayout->addWidget(realTimeCheckbox); //mainLayout->addWidget(UTCCheckbox); mainLayout->addLayout(timeLayout); mainLayout->addWidget(imperialCheckBox); mainLayout->addLayout(dataLayout); mainLayout->addWidget(sendQSLWhenRecCheckBox); mainLayout->addWidget(showStationCallWhenSearchCheckBox); setLayout(mainLayout); connect(fileNameButton, SIGNAL(clicked () ), this, SLOT(slotOpenFileButtonClicked() ) ); connect(useDefaultName, SIGNAL(stateChanged (int) ), this, SLOT(slotUseDefaultButtonStateChanged(int) ) ); } SetupPageMisc::~SetupPageMisc(){ //qDebug() << "SetupPageMisc::~SetupPageMisc" << endl; } void SetupPageMisc::createActions(){ //void itemDoubleClicked ( QListWidgetItem * item ) } QString SetupPageMisc::getRealTime(){ if (realTimeCheckbox->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setRealTime(const QString t){ //QString st = t; if ( (t.toUpper()) == "FALSE") { realTimeCheckbox->setChecked(false); } else { realTimeCheckbox->setChecked(true); } } QString SetupPageMisc::getUTCTime(){ if (UTCCheckbox->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setUTCTime(const QString t){ if ( (t.toUpper()) == "FALSE") { UTCCheckbox->setChecked(false); } else { UTCCheckbox->setChecked(true); } } QString SetupPageMisc::getAlwaysADIF() { if (alwaysADIFCheckBox->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setAlwaysADIF(const QString t) { // Defaul value is false if ( (t.toUpper()) == "TRUE") { alwaysADIFCheckBox->setChecked(true); } else { alwaysADIFCheckBox->setChecked(false); } } QString SetupPageMisc::getDefaultFileName() { return defaultFileName; } void SetupPageMisc::setDefaultFileName(const QString t) { defaultFileName = t; defaultFileNameLineEdit->setText(defaultFileName); } void SetupPageMisc::slotOpenFileButtonClicked() { defaultFileName = QFileDialog::getOpenFileName(this, tr("Open File"), kontestDir, tr("ADIF (*.adi)")); defaultFileNameLineEdit->setText(defaultFileName); } /* QString SetupPageMisc::getInMemory() { if (dbInMemory->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setInMemory(const QString t) { if ( (t.toUpper()) == "FALSE") { dbInMemory->setChecked(false); } else { dbInMemory->setChecked(true); } } */ QString SetupPageMisc::getUseDefaultName() { if (useDefaultName->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setUseDefaultName(const QString t) { if ( (t.toUpper()) == "FALSE") { useDefaultName->setChecked(false); } else { useDefaultName->setChecked(true); } } QString SetupPageMisc::getImperial() { if (imperialCheckBox->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setImperial(const QString t) { if ( (t.toUpper()) == "FALSE") { imperialCheckBox->setChecked(false); } else { imperialCheckBox->setChecked(true); } } void SetupPageMisc::slotUseDefaultButtonStateChanged(int state) { //qDebug() << "SetupPageMisc::slotUseDefaultButtonStateChanged" << endl; if (state) { defaultFileNameLineEdit->setEnabled(true); fileNameButton->setEnabled(true); } else { defaultFileNameLineEdit->setEnabled(false); fileNameButton->setEnabled(false); } } QString SetupPageMisc::getSendQSLWhenRec(){ if (sendQSLWhenRecCheckBox->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setSendQSLWhenRec(const QString t){ if ( (t.toUpper()) == "FALSE") { sendQSLWhenRecCheckBox->setChecked(false); } else { sendQSLWhenRecCheckBox->setChecked(true); } } QString SetupPageMisc::getShowStationCallSignInSearch() { if (showStationCallWhenSearchCheckBox->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setShowStationCallSignInSearch(const QString t) { if ( (t.toUpper()) == "FALSE") { showStationCallWhenSearchCheckBox->setChecked(false); } else { showStationCallWhenSearchCheckBox->setChecked(true); } } QString SetupPageMisc::getKeepMyData() { if (keepMyDataCheckBox->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setKeepMyData(const QString t) { if ( (t.toUpper()) == "FALSE") { keepMyDataCheckBox->setChecked(false); } else { keepMyDataCheckBox->setChecked(true); } } QString SetupPageMisc::getCompleteWithPrevious() { if (completeWithPreviousCheckBox->isChecked()) { return "True"; } else { return "False"; } } void SetupPageMisc::setCompleteWithPrevious(const QString t) { if ( (t.toUpper()) == "FALSE") { completeWithPreviousCheckBox->setChecked(false); } else { completeWithPreviousCheckBox->setChecked(true); } } klog-0.9.2.2/setuppageclublog.cpp0000644000076700000620000001760112627126144014647 0ustar staff/*************************************************************************** setuppageclublog.cpp - description ------------------- begin : apt 2015 copyright : (C) 2015 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include "setuppageclublog.h" SetupPageClubLog::SetupPageClubLog(QWidget *parent) : QWidget(parent) { //Debug() << "SetupPageClubLog::SetupPageClubLog" << endl; clubLogActive = false; call = QString(); email = QString(); pass = QString(); emailLineEdit = new QLineEdit; callLineEdit = new QLineEdit; passwordLineEdit = new QLineEdit; callLabel = new QLabel(tr("&Callsign")); passwordLabel = new QLabel(tr("Clublog &password")); emailLabel = new QLabel(tr("Clublog &email")); callLabel->setBuddy(callLineEdit); passwordLabel->setBuddy(passwordLineEdit); emailLabel->setBuddy(emailLineEdit); emailLineEdit->setToolTip(tr("Enter the email you used to register in clublog")); callLineEdit->setToolTip(tr("Enter the callsign you used to register in clublog")); passwordLineEdit->setToolTip(tr("Enter your password in clublog")); //passwordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit); sendInRealTimeCheckBox = new QCheckBox(tr("&Send QSOs in real time"), this); clubLogActiveCheckBox = new QCheckBox(tr("&Activate ClubLog"), this); useQSOStationCallCheckBox = new QCheckBox(tr("Use QSO Station &Callsign"), this); sendInRealTimeCheckBox->setToolTip(tr("Send each QSO to ClubLog in real time, as they are added (or modified) in KLog")); clubLogActiveCheckBox->setToolTip(tr("Starts the ClubLog support in KLog")); useQSOStationCallCheckBox->setToolTip(tr("Use the Station Callsign defined in each QSO instead of the defined here")); QHBoxLayout *callSLayout = new QHBoxLayout; callSLayout->addWidget(callLineEdit); callSLayout->addWidget(useQSOStationCallCheckBox); QGridLayout *glayout = new QGridLayout; glayout->addWidget(callLabel, 0, 0); glayout->addWidget(emailLabel, 1, 0); glayout->addWidget(passwordLabel, 2, 0); glayout->addLayout(callSLayout, 0, 1); //glayout->addWidget(callLineEdit, 0, 1); glayout->addWidget(emailLineEdit, 1, 1); glayout->addWidget(passwordLineEdit, 2, 1); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(clubLogActiveCheckBox); layout->addLayout(glayout); layout->addWidget(sendInRealTimeCheckBox); setLayout(layout); //connect(newOneColorButton, SIGNAL(clicked()), this, SLOT(slotNewOneColorButtonClicked()) ); connect(clubLogActiveCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotClubLogActive(bool))); connect(useQSOStationCallCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotUseStationCall(bool))); //connect(sendInRealTimeCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotClubLogActive(bool))); slotClubLogActive(clubLogActive); } SetupPageClubLog::~SetupPageClubLog() { } void SetupPageClubLog::setEmail(const QString c) { emailLineEdit->setText(c); } void SetupPageClubLog::setPassword(const QString c) { passwordLineEdit->setText(c); } void SetupPageClubLog::setCallsign(const QString c) { callLineEdit->setText(c.toUpper()); } QString SetupPageClubLog::getEmail() { return (emailLineEdit->text()); } QString SetupPageClubLog::getPassword() { return passwordLineEdit->text(); } QString SetupPageClubLog::getCallsign() { return (callLineEdit->text()).toUpper(); } QString SetupPageClubLog::getUseQSOStationCallsign() { if (useQSOStationCallCheckBox->isChecked() ) { return "True"; } else { return "False"; } } void SetupPageClubLog::setUseStationCall(const QString _s) { if ( (_s.toUpper()) == "FALSE") { useQSOStationCallCheckBox->setChecked(false); } else { useQSOStationCallCheckBox->setChecked(true); } } QString SetupPageClubLog::getClubLog() { if (clubLogActiveCheckBox->isChecked() ) { return "True"; } else { return "False"; } } void SetupPageClubLog::setClubLog(const QString _s) { if ( (_s.toUpper()) == "FALSE") { clubLogActive = false; clubLogActiveCheckBox->setChecked(false); } else { clubLogActive = true; clubLogActiveCheckBox->setChecked(true); } } void SetupPageClubLog::slotUseStationCall(bool _s) { //qDebug() << "SetupPageClubLog::slotUseStationCall" << endl; if (useQSOStationCallCheckBox->isChecked()) { callLineEdit->setEnabled(false); callLabel->setEnabled(false); } else { callLineEdit->setEnabled(true); callLabel->setEnabled(true); } } void SetupPageClubLog::slotClubLogActive(bool _s) { //qDebug() << "SetupPageClubLog::slotClubLogActive" << endl; if (_s) { //qDebug() << "SetupPageClubLog::slotClubLogActive TRUE" << endl; callLabel->setEnabled(true); emailLabel->setEnabled(true); passwordLabel->setEnabled(true); callLineEdit->setEnabled(true); emailLineEdit->setEnabled(true); passwordLineEdit->setEnabled(true); sendInRealTimeCheckBox->setEnabled(true); useQSOStationCallCheckBox->setEnabled(true); clubLogActive = true; } else { //qDebug() << "SetupPageClubLog::slotClubLogActive FALSE" << endl; callLabel->setEnabled(false); emailLabel->setEnabled(false); passwordLabel->setEnabled(false); callLineEdit->setEnabled(false); emailLineEdit->setEnabled(false); passwordLineEdit->setEnabled(false); sendInRealTimeCheckBox->setEnabled(false); useQSOStationCallCheckBox->setEnabled(false); clubLogActive = false; } } void SetupPageClubLog::setClubLogRealTime(const QString _s) { if ( (_s.toUpper()) == "FALSE") { sendInRealTimeCheckBox->setChecked(false); } else { sendInRealTimeCheckBox->setChecked(true); } } QString SetupPageClubLog::getClubLogRealTime() { if (sendInRealTimeCheckBox->isChecked()) { return "True"; } else { return "False"; } //return sendInRealTimeCheckBox->isChecked(); } klog-0.9.2.2/setuppagemisc.h0000644000076700000620000000665312627126144013625 0ustar staff#ifndef SETUPPAGEMISC_H #define SETUPPAGEMISC_H /*************************************************************************** setuppagemisc.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include class SetupPageMisc : public QWidget { Q_OBJECT public: SetupPageMisc(QWidget *parent=0); ~SetupPageMisc(); QString getRealTime(); void setRealTime(const QString t); QString getUTCTime(); void setUTCTime(const QString t); QString getAlwaysADIF(); void setAlwaysADIF(const QString t); QString getDefaultFileName(); void setUseDefaultName(const QString t); QString getUseDefaultName(); void setDefaultFileName(const QString t); //QString getInMemory(); //void setInMemory(const QString t); QString getImperial(); void setImperial(const QString t); QString getSendQSLWhenRec(); void setSendQSLWhenRec(const QString t); QString getShowStationCallSignInSearch(); void setShowStationCallSignInSearch(const QString t); QString getKeepMyData(); void setKeepMyData(const QString t); QString getCompleteWithPrevious(); void setCompleteWithPrevious(const QString t); private slots: void slotOpenFileButtonClicked(); void slotUseDefaultButtonStateChanged(int state); private: void createActions(); QCheckBox *realTimeCheckbox, *UTCCheckbox, *alwaysADIFCheckBox, *useDefaultName, *completeWithPreviousCheckBox; QCheckBox *imperialCheckBox, *sendQSLWhenRecCheckBox, *showStationCallWhenSearchCheckBox, *keepMyDataCheckBox; QString defaultFileName; QLineEdit *defaultFileNameLineEdit; QPushButton *fileNameButton; QString kontestDir; //TODO: To be removed when the defaultDir is saved in the config file //QWidget *bandsWidget; }; #endif // SETUPPAGEMISC_H klog-0.9.2.2/logwindow.h0000644000076700000620000000464612627126144012765 0ustar staff#ifndef LOGWINDOW_H #define LOGWINDOW_H /*************************************************************************** logwindow.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include #include #include #include class QStringList; class QLabel; class QVBoxLayout; enum { Log_Id = 0, Log_Name = 1, Log_BandId = 2, Log_ModeId = 3, Log_DateId = 4, Log_TimeId = 5 }; class LogWindow : public QWidget { Q_OBJECT public: LogWindow(); ~LogWindow(); private: QSqlRelationalTableModel *logModel; QWidget *logPanel; QTableView *logView; QLabel *logLabel; QAction *logWinAct; QAction *loggWinAct; void createlogPanel(); }; #endif // LOGWINDOW_H klog-0.9.2.2/database.cpp0000644000076700000620000040430412627126144013046 0ustar staff/*************************************************************************** database.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "database.h" //#include DataBase::DataBase(const QString _softVersion, bool inmemoryonly){ //qDebug() << "DataBase::DataBase: " << _softVersion << endl; //TODO: Sometimes the DB is created without the proper calling (without passing softVersion) dbVersion = DBVersionf; softVersion = _softVersion; inMemoryOnly = inmemoryonly; latestReaded = 0.0; util = new Utilities(); //db = new QSqlDatabase; db = QSqlDatabase::database(); createConnection(); } DataBase::~DataBase() { //qDebug() << "DataBase::~DataBase" << endl; } void DataBase::compress() { //qDebug() << "DataBase::compress " << endl; QSqlDatabase db = QSqlDatabase::database(); if (!db.open()) { QMessageBox::warning(0, QObject::tr("Database Error"), db.lastError().text()); } else { db.exec("VACUUM;"); } } bool DataBase::createConnection() { //qDebug() << "DataBase::createConnection: " << QString::number(dbVersion) << "/" << softVersion << endl; QString stringQuery; //qDebug() << "DataBase::createConnection: 0" << endl; QSqlQuery query; //rc = sqlite3_open(":memory:", &db); if (!db.isOpen()) { //qDebug() << "DataBase::createConnection: DB NOT Opened" << endl; db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("logbook.dat"); if (!db.open()) { QMessageBox::warning(0, QObject::tr("Database Error"), db.lastError().text()); //qDebug() << "DataBase::createConnection: DB creation ERROR" << endl; return false; } else { //qDebug() << "DataBase::createConnection: created?" << endl; if (isTheDBCreated()) { //qDebug() << "DataBase::createConnection: DB Exists" << endl; } else { //qDebug() << "DataBase::createConnection: DB does not exist" << endl; createDataBase(); stringQuery ="PRAGMA main.page_size = 4096;"; query.exec(stringQuery); stringQuery ="PRAGMA main.cache_size=10000;"; query.exec(stringQuery); stringQuery ="PRAGMA main.locking_mode=EXCLUSIVE;"; query.exec(stringQuery); stringQuery ="PRAGMA main.synchronous=NORMAL;"; query.exec(stringQuery); stringQuery ="PRAGMA main.journal_mode=WAL;"; query.exec(stringQuery); stringQuery ="PRAGMA main.cache_size=5000;"; query.exec(stringQuery); stringQuery ="PRAGMA synchronous=OFF;"; query.exec(stringQuery); stringQuery ="PRAGMA main.temp_store = MEMORY;"; query.exec(stringQuery); //stringQuery="PRAGMA auto_vacuum = FULL;"; //query.exec(stringQuery); stringQuery ="PRAGMA case_sensitive_like=OFF;"; query.exec(stringQuery); } } } else { //qDebug() << "DataBase::createConnection: DB already opened" << endl; } createBandModeMaps(); //qDebug() << "DataBase::createConnection: END" << endl; return unMarkAllQSO(); } bool DataBase::isTheDBCreated() { //qDebug() << "DataBase::isTheDBCreated" << endl; QSqlQuery query; int _num = 0; QString stringQuery ("SELECT count(id) FROM softwarecontrol"); bool sqlOK = query.exec(stringQuery); //En esta ejecución da driver not loaded if (sqlOK) { query.next(); if (query.isValid()) { //qDebug() << "DataBase::isTheDBCreated - valid" << endl; _num = (query.value(0)).toInt(); if (_num > 0) { //qDebug() << "DataBase::isTheDBCreated - DB Exists" << endl; return true; } else { //qDebug() << "DataBase::isTheDBCreated - DB does not Exist" << endl; return false; } } else { //qDebug() << "DataBase::isTheDBCreated - not valid" << endl; return false; } } else { //qDebug() << "DataBase::isTheDBCreated: LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataBase::isTheDBCreated: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "DataBase::isTheDBCreated: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "DataBase::isTheDBCreated: LastError-n: " << QString::number(query.lastError().number() ) << endl; return false; } //qDebug() << "DataBase::isTheDBCreated: END FALSE" << endl; return false; } bool DataBase::createTableLog(bool temp) { //Creates a temporal table or the normal one. //QString logToCreate = "log"; QSqlQuery query; QString stringQuery = QString(); if (temp) { stringQuery = "CREATE TABLE log" ; //qDebug() << "DataBase::createTableLog: log" << endl; } else { stringQuery = "CREATE TABLE logtemp" ; //qDebug() << "DataBase::createTableLog: logtemp" << endl; } stringQuery = stringQuery + QString(" (id INTEGER PRIMARY KEY AUTOINCREMENT, " "qso_date VARCHAR(10) NOT NULL, " "time_on VARCHAR(8) NOT NULL, " "call VARCHAR(40) NOT NULL, " "rst_sent VARCHAR, " "rst_rcvd VARCHAR, " "bandid INTEGER NOT NULL, " "modeid INTEGER NOT NULL, " "srx VARCHAR(10), " "stx VARCHAR(10), " "points INTEGER," "multiplier INTEGER," "cqz INTEGER," "ituz INTEGER," "dxcc INTEGER," "address VARCHAR, " "age INTEGER, " "cnty VARCHAR, " "comment VARCHAR, " "a_index INTEGER, " "ant_az INTEGER, " "ant_el INTEGER, " "ant_path INTEGER, " "arrl_sect INTEGER, " "band_rx INTEGER, " "checkcontest VARCHAR, " "class VARCHAR, " "contacted_op VARCHAR(40), " "contest_id VARCHAR, " "country VARCHAR, " "credit_submitted VARCHAR, " "credit_granted VARCHAR, " "distance INTEGER, " "email VARCHAR, " "eq_call VARCHAR, " "eqsl_qslrdate VARCHAR(10), " "eqsl_qslsdate VARCHAR(10), " "eqsl_qsl_rcvd VARCHAR(1), " "eqsl_qsl_sent VARCHAR(1), " "force_init INTEGER, " "freq VARCHAR, " "freq_rx VARCHAR, " "gridsquare VARCHAR, " "iota VARCHAR(6), " "iota_island_id VARCHAR, " "k_index INTEGER, " "lat VARCHAR(11), " "lon VARCHAR(11), " "lotw_qslrdate VARCHAR(10), " "lotw_qslsdate VARCHAR(10), " "lotw_qsl_rcvd VARCHAR(1), " "lotw_qsl_sent VARCHAR(1), " "clublog_qso_upload_date VARCHAR(10), " "clublog_qso_upload_status VARCHAR(1), " "max_bursts INTEGER, " "ms_shower VARCHAR, " "my_city VARCHAR, " "my_cnty VARCHAR, " "my_country INTEGER, " "my_cq_zone INTEGER, " "my_gridsquare VARCHAR, " "my_iota VARCHAR(6), " "my_iota_island_id VARCHAR, " "my_lat VARCHAR(11), " "my_lon VARCHAR(11), " "my_name VARCHAR, " "my_rig VARCHAR, " "my_sig VARCHAR, " "my_sig_info VARCHAR, " "my_state VARCHAR, " "my_street VARCHAR, " "name VARCHAR, " "notes VARCHAR, " "nr_bursts INTEGER, " "nr_pings INTEGER, " "operator VARCHAR, " "owner_callsign VARCHAR, " "pfx VARCHAR, " "precedence VARCHAR, " "prop_mode VARCHAR, " "public_key VARCHAR, " "qslmsg VARCHAR, " "qslrdate VARCHAR(10), " "qslsdate VARCHAR(10), " "qsl_rcvd VARCHAR(1), " "qsl_sent VARCHAR(1), " "qsl_rcvd_via VARCHAR(1), " "qsl_sent_via VARCHAR(1), " "qsl_via VARCHAR, " "qso_complete VARCHAR(1), " "qso_random INTEGER, " "qth VARCHAR, " "rx_pwr REAL, " "sat_mode VARCHAR, " "sat_name VARCHAR, " "sfi INTEGER, " "sig VARCHAR, " "sig_info VARCHAR, " "srx_string VARCHAR, " "stx_string VARCHAR, " "state VARCHAR, " "station_callsign VARCHAR, " "swl INTEGER, " "ten_ten INTEGER, " "tx_pwr REAL, " "web VARCHAR, " "qso_date_off VARCHAR(10), " "time_off VARCHAR(8), " "transmiterid VARCHAR, " "marked VARCHAR(1), " "lognumber INTEGER NOT NULL, " "UNIQUE (call, qso_date, time_on, bandid, modeid, lognumber), " "FOREIGN KEY (qso_complete) REFERENCES qso_complete_enumeration, " "FOREIGN KEY (qsl_rcvd_via) REFERENCES qsl_via_enumeration, " "FOREIGN KEY (qsl_sent_via) REFERENCES qsl_via_enumeration, " "FOREIGN KEY (qsl_rcvd) REFERENCES qsl_rec_status, " "FOREIGN KEY (qsl_sent) REFERENCES qsl_sent_status, " "FOREIGN KEY (prop_mode) REFERENCES prop_mode_enumeration, " "FOREIGN KEY (my_country) REFERENCES entity, " "FOREIGN KEY (lotw_qsl_rcvd) REFERENCES qsl_rec_status, " "FOREIGN KEY (lotw_qsl_sent) REFERENCES qsl_sent_status, " "FOREIGN KEY (eqsl_qsl_rcvd) REFERENCES qsl_rec_status, " "FOREIGN KEY (eqsl_qsl_sent) REFERENCES qsl_sent_status, " "FOREIGN KEY (credit_submitted) REFERENCES award_enumeration, " "FOREIGN KEY (credit_granted) REFERENCES award_enumeration, " "FOREIGN KEY (country) REFERENCES entity, " "FOREIGN KEY (ant_path) REFERENCES ant_path_enumeration, " "FOREIGN KEY (arrl_sect) REFERENCES arrl_sect_enumeration, " "FOREIGN KEY (band_rx) REFERENCES band, " "FOREIGN KEY (modeid) REFERENCES mode, " "FOREIGN KEY (dxcc) REFERENCES entity, " "FOREIGN KEY (bandid) REFERENCES band)"); //qDebug() << "DataBase::createTableLog: " << stringQuery << endl; return query.exec(stringQuery); } bool DataBase::createDataBase() { //qDebug() << "DataBase::createDataBase" << endl; //bool qres; //http://www.sqlite.org/ //http://www.sqlite.org/datatype3.html //qDebug() << "DataBase::createData" << endl; //int softDB = dbVersion; //QString softV = _softVersion; QString dateString; QSqlQuery query; query.exec("DROP TABLE log"); query.exec("DROP TABLE band"); query.exec("DROP TABLE mode"); //query.exec("DROP TABLE mode"); query.exec("DROP TABLE prefixesofentity"); query.exec("DROP TABLE continent"); query.exec("DROP TABLE entity"); query.exec("CREATE TABLE softwarecontrol (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "dateupgrade VARCHAR(10) NOT NULL, " "softversion REAL NOT NULL, " "dbversion REAL NOT NULL)"); dateString = (date.currentDateTime()).toString("yyyyMMdd"); query.exec("INSERT INTO softwarecontrol (dateupgrade, softversion, dbversion) VALUES ('" + dateString + "', '" + softVersion + "', '" + QString::number(dbVersion) + "')"); /* if (qres) { //qDebug() << "DataBase::createDataBase - Band created" << endl; } else { //qDebug() << "DataBase::createDataBase - Band not created" << endl; //qDebug() << "DataBase::createDataBase: " << query.lastError().text() << endl; } */ createTableBand(true); populateTableBand(true); createTableMode(true); populateTableMode(true); createTableLog(true); //DATE YYYY-MM-DD //TIME HHmmss //http://www.sqlite.org/lang_datefunc.html /* "confirmed INTEGER NOT NULL, " confirmed means: confirmed = 0 Set as Worked confirmed = 1 Set as Confirmed */ query.exec("CREATE TABLE continent (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(2) NOT NULL, " "name VARCHAR(15) NOT NULL)"); query.exec("CREATE TABLE ant_path_enumeration (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(1) NOT NULL, " "name VARCHAR(15) NOT NULL)"); query.exec("CREATE TABLE arrl_sect_enumeration (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(2) NOT NULL, " "name VARCHAR(30) NOT NULL)"); query.exec("CREATE TABLE qso_complete_enumeration (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(3) NOT NULL, " "name VARCHAR(10) NOT NULL)"); createTableContest(); query.exec("CREATE TABLE contestcategory (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(20) NOT NULL, " "name VARCHAR(40) NOT NULL"); query.exec("CREATE TABLE award_enumeration (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "name VARCHAR(15) NOT NULL)"); query.exec("CREATE TABLE entity (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "name VARCHAR(40) NOT NULL," "cqz INTEGER NOT NULL, " "ituz INTEGER NOT NULL, " "continent INTEGER NOT NULL, " "latitude REAL NOT NULL, " "longitude REAL NOT NULL, " "utc INTEGER NOT NULL, " "dxcc INTEGER NOT NULL, " "mainprefix VARCHAR(15) NOT NULL, " "deleted INTEGER, " "sincedate VARCHAR(10), " "todate VARCHAR(10), " "UNIQUE (dxcc, mainprefix), " "FOREIGN KEY (continent) REFERENCES continent(shortname))"); //TODO: To add some columns in this the table to mark if worked/confirmed/band/Mode //query.exec("INSERT INTO entity (name, cqz, ituz, continent, latitude, longitude, utc, dxcc, mainprefix, deleted, sincedate, todate) VALUES ('Canada', '0', '0', '0', '0', '0', '0', '0', 'VE', 'q', 'sincedate', 'todate')"); query.exec("CREATE TABLE prefixesofentity (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "prefix VARCHAR(15) NOT NULL," "dxcc INTEGER NOT NULL," "cqz INTEGER NOT NULL," "ituz INTEGER NOT NULL," "UNIQUE (prefix, dxcc), " "FOREIGN KEY (dxcc) REFERENCES entity)"); query.exec("CREATE TABLE awarddxcc (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "dxcc INTEGER NOT NULL," "band INTEGER NOT NULL, " "mode INTEGER NOT NULL, " "confirmed INTEGER, " "qsoid INTEGER NOT NULL, " "lognumber INTEGER, " "UNIQUE (dxcc, band, mode, lognumber), " "FOREIGN KEY (dxcc) REFERENCES entity, " "FOREIGN KEY (band) REFERENCES band, " "FOREIGN KEY (mode) REFERENCES mode, " "FOREIGN KEY (qsoid) REFERENCES log)"); /* In awarddxcc confirmed means: confirmed = 0 Set as Worked confirmed = 1 Set as Confirmed */ query.exec("CREATE TABLE awardwaz (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "cqz INTEGER NOT NULL," "band INTEGER NOT NULL, " "mode INTEGER NOT NULL, " "confirmed INTEGER, " "qsoid INTEGER NOT NULL, " "lognumber INTEGER, " "UNIQUE (cqz, band, mode, confirmed, lognumber), " "FOREIGN KEY (band) REFERENCES band, " "FOREIGN KEY (mode) REFERENCES mode, " "FOREIGN KEY (qsoid) REFERENCES log)"); /* In awardwaz confirmed means: confirmed = 0 Set as Worked confirmed = 1 Set as Confirmed */ query.exec("CREATE TABLE qsl_rec_status (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(1) NOT NULL, " "name VARCHAR(15) NOT NULL)"); query.exec("CREATE TABLE qsl_sent_status (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(1) NOT NULL, " "name VARCHAR(15) NOT NULL)"); query.exec("CREATE TABLE qsl_via (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(1) NOT NULL, " "name VARCHAR(15) NOT NULL)"); createTablePropModes(); createTableLogs(); createTableClubLogStatus(); populateTableClubLogStatus(); /* query.exec("CREATE TABLE sat_modes (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "name VARCHAR(15) NOT NULL," "uplink INTEGER NOT NULL," "downlink INTEGER NOT NULL," "FOREIGN KEY (uplink) REFERENCES band, " "FOREIGN KEY (downlink) REFERENCES band)"); //http://en.wikipedia.org/wiki/OSCAR#Mode_designators //query.exec("INSERT INTO sat_modes (name, uplink, downlink) VALUES ('H', '15M', '148', '144')"); query.exec("CREATE TABLE sat_modes (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(8) NOT NULL, " "uplink VARCHAR(8) NOT NULL, " "downlink VARCHAR(55) NOT NULL)"); query.exec("CREATE TABLE sat_modes (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "name VARCHAR(15) NOT NULL," "uplink INTEGER NOT NULL," "downlink INTEGER NOT NULL," "FOREIGN KEY (uplink) REFERENCES band, " "FOREIGN KEY (downlink) REFERENCES band)"); */ /* qry.prepare( "INSERT INTO names (id, firstname, lastname) VALUES (:id, :firstname, :lastname)" ); qry.bindValue( ":id", 9 ); qry.bindValue( ":firstname", "Ralph" ); qry.bindValue( ":lastname", "Roe" ); query.prepare("INSERT INTO qsl_sent_status (shortname, name) VALUES (:shortname, :name)"); query.bindValue(":shortname", "Y"); query.bindValue(":name", "Yes"); query.prepare("INSERT INTO qsl_sent_status (shortname, name) VALUES (:shortname, :name)"); query.bindValue(":shortname", "N"); query.bindValue(":name", "No"); query.exec(); */ query.exec("INSERT INTO qsl_sent_status (shortname, name) VALUES ('Y', 'Yes')"); query.exec("INSERT INTO qsl_sent_status (shortname, name) VALUES ('N', 'No')"); query.exec("INSERT INTO qsl_sent_status (shortname, name) VALUES ('R', 'Requested')"); query.exec("INSERT INTO qsl_sent_status (shortname, name) VALUES ('Q', 'Queued')"); query.exec("INSERT INTO qsl_sent_status (shortname, name) VALUES ('I', 'Ignore/Invalid')"); query.exec("INSERT INTO qsl_rec_status (shortname, name) VALUES ('Y', 'Yes')"); query.exec("INSERT INTO qsl_rec_status (shortname, name) VALUES ('N', 'No')"); query.exec("INSERT INTO qsl_rec_status (shortname, name) VALUES ('R', 'Requested')"); query.exec("INSERT INTO qsl_rec_status (shortname, name) VALUES ('I', 'Ignore/Invalid')"); query.exec("INSERT INTO qsl_rec_status (shortname, name) VALUES ('V', 'Validated')"); query.exec("INSERT INTO continent (shortname, name) VALUES ('AF', 'Africa')"); query.exec("INSERT INTO continent (shortname, name) VALUES ('AS', 'Asia')"); query.exec("INSERT INTO continent (shortname, name) VALUES ('EU', 'Europe')"); query.exec("INSERT INTO continent (shortname, name) VALUES ('NA', 'North America')"); query.exec("INSERT INTO continent (shortname, name) VALUES ('OC', 'Oceania')"); query.exec("INSERT INTO continent (shortname, name) VALUES ('SA', 'South America')"); query.exec("INSERT INTO continent (shortname, name) VALUES ('AN', 'Antartica')"); populateContestData(); populatePropagationModes(); //To add a mode, just create another line: query.exec("INSERT INTO ant_path_enumeration (shortname, name) VALUES ('G', 'GrayLine')"); query.exec("INSERT INTO ant_path_enumeration (shortname, name) VALUES ('O', 'Other')"); query.exec("INSERT INTO ant_path_enumeration (shortname, name) VALUES ('S', 'ShortPath')"); query.exec("INSERT INTO ant_path_enumeration (shortname, name) VALUES ('L', 'LongPath')"); query.exec("INSERT INTO arrl_sect_enumeration (shortname, name) VALUES ('AL', 'Alabama')"); query.exec("INSERT INTO award_enumeration (name) VALUES ('AJA')"); query.exec("INSERT INTO award_enumeration (name) VALUES ('CQDX')"); query.exec("INSERT INTO award_enumeration (name) VALUES (CQDXFIELD')"); query.exec("INSERT INTO award_enumeration (name) VALUES (DXCC')"); query.exec("INSERT INTO award_enumeration (name) VALUES (TPEA')"); query.exec("INSERT INTO qsl_via (shortname, name) VALUES ('B', 'Bureau')"); query.exec("INSERT INTO qsl_via (shortname, name) VALUES ('D', 'Direct')"); query.exec("INSERT INTO qsl_via (shortname, name) VALUES ('E', 'Electronic')"); query.exec("INSERT INTO qsl_via (shortname, name) VALUES ('M', 'Manager')"); query.exec("INSERT INTO qso_complete_enumeration (shortname, name) VALUES ('Y', 'Yes')"); query.exec("INSERT INTO qso_complete_enumeration (shortname, name) VALUES ('N', 'No')"); query.exec("INSERT INTO qso_complete_enumeration (shortname, name) VALUES ('NIL', 'Not heard')"); query.exec("INSERT INTO qso_complete_enumeration (shortname, name) VALUES ('?', 'Uncertain')"); return true; } int DataBase::getBandIdFromName(const QString b) { //qDebug() << "DataBase::getBandIdFromName: " << b << endl; QSqlQuery query; if (isValidBand(b)) { QString queryString = QString("SELECT id FROM band WHERE name='%1'").arg(b); query.exec(queryString); query.next(); if ( query.isValid() ) { //qDebug() << "DataBase::getBandIdFromName: OK" << QString::number((query.value(0)).toInt()) << endl; return (query.value(0)).toInt(); } else { //qDebug() << "DataBase::getBandIdFromName: NOK 1" << endl; return -1; } } else { //qDebug() << "DataBase::getBandIdFromName: NOK 2" << endl; return -1; } //qDebug() << "DataBase::getBandIdFromName: NOK 3" << endl; return -1; } int DataBase::getModeIdFromName(const QString b) { //qDebug() << "DataBase::getModeIdFromName: " << b << endl; QSqlQuery query; if (isValidMode(b, false)) { QString queryString = QString("SELECT id FROM mode WHERE name='%1'").arg(b); //qDebug() << "DataBase::getModeIdFromName: queryString: " << queryString << endl; query.exec(queryString); query.next(); if ( query.isValid() ) { //qDebug() << "DataBase::getModeIdFromName: OK" << QString::number((query.value(0)).toInt()) << endl; return (query.value(0)).toInt(); } else { //qDebug() << "DataBase::getModeIdFromName: NOK 1" << endl; return -1; } } else { //qDebug() << "DataBase::getModeIdFromName: NOK 2" << endl; return -1; } //qDebug() << "DataBase::getModeIdFromName: NOK 3" << endl; return -1; } int DataBase::getModeIdFromSubMode(const QString b, const bool _tmp) { //qDebug() << "DataBase::getModeIdFromSubMode: " << b << endl; QSqlQuery query; QString queryString; if (_tmp) { queryString = QString("SELECT id FROM modetemp WHERE submode='%1'").arg(b); } else { queryString = QString("SELECT id FROM mode WHERE submode='%1'").arg(b); } if (isValidMode(b, _tmp)) { //queryString = QString("SELECT id FROM mode WHERE name='%1'").arg(b); //qDebug() << "DataBase::getModeIdFromName: queryString: " << queryString << endl; query.exec(queryString); query.next(); if ( query.isValid() ) { //qDebug() << "DataBase::getModeIdFromName: OK" << QString::number((query.value(0)).toInt()) << endl; return (query.value(0)).toInt(); } else { //qDebug() << "DataBase::getModeIdFromName: NOK 1" << endl; return -1; } } else { //qDebug() << "DataBase::getModeIdFromName: NOK 2" << endl; return -1; } //qDebug() << "DataBase::getModeIdFromName: NOK 3" << endl; return -1; } QString DataBase::getBandNameFromNumber(const int _n) { //qDebug() << "DataBase::getBandNameFromNumber: " << QString::number(_n) << endl; QSqlQuery query; QString queryString = QString("SELECT name FROM band WHERE id='%1'").arg(_n); query.exec(queryString); query.next(); if ( query.isValid() ) { if ( isValidBand((query.value(0)).toString()) ) { return (query.value(0)).toString(); } else { return ""; } } else { return ""; } } QString DataBase::getModeNameFromNumber(const int _n, const bool _tmp) { //FALLA AL IDENTIFICAR EL SUBMODO MODO, MODETEMP... (Revisar STEP-2 o 3) //qDebug() << "DataBase::getModeNameFromNumber: " << QString::number(_n) << endl; QSqlQuery query; QString queryString; if (_tmp) { queryString = QString("SELECT name FROM modetemp WHERE id='%1'").arg(_n); } else { queryString = QString("SELECT name FROM mode WHERE id='%1'").arg(_n); } query.exec(queryString); query.next(); //qDebug() << "DataBase::getModeNameFromNumber: " << QString::number(_n) <<" - " << isValidMode((query.value(0)).toString(), _tmp) << endl; if ( query.isValid() ) { return (query.value(0)).toString(); /* In a version when I change the mode table to include submode, this comparison may need to be checked in both versions * at once, failing the query as old version was not having the column submode * if ( isValidMode((query.value(0)).toString(), _tmp)) { //qDebug() << "DataBase::getModeNameFromNumber - Found: " << (query.value(0)).toString() << endl; return (query.value(0)).toString(); } else { //qDebug() << "DataBase::getModeNameFromNumber - Not Valid Mode: " << (query.value(0)).toString() << endl; return ""; } */ } else { //qDebug() << "DataBase::getModeNameFromNumber - Not Valid record" << endl; return ""; } } QString DataBase::getSubModeNameFromNumber(const int _n, const bool _tmp) { //qDebug() << "DataBase::getSubModeNameFromNumber: " << QString::number(_n) << endl; QSqlQuery query; QString queryString; if (_tmp) { queryString = QString("SELECT submode FROM modetemp WHERE id='%1'").arg(_n); } else { queryString = QString("SELECT submode FROM mode WHERE id='%1'").arg(_n); } bool sqlOk = query.exec(queryString); //qDebug() << "DataBase::getSubModeNameFromNumber - query: " << query.lastQuery() << endl; if (sqlOk) { if (query.next()) { if ( query.isValid() ) { if ( isValidMode((query.value(0)).toString(), _tmp) ) { //qDebug() << "DataBase::getSubModeNameFromNumber: RETURN: " << (query.value(0)).toString() << endl; return (query.value(0)).toString(); } else { //qDebug() << "DataBase::getSubModeNameFromNumber: NO valid mode " << endl; return ""; } } else { //qDebug() << "DataBase::getSubModeNameFromNumber: query not valid" << endl; return ""; } } else { //qDebug() << "DataBase::getSubModeNameFromNumber: query not next" << endl; return ""; } } else { //qDebug() << "DataBase::getSubModeNameFromNumber: SQL FALSE" << endl; return ""; } return ""; } bool DataBase::isValidBand (const QString b) { if (b.length()<1) { return false; } QString stringQuery = QString("SELECT id FROM band WHERE name='%1'").arg(b); QSqlQuery query(stringQuery); query.next(); return query.isValid(); } bool DataBase::isValidMode (const QString b, const bool _tmp) { //qDebug() << "DataBase::isValidMode: " << b << endl; QString stringQuery; if (b.length()<2) { //qDebug() << "DataBase::isValidMode: (length<2) FALSE" << endl; return false; } if (_tmp) { stringQuery = QString("SELECT id FROM modetemp WHERE submode='%1'").arg(b); } else { stringQuery = QString("SELECT id FROM mode WHERE submode='%1'").arg(b); } stringQuery = QString("SELECT id FROM mode WHERE submode='%1'").arg(b); QSqlQuery query(stringQuery); query.next(); return query.isValid(); } bool DataBase::isValidBandNumber (const int b) { return isValidBand(getBandNameFromNumber(b)); } bool DataBase::isValidModeNumber (const int b) { return isValidMode(getModeNameFromNumber(b, false), false); } int DataBase::getBandIdFromFreq(const QString fr) { //qDebug() << "DataBase::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(fr).arg(fr); QSqlQuery query(queryString); sqlOk = query.exec(); //qDebug() << "DataBase::getBandIdFromFreq: Query: " << query.lastQuery() << endl; if (sqlOk) { //qDebug() << "DataBase::getBandIdFromFreq: Query OK" << endl; query.next(); if (query.isValid()) { return (query.value(0)).toInt(); } else { return -1; } } else { //qDebug() << "DataBase::getBandIdFromFreq: Query NOK" << endl; return -1; } return -1; } bool DataBase::isThisFreqInBand(const QString b, const QString fr) {//Freq should be in MHz //qDebug() << "DataBase::isThisFreqInBand: " << b << "/" << fr << endl; int bandNf = getBandIdFromFreq(fr); int bandN = getBandIDFromName2(b); //qDebug() << "DataBase::isThisFreqInBand: (b/f)" << QString::number(bandN) << "/" << QString::number(bandNf) << endl; if (bandNf == bandN) { //qDebug() << "DataBase::isThisFreqInBand: OK " << b << "/" << fr << endl; return true; } else { //qDebug() << "DataBase::isThisFreqInBand: NOK " << b << "/" << fr << endl; return false; } return false; } bool DataBase::unMarkAllQSO() { QString stringQuery = QString("UPDATE log SET marked = 'N' WHERE 1"); QSqlQuery query(stringQuery); //qDebug() << "MainWindow::slotQSLSentViaBureauFromLog: " << stringQuery << endl; //query.exec(stringQuery); //TODO: Check if the execution of this query is OK or NOK (should return false) return true; } bool DataBase::updateIfNeeded() { //qDebug() << "DataBase::updateIfNeeded - Version: " << QString::number(dbVersion) << endl; /************************************************************************************** * This function should call to bool updateToXXX () being XXX dbVersion and * */ float aux = 0.0; int nameCol; int errorCode = -1; bool toBeUpdated = false; bool sqlOK; QString dateString; QString SQLString, auxs; QStringList SQLStrings; SQLStrings.clear(); QSqlQuery query("SELECT dbversion FROM softwarecontrol"); QSqlRecord rec = query.record(); while ( (query.next())) { // We run the DB to find what is the latest DB version updated. if (query.isValid()) { nameCol = rec.indexOf("dbversion"); aux = (query.value(nameCol)).toFloat(); //qDebug() << "DataBase::updateIfNeeded - Version found: " << QString::number(aux) << endl; if (aux > latestReaded) { latestReaded = aux; } else { } } else { } } if (latestReaded >= dbVersion) { // DB is updated, no update is needed //qDebug() << "DataBase::updateIfNeeded - DB updated (no need to update anything!) " << endl; toBeUpdated = false; return true; } else { // DB is outdated. We need to update!! //qDebug() << "DataBase::updateIfNeeded - DB outdated... upgrade starts now! " << endl; QMessageBox msgBox; msgBox.setText( QObject::tr("KLog DB needs to be upgraded.")); msgBox.setInformativeText( QObject::tr("Do you want to upgrade it now?\nIf DB is not upgraded KLog may not work properly.")); msgBox.setStandardButtons(QMessageBox::Apply | QMessageBox::Discard); msgBox.setDefaultButton(QMessageBox::Apply); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Apply: // Save was clicked updateToLatest(); break; case QMessageBox::Discard: // Discard was clicked break; default: // should never be reached return false; break; } } // If the DB needs to be updated... we update it! :-) //qDebug() << "DataBase::updateIfNeeded - END!" << endl; return true; } bool DataBase::createTheBandQuickReference() { /* KEY Value QHash bandIDHash; QHash modeIDHash; QHash IDBandHash; QHash IDModeHash QHash freqBandIdHash; */ //qDebug() << "DataBase::createTheBandQuickReference: " << endl; QString st = "NULL"; int in = 0; QString fr = 0; bandIDHash.clear(); IDBandHash.clear(); QSqlQuery query("SELECT id, name, lower FROM band"); while (query.next()) { if (query.isValid()) { st = (query.value(1)).toString(); in = (query.value(0)).toInt(); fr = (query.value(2)).toString(); bandIDHash.insert(st, in ); IDBandHash.insert(in, st); freqBandIdHash.insert(in, fr); //qDebug() << "DataBase::createTheBandQuickReference: " << st <<"/" << QString::number(in)<< endl; } else { //qDebug() << "DataBase::createTheBandQuickReference: Query not valid -'RETURN FALSE" << endl; // QMessageBox::warning(0, QObject::tr("Database Error (DataBase::createTheBandQuickReference)"), // query.lastError().text()); return false; //TODO: Manage this error, in case the query is NOK. } } /* QHashIterator i(bandIDHash); while (i.hasNext()) { i.next(); //qDebug() << i.key() << ": " << QString::number(i.value()) << endl; } */ return true; } bool DataBase::createTheModeQuickReference() { /* KEY Value QHash modeIDHash; QHash IDModeHash */ //qDebug() << "DataBase::createTheModeQuickReference: " << endl; QString st = "NULL"; int in = 0; modeIDHash.clear(); IDModeHash.clear(); QSqlQuery query("SELECT id, submode FROM mode"); while (query.next()) { if (query.isValid()) { st = (query.value(1)).toString(); in = (query.value(0)).toInt(); modeIDHash.insert(st, in ); IDModeHash.insert(in, st); //qDebug() << "DataBase::createTheModeQuickReference: " << st <<"/" << QString::number(in)<< endl; } else { //qDebug() << "DataBase::createTheModeQuickReference: Query not valid" << endl; //QMessageBox::warning(0, QObject::tr("Database Error (DataBase::createTheModeQuickReference)"), // query.lastError().text()); return false; //TODO: Manage this error, in case the query is NOK. } } /* QHashIterator i(modeIDHash); while (i.hasNext()) { i.next(); //qDebug() << i.key() << ": " << QString::number(i.value()) << endl; } */ return true; } int DataBase::getBandIDFromName2(const QString b) {//KEY, value //name, id /* KEY Value QHash bandIDHash; QHash modeIDHash; QHash IDBandHash; QHash IDModeHash */ //qDebug() << "DataBase::getBandIDFromName2: " << b << endl; return getBandIdFromName(b); if (b.length()<1) { return -3; } if (bandIDHash.contains(b)) { //qDebug() << "DataBase::getBandIDFromName2: " << b << ":" << bandIDHash.value(b) << endl; return bandIDHash.value(b); } else { //qDebug() << "DataBase::getBandIDFromName2: Contains - False" << endl; return -1; } //qDebug() << "DataBase::getBandIDFromName2: Safety exit" << endl; return -2; } int DataBase::getModeIDFromName2(const QString b) { //qDebug() << "DataBase::getModeIDFromName2: " << b << endl; //return getModeIdFromName(b); if (b.length()<2) { return -3; } if (modeIDHash.contains(b)) { //qDebug() << "DataBase::getModeIDFromName2: " << b << ":" << modeIDHash.value(b) << endl; return modeIDHash.value(b); } else { //qDebug() << "DataBase::getModeIDFromName2: Contains - False" << endl; return -1; } //qDebug() << "DataBase::getModeIDFromName2: Safety exit" << endl; return -2; } QString DataBase::getBandNameFromID2(const int _i) { //qDebug() << "DataBase::getBandNameFromid2: " << QString::number(_i) << endl; //return getBandNameFromNumber(_i); if (IDBandHash.contains(_i)) { return IDBandHash.value(_i); } else { return "-1"; } return "-2"; } QString DataBase::getModeNameFromID2(const int _i) { //qDebug() << "DataBase::getModeNameFromId2: " << QString::number(_i) << endl; //return getSubModeNameFromNumber(_i); if (IDModeHash.contains(_i)) { return IDModeHash.value(_i); } else { return "-1"; } return "-2"; } bool DataBase::createBandModeMaps() { //qDebug() << "DataBase::createBandModeMaps" << endl; //bool b = createTheBandQuickReference(); //bool m = createTheModeQuickReference(); //return (b && m); if (isTheDBCreated()) { //qDebug() << "DataBase::createBandModeMaps - isDbCreated TRUE" << endl; return (createTheBandQuickReference() && createTheModeQuickReference()); } else { //qDebug() << "DataBase::createBandModeMaps - isDbCreated FALSE" << endl; return false; } } QString DataBase::getFreqFromBandId(const int _i) { if (freqBandIdHash.contains(_i)) { return freqBandIdHash.value(_i); } else { return "-1.0"; } return "-2.0"; } bool DataBase::updateToLatest() { /* * With the DB updates, the function that is called from here should be also updated. * The updateXXX are recursive calls that calls the previous one. * */ //qDebug() << "DataBase::updateToLatest-006 " << endl; return updateTo007(); } bool DataBase::updateTo003() {// Updates the DB to 0.0.3 /* * This function should be used as a template to create the all the update functions implementing the needed changes * in the dB to update from one version to the following one. * * // dbVersion shows the DB version that is being deployed * // latestReaded shows the DB version that is currently deployed. *i.e.: * QString stringQuery = QString ("ALTER TABLE award_enumeration ADD COLUMN dxcc INTEGER;"); * */ //qDebug() << "DataBase::updateTo003" << endl; bool IAmIn003 = false; bool IAmIn002 = false; bool ErrorUpdating = false; if (latestReaded >= 0.003) { //IAmIn003 = true; return true; } else { IAmIn003 = false; } while (!IAmIn003 && !ErrorUpdating) { while (!IAmIn002 && !ErrorUpdating) { //IAmIn002 = updateTo002(); IAmIn002 = true; } if (ErrorUpdating) { return false; } //DO ALL THE TASKS TO BE IN 0.003 from 0.002 HERE and set ErrorUpdating if it is not possible. IAmIn003 = true; } return IAmIn003; } bool DataBase::updateTo004() {// Updates the DB to 0.0.4 //qDebug() << "DataBase::updateTo004" << endl; bool IAmIn004 = false; bool IAmIn003 = false; bool ErrorUpdating = false; QString stringQuery = QString(); QString dateString = (date.currentDateTime()).toString("yyyyMMdd"); QSqlQuery query; bool sqlOk = false; if (latestReaded >= 0.004) { //qDebug() << "DataBase::updateTo004: - I am in 004" << endl; return true; } else { //qDebug() << "DataBase::updateTo004: - I am not in 004" << endl; IAmIn004 = false; } while (!IAmIn004 && !ErrorUpdating) { while (!IAmIn003 && !ErrorUpdating) { //qDebug() << "DataBase::updateTo004: - And I am not in 003" << endl; //IAmIn002 = updateTo002(); IAmIn003 = true; } if (ErrorUpdating) { return false; } sqlOk = query.exec("INSERT INTO softwarecontrol (dateupgrade, softversion, dbversion) VALUES ('" + dateString + "', '" + softVersion + "', '" + QString::number(dbVersion) + "')"); if (sqlOk) { // Version updated sqlOk = query.exec("DROP TABLE award_enumeration"); } else { // Version not updated } //DO ALL THE TASKS TO BE IN 0.004 from 0.003 HERE and set ErrorUpdating if it is not possible. IAmIn004 = true; } return IAmIn004; } bool DataBase::updateTo005() {// Updates the DB to 0.0.5 //qDebug() << "DataBase::updateTo005" << endl; bool IAmIn005 = false; bool IAmIn004 = false; bool ErrorUpdating = false; QString stringQuery = QString(); QString dateString = (date.currentDateTime()).toString("yyyyMMdd"); QSqlQuery query; QMessageBox msgBox; msgBox.setIcon(QMessageBox::Information); int errorCode; bool sqlOk = false; if (latestReaded >= 0.005) { //qDebug() << "DataBase::updateTo005 - Already in 005" << endl; return true; } else { //qDebug() << "DataBase::updateTo005 - 005 update false" << endl; IAmIn005 = false; } while (!IAmIn005 && !ErrorUpdating) { //qDebug() << "DataBase::updateTo005 - I am not in 005" << endl; while (!IAmIn004 && !ErrorUpdating) { //qDebug() << "DataBase::updateTo005 - I am not in 004" << endl; IAmIn004 = updateTo004(); } //qDebug() << "DataBase::updateTo005 - I am in 004" << endl; if (ErrorUpdating) { //qDebug() << "DataBase::updateTo005 - 005 update false2" << endl; return false; } sqlOk = query.exec("INSERT INTO softwarecontrol (dateupgrade, softversion, dbversion) VALUES ('" + dateString + "', '" + softVersion + "', '" + QString::number(dbVersion) + "')"); if (sqlOk) { // Version updated if (recreateContestData()) { //qDebug() << "DataBase::updateTo005 - recreateContestData OK" << endl; sqlOk = query.exec ("DROP table logs"); sqlOk = createTableLogs(); if (!sqlOk) { //qDebug() << "DataBase::updateTo005 - logs table do not created" << endl; } if (howManyQSOsInLog(0)>0) { // If the user has QSOs that were added with previous versions... // We need to create a new log and rename all QSOs to that QSO. //stringQuery = QString("UPDATE log SET lognumber='1' WHERE lognumber='0'"); msgBox.setText(QObject::tr("KLog has detected a previous log in the DB. All data will be migrated to a newly created DX type log for you.")); msgBox.exec(); if (query.exec("UPDATE log SET lognumber='1' WHERE lognumber='0'")) {} else { //showError(QObject::tr("QSOs not updated to main log")); //qDebug() << "DataBase::updateTo005 - QSOs not updated to main log" << endl; errorCode = query.lastError().number(); //qDebug() << "DataBase::updateTo005 - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataBase::updateTo005: LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataBase::updateTo005: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "DataBase::updateTo005: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "DataBase::updateTo005: LastError-n: " << QString::number(query.lastError().number() ) << endl; } QString dateString = (QDate::currentDate()).toString("yyyy/MM/dd"); QString callToUse = QString(); bool ok; //QString text; //text = QInputDialog::getText(this, QObject::tr("Station Callsign"), QObject::tr("Enter the Station Callsign you want to use in the imported log:"), QLineEdit::Normal, QObject::tr("N0CALL"), &ok); QString text = (QInputDialog::getText(0, QObject::tr("KLog: Enter Station callsign"), QObject::tr("Enter the station callsign used in this log"), QLineEdit::Normal, QObject::tr("Station Callsign"), &ok)).toUpper(); text.toUpper(); if (ok && !text.isEmpty()) { callToUse = text; } else { callToUse = "N0CALL"; } stringQuery = QString("INSERT INTO logs (logdate, stationcall, logtype, logtypen) values('%1','%2','DX', '1')").arg(dateString).arg(callToUse); if (query.exec(stringQuery)) { } else { //showError(QObject::tr("New Log not created")); //qDebug() << "DataBase::updateTo005 - New Log not created" << endl; //qDebug() << "DataProxy_SQLite::clearLog: Log deleted FAILED" << endl; errorCode = query.lastError().number(); //qDebug() << "DataBase::updateTo005a - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataBase::updateTo005a: LastQuery: " << query.lastQuery() << endl; //qDebug() << "DataBase::updateTo005a: LastError-data: " << query.lastError().databaseText() << endl; //qDebug() << "DataBase::updateTo005a: LastError-driver: " << query.lastError().driverText() << endl; //qDebug() << "DataBase::updateTo005a: LastError-n: " << QString::number(query.lastError().number() ) << endl; } } else { } IAmIn005 = true; } else { //qDebug() << "DataBase::updateTo005 - recreateContestData FAILED" << endl; ErrorUpdating = true; } } else { // Version not updated //qDebug() << "DataBase::updateTo005 - 005 update false6" << endl; ErrorUpdating = true; } } //qDebug() << "DataBase::updateTo005 - 005 updated 3" << endl; //TODO: Delete the table and recreate it if (IAmIn005) { msgBox.setText(QObject::tr("All the data was migrated correctly. You should now to go to Setup->Preferences->Logs to check that everything is OK.")); msgBox.exec(); } //qDebug() << "DataBase::updateTo005 - I am in 005 already!! " << endl; return IAmIn005; } bool DataBase::recreateContestData() { QSqlQuery query; bool sqlOk = false; sqlOk = query.exec("DROP TABLE contest"); if (sqlOk) { if (createTableContest()) { return populateContestData(); } } return false; } bool DataBase::updateLog() { //qDebug() << "DataBase::updateLog" << endl; QSqlQuery query; bool sqlOk = false; return sqlOk; } bool DataBase::createTableLogs() { QSqlQuery query; return query.exec("CREATE TABLE logs (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "logdate VARCHAR(10), " "stationcall VARCHAR(15) NOT NULL, " "comment VARCHAR, " "logtype VARCHAR, " "logtypen INTEGER, " "FOREIGN KEY (logtypen) REFERENCES supportedcontests(id)," "FOREIGN KEY (logtype) REFERENCES supportedcontests(name))"); } bool DataBase::createTablePropModes() { QSqlQuery query; return query.exec("CREATE TABLE prop_mode_enumeration (id INTEGER PRIMARY KEY AUTOINCREMENT, shortname VARCHAR(8), name VARCHAR(55) )"); } bool DataBase::createTableContest() { QSqlQuery query; query.exec("CREATE TABLE contest (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "contest INTEGER NOT NULL," "catoperator INTEGER NOT NULL," "catassisted INTEGER NOT NULL," "catpower INTEGER NOT NULL," "catband INTEGER NOT NULL," "catoverlay INTEGER NOT NULL," "catmode INTEGER NOT NULL," "FOREIGN KEY (contest) REFERENCES supportedcontests(id), " "FOREIGN KEY (catoperator) REFERENCES contestcatoperator(id), " "FOREIGN KEY (catassisted) REFERENCES contestcatassisted(id), " "FOREIGN KEY (catpower) REFERENCES contestcatpower(id), " "FOREIGN KEY (catband) REFERENCES contestcatband(id), " "FOREIGN KEY (catoverlay) REFERENCES contestcatoverlay(id), " "FOREIGN KEY (catmode) REFERENCES contestcatmode(id))"); query.exec("CREATE TABLE supportedcontests (" "id INTEGER PRIMARY KEY, " "longname VARCHAR," "name VARCHAR)"); query.exec("CREATE TABLE contestcatoperator (" "id INTEGER PRIMARY KEY, " "name VARCHAR)"); query.exec("CREATE TABLE contestcatassisted (" "id INTEGER PRIMARY KEY, " "name VARCHAR)"); query.exec("CREATE TABLE contestcatpower (" "id INTEGER PRIMARY KEY, " "name VARCHAR)"); query.exec("CREATE TABLE contestcatband (" "id INTEGER PRIMARY KEY, " "name VARCHAR)"); query.exec("CREATE TABLE contestcatoverlay (" "id INTEGER PRIMARY KEY, " "name VARCHAR)"); query.exec("CREATE TABLE contestcatmode (" "id INTEGER PRIMARY KEY, " "name VARCHAR)"); // ADDING ALL THE CATEGORIES OPTIONS query.exec("INSERT INTO supportedcontests (id, longname, name) VALUES ('0', 'Normal log', 'DX')"); // query.exec("INSERT INTO supportedcontests (id, longname, name) VALUES ('1', 'CQ WW DX Contest(SSB)', 'CQ-WW-SSB')"); query.exec("INSERT INTO contestcatoperator (id, name) VALUES ('0', 'N/A')"); query.exec("INSERT INTO contestcatoperator (id, name) VALUES ('1', 'Single-Operator')"); query.exec("INSERT INTO contestcatoperator (id, name) VALUES ('2', 'Multi-One')"); query.exec("INSERT INTO contestcatoperator (id, name) VALUES ('3', 'Multi-Two')"); query.exec("INSERT INTO contestcatoperator (id, name) VALUES ('4', 'Multi-Unlimited')"); query.exec("INSERT INTO contestcatoperator (id, name) VALUES ('5', 'CheckLog')"); query.exec("INSERT INTO contestcatassisted (id, name) VALUES ('0', 'N/A')"); query.exec("INSERT INTO contestcatassisted (id, name) VALUES ('1', 'Non-Assisted')"); query.exec("INSERT INTO contestcatassisted (id, name) VALUES ('2', 'Assisted')"); query.exec("INSERT INTO contestcatpower (id, name) VALUES ('0', 'N/A')"); query.exec("INSERT INTO contestcatpower (id, name) VALUES ('1', 'High-Power')"); query.exec("INSERT INTO contestcatpower (id, name) VALUES ('2', 'Low-Power')"); query.exec("INSERT INTO contestcatpower (id, name) VALUES ('3', 'QRP')"); query.exec("INSERT INTO contestcatband (id, name) VALUES ('0', 'N/A')"); query.exec("INSERT INTO contestcatband (id, name) VALUES ('1', 'All-Band')"); query.exec("INSERT INTO contestcatband (id, name) VALUES ('2', 'Single-Band')"); query.exec("INSERT INTO contestcatoverlay (id, name) VALUES ('0', 'N/A')"); query.exec("INSERT INTO contestcatoverlay (id, name) VALUES ('1', 'Classic')"); query.exec("INSERT INTO contestcatoverlay (id, name) VALUES ('2', 'Rookie')"); query.exec("INSERT INTO contestcatmode (id, name) VALUES ('0', 'N/A')"); query.exec("INSERT INTO contestcatmode (id, name) VALUES ('1', 'SSB')"); query.exec("INSERT INTO contestcatmode (id, name) VALUES ('2', 'CW')"); query.exec("INSERT INTO contestcatmode (id, name) VALUES ('3', 'MIXED')"); return true; } bool DataBase::createTableMode(const bool NoTmp) { // NoTmp = false => TMP data table to operate and be deleted afterwards QString stringQuery = QString(); QSqlQuery query; if (NoTmp) { stringQuery = "CREATE TABLE mode" ; } else { stringQuery = "CREATE TABLE modetemp" ; } stringQuery = stringQuery + QString(" (id INTEGER PRIMARY KEY AUTOINCREMENT, " "cabrillo VARCHAR(2) NOT NULL, " "name VARCHAR(40) NOT NULL, " "submode VARCHAR(40) NOT NULL, " "deprecated VARCHAR(1) NOT NULL)"); return query.exec(stringQuery); } bool DataBase::populateTableMode(const bool NoTmp) { QSqlQuery query; QString tableName = QString(); QString squery = QString(); if (NoTmp) { tableName = "mode"; } else { tableName = "modetemp"; } //query.exec("INSERT INTO mode (submode, name, cabrillo, deprecated) VALUES ('AM', 'AM', 'PH', '0')"); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('AM', 'AM', 'PH', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('AMTORFEC', 'TOR', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('ASCI', 'RTTY', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('ATV', 'ATV', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('CHIP', 'CHIP', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('CHIP64', 'CHIP', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('CHIP128', 'CHIP', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('CLO', 'CLO', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('CONTESTI', 'CONTESTI', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('CW', 'CW', 'CW', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('DIGITALVOICE', 'DIGITALVOICE', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('DSTAR', 'DSTAR', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('DOMINO', 'DOMINO', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('DOMINOEX', 'DOMINO', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('DOMINOF', 'DOMINO', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('FAX', 'FAX', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('FM', 'FM', 'PH', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('FMHELL', 'HELL', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('FSK31', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('FSK441', 'FSK441', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('FSKHELL', 'HELL', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('GTOR', 'TOR', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('HELL', 'HELL', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('HELL80', 'HELL', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('HFSK', 'HELL', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('ISCAT', 'ISCAT', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('ISCAT-A', 'ISCAT', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('ISCAT-B', 'ISCAT', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT4', 'JT4', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT4A', 'JT4', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT4B', 'JT4', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT4C', 'JT4', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT4D', 'JT4', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT4E', 'JT4', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT4F', 'JT4', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT4G', 'JT4', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT6M', 'JT6M', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT9-1', 'JT9', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT9-2', 'JT9', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT9-5', 'JT9', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT9-10', 'JT9', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT9-30', 'JT9', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT44', 'JT44', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT65', 'JT65', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT65A', 'JT65', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT65B', 'JT65', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT65B2', 'JT65', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT65C', 'JT65', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('JT65C2', 'JT65', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK', 'MFSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK4', 'MFSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK8', 'MFSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK11', 'MFSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK16', 'MFSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK22', 'MFSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK31', 'MFSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK32', 'MFSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK64', 'MFSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MFSK128', 'MFSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('MT63', 'MT63', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OLIVIA', 'OLIVIA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OLIVIA 4/125', 'OLIVIA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OLIVIA 4/250', 'OLIVIA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OLIVIA 8/250', 'OLIVIA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OLIVIA 8/500', 'OLIVIA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OLIVIA 16/500', 'OLIVIA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OLIVIA 16/1000', 'OLIVIA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OLIVIA 32/1000', 'OLIVIA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OPERA', 'OPERA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OPERA-BEACON', 'OPERA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('OPERA-QSO', 'OPERA', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PAC', 'PAC', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PAC2', 'PAC', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PAC3', 'PAC', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PAC4', 'PAC', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PAX', 'PAX', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PAX2', 'PAX', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PCW', 'CW', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PKT', 'PKT', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK', 'PSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK10', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK31', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK63', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK63F', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK125', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK250', 'PSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK500', 'PSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK1000', 'PSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSKAM10', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSKAM31', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSKAM50', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSKFEC31', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSK2K', 'PSK2K', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('PSKHELL', 'HELL', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('Q15', 'Q15', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('QPSK31', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('QPSK63', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('QPSK125', 'PSK', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('QPSK250', 'PSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('QPSK500', 'PSK', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('ROS', 'ROS', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('ROS-EME', 'ROS', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('ROS-HF', 'ROS', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('ROS-MF', 'ROS', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('RTTY', 'RTTY', 'RY', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('RTTYM', 'RTTYM', 'RY', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('SSB', 'SSB', 'PH', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('LSB', 'SSB', 'PH', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('USB', 'SSB', 'PH', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('SSTV', 'SSTV', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('THRB', 'THRB', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('THRBX', 'THRB', 'NO', '1')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('THOR', 'THOR', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('TOR', 'TOR', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('V4', 'V4', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('VOI', 'VOI', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('WINMOR', 'WINMOR', 'NO', '0')").arg(tableName)); query.exec(QString("INSERT INTO %1 (submode, name, cabrillo, deprecated) VALUES ('WSPR', 'WSPR', 'NO', '0')").arg(tableName)); createTheModeQuickReference(); return true; } bool DataBase::createTableBand(const bool NoTmp) { // NoTmp = false => TMP data table to operate and be deleted afterwards QString stringQuery = QString(); QSqlQuery query; if (NoTmp) { stringQuery = "CREATE TABLE band" ; } else { stringQuery = "CREATE TABLE bandtemp" ; } /* qres = query.exec("CREATE TABLE band (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "lower REAL NOT NULL, " "upper REAL NOT NULL, " "cabrillo VARCHAR(6) NOT NULL, " "name VARCHAR(40) NOT NULL, " "UNIQUE (lower, upper, cabrillo, name) )"); */ stringQuery = stringQuery + QString(" (id INTEGER PRIMARY KEY AUTOINCREMENT, " "lower REAL NOT NULL, " "upper REAL NOT NULL, " "cabrillo VARCHAR(6) NOT NULL, " "name VARCHAR(40) NOT NULL, " "UNIQUE (lower, upper, cabrillo, name) )"); return query.exec(stringQuery); } bool DataBase::populateTableBand(const bool NoTmp) { // Cabrillo definition: http://wwrof.org/cabrillo/cabrillo-specification-v3/ QSqlQuery query; QString tableName = QString(); QString squery = QString(); if (NoTmp) { tableName = "band"; } else { tableName = "bandtemp"; } //To add a band, just create another line: query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('0', '0', '0', 'Light')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('1mm', '241000', '250000', '241G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('2mm', '142000', '149000', '142G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('2.5mm', '119980', '120020', '119G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('4mm', '75500', '81000', '75G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('6mm', '47000', '47200', '47G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('1.25CM', '24000', '24250', '24G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('3CM', '10000', '10500', '10G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('6CM', '5650', '5925', '5.7G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('9CM', '3300', '3500', '3.4G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('13CM', '2340', '2450', '2.3G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('23CM', '1240', '1300', '1.2G')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('33CM', '902', '928', '902')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('70CM', '420', '450', '432')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('1.25M', '222', '225', '222')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('2M', '144', '148', '144')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('4M', '70', '71', '4M')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('6M', '50', '54', '50')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('10M', '28.0', '29.7', '28000')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('12M', '24.89', '24.99', '24000')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('15M', '21.0', '21.45', '21000')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('17M', '18.068', '18.168', '18100')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('20M', '14.0', '14.35', '14000')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('30M', '10.0', '10.15', '10000')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('40M', '7.0', '7.3', '7000')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('60M', '5.102', '5.404', '5100')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('80M', '3.5', '4.0', '3500')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('160M', '1.8', '2.0', '1800')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('560M', '0.501', '0.504', '560M')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('630M', '0.472', '0.479', '630M')").arg(tableName)); query.exec(QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('2190M', '0.136', '0.137', '2190M')").arg(tableName)); createTheBandQuickReference(); return true; } bool DataBase::populatePropagationModes() { QSqlQuery query; //query.exec("INSERT INTO prop_mode_enumeration (id, shortname, name) VALUES ('0', Not', 'Not Identified')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('AUR', 'Aurora')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('AUE', 'Aurora-E')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('BS', 'Back scatter')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('ECH', 'EchoLink')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('EME', 'Earth-Moon-Earth')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('ES', 'Sporadic E')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('FAI', 'Field Aligned Irregularities')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('F2', 'F2 Reflection')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('INTERNET', 'Internet-assisted')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('ION', 'Ionoscatter')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('IRL', 'IRLP')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('MS', 'Meteor scatter')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('RPT', 'Terrestrial or atmospheric repeater or transponder')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('RS', 'Rain scatter')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('SAT', 'Satellite')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('TEP', 'Trans-equatorial')"); query.exec("INSERT INTO prop_mode_enumeration (shortname, name) VALUES ('TR', 'Tropospheric ducting')"); return true; } bool DataBase::populateContestData() { QSqlQuery query; // CONTEST DEFINITIONS START HERE // DX query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (0, 0, 0, 0, 0, 0, 0)"); // DX START /* // CQ WW DX SSB START query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 1, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 1, 2, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 2, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 2, 2, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 3, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 3, 2, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 1, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 1, 2, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 2, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 2, 2, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 3, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 3, 2, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 1, 1, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 1, 2, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 2, 1, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 2, 2, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 3, 1, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 3, 2, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 1, 1, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 1, 2, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 2, 1, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 2, 2, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 3, 1, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 3, 2, 1, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 1, 1, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 1, 2, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 2, 1, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 2, 2, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 3, 1, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 1, 3, 2, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 1, 1, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 1, 2, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 2, 1, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 2, 2, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 3, 1, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 1, 2, 3, 2, 2, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 2, 0, 1, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 2, 0, 2, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 3, 0, 1, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 3, 0, 2, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 4, 0, 1, 1, 0, 1)"); query.exec("INSERT INTO contest (contest, catoperator, catassisted, catpower, catband, catoverlay, catmode) VALUES (1, 5, 0, 0, 0, 0, 1)"); // CQ WW DX SSB END */ return true; } bool DataBase::howManyQSOsInLog(const int i) { //qDebug() << "DataProxy_SQLite::haveAtLeastOneLog()" << endl; QSqlQuery query; QString sqlQueryString = QString("SELECT COUNT(id) from log WHERE lognumber='%1'").arg(i); if (query.exec(sqlQueryString)) { query.next(); if (query.isValid()) { return (query.value(0)).toInt(); } else { return -1; } } else { return -1; } } bool DataBase::updateTo006() {// Updates the DB to 0.0.6 //qDebug() << "DataBase::updateTo006" << endl; bool IAmIn006 = false; bool IAmIn005 = false; bool ErrorUpdating = false; QString stringQuery = QString(); QString dateString = (date.currentDateTime()).toString("yyyyMMdd"); QSqlQuery query; bool sqlOk = false; if (latestReaded >= 0.006) { return true; } else { IAmIn006 = false; } while (!IAmIn006 && !ErrorUpdating) { //qDebug() << "DataBase::updateTo006: - Still not in 006" << endl; while (!IAmIn005 && !ErrorUpdating) { //qDebug() << "DataBase::updateTo006: - And still not in 005" << endl; IAmIn005 = updateTo005(); } //qDebug() << "DataBase::updateTo006: - Already in 005" << endl; if (ErrorUpdating) { return false; } sqlOk = query.exec("INSERT INTO softwarecontrol (dateupgrade, softversion, dbversion) VALUES ('" + dateString + "', '" + softVersion + "', '" + QString::number(dbVersion) + "')"); if (sqlOk) { // Version updated sqlOk = query.exec("DROP TABLE prop_mode_enumeration"); if (!sqlOk) { //qDebug() << "DataBase::updateTo006 - prop_mode_enumeration NOT DROPED" << endl; } sqlOk = createTablePropModes(); if (!sqlOk) { //qDebug() << "DataBase::updateTo006 - createTablePropModes FALSE" << endl; } sqlOk = populatePropagationModes(); if (!sqlOk) { //qDebug() << "DataBase::updateTo006 - populatePropagationModes FALSE" << endl; } sqlOk = updateTableLog(6); // We copy the log into logtemp if (!sqlOk) { //qDebug() << "DataBase::updateTo006 - prop_mode table do not created" << endl; } createTableBand(false); // We create the bandTemp populateTableBand(false); // Populate the bandTemp updateBandIdTableLogToNewOnes(); updateBandIdTableAward(1); // DXCC updateBandIdTableAward(2); // WAZ if (query.exec("DROP TABLE band")) { if (query.exec("ALTER TABLE bandtemp RENAME TO band")) { } else { //qDebug() << "DataBase::updateTo006 - ERROR - bandtemp not renamed" << endl; } } else { //qDebug() << "DataBase::updateTo006 - ERROR - bandtemp not dropped" << endl; } createTableMode(false); // Create modetemp populateTableMode(false); // Populate modetemp updateModeIdFromSubModeId(); // Updates the log with the new mode IDs in each QSO //updateModeIdTableAward(1); //DXCC //updateModeIdTableAward(2); // WAZ if (query.exec("DROP TABLE mode")) { if (query.exec("ALTER TABLE modetemp RENAME TO mode")) { } else { //qDebug() << "DataBase::updateTo006 - ERROR - modetemp not renamed" << endl; } } else { //qDebug() << "DataBase::updateTo006 - ERROR - modetemp not dropped" << endl; } createTableClubLogStatus(); populateTableClubLogStatus(); } else { // Version not updated } //DO ALL THE TASKS TO BE IN 0.006 from 0.005 HERE and set ErrorUpdating if it is not possible. //qDebug() << "DataBase::updateTo006 - I am in 006 " << endl; IAmIn006 = true; } //qDebug() << "DataBase::updateTo006 - END " << endl; return IAmIn006; } bool DataBase::updateTableLog(const int _v) { //qDebug() << "DataBase::updateTableLog " << endl; createTableLog(false); QString queryString; switch (_v) { case 6: queryString = QString ("INSERT INTO logtemp (qso_date, time_on, call, rst_sent, rst_rcvd, bandid, modeid, srx, stx, points, multiplier, cqz, ituz, dxcc, address, age, cnty, comment, a_index, ant_az, ant_el, ant_path, arrl_sect, band_rx, checkcontest, class, contacted_op, contest_id, country, credit_submitted, credit_granted, distance, email, eq_call, eqsl_qslrdate, eqsl_qslsdate, eqsl_qsl_rcvd, eqsl_qsl_sent, force_init, freq, freq_rx, gridsquare, iota, iota_island_id, k_index, lat, lon, lotw_qslrdate, lotw_qslsdate, lotw_qsl_rcvd, lotw_qsl_sent, max_bursts, ms_shower, my_city, my_cnty, my_country, my_cq_zone, my_gridsquare, my_iota, my_iota_island_id, my_lat, my_lon, my_name, my_rig, my_sig, my_sig_info, my_state, my_street, name, notes, nr_bursts, nr_pings, operator, owner_callsign, pfx, precedence, prop_mode, public_key, qslmsg, qslrdate, qslsdate, qsl_rcvd, qsl_sent, qsl_rcvd_via, qsl_sent_via, qsl_via, qso_complete, qso_random, qth, rx_pwr, sat_mode, sat_name, sfi, sig, sig_info, srx_string, stx_string, state, station_callsign, swl, ten_ten, tx_pwr, web, qso_date_off, time_off, transmiterid, marked, lognumber) SELECT qso_date, time_on, call, rst_sent, rst_rcvd, bandid, modeid, srx, stx, points, multiplier, cqz, ituz, dxcc, address, age, cnty, comment, a_index, ant_az, ant_el, ant_path, arrl_sect, band_rx, checkcontest, class, contacted_op, contest_id, country, credit_submitted, credit_granted, distance, email, eq_call, eqsl_qslrdate, eqsl_qslsdate, eqsl_qsl_rcvd, eqsl_qsl_sent, force_init, freq, freq_rx, gridsquare, iota, iota_island_id, k_index, lat, lon, lotw_qslrdate, lotw_qslsdate, lotw_qsl_rcvd, lotw_qsl_sent, max_bursts, ms_shower, my_city, my_cnty, my_country, my_cq_zone, my_gridsquare, my_iota, my_iota_island_id, my_lat, my_lon, my_name, my_rig, my_sig, my_sig_info, my_state, my_street, name, notes, nr_bursts, nr_pings, operator, owner_callsign, pfx, precedence, prop_mode, public_key, qslmsg, qslrdate, qslsdate, qsl_rcvd, qsl_sent, qsl_rcvd_via, qsl_sent_via, qsl_via, qso_complete, qso_random, qth, rx_pwr, sat_mode, sat_name, sfi, sig, sig_info, srx_string, stx_string, state, station_callsign, swl, ten_ten, tx_pwr, web, qso_date_off, time_off, transmiterid, marked, lognumber FROM log"); break; default: return false; break; } QSqlQuery query; if (query.exec(queryString)) { //qDebug() << "DataBase::updateTableLog: " << QString::number(_v) << " - Query executed" << endl; queryString = "DROP TABLE log"; if (query.exec(queryString)) { //qDebug() << "DataBase::updateTableLog: " << QString::number(_v) << " - Table log dropped" << endl; queryString = "ALTER TABLE logtemp RENAME TO log" ; if (query.exec(queryString)) { //qDebug() << "DataBase::updateTableLog: " << QString::number(_v) << " - tmp renamed" << endl; return true; } else { //qDebug() << "DataBase::updateTableLog: " << QString::number(_v) << " - Renaming failed" << endl; } } else { //qDebug() << "DataBase::updateTableLog: " << QString::number(_v) << " - Table log Not dropped" << endl; } } else { //qDebug() << "DataBase::updateTableLog: " << QString::number(_v) << " - query failed" << endl; } return false; } bool DataBase::createTableClubLogStatus() { QSqlQuery query; return query.exec("CREATE TABLE clublog_status (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "shortname VARCHAR(1) NOT NULL, " "name VARCHAR(15) NOT NULL)"); } bool DataBase::populateTableClubLogStatus() { QSqlQuery query; if (query.exec("INSERT INTO clublog_status (shortname, name) VALUES ('Y', 'Uploaded')")) { if (query.exec("INSERT INTO clublog_status (shortname, name) VALUES ('N', 'Do not upload')")) { return query.exec("INSERT INTO clublog_status (shortname, name) VALUES ('M', 'Modified')"); } } return false; } bool DataBase::moveFromModeIdToSubmodeId() { return false; } bool DataBase::updateModeIdFromSubModeId() {// Updates the log with the new mode IDs in each QSO: // STEP-1: Get the modeid and QSOid from the log // STEP-2: uses the modeid to get the name of the mode in the mode table (the old one) // STEP-3: uses the name of the mode in the modetemp table (the new one) to get the new ID // STEP-4: Updates the new ID in the QSO in the log //qDebug() << "DataBase::updateModeIdFromSubModeId: " << endl; bool cancel = false; bool alreadyCancelled = false; QString modetxt = QString(); QString sq = QString(); bool sqlOk2 = false; bool sqlOk3 = false; int modeFound = -1; int id = -1; int qsos; int i = 0; QString aux; QSqlQuery query, query2, query3; bool sqlOk = query.exec("SELECT COUNT (*) FROM log"); if (sqlOk) { query.next(); qsos = (query.value(0)).toInt(); } else { return false; } int step = util->getProgresStepForDialog(qsos); QProgressDialog progress(QObject::tr("Updating mode information..."), QObject::tr("Abort updating"), 0, qsos); progress.setMaximum(qsos); progress.setWindowModality(Qt::WindowModal); sqlOk = query.exec("SELECT modeid, id FROM log ORDER BY modeid"); // STEP-1 if (sqlOk) { while (query.next()) { modetxt = ""; modeFound = -1; if (query.isValid()) { i++; if (( (i % step )== 0) ) { // To update the speed I will only show the progress once each X QSOs aux = QObject::tr("Updating mode information...\n QSO: ") + QString::number(i) + "/" + QString::number(qsos); progress.setLabelText(aux); progress.setValue(i); } modeFound = (query.value(0)).toInt(); id = (query.value(1)).toInt(); //qDebug() << "DataBase::updateModeIdFromSubModeId: (STEP-1) modeFound (numb): " << QString::number(modeFound) << endl; modetxt = getModeNameFromNumber(modeFound, false); //STEP-2 //qDebug() << "DataBase::updateModeIdFromSubModeId: (STEP-2) mode found (txt): " << modetxt << endl; //TODO The following query can be executed in: getModeIdFromSubMode() sq = QString("SELECT id FROM modetemp WHERE submode='%1'").arg(modetxt); // STEP-3 sqlOk2 = query2.exec(sq); if (sqlOk2) { //qDebug() << "DataBase::updateModeIdFromSubModeId: (STEP-3) sqlOK2 TRUE" << endl; if (query2.next()) { if (query2.isValid()) { modeFound = query2.value(0).toInt(); sq = QString ("UPDATE log SET modeid='%1' WHERE id='%2'").arg(modeFound).arg(id); // STEP-4 sqlOk3 = query3.exec(sq); if (sqlOk3) { //qDebug() << "DataBase::updateModeIdFromSubModeId: (STEP-4) ID: " << QString::number(id) << " updated to: " << QString::number(modeFound) <<"/"<< modetxt << endl; } else { //qDebug() << "DataBase::updateModeIdFromSubModeId: (STEP-4) ID: " << QString::number(id) << " NOT updated-2" << endl; } } else { //qDebug() << "DataBase::updateModeIdFromSubModeId: (STEP-3) query2 not valid " << endl; } } else { //qDebug() << "DataBase::updateModeIdFromSubModeId: query2 not next " << endl; } } else { //qDebug() << "DataBase::updateModeIdFromSubModeId: ID: " << QString::number(id) << " NOT updated-1" << endl; } } if ( progress.wasCanceled() ) { if (alreadyCancelled) { } else { alreadyCancelled = true; QMessageBox msgBox; aux = QObject::tr("Cancelling this update will cause data inconsistencies and possibly data loss. Do you still want to cancel?"); 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 cancel = true; break; case QMessageBox::No: // No Save was clicked cancel = false; progress.setCancelButton(0); break; default: // should never be reached cancel = false; break; } } } } if (cancel && (!alreadyCancelled)) { return false; } return true; } else { return false; } } bool DataBase::updateBandIdTableLogToNewOnes() { //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: " << endl; QString bandtxt = QString(); bool cancel = false; bool alreadyCancelled = false; int errorCode = -1; QString sq = QString(); bool sqlOk2 = false; bool sqlOk3 = false; int bandFound = -1; int id = -1; int qsos; int i = 0; QString aux; QSqlQuery query, query2, query3; bool sqlOk = query.exec("SELECT COUNT (*) FROM log"); if (sqlOk) { query.next(); qsos = (query.value(0)).toInt(); } else { return false; } int step = util->getProgresStepForDialog(qsos); QProgressDialog progress(QObject::tr("Updating bands information..."), QObject::tr("Abort updating"), 0, qsos); progress.setMaximum(qsos); progress.setWindowModality(Qt::WindowModal); sqlOk = query.exec("SELECT bandid, id FROM log ORDER BY bandid DESC"); if (sqlOk) { while (query.next() && (!cancel) ) { bandtxt = ""; bandFound = -1; if (query.isValid()) { i++; if (( (i % step )== 0) ) { // To update the speed I will only show the progress once each X QSOs aux = QObject::tr("Updating bands information...\n QSO: ") + QString::number(i) + "/" + QString::number(qsos); progress.setLabelText(aux); progress.setValue(i); } bandFound = (query.value(0)).toInt(); id = (query.value(1)).toInt(); bandtxt = getBandNameFromNumber(bandFound); //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: band found: " << bandtxt << endl; sq = QString("SELECT id FROM bandtemp WHERE name='%1'").arg(bandtxt); sqlOk2 = query2.exec(sq); if (sqlOk2) { if (query2.next()) { if (query2.isValid()) { bandFound = query2.value(0).toInt(); sq = QString ("UPDATE log SET bandid='%1' WHERE id='%2'").arg(bandFound).arg(id); sqlOk3 = query3.exec(sq); if (sqlOk3) { //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: ID: " << QString::number(id) << " updated to: " << QString::number(bandFound) <<"/"<< bandtxt << endl; } else { //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: ID: " << QString::number(id) << " NOT updated-2" << endl; //qDebug() << "DataBase::updateBandIdTableLogToNewOnes - QSOs not updated to main log" << endl; errorCode = query3.lastError().number(); //qDebug() << "DataBase::updateBandIdTableLogToNewOnes - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: LastQuery: " << query3.lastQuery() << endl; //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: LastError-data: " << query3.lastError().databaseText() << endl; //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: LastError-driver: " << query3.lastError().driverText() << endl; //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: LastError-n: " << QString::number(query3.lastError().number() ) << endl; } } else { //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: query2 not valid " << endl; } } else { //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: query2 not next " << endl; } } else { //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: ID: " << QString::number(id) << " NOT updated-1" << endl; } } if ( progress.wasCanceled() ) { if (alreadyCancelled) { } else { alreadyCancelled = true; QMessageBox msgBox; aux = QObject::tr("Cancelling this update will cause data inconsistencies and possibly data loss. Do you still want to cancel?"); 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 cancel = true; break; case QMessageBox::No: // No Save was clicked cancel = false; progress.setCancelButton(0); break; default: // should never be reached cancel = false; break; } } } } if (cancel && (!alreadyCancelled)) { return false; } //qDebug() << "DataBase::updateBandIdTableLogToNewOnes: FINISHED OK" << endl; return true; } else { return false; } } bool DataBase::updateBandIdTableAward(const int _db) { //qDebug() << "DataBase::updateBandIdTableAward: " << endl; QString table = QString(); QString field = QString(); QString awardSelected = QString(); switch (_db) { case 1: // table = "awarddxcc"; field = "band"; awardSelected = "DXCC"; break; case 2: table = "awardwaz"; field = "band"; awardSelected = "WAZ"; break; default: return false; break; } QString bandtxt = QString(); bool cancel = false; bool alreadyCancelled = false; int errorCode = -1; QString sq = QString(); bool sqlOk2 = false; bool sqlOk3 = false; int bandFound = -1; int id = -1; int qsos; int i = 0; QString aux; QSqlQuery query, query2, query3; sq = QString("SELECT COUNT (*) FROM %1").arg(table); bool sqlOk = query.exec(sq); if (sqlOk) { query.next(); qsos = (query.value(0)).toInt(); } else { return false; } int step = util->getProgresStepForDialog(qsos); QString progressmsg = QString(QObject::tr("Updating bands information in %1 status...")).arg(awardSelected); QProgressDialog progress(progressmsg, QObject::tr("Abort updating"), 0, qsos); progress.setMaximum(qsos); progress.setWindowModality(Qt::WindowModal); sq = QString("SELECT %1, id FROM %2 ORDER BY %3 DESC").arg(field).arg(table).arg(field); sqlOk = query.exec(sq); if (sqlOk) { while (query.next() && (!cancel) ) { bandtxt = ""; bandFound = -1; if (query.isValid()) { i++; if (( (i % step )== 0) ) { // To update the speed I will only show the progress once each X QSOs aux = QObject::tr("Updating bands information...\n Progress: ") + QString::number(i) + "/" + QString::number(qsos); progress.setLabelText(aux); progress.setValue(i); } bandFound = (query.value(0)).toInt(); id = (query.value(1)).toInt(); bandtxt = getBandNameFromNumber(bandFound); //qDebug() << "DataBase::updateBandIdTableAward: band found: " << bandtxt << endl; sq = QString("SELECT id FROM bandtemp WHERE name='%1'").arg(bandtxt); sqlOk2 = query2.exec(sq); if (sqlOk2) { if (query2.next()) { if (query2.isValid()) { bandFound = query2.value(0).toInt(); sq = QString ("UPDATE %1 SET %2='%3' WHERE id='%4'").arg(table).arg(field).arg(bandFound).arg(id); sqlOk3 = query3.exec(sq); if (sqlOk3) { //qDebug() << "DataBase::updateBandIdTableAward: ID: " << QString::number(id) << " updated to: " << QString::number(bandFound) <<"/"<< bandtxt << endl; } else { //qDebug() << "DataBase::updateBandIdTableAward: ID: " << QString::number(id) << " NOT updated-2" << endl; //qDebug() << "DataBase::updateBandIdTableAward - QSOs not updated to main log" << endl; errorCode = query3.lastError().number(); //qDebug() << "DataBase::updateBandIdTableAward - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataBase::updateBandIdTableAward: LastQuery: " << query3.lastQuery() << endl; //qDebug() << "DataBase::updateBandIdTableAward: LastError-data: " << query3.lastError().databaseText() << endl; //qDebug() << "DataBase::updateBandIdTableAward: LastError-driver: " << query3.lastError().driverText() << endl; //qDebug() << "DataBase::updateBandIdTableAward: LastError-n: " << QString::number(query3.lastError().number() ) << endl; } } else { //qDebug() << "DataBase::updateBandIdTableAward: query2 not valid " << endl; } } else { //qDebug() << "DataBase::updateBandIdTableAward: query2 not next " << endl; } } else { //qDebug() << "DataBase::updateBandIdTableAward: ID: " << QString::number(id) << " NOT updated-1" << endl; } } if ( progress.wasCanceled() ) { if (alreadyCancelled) { } else { alreadyCancelled = true; QMessageBox msgBox; aux = QObject::tr("Cancelling this update will cause data inconsistencies and possibly data loss. Do you still want to cancel?"); 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 cancel = true; break; case QMessageBox::No: // No Save was clicked cancel = false; progress.setCancelButton(0); break; default: // should never be reached cancel = false; break; } } } } if (cancel && (!alreadyCancelled)) { return false; } //qDebug() << "DataBase::updateBandIdTableAward: FINISHED OK" << endl; return true; } else { return false; } } bool DataBase::updateModeIdTableAward(const int _db) { //qDebug() << "DataBase::updateModeIdTableAward: " << QString::number(_db) << endl; QString table = QString(); QString field = "mode"; QString awardSelected = QString(); switch (_db) { case 1: // table = "awarddxcc"; awardSelected = "DXCC"; break; case 2: table = "awardwaz"; awardSelected = "WAZ"; break; default: return false; break; } QString bandtxt = QString(); bool cancel = false; bool alreadyCancelled = false; int errorCode = -1; QString sq = QString(); bool sqlOk2 = false; bool sqlOk3 = false; int bandFound = -1; int id = -1; int qsos; int i = 0; QString aux; QSqlQuery query, query2, query3; sq = QString("SELECT COUNT (*) FROM %1").arg(table); bool sqlOk = query.exec(sq); if (sqlOk) { query.next(); qsos = (query.value(0)).toInt(); } else { return false; } int step = util->getProgresStepForDialog(qsos); QString progressmsg = QString(QObject::tr("Updating mode information in %1 status...")).arg(awardSelected); QProgressDialog progress(progressmsg, QObject::tr("Abort updating"), 0, qsos); progress.setMaximum(qsos); progress.setWindowModality(Qt::WindowModal); sq = QString("SELECT %1, id FROM %2 ORDER BY %3 DESC").arg(field).arg(table).arg(field); sqlOk = query.exec(sq); //qDebug() << "DataBase::updateModeIdTableAward (query): " << query.lastQuery() << endl; if (sqlOk) { while (query.next() && (!cancel) ) { bandtxt = ""; bandFound = -1; if (query.isValid()) { i++; if (( (i % step )== 0) ) { // To update the speed I will only show the progress once each X QSOs aux = QObject::tr("Updating bands information...\n Progress: ") + QString::number(i) + "/" + QString::number(qsos); progress.setLabelText(aux); progress.setValue(i); } bandFound = (query.value(0)).toInt(); id = (query.value(1)).toInt(); //qDebug() << "DataBase::updateModeIdTableAward: bandfound: " << QString::number(bandFound) << endl; //qDebug() << "DataBase::updateModeIdTableAward: id: " << QString::number(id) << endl; bandtxt = getSubModeNameFromNumber(bandFound, true); //qDebug() << "DataBase::updateModeIdTableAward: mode found: " << bandtxt << "/" << QString::number(bandFound) << endl; sq = QString("SELECT id FROM modetemp WHERE submode='%1'").arg(bandtxt); sqlOk2 = query2.exec(sq); //qDebug() << "DataBase::updateModeIdTableAward (query2): " << query2.lastQuery() << endl; if (sqlOk2) { if (query2.next()) { if (query2.isValid()) { bandFound = query2.value(0).toInt(); sq = QString ("UPDATE %1 SET %2='%3' WHERE id='%4'").arg(table).arg(field).arg(bandFound).arg(id); sqlOk3 = query3.exec(sq); //qDebug() << "DataBase::updateModeIdTableAward (query3 update): " << query3.lastQuery() << endl; if (sqlOk3) { //qDebug() << "DataBase::updateModeIdTableAward: ID: " << QString::number(id) << " updated to: " << QString::number(bandFound) <<"/"<< bandtxt << endl; } else { //qDebug() << "DataBase::updateModeIdTableAward: ID: " << QString::number(id) << " NOT updated-2" << endl; //qDebug() << "DataBase::updateModeIdTableAward - QSOs not updated to main log" << endl; errorCode = query3.lastError().number(); //qDebug() << "DataBase::updateModeIdTableAward - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataBase::updateModeIdTableAward: LastQuery: " << query3.lastQuery() << endl; //qDebug() << "DataBase::updateModeIdTableAward: LastError-data: " << query3.lastError().databaseText() << endl; //qDebug() << "DataBase::updateModeIdTableAward: LastError-driver: " << query3.lastError().driverText() << endl; //qDebug() << "DataBase::updateModeIdTableAward: LastError-n: " << QString::number(query3.lastError().number() ) << endl; } } else { //qDebug() << "DataBase::updateModeIdTableAward: query2 not valid " << endl; } } else { //qDebug() << "DataBase::updateModeIdTableAward: query2 not next " << endl; } } else { //qDebug() << "DataBase::updateModeIdTableAward: ID: " << QString::number(id) << " NOT updated-1" << endl; } } if ( progress.wasCanceled() ) { if (alreadyCancelled) { } else { alreadyCancelled = true; QMessageBox msgBox; aux = QObject::tr("Cancelling this update will cause data inconsistencies and possibly data loss. Do you still want to cancel?"); 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 cancel = true; break; case QMessageBox::No: // No Save was clicked cancel = false; progress.setCancelButton(0); break; default: // should never be reached cancel = false; break; } } } } if (cancel && (!alreadyCancelled)) { return false; } //qDebug() << "DataBase::updateModeIdTableAward: FINISHED OK" << endl; return true; } else { return false; } } /* bool DataBase::updateModeIdTableLogToNewOnes() { //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: " << endl; QString bandtxt = QString(); bool cancel = false; bool alreadyCancelled = false; int errorCode = -1; QString sq = QString(); bool sqlOk2 = false; bool sqlOk3 = false; int bandFound = -1; int id = -1; int qsos; int i = 0; QString aux; QSqlQuery query, query2, query3; bool sqlOk = query.exec("SELECT COUNT (*) FROM log"); if (sqlOk) { query.next(); qsos = (query.value(0)).toInt(); } else { return false; } int step = util->getProgresStepForDialog(qsos); QProgressDialog progress(QObject::tr("Updating mode information..."), QObject::tr("Abort updating"), 0, qsos); progress.setMaximum(qsos); progress.setWindowModality(Qt::WindowModal); sqlOk = query.exec("SELECT modeid, id FROM log ORDER BY bandid DESC"); if (sqlOk) { while (query.next() && (!cancel) ) { bandtxt = ""; bandFound = -1; if (query.isValid()) { i++; if (( (i % step )== 0) ) { // To update the speed I will only show the progress once each X QSOs aux = QObject::tr("Updating mode information...\n QSO: ") + QString::number(i) + "/" + QString::number(qsos); progress.setLabelText(aux); progress.setValue(i); } bandFound = (query.value(0)).toInt(); id = (query.value(1)).toInt(); bandtxt = getModeNameFromNumber(bandFound, false); //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: mode found: " << bandtxt << endl; sq = QString("SELECT id FROM modetemp WHERE name='%1'").arg(bandtxt); sqlOk2 = query2.exec(sq); if (sqlOk2) { if (query2.next()) { if (query2.isValid()) { bandFound = query2.value(0).toInt(); sq = QString ("UPDATE log SET modeid='%1' WHERE id='%2'").arg(bandFound).arg(id); sqlOk3 = query3.exec(sq); if (sqlOk3) { //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: ID: " << QString::number(id) << " updated to: " << QString::number(bandFound) <<"/"<< bandtxt << endl; } else { //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: ID: " << QString::number(id) << " NOT updated-2" << endl; //qDebug() << "DataBase::updateModeIdTableLogToNewOnes - QSOs not updated to main log" << endl; errorCode = query3.lastError().number(); //qDebug() << "DataBase::updateModeIdTableLogToNewOnes - query error: " << QString::number(errorCode) << endl; //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: LastQuery: " << query3.lastQuery() << endl; //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: LastError-data: " << query3.lastError().databaseText() << endl; //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: LastError-driver: " << query3.lastError().driverText() << endl; //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: LastError-n: " << QString::number(query3.lastError().number() ) << endl; } } else { //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: query2 not valid " << endl; } } else { //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: query2 not next " << endl; } } else { //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: ID: " << QString::number(id) << " NOT updated-1" << endl; } } if ( progress.wasCanceled() ) { if (alreadyCancelled) { } else { alreadyCancelled = true; QMessageBox msgBox; aux = QObject::tr("Cancelling this update will cause data inconsistencies and possibly data loss. Do you still want to cancel?"); 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 cancel = true; break; case QMessageBox::No: // No Save was clicked cancel = false; progress.setCancelButton(0); break; default: // should never be reached cancel = false; break; } } } } if (cancel && (!alreadyCancelled)) { return false; } //qDebug() << "DataBase::updateModeIdTableLogToNewOnes: FINISHED OK" << endl; return true; } else { return false; } } */ bool DataBase::updateTo007() {// Updates the DB to 0.0.7 //qDebug() << "DataBase::updateTo007" << endl; bool IAmIn007 = false; bool IAmIn006 = false; bool ErrorUpdating = false; QString stringQuery = QString(); QString dateString = (date.currentDateTime()).toString("yyyyMMdd"); QSqlQuery query; bool sqlOk = false; if (latestReaded >= 0.007) { //qDebug() << "DataBase::updateTo007: - I am in 007" << endl; return true; } else { //qDebug() << "DataBase::updateTo007: - I am not in 007" << endl; IAmIn007 = false; } while (!IAmIn007 && !ErrorUpdating) { while (!IAmIn006 && !ErrorUpdating) { //qDebug() << "DataBase::updateTo007: - And I am not in 006" << endl; IAmIn006 = updateTo006(); } if (ErrorUpdating) { return false; } sqlOk = query.exec("INSERT INTO softwarecontrol (dateupgrade, softversion, dbversion) VALUES ('" + dateString + "', '" + softVersion + "', '" + QString::number(dbVersion) + "')"); if (sqlOk) { // Version updated IAmIn007 = updateTableLog(6); } else { // Version not updated } //DO ALL THE TASKS TO BE IN 0.004 from 0.003 HERE and set ErrorUpdating if it is not possible. IAmIn007 = true; } return IAmIn007; } klog-0.9.2.2/mainwindowsattab.cpp0000644000076700000620000001204112627126144014646 0ustar staff /*************************************************************************** mainwindowsattab.cpp - description ------------------- begin : jan 2015 copyright : (C) 2015 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "mainwindowsattab.h" MainWindowSatTab::MainWindowSatTab(QWidget *parent) : QWidget(parent) { satNameLineEdit = new QLineEdit; satModeLineEdit = new QLineEdit; keepThisDataForNextQSORadiobutton = new QRadioButton; createUI(); } MainWindowSatTab::~MainWindowSatTab(){} void MainWindowSatTab::createUI() { connect(satNameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(satNameTextChanged() ) ); connect(satModeLineEdit, SIGNAL(textChanged(QString)), this, SLOT(satModeTextChanged() ) ); QLabel *keepLabel = new QLabel(); keepLabel->setText(tr("Keep this data")); keepLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); keepLabel->setToolTip(tr("Data entered in this tab will be copied into the next QSO")); keepThisDataForNextQSORadiobutton->setToolTip(tr("Data entered in this tab will be copied into the next QSO")); satNameLineEdit->setToolTip(tr("Name of the Satellite (format like AO-51)")); satModeLineEdit->setToolTip(tr("Satellite mode used")); QLabel *satNameLabel = new QLabel(); satNameLabel->setText(tr("Satellite")); satNameLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QLabel *satModeLabel = new QLabel(); satModeLabel->setText(tr("Mode")); satModeLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight); QGridLayout *tabLayout = new QGridLayout; tabLayout->addWidget(satNameLabel, 0, 0); tabLayout->addWidget(satNameLineEdit, 0, 1); tabLayout->addWidget(satModeLabel, 1, 0); tabLayout->addWidget(satModeLineEdit, 1, 1); tabLayout->addWidget(keepLabel, 3, 2); tabLayout->addWidget(keepThisDataForNextQSORadiobutton, 3, 3); setLayout(tabLayout); } void MainWindowSatTab::satNameTextChanged() { //qDebug() << "MainWindowSatTab::satNameTextChanged: " << satNameLineEdit->text() << endl; satNameLineEdit->setText((satNameLineEdit->text()).toUpper()); if ((satNameLineEdit->text()).length()>0) { emit setPropModeSat("SAT"); } else if ((satModeLineEdit->text()).length()<1) { emit setPropModeSat("Not"); } } void MainWindowSatTab::satModeTextChanged() { //qDebug() << "MainWindowSatTab::satModeTextChanged: " << satModeLineEdit->text() << endl; satModeLineEdit->setText((satModeLineEdit->text()).toUpper()); if ((satModeLineEdit->text()).length()>0) { emit setPropModeSat("SAT"); } else if ((satNameLineEdit->text()).length()<1) { emit setPropModeSat("Not"); } } QString MainWindowSatTab::getSatName() { // Sat name must follow the format CC-NN to make it compatible with LOTW // C = Character // N = Number QString satName; satName = satNameLineEdit->text(); //TODO: Check that the format is OK return satName; } void MainWindowSatTab::setSatName(const QString _t) { //TODO: Check that the format is OK satNameLineEdit->setText(_t); } QString MainWindowSatTab::getSatMode() { return satModeLineEdit->text(); } void MainWindowSatTab::setSatMode(const QString _t) { satModeLineEdit->setText(_t); } bool MainWindowSatTab::getRepeatThis() { return keepThisDataForNextQSORadiobutton->isChecked(); } void MainWindowSatTab::setRepeatThis(const bool _t) { keepThisDataForNextQSORadiobutton->setChecked(_t); } void MainWindowSatTab::clear() { satModeLineEdit->clear(); satNameLineEdit->clear(); } klog-0.9.2.2/setuppageuserdata.cpp0000644000076700000620000005326512627126144015036 0ustar staff/*************************************************************************** userdatapage.cpp - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * Foobar is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "setuppageuserdata.h" SetupPageUserDataPage::SetupPageUserDataPage(QWidget *parent) : QWidget(parent){ locator = new Locator(); operatorOK = false; operatorsOK = false; tabWidget = new QTabWidget; QWidget *personalTab = new QWidget; QWidget *stationTab = new QWidget; tabWidget->addTab(personalTab, tr("&Personal data")); tabWidget->addTab(stationTab, tr("Station &data")); qrzLineEdit = new QLineEdit; operatorsLineEdit = new QLineEdit; nameLineEdit = new QLineEdit; cqzLineEdit = new QLineEdit; ituzLineEdit = new QLineEdit; myLocatorLineEdit = new QLineEdit; defaultPalette = new QPalette; //defaultPalette = operatorsLineEdit->palette(); wrongPalette = new QPalette; //wrongPalette->setColor(QPalette::WindowText, setNamedColor(Qt::red)); //redColor.setNamedColor(Qt::red); //redColor->setNamedColor(Qt::red); wrongPalette->setColor(QPalette::Text, Qt::red); //Personal Tab nameLineEdit = new QLineEdit; address1LineEdit = new QLineEdit; address2LineEdit = new QLineEdit; address3LineEdit = new QLineEdit; address4LineEdit = new QLineEdit; cityLineEdit = new QLineEdit; zipLineEdit = new QLineEdit; provinceLineEdit = new QLineEdit; countryLineEdit = new QLineEdit; nameLineEdit->setToolTip(tr("Enter your name")); address1LineEdit->setToolTip(tr("Enter your address - 1st line")); address2LineEdit->setToolTip(tr("Enter your address - 2nd line")); address3LineEdit->setToolTip(tr("Enter your address - 3st line")); address4LineEdit->setToolTip(tr("Enter your address - 4nd line")); cityLineEdit->setToolTip(tr("Enter your city")); zipLineEdit->setToolTip(tr("Enter your zip code")); provinceLineEdit->setToolTip(tr("Enter your province or state")); countryLineEdit->setToolTip(tr("Enter your country")); QLabel *nameLabel = new QLabel(tr("&Name")); QLabel *addressLabel = new QLabel(tr("&Address")); QLabel *cityLabel = new QLabel(tr("Cit&y")); QLabel *zipLabel = new QLabel(tr("&Zip Code")); QLabel *provLabel = new QLabel(tr("Pro&v/State")); QLabel *countryLabel = new QLabel(tr("Countr&y")); nameLabel->setBuddy(nameLineEdit); addressLabel->setBuddy(address1LineEdit); cityLabel->setBuddy(cityLineEdit); zipLabel->setBuddy(zipLineEdit); provLabel->setBuddy(provinceLineEdit); countryLabel->setBuddy(countryLineEdit); //void addWidget ( QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 ) // 0 1 2 3 QGridLayout *personalLayout = new QGridLayout(); personalLayout->addWidget(nameLabel, 0, 0); personalLayout->addWidget(nameLineEdit, 1, 0); personalLayout->addWidget(addressLabel, 2, 0); personalLayout->addWidget(address1LineEdit, 3, 0, 1, 2); personalLayout->addWidget(address2LineEdit, 4, 0, 1, 2); personalLayout->addWidget(address3LineEdit, 5, 0, 1, 2); personalLayout->addWidget(address4LineEdit, 6, 0, 1, 2); personalLayout->addWidget(cityLabel, 2, 2); personalLayout->addWidget(cityLineEdit, 3, 2, 1, 1); personalLayout->addWidget(zipLabel, 2, 5); personalLayout->addWidget(zipLineEdit, 3, 5, 1, 1); personalLayout->addWidget(provLabel, 4, 2); personalLayout->addWidget(provinceLineEdit, 5, 2, 1, 1); personalLayout->addWidget(countryLabel, 4, 5); personalLayout->addWidget(countryLineEdit, 5, 5, 1, 1); //personalLayout->addWidget(); //QHBoxLayout *personalAllLayout = new QHBoxLayout(); //personalAllLayout->addLayout(nameLayout); //personalAllLayout->addLayout(personalLayout); personalTab->setLayout(personalLayout); // Station Tab rig1LineEdit = new QLineEdit; rig2LineEdit = new QLineEdit; rig3LineEdit = new QLineEdit; ant1LineEdit = new QLineEdit; ant2LineEdit = new QLineEdit; ant3LineEdit = new QLineEdit; //powerLineEdit = new QLineEdit; myPowerSpinBox = new QDoubleSpinBox; myPowerSpinBox->setDecimals(2); myPowerSpinBox->setMaximum(9999); rig1LineEdit->setToolTip(tr("Enter your rig #1 information")); rig2LineEdit->setToolTip(tr("Enter your rig #2 information")); rig3LineEdit->setToolTip(tr("Enter your rig #3 information")); ant1LineEdit->setToolTip(tr("Enter your antenna #1 information")); ant2LineEdit->setToolTip(tr("Enter your antenna #2 information")); ant3LineEdit->setToolTip(tr("Enter your antenna #3 information")); myPowerSpinBox->setToolTip(tr("Enter your power information")); QLabel *rig1Label = new QLabel(tr("&Rig 1")); QLabel *rig2Label = new QLabel(tr("R&ig 2")); QLabel *rig3Label = new QLabel(tr("Ri&g 3")); QLabel *antenna1Label = new QLabel(tr("Antenna &1")); QLabel *antenna2Label = new QLabel(tr("Antenna &2")); QLabel *antenna3Label = new QLabel(tr("Antenna &3")); QLabel *powerLabel = new QLabel(tr("Po&wer")); rig1Label->setBuddy(rig1LineEdit); rig2Label->setBuddy(rig2LineEdit); rig3Label->setBuddy(rig3LineEdit); antenna1Label->setBuddy(ant1LineEdit); antenna2Label->setBuddy(ant2LineEdit); antenna3Label->setBuddy(ant3LineEdit); powerLabel->setBuddy(myPowerSpinBox); //void addWidget ( QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 ) // 0 1 2 3 QGridLayout *stationLayout = new QGridLayout(); stationLayout->addWidget(rig1Label, 0, 0); stationLayout->addWidget(rig1LineEdit, 1, 0, 1, 1); stationLayout->addWidget(rig2Label, 2, 0); stationLayout->addWidget(rig2LineEdit, 3, 0, 1, 1); stationLayout->addWidget(rig3Label, 4, 0); stationLayout->addWidget(rig3LineEdit, 5, 0, 1, 1); stationLayout->addWidget(antenna1Label, 0, 2); stationLayout->addWidget(ant1LineEdit, 1, 2, 1, 1); stationLayout->addWidget(antenna2Label, 2, 2); stationLayout->addWidget(ant2LineEdit, 3, 2, 1, 1); stationLayout->addWidget(antenna3Label, 4, 2); stationLayout->addWidget(ant3LineEdit, 5, 2, 1, 1); stationLayout->addWidget(powerLabel, 0, 4); stationLayout->addWidget(myPowerSpinBox, 1, 4); stationTab->setLayout(stationLayout); //TODO:Defining ALL the tooltips qrzLineEdit->setToolTip(tr("Enter the station callsign that will be used for logging")); operatorsLineEdit->setToolTip(tr("Enter the operators (comma separated if more than one).")); myLocatorLineEdit->setToolTip(tr("Enter the locator of your station. KLog will propose one locator based on your callsign")); QLabel *qrzLabel = new QLabel(tr("&QRZ")); QLabel *operatorsLabel = new QLabel (tr("&Operators")); QLabel *cqzLabel = new QLabel(tr("&CQ Zone")); QLabel *ituzLabel = new QLabel(tr("&ITU Zone")); myLocatorLabel = new QLabel(tr("&Locator")); qrzLabel->setBuddy(qrzLineEdit); operatorsLabel->setBuddy(operatorsLineEdit); cqzLabel->setBuddy(cqzLineEdit); ituzLabel->setBuddy(ituzLineEdit); myLocatorLabel->setBuddy(myLocatorLineEdit); cqzLineEdit->setInputMask("09"); ituzLineEdit->setInputMask("09"); cqzLineEdit->setText("00"); ituzLineEdit->setText("00"); //QHBoxLayout *operatorLayout = new QHBoxLayout; //operatorLayout->addWidget(qrzLabel); //operatorLayout->addWidget(qrzLineEdit); //operatorLayout->addWidget(operatorsLabel); //operatorLayout->addWidget(operatorsLineEdit); //QGridLayout *operatorLayout = new QGridLayout(); //operatorLayout->addWidget(qrzLabel, 0, 0); //operatorLayout->addWidget(qrzLineEdit, 1, 0); ////operatorLayout->addWidget(nameLabel, 0, 1); ////operatorLayout->addWidget(nameLineEdit, 1, 1); /* QGridLayout *zonesBoxLayout = new QGridLayout; zonesBoxLayout->addWidget(myLocatorLabel,0,0); zonesBoxLayout->addWidget(cqzLabel,0,1); zonesBoxLayout->addWidget(ituzLabel,0,2); zonesBoxLayout->addWidget(myLocatorLineEdit,1,0); zonesBoxLayout->addWidget(cqzLineEdit,1,1); zonesBoxLayout->addWidget(ituzLineEdit,1,2); QVBoxLayout *userdataLayout = new QVBoxLayout(); userdataLayout->addLayout(operatorLayout); userdataLayout->addLayout(zonesBoxLayout); */ QGridLayout *userdataLayout = new QGridLayout; userdataLayout->addWidget(qrzLabel, 0, 0); userdataLayout->addWidget(qrzLineEdit, 1, 0); userdataLayout->addWidget(operatorsLabel, 0, 1); userdataLayout->addWidget(operatorsLineEdit, 1, 1, 1, -1); userdataLayout->addWidget(myLocatorLabel, 3, 0); userdataLayout->addWidget(myLocatorLineEdit, 4, 0); userdataLayout->addWidget(cqzLabel, 3, 1); userdataLayout->addWidget(cqzLineEdit, 4, 1); userdataLayout->addWidget(ituzLabel, 3, 2); userdataLayout->addWidget(ituzLineEdit, 4, 2); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(userdataLayout); mainLayout->addWidget(tabWidget); //mainLayout->addStretch(1); connect(qrzLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotQRZTextChanged() ) ); connect(myLocatorLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotMyLocatorTextChanged() ) ); connect(operatorsLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotOperatorsChanged() ) ); setLayout(mainLayout); } SetupPageUserDataPage::~SetupPageUserDataPage() { //qDebug() << "SetupPageUserDataPage::~SetupPageUserDataPage" << endl; } QString SetupPageUserDataPage::getStationQrz() { operatorOK = world.checkQRZValidFormat(qrzLineEdit->text()); if (operatorOK) { return qrzLineEdit->text(); } else { return QString(); } } void SetupPageUserDataPage::slotQRZTextChanged() { //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()) { qrzLineEdit->setText(_a.remove(i-1, 1)); } qrzLineEdit->setText(((qrzLineEdit->text())).simplified()); qrzLineEdit->setText((qrzLineEdit->text()).toUpper()); cqzLineEdit->setText(QString::number(world.getQRZCqz(qrzLineEdit->text()))); ituzLineEdit->setText(QString::number(world.getQRZItuz(qrzLineEdit->text()))); myLocatorLineEdit->setText(world.getQRZLocator(qrzLineEdit->text())); qrzLineEdit->setCursorPosition(i); /* if (!locator->isValidLocator(myLocatorLineEdit->text()) ) { myLocatorLineEdit->setText(world.getQRZLocator(qrzLineEdit->text())); } */ } int SetupPageUserDataPage::getCQz(){ return (cqzLineEdit->text()).toInt(); } int SetupPageUserDataPage::getITUz(){ return (ituzLineEdit->text()).toInt(); } bool SetupPageUserDataPage::setStationQrz(const QString _qrz){ qrzLineEdit->setText((_qrz).toUpper()); return true; } bool SetupPageUserDataPage::setCQz(const int _cqz){ cqzLineEdit->setText(QString::number(_cqz)); return true; } bool SetupPageUserDataPage::setITUz(const int _ituz){ ituzLineEdit->setText(QString::number(_ituz)); return true; } void SetupPageUserDataPage::slotMyLocatorTextChanged() { //qDebug() << "SetupPageUserDataPage::slotMyLocatorTextChanged: " << myLocatorLineEdit->text() << endl; //int i; myLocatorLineEdit->setText(((myLocatorLineEdit->text())).simplified()); myLocatorLineEdit->setText((myLocatorLineEdit->text()).toUpper()); if ( ((myLocatorLineEdit->text()).length()) >3 ) { if (!(locator->isValidLocator(myLocatorLineEdit->text()) )) { myLocatorLabel->setText(tr("&Locator (not valid)")); } else { myLocatorLabel->setText(tr("&Locator")); } } } QString SetupPageUserDataPage::getStationLocator() { if (!(locator->isValidLocator(myLocatorLineEdit->text()) )) { return ""; } else { return (myLocatorLineEdit->text()).toUpper(); } } bool SetupPageUserDataPage::setStationLocator(const QString _loc) { if (!(locator->isValidLocator(_loc) )) { return false; } else { myLocatorLineEdit->setText((_loc).toUpper()); return true; } } QString SetupPageUserDataPage::getName() { return nameLineEdit->text(); } QStringList SetupPageUserDataPage::getAddress() { QStringList a; a.clear(); a << address1LineEdit->text() << address2LineEdit->text() << address3LineEdit->text() << address4LineEdit->text(); return a; } QString SetupPageUserDataPage::getAddress1() { return address1LineEdit->text(); } QString SetupPageUserDataPage::getAddress2() { return address2LineEdit->text(); } QString SetupPageUserDataPage::getAddress3() { return address3LineEdit->text(); } QString SetupPageUserDataPage::getAddress4() { return address4LineEdit->text(); } QString SetupPageUserDataPage::getRig1() { return rig1LineEdit->text(); } QString SetupPageUserDataPage::getRig2() { return rig2LineEdit->text(); } QString SetupPageUserDataPage::getRig3() { return rig3LineEdit->text(); } QString SetupPageUserDataPage::getAntenna1() { return ant1LineEdit->text(); } QString SetupPageUserDataPage::getAntenna2() { return ant2LineEdit->text(); } QString SetupPageUserDataPage::getAntenna3() { return ant3LineEdit->text(); } QString SetupPageUserDataPage::getCity() { return cityLineEdit->text(); } QString SetupPageUserDataPage::getZipCode() { return zipLineEdit->text(); } QString SetupPageUserDataPage::getProvince() { return provinceLineEdit->text(); } QString SetupPageUserDataPage::getCountry() { return countryLineEdit->text(); } bool SetupPageUserDataPage::setName (const QString _aux) { nameLineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setAddress (const QStringList _aux) { address1LineEdit->setText(_aux.at(0)); address2LineEdit->setText(_aux.at(1)); address3LineEdit->setText(_aux.at(2)); address4LineEdit->setText(_aux.at(3)); return true; } bool SetupPageUserDataPage::setAddress1 (const QString _aux) { address1LineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setAddress2 (const QString _aux) { address2LineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setAddress3 (const QString _aux) { address3LineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setAddress4 (const QString _aux) { address4LineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setCity (const QString _aux) { cityLineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setZipCode(const QString _aux) { zipLineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setProvince (const QString _aux) { provinceLineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setCountry (const QString _aux) { countryLineEdit->setText(_aux); return true; } QStringList SetupPageUserDataPage::getRigs() { QStringList a; a.clear(); a << rig1LineEdit->text() << rig2LineEdit->text() << rig3LineEdit->text(); return a; } QStringList SetupPageUserDataPage::getAntennas() { QStringList a; a.clear(); a << ant1LineEdit->text() << ant2LineEdit->text() << ant3LineEdit->text(); return a; } QString SetupPageUserDataPage::getPower() { return QString::number(myPowerSpinBox->value()); } bool SetupPageUserDataPage::setPower(const QString _aux) { myPowerSpinBox->setValue(_aux.toFloat()); return true; } bool SetupPageUserDataPage::setRig1 (const QString _aux) { rig1LineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setRig2 (const QString _aux) { rig2LineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setRig3 (const QString _aux) { rig3LineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setAntenna1 (const QString _aux) { ant1LineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setAntenna2 (const QString _aux) { ant2LineEdit->setText(_aux); return true; } bool SetupPageUserDataPage::setAntenna3 (const QString _aux) { ant3LineEdit->setText(_aux); return true; } void SetupPageUserDataPage::slotOperatorsChanged() { //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged" << endl; //QString _operators = operatorsLineEdit->text(); if (operatorsLineEdit->text().length() < 1) return; int i = operatorsLineEdit->cursorPosition(); //QColor defaultColor = (operatorsLineEdit->palette()).color(QPalette::WindowText); int ent = -1; //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-00" << endl; QString _a = operatorsLineEdit->text(); if ((_a.at(i-1)).isSpace()) { operatorsLineEdit->setText(_a.remove(i-1, 1)); } //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-01" << endl; //operatorsLineEdit->setText(((operatorsLineEdit->text())).simplified()); //operatorsLineEdit->setText((operatorsLineEdit->text()).toUpper()); operatorsLineEdit->setText(_a.simplified().toUpper()); _a = operatorsLineEdit->text(); QStringList operators = _a.split(",", QString::SkipEmptyParts); //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-02" << endl; //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-02.5 Size: " << QString::number(operators.size()) << endl; for (int ii = 0; ii < operators.size(); ++ii) { //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-03 - " << QString::number(ii) << endl; operatorsOK = world.checkQRZValidFormat(operators.at(ii)); //ent = world.getQRZARRLId(operators.at(ii)); if (operatorsOK) { //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged: NO VALID CALL: " << operators.at(ii) << endl; } else { //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged: VALID CALL: " << operators.at(ii) << endl; } } // cout << fonts.at(i).toLocal8Bit().constData() << endl; //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-04" << endl; if (operatorsOK) { //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged: VALID FORMAT" << endl; //QColor defaultColor = (operatorsLineEdit->palette()).color(QPalette::WindowText); operatorsLineEdit->setPalette(*defaultPalette); } else { operatorsLineEdit->setPalette(*wrongPalette); //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged: NOT VALID FORMAT" << endl; } //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-05" << endl; /* cqzLineEdit->setText(QString::number(world.getQRZCqz(qrzLineEdit->text()))); ituzLineEdit->setText(QString::number(world.getQRZItuz(qrzLineEdit->text()))); myLocatorLineEdit->setText(world.getQRZLocator(qrzLineEdit->text())); */ //operatorsLineEdit->setText(_a); operatorsLineEdit->setCursorPosition(i); //qDebug() << "SetupPageUserDataPage::slotOperatorsChanged-END" << endl; } QString SetupPageUserDataPage::getOperators() { if (operatorsOK) { return operatorsLineEdit->text(); } else { return QString(); } } bool SetupPageUserDataPage::setOperators(const QString _aux) { if (checkOperatorsLineQString(_aux)) { operatorsLineEdit->setText(_aux); return true; } return false; } bool SetupPageUserDataPage::checkOperatorsLineQString(const QString _auxLine) { QStringList _aux = _auxLine.split(','); for (int ii = 0; ii < _aux.size(); ++ii) { operatorsOK = world.checkQRZValidFormat(_aux.at(ii)); if (!operatorsOK) return operatorsOK; } return true; } klog-0.9.2.2/dataproxy.cpp0000644000076700000620000002140712627126144013314 0ustar staff/*************************************************************************** dataproxy.cpp - description ------------------- begin : sept 2014 copyright : (C) 2014 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "dataproxy.h" DataProxy::DataProxy() { //qDebug() << "DataProxy::DataProxy" << endl; } DataProxy::~DataProxy() { } void DataProxy::createLogModel(){} void DataProxy::createLogPanel(){} bool DataProxy::haveAtLeastOneLog(){return true;} int DataProxy::getIdFromModeName(const QString& _modeName) { return -1; } int DataProxy::getIdFromBandName(const QString& _bandName) { return -1; } int DataProxy::getSubModeIdFromSubMode(const QString _subModeName) { return -1; } int DataProxy::getModeIdFromSubModeId(const int _sm) { return -1; } QString DataProxy::getModeFromSubMode (const QString _sm) { return ""; } bool DataProxy::isModeDeprecated (const QString _sm) { return false; } QString DataProxy::getNameFromBandId (const int _id) { return ""; } QString DataProxy::getNameFromModeId (const int _id) { return ""; } QString DataProxy::getNameFromSubModeId (const int _id) { return ""; } QString DataProxy::getSubModeFromId (const int _id) { return QString(); } QString DataProxy::getNameFromSubMode (const QString _sm) { return ""; } QString DataProxy::getFreqFromBandId(const int _id) { return ""; } int DataProxy::getBandIdFromFreq(const double _n) { return -1; } QStringList DataProxy::getBands() { return QStringList(); } QStringList DataProxy::getModes() { return QStringList(); } QStringList DataProxy::getBandsInLog(const int _log) { return QStringList(); } QStringList DataProxy::getModesInLog(const int _log) { return QStringList(); } int DataProxy::getLastQSOid() { return -1; } bool DataProxy::clearLog() { return false; } bool DataProxy::qslSentViaDirect(const int _qsoId, const QString _updateDate) { return false; } bool DataProxy::qslSentViaBureau(const int _qsoId, const QString _updateDate) { return false; } bool DataProxy::qslRecViaBureau(const int _qsoId, const QString _updateDate) { return false; } bool DataProxy::qslRecViaBureau(const int _qsoId, const QString _updateDate, const bool _queueSentQSL) { return false; } bool DataProxy::qslRecViaDirect(const int _qsoId, const QString _updateDate, const bool _queueSentQSL) { return false; } bool DataProxy::qslRecViaDirect(const int _qsoId, const QString _updateDate) { return false; } bool DataProxy::qslSentAsRequested(const int _qsoId, const QString _updateDate) { return false; } bool DataProxy::qslRecAsRequested(const int _qsoId, const QString _updateDate) { return false; } bool DataProxy::setClubLogSent(const int _qsoId, const QString _st, const QString _updateDate) { return false; } bool DataProxy::isQSLReceived(const int _qsoId) { return false; } bool DataProxy::isQSLSent(const int _qsoId) { return false; } QString DataProxy::getCallFromId(const int _qsoId) { return ""; } QStringList DataProxy::getClubLogRealTimeFromId(const int _qsoId) { return QStringList(); } QString DataProxy::getNameFromQRZ(const QString _call) { return QString(); } QString DataProxy::getQTHFromQRZ(const QString _call) { return QString(); } QString DataProxy::getLocatorFromQRZ(const QString _call) { return QString(); } QString DataProxy::getIOTAFromQRZ(const QString _call) { return QString(); } QString DataProxy::getQSLViaFromQRZ(const QString _call) { return QString(); } bool DataProxy::deleteQSO(const int _qsoId) { return false; } 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; } bool DataProxy::isHF(const int _band) { return false; } bool DataProxy::isWARC(const int _band) { return false; } bool DataProxy::isVHF(const int _band) { return false; } QStringList DataProxy::getOperatingYears(const int _currentLog) { return QStringList(); } void DataProxy::compressDB() { } int DataProxy::getDXCConYear(const int _year, const int _logNumber) { return -1; } int DataProxy::getCQzonYear(const int _year, const int _logNumber) { return -1; } bool DataProxy::newDXMarathon(const int _dxcc, const int _cq, const int _year, const int _logNumber) { return false; } QStringList DataProxy::getContestNames() { return QStringList(); } QStringList DataProxy::getContestCat(const int _catn){ return QStringList(); } QStringList DataProxy::getContestOverlays() { return QStringList(); } QStringList DataProxy::getBandNames(){ return QStringList(); } QStringList DataProxy::getPropModeList() { return QStringList(); } QStringList DataProxy::getValidCatOptions(const int _currentCat, const int _lowerCa) { return QStringList(); } int DataProxy::getNumberOfManagedLogs() { return -1; } int DataProxy::getMaxLogNumber() { return -1; } QStringList DataProxy::getListOfManagedLogs() { return QStringList(); } QString DataProxy::getStationCallSignFromLog(const int _log) { return QString(); } int DataProxy::getContestTypeN(const int _co, const int _catop, const int _catas, const int _catpo, const int _catba, const int _catov, const int _catmo) { return -1; } QStringList DataProxy::getDataFromContestType(const int _n) { return QStringList(); } 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(); } klog-0.9.2.2/klog.10000644000076700000620000000275012627126144011613 0ustar staff.TH KLog 1 "version 0.9.2" "Jaime Robles, EA4TV" "Hamradio" .SH "NAME" klog \- The Ham Radio Logging program .SH SYNOPSIS \fBklog\fR \fI[option]\fR .SH OPTIONS A summary of options is included below. .TP \fB\-\-help\fR Show summary of options. .TP \fB\-\-version\fR Output version information and exit. .SH DESCRIPTION \fBklog\fR is a ham radio logging program for Linux, OSX and Windows. With KLog you can log your QSOs and save it in ADIF format. KLog helps you to manage DXCC, WAZ and IOTA award. .SH USAGE Enter you QSO data in the top left box while entity data, direction and other usefull information will be shown in the top right box. .P Previous QSOs are shown in the botton box where you can click to edit them. .P Here is a list of keys that can be used to navigate through klog: .TP \fIControl a\fR: Add a QSO. .TP \fIControl d\fR: Delete a selected QSO. .SH PRINTING KLog has a very basic printing feature implemented. .SH PREFERENCES You can edit the ~/.klog/klogrc file to setup you call and locator. .P All the data files are saved in the KLog home directory (~/.klog) by default. .SH FILES \fI/usr/share/klog/cty.csv\fR contains the DXCC entries read by KLog. \fI~/.klog/logbook.dat.\fR contains all the logbook and information of KLog. .SH AUTHORS KLog was written by Jaime Robles, EA4TV aka Download the last version from: http://jaime.robles.es Calculation of heading and distance was taken from Loccalc code by Marco Bersani, IK2PIH. klog-0.9.2.2/downloadcty.h0000644000076700000620000000247612627126144013302 0ustar staff#ifndef DOWNLOADCTY_H #define DOWNLOADCTY_H #include #include #include #include #include #include #include #include #include #include #include #include class QSslError; QT_USE_NAMESPACE class DownLoadCTY : public QObject { Q_OBJECT public: explicit DownLoadCTY(const QString _kontestDir, const QString _klogVersion); ~DownLoadCTY(); int download(); private: //void setTarget(const QString& t); bool saveToDisk(const QString &filename, QIODevice *data); QString saveFileName(const QUrl &url); QNetworkAccessManager *manager; QNetworkRequest *request; //QString target; int result; // enum QNetworkReply::NetworkError QString kontestDir; QString urld; QUrl *url; private slots: void slotDownloadFinished(QNetworkReply* reply); void slotDownloadProgress(qint64 received, qint64 total); void slotErrorManagement(QNetworkReply::NetworkError networkError); signals: void actionReturnDownload(const int _i); void done(); void actionShowProgres(qint64 received, qint64 total); void actionError(const int _i); }; #endif // DOWNLOADCTY_H klog-0.9.2.2/setuppagelogs.cpp0000644000076700000620000004556512627126144014176 0ustar staff/*************************************************************************** setuppagelogs.cpp - description ------------------- begin : feb 2012 copyright : (C) 2012 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include "setuppagelogs.h" SetupPageLogs::SetupPageLogs(QWidget *parent) : QWidget(parent){ //qDebug() << "SetupPageLogs::SetupPageLogs" << endl; stationCallsign = QString(); operators = QString(); comment = QString(); dateString = QString(); typeContest = QString(); contestCatMode = -1; contestCatOperators = -1; contestCatAssisted = -1; contestCatPower = -1; contestCatBands = -1; contestBands = -1; typeContestN = -1; currentLogs = new QComboBox(); logsAvailable.clear(); newLog = new SetupPageLogsNew(); logsModel = new QSqlRelationalTableModel(this); logsView = new QTableView; logsView->setContextMenuPolicy(Qt::CustomContextMenu); logsView->setSortingEnabled(true); createLogsModel(); createLogsPanel(); logsView->setCurrentIndex(logsModel->index(0, 0)); lastLog = 0; newLogPushButton = new QPushButton(tr("&New"), this); editPushButton = new QPushButton(tr("&Edit"), this); removePushButton = new QPushButton(tr("&Remove"), this); newLogPushButton->setToolTip(tr("Add a new log")); //loadAllPushButton->setToolTip(tr("Load all the logs")); //loadSelectedPushButton->setToolTip(tr("Load only the selected log")); //clearPushButton->setToolTip(tr("Clear selection")); editPushButton->setToolTip(tr("Edit the selected log")); removePushButton->setToolTip(tr("Remove the selected log")); currentLogs->setToolTip(tr("Select the log you want to open")); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addWidget(newLogPushButton); buttonsLayout->addWidget(editPushButton); buttonsLayout->addWidget(removePushButton); QVBoxLayout *widgetLayout = new QVBoxLayout; widgetLayout->addWidget(logsView); widgetLayout->addWidget(currentLogs); widgetLayout->addLayout(buttonsLayout); //widgetLayout->addLayout(logDataLayout); setLayout(widgetLayout); dataProxy = new DataProxy_SQLite(); //connect(newLogPushButton, SIGNAL(clicked ( )), this, SLOT(slotNewButtonClicked() ) ); createActions(); updateSelectedLogs(); } SetupPageLogs::~SetupPageLogs(){ //qDebug() << "SetupPageLogs::~SetupPageLogs" << endl; } void SetupPageLogs::slotNewButtonClicked() { //qDebug() << "SetupPageLogs::slotNewButtonClicked" << endl; newLog->exec(); } void SetupPageLogs::slotEditButtonClicked() { //qDebug() << "SetupPageLogs::slotEditButtonClicked" << endl; QSqlQuery query; int nameCol = -1; int selectedLog = getSelectedLog(); //qDebug() << "SetupPageLogs::slotEditButtonClicked-1 (selectedlog: " << QString::number(selectedLog) << ")" << endl; QString stringQuery = QString("SELECT * FROM logs WHERE id='%1'").arg(selectedLog); //qDebug() << "SetupPageLogs::slotEditButtonClicked -2" << endl; bool sqlOk = query.exec(stringQuery); QSqlRecord rec = query.record(); if (sqlOk) { //qDebug() << "SetupPageLogs::slotEditButtonClicked Query OK" << endl; QSqlRecord rec = query.record(); if ( (query.next()) && (query.isValid()) ) {//id/logdate/stationcall/comment/logtype/logtypeid //qDebug() << "SetupPageLogs::slotEditButtonClicked Query Valid" << endl; newLog->setEditing(true); nameCol = rec.indexOf("stationcall"); newLog->setStationCallSign((query.value(nameCol)).toString()); nameCol = rec.indexOf("comment"); newLog->setComment((query.value(nameCol)).toString()); nameCol = rec.indexOf("logdate"); newLog->setDateString((query.value(nameCol)).toString()); nameCol = rec.indexOf("logtypen"); //qDebug() << "SetupPageLogs::slotEditButtonClicked -3" << endl; newLog->setTypeN((query.value(nameCol)).toInt()); newLog->exec(); } } } void SetupPageLogs::slotRemoveButtonClicked() { //qDebug() << "SetupPageLogs::slotRemoveButtonClicked" << endl; int selectedLog = getSelectedLog(); QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("KLog"), tr("Do you really want to remove this log?\n" "All the QSO from this log will be also deleted..."), QMessageBox::Yes | QMessageBox::No); if (ret == QMessageBox::Yes) { //qDebug() << "SetupPageLogs::slotRemoveButtonClicked (selected log to remove: " << QString::number(selectedLog) << ")" << endl; QString stringQuery = QString("DELETE FROM logs WHERE id='%1'").arg(selectedLog); QSqlQuery query(stringQuery); bool sqlOk = query.exec(); if (sqlOk) { //qDebug() << "SetupPageLogs::slotRemoveButtonClicked (REMOVED: " << QString::number(selectedLog) << ")" << endl; logsModel->select(); updateSelectedLogs(); stringQuery = QString("DELETE FROM log WHERE lognumber='%1'").arg(selectedLog); query.exec(stringQuery); sqlOk = query.exec(); //qDebug() << "SetupPageLogs::slotRemoveButtonClicked: LastQuery: " << query.lastQuery() << endl; if (sqlOk) { //qDebug() << "SetupPageLogs::slotRemoveButtonClicked (QSOS REMOVED: " << QString::number(selectedLog) << ")" << endl; stringQuery = QString("DELETE FROM awarddxcc WHERE lognumber='%2'").arg(selectedLog); query.exec(stringQuery); sqlOk = query.exec(); //qDebug() << "SetupPageLogs::slotRemoveButtonClicked: LastQuery: " << query.lastQuery() << endl; if (sqlOk) { //qDebug() << "SetupPageLogs::slotRemoveButtonClicked (AWARDDXCC REMOVED: " << QString::number(selectedLog) << ")" << endl; } else { showError(tr("Log has not been removed. (#3)")); //qDebug() << "SetupPageLogs::slotRemoveButtonClicked (AWARDDXCC NOT REMOVED: " << QString::number(selectedLog) << ")" << endl; } } else { showError(tr("Log has not been removed. (#2)")); //qDebug() << "SetupPageLogs::slotRemoveButtonClicked (QSOS NOT REMOVED: " << QString::number(selectedLog) << ")" << endl; } } else { showError(tr("Log has not been removed. (#1)")); //qDebug() << "SetupPageLogs::slotRemoveButtonClicked (NOT REMOVED: " << QString::number(selectedLog) << ")" << endl; } } //ASK FOR A CONFIRMATION //DELETE ALL THE QSO IN THE REMOVED LOG } void SetupPageLogs::createLogsPanel() { //qDebug() << "SetupPageLogs::createLogsPanel" << endl; logsView->setModel(logsModel); QString stringQuery = QString("SELECT * FROM logs"); QSqlQuery query(stringQuery); QSqlRecord rec = query.record(); // Number of columns int columns = rec.count(); for (int i = 0; i < columns; i++ ){ logsView->setColumnHidden(i, true); } columns = rec.indexOf("id"); logsView->setColumnHidden(columns, false); columns = rec.indexOf("logdate"); logsView->setColumnHidden(columns, false); columns = rec.indexOf("stationcall"); logsView->setColumnHidden(columns, false); columns = rec.indexOf("comment"); logsView->setColumnHidden(columns, false); columns = rec.indexOf("logtype"); logsView->setColumnHidden(columns, false); logsView->setItemDelegate(new QSqlRelationalDelegate(this)); logsView->setSelectionMode( QAbstractItemView::SingleSelection); logsView->setSelectionBehavior(QAbstractItemView::SelectRows); logsView->resizeColumnsToContents(); logsView->horizontalHeader()->setStretchLastSection(true); } void SetupPageLogs::createLogsModel() { //qDebug() << "SetupPageLogs::createLogsModel" << endl; QString stringQuery = QString("SELECT * FROM logs"); QSqlQuery q(stringQuery); QSqlRecord rec = q.record(); int nameCol; //logsModel = new QSqlRelationalTableModel(this); logsModel->setTable("logs"); nameCol = rec.indexOf("id"); logsModel->setSort(nameCol, Qt::AscendingOrder); logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("ID")); nameCol = rec.indexOf("logdate"); logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("Date")); nameCol = rec.indexOf("stationcall"); logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("Station Callsign")); nameCol = rec.indexOf("comment"); logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("Comments")); nameCol = rec.indexOf("logtype"); logsModel->setHeaderData(nameCol, Qt::Horizontal, tr("Type")); logsModel->select(); } void SetupPageLogs::slotLogSelected(const QModelIndex & index) { //qDebug() << "SetupPageLogs::slotLogSelected" << endl; int row = index.row(); setSelectedLog((logsModel->index(row, 0)).data(0).toInt()); } void SetupPageLogs::slotLogDoubleClicked(const QModelIndex & index) { //qDebug() << "SetupPageLogs::slotLogDoubleClicked" << endl; int row = index.row(); setSelectedLog((logsModel->index(row, 0)).data(0).toInt()); slotEditButtonClicked(); } void SetupPageLogs::createActions() { //qDebug() << "SetupPageLogs::createActions" << endl; connect(newLogPushButton, SIGNAL(clicked ( )), this, SLOT(slotNewButtonClicked() ) ); connect(removePushButton, SIGNAL(clicked ( )), this, SLOT(slotRemoveButtonClicked() ) ); connect(editPushButton, SIGNAL(clicked ( )), this, SLOT(slotEditButtonClicked() ) ); connect(newLog, SIGNAL(newLogData(QStringList)), this, SLOT(slotAnalyzeNewLogData(QStringList) ) ); connect(logsView, SIGNAL(clicked(QModelIndex)), this, SLOT(slotLogSelected(QModelIndex) ) ); connect(logsView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotLogDoubleClicked(QModelIndex) ) ); //connect(logView, SIGNAL(doubleClicked ( const QModelIndex& ) ), this, SLOT(slotDoubleClickLog( const QModelIndex& ) ) ); //loadAllPushButton->setToolTip(tr("Load all the logs")); //loadSelectedPushButton->setToolTip(tr("Load only the selected log")); //clearPushButton->setToolTip(tr("Clear selection")); } QStringList SetupPageLogs::readLogs() { //qDebug() << "SetupPageLogs::readLogs" << endl; QString aux, aux2; QStringList _logs; QSqlQuery query; int nameCol = -1; bool sqlOk = false; QDate date = QDate::currentDate(); aux2.clear(); aux.clear(); _logs.clear(); aux = "SELECT id, logdate, stationcall, logtype FROM logs"; sqlOk = query.exec(aux); if (sqlOk) { QSqlRecord rec = query.record(); while ( (query.next()) && (query.isValid()) ) { aux2.clear(); nameCol = rec.indexOf("id"); aux2 = (query.value(nameCol)).toString(); nameCol = rec.indexOf("logdate"); aux2 = aux2.append("--"); aux2.append((query.value(nameCol)).toString()); nameCol = rec.indexOf("stationcall"); aux2 = aux2.append("-"); aux2.append((query.value(nameCol)).toString()); nameCol = rec.indexOf("logtype"); aux2 = aux2.append("-"); aux2.append((query.value(nameCol)).toString()); _logs.append(aux2); } return _logs; } else { return _logs; } _logs.clear(); //qDebug() << "SetupPageLogs::readLogs: " << QString::number(_logs.size())<< endl; return _logs; } void SetupPageLogs::slotAnalyzeNewLogData(const QStringList _qs) { //qDebug() << "SetupPageLogs::slotAnalyzeNewLogData (length=" << QString::number(_qs.length()) << ")" << endl; if (_qs.length()!=13) { return; } /* From SetupPageLogsNew::gatherAndSend() logData.clear(); logData << stationCallsign << operators << comment << dateString << typeConteststr << QString::number(contestCatMode) << QString::number(contestCatOperators) << QString::number(contestCatAssisted) << QString::number(contestCatPower) << QString::number(contestCatBands) << QString::number(contestBands) << QString::number(contestCatOverlay) << QString::number(typeContest); */ stationCallsign = _qs.at(0); operators = _qs.at(1); comment = _qs.at(2); dateString = _qs.at(3); typeContest = _qs.at(4); contestCatMode = (_qs.at(5)).toInt(); contestCatOperators = (_qs.at(6)).toInt(); contestCatAssisted = (_qs.at(7)).toInt(); contestCatPower = (_qs.at(8)).toInt(); contestCatBands = (_qs.at(9)).toInt(); contestBands = (_qs.at(10)).toInt(); typeContestN = (_qs.at(12)).toInt(); //OVERLAY = 11 QStringList newLogq; newLogq.clear(); newLogq << dateString << stationCallsign << _qs.at(4) << comment << _qs.at(12); if (dataProxy->addNewLog(newLogq)) { logsModel->select(); updateSelectedLogs(); } } /* bool SetupPageLogs::addNewLog(const QStringList _qs) { //qDebug() << "SetupPageLogs::addNewLog: " << _qs.at(2) << endl; 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) { //qDebug() << "SetupPageLogs::addNewLog ADDED! id = " << endl; logsModel->select(); updateSelectedLogs(); return true; } else { return false; } return false; } */ void SetupPageLogs::updateSelectedLogs() { //qDebug() << "SetupPageLogs::updateSelectedLogs" << endl; logsAvailable = readLogs(); if (logsAvailable.length()>0) { currentLogs->clear(); currentLogs->addItems(logsAvailable); } else { //qDebug() << "SetupPageLogs::updateSelectedLogs Not selected (less than 1)" << endl; currentLogs->clear(); } } int SetupPageLogs::getSelectedLog() { //qDebug() << "SetupPageLogs::getSelectedLog: " << currentLogs->currentText() << endl; QString selectedLog = currentLogs->currentText(); int i = 0; QStringList qs; qs.clear(); qs << selectedLog.split("-"); i = (qs.at(0)).toInt(); if (i>=1) { return i; } else { return 0; } return 0; } void SetupPageLogs::setSelectedLog(const int _i) { //qDebug() << "SetupPageLogs::SetupPageLogs::setSelectedLog: " << QString::number(_i) << endl; QString n = QString::number(_i) + "--"; int selected = currentLogs->findText(n, Qt::MatchStartsWith); if (selected >= 0) { //qDebug() << "SetupPageLogs::SetupPageLogs::setSelectedLog selected>0: " << QString::number(selected) << endl; currentLogs->setCurrentIndex(selected); } else { //qDebug() << "SetupPageLogs::SetupPageLogs::setSelectedLog not selcted" << endl; return; } } void SetupPageLogs::readSelectedLog(const int _i) { /* stationCallsign = _qs.at(0); operators = _qs.at(1); comment = _qs.at(2); dateString = _qs.at(3); typeContest = _qs.at(4); contestCatMode = (_qs.at(5)).toInt(); contestCatOperators = (_qs.at(6)).toInt(); contestCatAssisted = (_qs.at(7)).toInt(); contestCatPower = (_qs.at(8)).toInt(); contestCatBands = (_qs.at(9)).toInt(); contestBands = (_qs.at(10)).toInt(); */ } void SetupPageLogs::showError(const QString _errorC) { QString text = QString(tr("An error has ocurred showing the following error code:\n'%1'")).arg(_errorC); int ret = QMessageBox::warning(this, tr("KLog - SetupPageLogs"), text, QMessageBox::Ok); } klog-0.9.2.2/utilities.h0000644000076700000620000000435412627126144012763 0ustar staff#ifndef UTILITIES_H #define UTILITIES_H /*************************************************************************** utilities.h - description ------------------- begin : jun 2015 copyright : (C) 2015 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ /* 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 class Utilities { public: Utilities(); int getProgresStepForDialog(int totalSteps); bool trueOrFalse(const QString _s); // reads a String and return true if s.upper()== TRUE :-) QString checkAndFixASCIIinADIF(const QString _data); }; #endif // UTILITIES_H klog-0.9.2.2/elogclublog.cpp0000644000076700000620000003643312627126144013604 0ustar staff#include "elogclublog.h" #include #include #include #include #include eLogClubLog::eLogClubLog() : QObject(0) { //qDebug() << "eLogClubLog::eLogClubLog" << endl; call= QString(); email = QString(); pass = QString(); api = "9467beee93377e82a276b0a777d388b5c933d044"; currentQSO = -1; useQSOStationCallsign = false; stationCallsign = QString(); } eLogClubLog::~eLogClubLog() { //qDebug() << "eLogClubLog::~eLogClubLog" << endl; } void eLogClubLog::slotQsoUploadFinished(QNetworkReply *data) { //qDebug() << "eLogClubLog::slotQsoUploadFinished" << endl; result = data->error(); //qDebug() << "eLogClubLog::slotQsoUploadFinished - Result = " << QString::number(result) << endl; const QByteArray sdata = data->readAll(); QString text = QString(); if (currentQSO>0) { emit actionReturnDownload(result, currentQSO); currentQSO = -1; } if (result == QNetworkReply::NoError) { text = "ClubLog: " + prepareToTranslate(sdata); //qDebug() << sdata; } else if (result == QNetworkReply::HostNotFoundError) { //qDebug() << "eLogClubLog::slotQsoUploadFinished - Result = Host Not found! = " << QString::number(result) << endl; text = "ClubLog: " + tr("Host not found!"); //TODO: Mark the previous QSO as not sent to clublog } else if (result == QNetworkReply::TimeoutError) { //qDebug() << "eLogClubLog::slotQsoUploadFinished - Result = Time out error! = " << QString::number(result) << endl; text = "ClubLog: " + tr("Timeout error!"); //TODO: Mark the previous QSO as not sent to clublog } else if (result == 202) { //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"), 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); emit disableClubLogAction(true); //TODO: Mark the previous QSO as not sent to clublog } else { //qDebug() << "eLogClubLog::slotQsoUploadFinished - Result = UNDEFINED = " << QString::number(result) << endl; text = "ClubLog: " + tr("Undefined error..."); //TODO: Mark the previous QSO as not sent to clublog } //qDebug() << "eLogClubLog::slotQsoUploadFinished - Result = " << QString::number(result) << endl; //emit done(); emit showMessage(text); } void eLogClubLog::slotFileUploadFinished(QNetworkReply *data) { //qDebug() << "eLogClubLog::slotFileUploadFinished" << endl; result = data->error(); //qDebug() << "eLogClubLog::slotFileUploadFinished - Result = " << QString::number(result) << endl; const QByteArray sdata = data->readAll(); QString text = QString(); if (result == QNetworkReply::NoError) { text = "ClubLog: " + prepareToTranslate(sdata); //qDebug() << "eLogClubLog::slotFileUploadFinished - Result = NoError = " << QString::number(result) << endl; //qDebug() << sdata; } else if (result == QNetworkReply::HostNotFoundError) { //qDebug() << "eLogClubLog::slotFileUploadFinished - Result = Host Not found! = " << QString::number(result) << endl; text = "ClubLog: " + tr("Host not found!"); } else if (result == QNetworkReply::TimeoutError) { //qDebug() << "eLogClubLog::slotFileUploadFinished - Result = Time out error! = " << QString::number(result) << endl; text = "ClubLog: " + tr("Timeout error!"); } else { //qDebug() << "eLogClubLog::slotFileUploadFinished - Result = UNDEFINED = " << QString::number(result) << endl; text = "ClubLog: " + tr("Undefined error..."); } //qDebug() << "eLogClubLog::slotFileUploadFinished - Result = " << QString::number(result) << endl; //emit done(); emit showMessage(text); } void eLogClubLog::downloadProgress(qint64 received, qint64 total) { //qDebug() << "eLogClubLog::downloadProgress: " << QString::number(received) << "/" << QString::number(total) << endl; //qDebug() << received << total; emit actionShowProgres(received, total); } void eLogClubLog::slotErrorManagement(QNetworkReply::NetworkError networkError) { //qDebug() << "eLogClubLog::slotErrorManagement: " << QString::number(networkError) << endl; result = networkError; if (result == QNetworkReply::NoError) { } else if (result == QNetworkReply::HostNotFoundError) { //qDebug() << "eLogClubLog::slotErrorManagement: Host not found" << endl; } else { //qDebug() << "eLogClubLog::slotErrorManagement: ERROR!" << endl; } //actionError(result); } int eLogClubLog::sendQSO(QStringList _qso) { //qDebug() << "eLogClubLog::sendQSO: " << call <<"/"<< email << "/" << pass << "/" << api << endl; //qDebug() << "eLogClubLog::sendQSO:: length = " << QString::number(_qso.length()) << endl; // First Data in the QStringList is the QSO id, not to be sent to clublog but used in the signal actionReturnDownload(const int _i, const int _qsoId); if (_qso.length()!=18) { return -1; } currentQSO = (_qso.at(0)).toInt(); _qso.removeFirst(); stationCallsign = QString(); if (useQSOStationCallsign) { stationCallsign = _qso.last(); } //qDebug() << "eLogClubLog::sendQSO (stationCallsign = " << _qso.last() << ")" << endl; _qso.removeLast(); QString qso = getClubLogAdif(_qso); //qDebug() << "eLogClubLog::sendQSO: " << qso << endl; return sendData(qso); } int eLogClubLog::sendData(const QString _q) { //qDebug() << "eLogClubLog::sendData: " << _q << endl; //Posiblemente tenga que usar una de estas: void QUrlQuery::addQueryItem(const QString & key, const QString & value) QUrl serviceUrl = QUrl("https://secure.clublog.org/realtime.php"); QByteArray postData; //QByteArray postData; /* QUrl params; params.addQueryItem("email",email); params.addQueryItem("password",pass); if ((useQSOStationCallsign) && (stationCallsign.length()>2)) { params.addQueryItem("callsign",stationCallsign); //qDebug() << "eLogClubLog::sendData - callsign 1: " << stationCallsign << endl; } else { params.addQueryItem("callsign",call); //qDebug() << "eLogClubLog::sendData - callsign 2: " << call << endl; } params.addQueryItem("api",api); params.addQueryItem("adif",_q); postData = params.encodedQuery(); */ QUrlQuery params; params.addQueryItem("email",email); params.addQueryItem("password",pass); if ((useQSOStationCallsign) && (stationCallsign.length()>2)) { params.addQueryItem("callsign",stationCallsign); //qDebug() << "eLogClubLog::sendData - callsign 1: " << stationCallsign << endl; } else { params.addQueryItem("callsign",call); //qDebug() << "eLogClubLog::sendData - callsign 2: " << call << endl; } params.addQueryItem("api",api); params.addQueryItem("adif",_q); postData = params.query(QUrl::FullyEncoded).toUtf8(); //postData = params.encodedQuery(); // Call the webservice QNetworkAccessManager *networkManager = new QNetworkAccessManager(this); QNetworkRequest request(serviceUrl); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotQsoUploadFinished(QNetworkReply*))); networkManager->post(request, postData); return -1; } QString eLogClubLog::getClubLogAdif(const QStringList _q) { //qDebug() << "eLogClubLog::getClubLogAdif: " << QString::number(_q.length()) << endl; // _qso must include 16 ordered fields than can be empty or contain data. This function builds the ADIF QSO /* http://clublog.freshdesk.com/support/solutions/articles/53202-which-adif-fields-does-club-log-use- ClubLog only accepts the following ADIF fields: •QSO_DATE •TIME_ON •QSLRDATE •QSLSDATE •CALL •OPERATOR •MODE •BAND •BAND_RX •FREQ •QSL_RCVD •LOTW_QSL_RCVD •QSL_SENT •DXCC •PROP_MODE •CREDIT_GRANTED */ if (_q.length()!=16) { return QString(); } QString qso, aux1; qso.clear(); aux1 = _q.at(0); if ((aux1.length()) == 10){ aux1.remove(QChar('-'), Qt::CaseInsensitive); aux1.remove(QChar('/'), Qt::CaseInsensitive); qso = "" + aux1 + " "; } //qso = "" + _q.at(0) + " "; qso = qso + "" + _q.at(1) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 10" << endl; qso = qso + "" + _q.at(2) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 20" << endl; qso = qso + "" + _q.at(3) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 30" << endl; qso = qso + "" + _q.at(4) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 40" << endl; qso = qso + "" + _q.at(5) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 50" << endl; qso = qso + "" + _q.at(6) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 60" << endl; qso = qso + "" + _q.at(7) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 70" << endl; if ((_q.at(8)).length()> 2) { qso = qso + "" + _q.at(8) + " "; } if ((_q.at(9)).length()> 2) { qso = qso + "" + _q.at(9) + " "; } //qDebug() << "eLogClubLog::getClubLogAdif: 90" << endl; qso = qso + "" + _q.at(10) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 100" << endl; qso = qso + "" + _q.at(11) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 110" << endl; qso = qso + "" + _q.at(12) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 120" << endl; if ((_q.at(13)).toInt()> 0) { qso = qso + "" + _q.at(13) + " "; } //qDebug() << "eLogClubLog::getClubLogAdif: 130'" << endl; qso = qso + "" + _q.at(14) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 140" << endl; qso = qso + "" + _q.at(15) + " "; //qDebug() << "eLogClubLog::getClubLogAdif: 150" << endl; qso = qso + ""; ////qDebug() << "eLogClubLog:: - QSO: " << qso << endl; //qDebug() << "eLogClubLog::getClubLogAdif: 100" << endl; return qso; } void eLogClubLog::setCredentials(const QString _call, const QString _email, const QString _pass, const bool _useQSOStationCall) { //qDebug() << "eLogClubLog::setCredentials" << endl; call = _call; email = _email; pass = _pass; useQSOStationCallsign = _useQSOStationCall; } int eLogClubLog::deleteQSO(QStringList _qso) { //qDebug() << "eLogClubLog::deleteQSO: length = " << QString::number(_qso.length()) << endl; if (_qso.length()!=17) { return -1; } _qso.removeFirst(); //http://clublog.freshdesk.com/support/solutions/articles/54908-using-adif-to-update-or-delete-qsos //VP9NO2007090321330030MCWGH6UW QString replaceCall = "" + call + " " + ""; QString qso = getClubLogAdif(_qso); qso.replace("", replaceCall); //qDebug() << "eLogClubLog::deleteQSO: ready to send = " << qso << endl; return sendData(qso); } QString eLogClubLog::prepareToTranslate(const QString _m) { //qDebug() << "eLogClubLog:: = prepareToTranslate" << _m << endl; if (_m == "Callsign missing") { return tr("Callsign missing"); } else if (_m == "Invalid callsign") { return tr("Invalid callsign"); } else if (_m == "Skipping SWL callsign") { return tr("Skipping SWL callsign"); } else if (_m == "Callsign is your own call") { return tr("Callsign is your own call"); } else if (_m == "Invalid callsign with no DXCC mapping") { return tr("Invalid callsign with no DXCC mapping"); } else if (_m == "Updated QSO") { return tr("Updated QSO"); } else if (_m == "Invalid ADIF record") { return tr("Invalid ADIF record"); } else if (_m == "Missing ADIF record") { return tr("Missing ADIF record"); } else if (_m == "Test mode - parameters ok, no action taken") { return tr("Test mode - parameters ok, no action taken"); } else if (_m == "Excesive API Usage") { return tr("Excesive API Usage"); } else if (_m == "Internal Error") { return tr("Internal Error"); } else if (_m == "Rejected") { return tr("Rejected"); } else if (_m == "QSO Duplicate") { return tr("QSO Duplicate"); } else if (_m == "QSO Modified") { return tr("QSO Modified"); } else if (_m == "Missing Login") { return tr("Missing Login"); } else if (_m == "QSO OK") { return tr("QSO OK"); } else if (_m == "Upload denied") { return tr("Upload denied"); } else if (_m == "No callsign selected") { return tr("No callsign selected"); } else if (_m == "No match found") { return tr("No match found"); } else if (_m == "Dropped QSO") { return tr("Dropped QSO"); } else if (_m == "OK") { return tr("OK"); } else if (_m == "Login rejected") { return tr("Login rejected"); } else if (_m == "Upload denied") { return tr("Upload denied"); } else if (_m == "Rejected: Callsign is your own call") { return tr("Rejected: Callsign is your own call"); } else { return _m; } } int eLogClubLog::modifyQSO (QStringList _oldQSO, QStringList _newQSO) { int x = -1; x = deleteQSO(_oldQSO); x = sendQSO(_newQSO); return x; } klog-0.9.2.2/awarddxmarathon.cpp0000644000076700000620000000523712627126144014470 0ustar staff/*************************************************************************** awarddxmarathon.cpp - description ------------------- begin : feb 2015 copyright : (C) 2015 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "awarddxmarathon.h" DXMarathon::DXMarathon() { dataProxy = new DataProxy_SQLite(); } int DXMarathon::getDXMarathonDXCC(const int _year, const int _logNumber) { //qDebug() << "DXMarathon::getDXMarathonDXCC: " << QString::number(_year) << endl; return dataProxy->getDXCConYear(_year, _logNumber); } int DXMarathon::getDXMarathonCQ(const int _year, const int _logNumber) { //qDebug() << "DXMarathon::getDXMarathonCQ: " << QString::number(_year) << endl; return dataProxy->getCQzonYear(_year, _logNumber); } int DXMarathon::getDXMarathonScore(const int _year, const int _logNumber) { //qDebug() << "DXMarathon::getDXMarathonScore: " << QString::number(_year) << endl; return ( getDXMarathonDXCC(_year, _logNumber) + getDXMarathonCQ(_year, _logNumber)); } bool DXMarathon::neededForDXMarathon(const int _dxcc, const int _cq, const int _year, const int _logNumber) { return dataProxy->newDXMarathon(_dxcc, _cq, _year, _logNumber); } klog-0.9.2.2/setuppageworldeditor.h0000644000076700000620000000566712627126144015234 0ustar staff#ifndef SETUPPAGEWORLDEDITOR_H #define SETUPPAGEWORLDEDITOR_H /*************************************************************************** setuppageworldeditor.h - description ------------------- begin : jun 2012 copyright : (C) 2012 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ //#include #include #include #include #include "world.h" #include "setupentitydialog.h" enum { WORLD_DXCCid = 0, WORLD_Nameid = 1, WORLD_MainPrefix = 2, WORLD_CQZ = 3, WORLD_ITUZ = 4, WORLD_Cont = 5 }; class SetupPageWorldEditor : public QWidget { Q_OBJECT public: SetupPageWorldEditor(QWidget *parent=0); ~SetupPageWorldEditor(); private slots: void slotAddButtonClicked(); void slotDelButtonClicked(); void slotEditButtonClicked(); void slotDoubleClickEntity( const QModelIndex & index); void slotAnalyzeEntityAddedSignal(const QStringList _qs); private: World *world; void createWorldPanel(); void createWorldModel(); void createActions(); QSqlRelationalTableModel *worldModel; QWidget *worldPanel; QTableView *worldView; QTreeWidget *searchResultsTreeWidget; QPushButton *addEntityPushButton, *delEntityPushButton, *editEntityPushButton, *exportWorldPushButton, *loadWorldPushButton; SetupEntityDialog *setupEntityDialog; }; #endif // SETUPPAGEWORLDEDITOR_H klog-0.9.2.2/database.h0000644000076700000620000001240012627126144012503 0ustar staff#ifndef DATABASE_H #define DATABASE_H /*************************************************************************** database.h - description ------------------- begin : sept 2011 copyright : (C) 2011 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include #include #include #include #include #include #include #include #include #include "utilities.h" class QSqlRelationalTableModel; // Last db update 0.0.7 // Previous db update 0.0.6 const float DBVersionf = 0.007; class DataBase { public: DataBase(); DataBase(const QString _softVersion, bool inmemoryonly = false); ~DataBase(); bool createConnection(); //bool beginTransaction(); bool isValidBand (const QString b); bool isValidMode (const QString b, const bool _tmp); bool isValidBandNumber (const int b); bool isValidModeNumber (const int b); QString getBandNameFromNumber(const int _n); QString getModeNameFromNumber(const int _n, const bool _tmp); QString getSubModeNameFromNumber(const int _n, const bool _tmp); int getBandIdFromName(const QString b); int getModeIdFromName(const QString b); int getModeIdFromSubMode(const QString b, const bool _tmp); bool createBandModeMaps(); int getBandIDFromName2(const QString b); int getModeIDFromName2(const QString b); QString getBandNameFromID2(const int _i); QString getModeNameFromID2(const int _i); int getBandIdFromFreq(const QString fr); //Freq should be in MHz bool isThisFreqInBand(const QString b, const QString fr); //Freq should be in MHz QString getFreqFromBandId(const int _i); bool unMarkAllQSO(); bool updateIfNeeded(); void compress(); private: bool createDataBase(); bool isTheDBCreated(); bool updateToLatest(); bool updateTo003(); // Updates the DB to 0.0.3 bool updateTo004(); bool updateTo005(); bool updateTo006(); bool updateTo007(); bool updateTableLog(const int _v); bool createTheBandQuickReference(); bool createTheModeQuickReference(); bool updateLog(); // Updates the log table bool createTableLog(bool temp = false); // false creates the prouction DB. True a temporal one. bool createTableLogs(); bool createTablePropModes(); bool createTableClubLogStatus(); bool populateTableClubLogStatus(); bool createTableMode(const bool NoTmp); bool populateTableMode(const bool NoTmp); bool createTableBand(const bool NoTmp); bool populateTableBand(const bool NoTmp); bool recreateContestData(); bool createTableContest(); bool populateContestData(); bool populatePropagationModes(); bool howManyQSOsInLog(const int i); //void showError(const QString _errorC); bool moveFromModeIdToSubmodeId(); bool updateModeIdFromSubModeId(); bool updateBandIdTableLogToNewOnes(); bool updateBandIdTableAward(const int _db); bool updateModeIdTableAward(const int _db); float dbVersion; // The current version of the DB. May differ from latestReaded if we are updating the DB! QString softVersion; float latestReaded; // The latest version of DB readed in the DB itself bool inMemoryOnly; // The DB is to be created in memory, no file support... Faster but less safe! QDateTime date; QHash bandIDHash; QHash modeIDHash; QHash IDBandHash; QHash IDModeHash; QHash freqBandIdHash; QMap bandQMap; QMap modeQMap; Utilities *util; QSqlDatabase db; }; #endif // DATABASE_H klog-0.9.2.2/utilities.cpp0000644000076700000620000000314112627126144013307 0ustar staff#include "utilities.h" Utilities::Utilities() { } int Utilities::getProgresStepForDialog(int totalSteps){ //qDebug() << "Utilities::getProgresStepForDialog"; if (totalSteps <=100) return 1; else if (totalSteps <=1000) return 5; else if (totalSteps <=4000) return 10; else if (totalSteps <=5000) return 15; else if (totalSteps <=7000) return 20; else if (totalSteps <=9999) return 25; 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; } QString Utilities::checkAndFixASCIIinADIF(const QString _data) { //qDebug() << "SetupDialog::checkAndFixASCIIinADIF " << _data << endl; // This function is not really working with ASCII but with Unicode //TODO: this function is also in the FileManager class. Maybe I should call that one and keep just one copy ushort unicodeVal; QString st = _data; QString newString; newString.clear(); for(int i=0; i < st.length(); i++) { // Get unicode VALUE into unicodeVal unicodeVal = (st.at(i)).unicode(); if ((20 <= unicodeVal ) && (unicodeVal <= 126)) { newString.append(st.at(i)); } //qDebug() << "SetupDialog::checkAndFixunicodeinADIF: " << st.at(i) <<" = " << QString::number(unicodeVal) << endl; } // Show into another lineEdit return newString; } klog-0.9.2.2/helphelpdialog.h0000644000076700000620000000077212627126144013731 0ustar staff#ifndef HELPHELPDIALOG_H #define HELPHELPDIALOG_H //#include #include #include #include class HelpHelpDialog : public QDialog { Q_OBJECT public: HelpHelpDialog(const QString tversion); ~HelpHelpDialog(); private slots: void slotAcceptButtonClicked(); //void slotCancelButtonClicked(); private: //void keyPressEvent(QKeyEvent *event); QTextBrowser *textBrowser; }; #endif // HELPHELPDIALOG_H klog-0.9.2.2/awarddxmarathon.h0000644000076700000620000000432312627126144014130 0ustar staff#ifndef AWARDDXMARATHON_H #define AWARDDXMARATHON_H /*************************************************************************** awarddxmarathon.h - description ------------------- begin : feb 2015 copyright : (C) 2015 by Jaime Robles email : jaime@robles.es ***************************************************************************/ /***************************************************************************** * This file is part of KLog. * * * * KLog is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * KLog is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with KLog. If not, see . * * * *****************************************************************************/ #include "dataproxy.h" #include "dataproxy_sqlite.h" class DXMarathon { public: DXMarathon(); int getDXMarathonDXCC(const int _year, const int _logNumber); int getDXMarathonCQ(const int _year, const int _logNumber); int getDXMarathonScore(const int _year, const int _logNumber); bool neededForDXMarathon(const int _dxcc, const int _cq, const int _year, const int _logNumber); private: DataProxy *dataProxy; }; #endif // AWARDDXMARATHON_H klog-0.9.2.2/dataproxy.h0000644000076700000620000001316412627126144012762 0ustar staff#ifndef DATAPROXY_H #define DATAPROXY_H #include #include class DataProxy { public: DataProxy(); // DataProxy(const QStringList _qs); ~DataProxy(); virtual void createLogModel(); virtual void createLogPanel(); virtual bool haveAtLeastOneLog(); //UI functions virtual int getIdFromModeName(const QString& _modeName); virtual int getIdFromBandName(const QString& _bandName); virtual int getSubModeIdFromSubMode(const QString _subModeName); virtual int getModeIdFromSubModeId(const int _sm); virtual QString getNameFromBandId (const int _id); virtual QString getNameFromModeId (const int _id); virtual QString getNameFromSubModeId (const int _id); virtual QString getSubModeFromId (const int _id); virtual QString getNameFromSubMode (const QString _sm); // Checks if a submode is deprecated //TODO: Check if really needed virtual QString getModeFromSubMode (const QString _sm); virtual bool isModeDeprecated (const QString _sm); virtual QString getFreqFromBandId(const int _id); virtual int getBandIdFromFreq(const double _n); virtual QStringList getBands(); virtual QStringList getModes(); virtual QStringList getBandsInLog(const int _log); virtual QStringList getModesInLog(const int _log); virtual int getLastQSOid(); virtual bool clearLog(); 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); virtual bool qslSentViaDirect(const int _qsoId, const QString _updateDate); virtual bool qslSentViaBureau(const int _qsoId, const QString _updateDate); virtual bool qslSentAsRequested(const int _qsoId, const QString _updateDate); virtual bool qslRecAsRequested(const int _qsoId, const QString _updateDate); virtual bool qslRecViaBureau(const int _qsoId, const QString _updateDate); virtual bool qslRecViaBureau(const int _qsoId, const QString _updateDate, const bool _queueSentQSL); virtual bool qslRecViaDirect(const int _qsoId, const QString _updateDate); virtual bool qslRecViaDirect(const int _qsoId, const QString _updateDate, const bool _queueSentQSL); virtual bool setClubLogSent(const int _qsoId, const QString _st, const QString _updateDate); virtual bool isHF(const int _band); virtual bool isWARC(const int _band); virtual bool isVHF(const int _band); virtual QString getCallFromId(const int _qsoId); virtual QStringList getClubLogRealTimeFromId(const int _qsoId); // Complete with previous virtual QString getNameFromQRZ(const QString _call); virtual QString getQTHFromQRZ(const QString _call); virtual QString getLocatorFromQRZ(const QString _call); virtual QString getIOTAFromQRZ(const QString _call); 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(); virtual int getDXCConYear(const int _year, const int _logNumber); virtual int getCQzonYear(const int _year, const int _logNumber); virtual bool newDXMarathon(const int _dxcc, const int _cq, const int _year, const int _logNumber); virtual QStringList getContestNames(); virtual QStringList getContestCat(const int _catn); virtual QStringList getContestOverlays(); virtual int getContestTypeN(const int _co, const int _catop, const int _catas, const int _catpo, const int _catba, const int _catov, const int _catmo); virtual QStringList getDataFromContestType(const int _n); virtual QStringList getBandNames(); virtual QStringList getPropModeList(); virtual QStringList getValidCatOptions(const int _currentCat, const int _lowerCa); 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); /* virtual bool isMultiplier(const QStringList _qs); virtual int getQSOPoints(const QStringList _qs); virtual bool saveFileToSend(const QString& _fileName); virtual int getTotalScore(); virtual int getMultipliers(); virtual int getPoints(); */ private: // int points; // int multipliers; }; #endif // DATAPROXY_H klog-0.9.2.2/COPYING0000644000076700000620000010451312627126144011630 0ustar staff GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program 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. This program 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 this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . klog-0.9.2.2/TODO0000644000076700000620000003210312627126144011260 0ustar staffTODO: Add the tr() in the startwizard.cpp to the QString gplLic about the CTY download 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. 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? TODO GUI: To add the CQ/ITU box or make them editable BUG: Clublog: void MainWindow::slotQRZReturnPressed() _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 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 TODO: In slotQsoUploadFinished, if QSO is not uploaded. mark it as not uploaded in the log If qsoToEdit, nothing is modified and OK. (Clublog returns QSO DUPE) Again qsoToEdit, nothing is modified and OK (Clublogs returns QSO DROPPED, and QSO is dropped!) TODO: Check the values that clublog is returning to manage errors and show messages to the user TODO: To add the possibility to upload a modified QSO to clublog. TODO: If there is an error in password/username or whatever, disable clublog in KLog TODO: Upload a logfile to clublog // Ideas: https://code.google.com/p/datacod-qt-tools/source/browse/upcoder/uploader.h // https://code.google.com/p/datacod-qt-tools/source/browse/upcoder/uploader.cpp TODO: Define a maximum QSO upload rate to clublog to avoid excesive API usage. KLog 0.9.2 TODO: Remove all not needed fields from SetupPageLogNew::gatherAndSend() the type is enough NEXT: 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 another tab in the botton to list the DXCC status. TODO: checkIfNewBandOrMode() is not being used. Code should be removed... KLog 0.9.3 TODO: Support CQ WW SSB (Including Cabrillo Import/Export) TODO: Support CQ WW CW (Including Cabrillo Import/Export) KLog 0.9.4 TODO: Hamlib support (Linux). KLog 0.9.5 TODO: Support CQ WPX SSB (Including Cabrillo Import/Export) 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: 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. KLog 0.9.7 TODO: Integrate with www.clublog.org (http://www.clublog.org/docs/pages/viewpage.action?pageId=1638482) KLog 0.9.8 TODO: Integrate with eqsl.cc https://www.eqsl.cc/qslcard/ADIFContentSpecs.cfm KLog 0.9.9 TODO: Server to log all the QSO in real time (through the network) from N1MM http://n1mm.hamdocs.com/tiki-index.php?page=UDP+Broadcasts&structure=N1MM+Logger+Documentation KLog 0.9.10 TODO: Integrate with FLIGI real time logging (req by AA5VI) KLog 0.9.11 - Cluster release 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 (including a "to-be-worked") 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, ...) 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 :-? TODO: When importing an ADIF file with several logs, create automatically the logs as detected. TODO: HelpHelpDialog TODO: HelpAboutDialog TODO: setuppagelogs.cpp TODO: Remove references to DataBase from all classes except DataProxySQLite TODO: DXCluster: Lines that are not a DX should not be in another color than default. 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. (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 KLOG TODO: TODO: To create a function tha runs the log and marks "N" if QSL has not been sent or received. TODO: Create a setup page to configure a default prop_mode per band (ie 6m = ES) TODO: CTY.DAT update TODO: Award tabs: center/bold tabs TODO: Add export to cabrillo to the logfile SETUP: TODO: Show progress when doing actions TODO: Open this file when opening TODO: DXCLuster: Show HF activity TODO: DXCLuster: Show WARC TODO: DXCLuster: Show VHUF TODO: DXCLuster: Show confirmed TODO: DXCLuster: Show SSB TODO: DXCLuster: Show CW TODO: DXCLuster: Show Ann/full TODO: DXCLuster: Show WCY TODO: DXCLuster: Show WWV 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: Require mandatory fields in all QSO TODO: Awards: Add Award TODO: Awards: Remove Award ===================== TODO: Add Satellite support (maybe another Tab) (look this file (below) for details. TODO: Satellite name QLineEdit mask "Aaa-900" (check how the ISS is named to see if it would match... does not match!!!) TODO: Add satellite input fields (in the others input Tab?) TODO: Sats: https://www.eqsl.cc/qslcard/ADIFContentSpecs.cfm TODO: Sats: https://lotw.arrl.org/lotw/faq#sats TODO: Sat Modes: http://www.amsat.org/amsat/intro/sats_faq.html#RTFToC5 http://www.sckans.edu/~sireland/radio/amsat.html A - This mode requires a 2 meter SSB/CW transmitter and a 10 meter SSB/CW receiver and supports CW and voice. B - This mode requires a 70 cm SSB/CW transmitter and a 2 meter SSB/CW receiver and supports CW and voice. Some satellites also support RTTY and SSTV in this mode. J -> V Uplink and U downlink JA - This mode stands for J Analog and requires a 2 meter SSB/CW transmitter and a 70 cm SSB/CW receiver and supports CW, voice. JD - This mode stands for J Digital and requires a 2 meter FM transmitter and a 70 cm SSB/CW receiver and supports packet. K - This mode requires a 15 meter SSB/CW transmitter and a 10 meter SSB/CW receiver and supports CW and voice. This mode is unique in that it can be done with a simple HF rig. S - This mode requires a 70 cm SSB/CW transmitter and a 2.4 GHz SSB/CW receiver and supports CW and voice. Many people use a 2.4 GHz to 2 meter converter with a 2 meter SSB/CW receiver instead of buying a 2.4 GHz SSB/CW receiver. T - This mode requires a 15 meter SSB/CW transmitter and a 2 meter SSB/CW receiver and supports CW and voice. KT, KA, BS, Some satellites have dual modes that operate simultaneously. For example, AO-13 can operate in mode BS which means that it can do both mode B and mode S simultaneously. Other common dual modes are KT and KA. Mode V Mode U Mode U/V -> B TODO: Code a way to sort the bands/modes in the "setuppagebandsmodes.cpp TODO: Create an "updateKLog" class to manage all the release updates so there is a way to detect the version of KLog and upgrade the DB to the latest. TODO: The following fields may add information, even if the qsl has not been rcvd/sent B B TODO: showStatusOfDXCC should be executed when band change. TODO: Add color support: messages for slotQRZTextChanged TODO: SetupPageColors: Check the style in the buttons as the rounds are lost when I change the color!! TODO: MainWindow::processConfigLine: add support for the cluster data. 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: 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. TODO: World::getDXStatus: Calculate the algorithm to know the different status for a DXCC (confirmed, worked, confirmed in another band, ,...) TODO: World:: Maybe the color should be returned from the World class TODO: Check the readDataFromUI. QSO are not added when in contest. TODO: Check that New Log, Open, ... somewhere the log table is removed from the DB! 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: In CQWWSSB, when editing QSO the SRX, Points, multiplier, ... are not sent to the edit so after "OK", those data are lost. TODO: MainWindow::slotQsoDeleteFromLog: Add the CALL to the message before detele a QSO. 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: 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 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 TODO: Code a Tool to get statistcs for the contests, some kind of post contest tool. http://www.qsl.net/3v4-002/Contests/2011%20CQ-WW-SSB%203V8SS/index.htm TODO: Be able to send scores to: http://www.cqcontest.ru/help/developers.jsp 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". FILEMANAGER TODO: adifLogExportToFile: Count the marked QSO and adjust the numberOfQsos TODO: FileManager::adifReadLog: Optimize the dialog (maybe updating only each 100 or as in KLog) TODO: FileManager::adifReadLog: Add a semaphore/lock or similar to avoid running the same method twice or more at the same time... or at least the same file. It seems that now it "serializes" the import... TODO: Check that FileManager::adifLogExportToFile is exporting ALL the DB fields. TODO: FileManager::adifLogExportToFile code a progress dialog for exporting. TODO: When importing ADIF: Check if all the QSO have all the mandatory fields and warn the user if not. Optimization: The ADIF import is very slow. Optimization is recommended. IMPROVEMENT: Improve the result of the log printing. DONE: TODO: Working on the DB version update functions DONE: MainWindow::showAwards Remove "empty CQZ" when counting to avoid having 41 CQ zones DONE: Code the color configuration for status of an entity (needed/worked/confirmed). DONE: Color support: Calculate a color for the search results. DONE: Color support: Calculate a color for the DXCluster. DONE: TODO: Colors: Reconfigure the colors needs KLog to be restarted. DONE: Working on the dxCluster: Color support, identify the different kind of lines... DX de, normal spots, comments, ... DONE: Working on setAwardDXCC: When adding if a pair is already entered but we are going to add a confirmed status, modify it. DONE: Right click on log to show a to edit QSO. DONE: Right click on log to show a QSL received. DONE: Right click on log to remove a QSO. DONE: Right click on log to show a QSL sent. TODO: Right click on search to remove a QSO. DONE: Right click on search to show a QSL reception. DONE: Right click on search to show a QSL sent. DONE: Right click on search to show to edit QSO. DONE: Added a select/unselect all button to the search QSO tab. DONE: Search QSO to send DONE: Add a button to export to ADIF the content of searchResultsTreeWidget DONE: When importing ADIF, if the CQZ/ITUZ/DXCC is empty, calculate and add it. DONE: Not export ADIF fields if "N": DONE: Print the log. DONE: TODO: Time in UTC DONE: TODO: Log in real time DONE: Double click on cluster to select DONE: TODO: When double clicking on a DX-Spot, frequency should be also copied to inputbox 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