KLog 1.3 RC8 and translation files

This commit is contained in:
jaime 2020-09-28 13:21:03 +00:00
parent 03da6982b7
commit ebc50ba111
29 changed files with 4323 additions and 3710 deletions

View File

@ -2,9 +2,18 @@ TBD - 1.3
- Improved the search widget to make searching much quicker.
- Improved the Edit of QSO related to the default QSL sent status.
- Improved the QRZ.com & DXHeat.com queries from the log & search window.
- Adds an ".adi" file extension to the log ADIF files if not added by the user.
- Improved the UDP datagram receiver to ensure it is working multicast.
- UI: KLog remembers the size of the window from last execution. (TNX EA5WA)
- UI: The Station Callsign and number of QSOs in the current log is shown in the windows title.(TNX G4MKT)
- New feature: KLog now search for the call as the user enters for previously QSOs with that call. (TNX EA5WA)
- Adds an ".adi" file extension to the log ADIF files if not added by the user. (TNX G4MKT)
- When reading a log from LoTW, if there are new QSOs not present on the current logfile, KLog offers the option to import them.
- Bugfix: It was not possible to add a log if the date and Station Callsign were the same.
Now operators and comments are also taken into consideration.(TNX G4MKT)
- Bugfix: The export of QSOs without an station callsign defined was failing.(TNX G4MKT)
- Bugfix: When reading a log from LoTW, the list of QSOs were not shown at the end. (TNX EA5WA)
- Bugfix: Comment in the new log widget was converted to uppercase. (TNX G4MKT)
- Translations: Spanish (EA4K).
Sept 2020 - 1.2.2
- Bugfix: LoTW export was failing due to a wrong SQL sentence. (TNX PD9Q).

View File

@ -56,6 +56,51 @@ DataProxy_SQLite::~DataProxy_SQLite(){
}
int DataProxy_SQLite::getHowManyQSOPerPropMode(const QString &_p, const int _logn)
{
//qDebug() << "DataProxy_SQLite::getHowManyQSOPerPropMode: " << _p << "/" << QString::number(_logn) << endl;
QSqlQuery query;
QString queryString;
bool sqlOK;
if (_logn < 0)
{
queryString = QString("SELECT COUNT (DISTINCT id) FROM log WHERE prop_mode='%1'").arg(_p);
}
else
{
queryString = QString("SELECT COUNT (DISTINCT id) FROM log where lognumber='%1' AND prop_mode='%2'").arg(_logn).arg(_p);
}
sqlOK = query.exec(queryString);
//qDebug() << "DataProxy_SQLite::getHowManyQSOPerPropMode: queryString: " << queryString << endl;
if (sqlOK)
{
query.next();
if (query.isValid())
{
//qDebug() << "DataProxy_SQLite::getHowManyQSOPerPropMode: " << QString::number((query.value(0)).toInt()) << endl;
int v = (query.value(0)).toInt();
query.finish();
return v;
}
else
{
//qDebug() << "DataProxy_SQLite::getHowManyQSOPerPropModer: 0" << endl;
query.finish();
return 0;
}
}
else
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().number(), query.lastQuery());
//qDebug() << "DataProxy_SQLite::getHowManyQSOPerPropMode: Query error" << endl;
query.finish();
return 0;
}
}
QString DataProxy_SQLite::getSoftVersion()
{ //SELECT MAX (softversion) FROM softwarecontrol
@ -5788,7 +5833,7 @@ bool DataProxy_SQLite::addNewLog (const QStringList _qs)
// First we check if the log is already there
//queryString = QString("SELECT id FROM logs WHERE logdate='%1' AND stationcall='%2' AND logtype='%3' AND logtypen='%4'").arg(_dateString).arg(_stationCallsign).arg(_typeContest).arg(_typeContestN);
queryString = QString("SELECT id FROM logs WHERE logdate='%1' AND stationcall='%2'").arg(_dateString).arg(_stationCallsign);
queryString = QString("SELECT id FROM logs WHERE logdate='%1' AND stationcall='%2' AND operators = '%3' AND comment = '%4'").arg(_dateString).arg(_stationCallsign).arg(_operators).arg(_comment);
//"logs"
//"id, logdate, stationcall, comment, logtype"
//qDebug() << "DataProxy_SQLite::addNewLog query1: " << queryString << endl;
@ -5799,6 +5844,7 @@ bool DataProxy_SQLite::addNewLog (const QStringList _qs)
query.next();
if (query.isValid())
{
//qDebug() << "DataProxy_SQLite::addNewLog query error: " << queryString << endl;
// It seems that the log is already existing!
return false;
}

View File

@ -233,6 +233,8 @@ public:
QStringList getQSLSentList();
QStringList getClubLogStatusList();
QStringList getQSLViaList();
int getHowManyQSOPerPropMode(const QString &_p, const int _logn);
//QStringList getValidCatOptions(const int _currentCat, const int _lowerCa);

View File

@ -321,6 +321,8 @@ void DXCCStatusWidget::setBands(QStringList const &_ent, const bool _creating)
//qDebug() << "DXCCStatusWidget::setBands - 9 PRE-END" << endl;
//bool hasCurrentLoGSatellitesQSOs(const int _logn);
if (!_creating)
{
//qDebug() << "DXCCStatusWidget::setBands: 9.1 !_creating" << endl;

View File

@ -232,7 +232,7 @@ QList<int> FileManager::adifLogExportReturnList(const QString& _fileName, const
_queryLog = QString();
}
if ((!util->isValidCall(_callsign)) && (_callsign != "ALL"))
if ((!util->isValidCall(_callsign)) && (_callsign != "ALL") && (_callsign !="NOT"))
{
showError(tr("The selected callsign (%1) is not valid, please check it again to export the log.").arg(_callsign));
return qsos;
@ -2905,6 +2905,7 @@ bool FileManager::modifySetupFile(const QString& _filename, const QString &_fiel
QTextStream out(&tmp);
qint64 pos1 = in.pos();
qint64 pos2 = out.pos();
bool modified = false;
out << in.readAll();
@ -2919,12 +2920,18 @@ bool FileManager::modifySetupFile(const QString& _filename, const QString &_fiel
if (line.startsWith(_field))
{
in << _field << "=" << _value << ";" << endl;
modified = true;
}
else
{
in << line << endl;
}
}
if (!modified)
{// If the data is not found, we will add it to the end.
in << _field << "=" << _value << ";" << endl;
}
return true;
}

2
klog.1
View File

@ -1,4 +1,4 @@
.TH KLog 1 "version 1.2" "Jaime Robles, EA4K" "Hamradio"
.TH KLog 1 "version 1.3" "Jaime Robles, EA4K" "Hamradio"
.SH "NAME"
klog \- The Ham Radio Logging program

View File

@ -36,7 +36,7 @@ int main(int argc, char *argv[])
//qDebug() << "KLog Main: Start! " << endl;
//qDebug() << "KLog Main: " << QSslSocket::supportsSsl() << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionString() << endl;
QDir d1 = QDir();
QString version = "1.3-RC4";
QString version = "1.3-RC8";
Utilities util = Utilities();
QStringList arguments;
QTextStream cout(stdout);
@ -335,6 +335,7 @@ int main(int argc, char *argv[])
mw.checkIfNewVersion();
mw.recommendBackupIfNeeded();
//qDebug() << "KLog Main-101" << (QTime::currentTime()).toString("HH:mm:ss") << endl;
mw.show();
//qDebug() << "KLog Main-101.5" << (QTime::currentTime()).toString("HH:mm:ss") << endl;

View File

@ -212,12 +212,40 @@ MainWindow::MainWindow(const QString &_klogDir, const QString &tversion)
adifLoTWExportWidget = new AdifLoTWExportWidget(dataProxy, Q_FUNC_INFO);
showAdifImportWidget = new ShowAdifImportWidget(dataProxy, Q_FUNC_INFO);
//lotwUtilities->download();
logEvent(Q_FUNC_INFO, "END", logSeverity);
//qDebug() << "MainWindow::MainWindow: END" << endl;
}
void MainWindow::saveWindowsSize()
{
//qDebug()() << "MainWindow::saveWindows" << endl;
logEvent(Q_FUNC_INFO, "Start", logSeverity);
QSize size = this->size();
int height = size.height();
int width = size.width();
//qDebug()() << "MainWindow::windowsSizeAndPosition: Heigth: " << QString::number(height) << endl;
//qDebug()() << "MainWindow::windowsSizeAndPosition: Width: " << QString::number(width) << endl;
//(const QString& _filename, const QString &_field, const QString &_value)
filemanager->modifySetupFile(configFileName, "MainWindowSize", QString::number(width) + "x" + QString::number(height));
//return QString::number(width) + "x" + QString::number(height);
logEvent(Q_FUNC_INFO, "END", logSeverity);
//qDebug()() << "MainWindow::windowsSizeAndPosition: END" << endl;
}
void MainWindow::setWindowsSize(const int _width, const int _height)
{
QSize size;
size.setHeight(_height);
size.setWidth(_width);
this->resize(size);
}
void MainWindow::init()
{
@ -494,6 +522,7 @@ void MainWindow::createActionsCommon(){
// SEARCH TAB
connect(searchWidget, SIGNAL(actionQSODoubleClicked ( int ) ), this, SLOT(slotDoubleClickLog( const int ) ) );
connect(searchWidget, SIGNAL(updateAwards() ), this, SLOT(slotShowAwards() ) );
connect(searchWidget, SIGNAL(logRefresh() ), this, SLOT(slotLogRefresh() ) );
connect(searchWidget, SIGNAL(toStatusBar(QString) ), this, SLOT(slotUpdateStatusBar(QString) ) );
connect(searchWidget, SIGNAL(requestBeingShown() ), this, SLOT(slotShowSearchWidget() ) );
@ -662,6 +691,22 @@ void MainWindow::slotWorldMapShow()
worldMapWidget->show();
}
*/
void MainWindow::setMainWindowTitle(const QString _s)
{
QString aux = dataProxy->getCommentsFromLog(currentLog);
//qDebug() << "MainWindow::setMainWindowTitle: (comment): " << aux << endl;
if (aux.length()>0)
{
setWindowTitle(tr("KLog - %1 - QSOs: %2 - %3" ).arg(stationQRZ).arg(_s).arg(aux));
}
else
{
setWindowTitle(tr("KLog - %1 - QSOs: %2" ).arg(stationQRZ).arg(_s));
}
}
void MainWindow::createUI()
{
@ -2534,7 +2579,7 @@ void MainWindow::slotElogClubLogProcessAnswer(const int _i, const int _qID)
void MainWindow::slotExitFromSlotDialog(const int exitID)
{
//qDebug() << "MainWindow::slotExitFromSlotDialog: " << QString::number(exitID) << endl;
//qDebug()() << "MainWindow::slotExitFromSlotDialog: " << QString::number(exitID) << endl;
logEvent(Q_FUNC_INFO, "Start", logSeverity);
if (exitID == 2)
@ -2544,6 +2589,7 @@ void MainWindow::slotExitFromSlotDialog(const int exitID)
exitQuestion();
}
//qDebug()() << "MainWindow::slotExitFromSlotDialog: END " << endl;
logEvent(Q_FUNC_INFO, "END", logSeverity);
}
@ -2557,6 +2603,7 @@ void MainWindow::slotFileClose()
void MainWindow::exitQuestion()
{
logEvent(Q_FUNC_INFO, "Start", logSeverity);
//qDebug()() << "MainWindow::exitQuestion" << endl;
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Question);
msgBox.setWindowTitle(tr("KLog - Exit"));
@ -2570,6 +2617,7 @@ void MainWindow::exitQuestion()
case QMessageBox::Yes:
// Ok was clicked
logEvent(Q_FUNC_INFO, "Exiting KLog!", 0);
saveWindowsSize();
exit(0);
default:
// should never be reached
@ -2718,6 +2766,7 @@ void MainWindow::slotQRZTextChanged(QString _qrz)
//qDebug() << "MainWindow::slotQRZTextChanged: cursorP at the end : " << endl;
completeWithPreviousQSO(_qrz);
searchWidget->setCallToSearch(_qrz);
//qrzAutoChanging = false;
logEvent(Q_FUNC_INFO, "END", logSeverity);
//qDebug() << "MainWindow::slotQRZTextChanged: END" << endl;
@ -2860,6 +2909,10 @@ void MainWindow::slotClearButtonClicked()
clearUIDX(true);
statusBar()->clearMessage();
setCleaning(false);
//qDebug() << "MainWindow::slotClearButtonClicked: Log: " << QString::number(currentLog) << endl;
setMainWindowTitle(QString::number(dataProxy->getHowManyQSOInLog(currentLog)));
//qDebug() << "MainWindow::slotClearButtonClicked: " << mainQSOEntryWidget->getMode() << endl;
//qDebug() << "MainWindow::slotClearButtonClicked - currentMode = " << QString::number(currentMode) << endl;
logEvent(Q_FUNC_INFO, "END", logSeverity);
@ -2911,21 +2964,25 @@ void MainWindow::slotRefreshDXCCWidget()
void MainWindow::closeEvent(QCloseEvent *event)
{
//qDebug() << "MainWindow::closeEvent" << endl;
//qDebug()() << "MainWindow::closeEvent" << endl;
logEvent(Q_FUNC_INFO, "Start", logSeverity);
if (maybeSave())
{
//qDebug()() << "MainWindow::closeEvent saving needed" << endl;
dataProxy->unMarkAllQSO();
//slotFileClose();
dataProxy->compressDB();
//db->compress();
saveWindowsSize();
event->accept();
}
else
{
//qDebug()() << "MainWindow::closeEvent not saving needed" << endl;
event->ignore();
}
//qDebug()() << "MainWindow::closeEvent-END" << endl;
logEvent(Q_FUNC_INFO, "END", logSeverity);
}
@ -4141,6 +4198,7 @@ void MainWindow::readConfigData()
if (!UDPLogServer->isStarted())
{
//qDebug() << "MainWindow::readConfigData: 104: Server off" << endl;
//start(quint16 _port, QHostAddress const& _multicast_group_address)
if (!UDPLogServer->start())
{
errorMSG = tr("start");
@ -4461,12 +4519,10 @@ bool MainWindow::processConfigLine(const QString &_line){
else if (field=="INFOTIMEOUT")
{
int a = value.toInt();
if ((a>0) && (a<=30000))
if ((a>0) && (a<=65535))
{
infoTimeout = a;
}
}
else if (field=="LOGFROMWSJTX")
{
@ -4748,6 +4804,16 @@ bool MainWindow::processConfigLine(const QString &_line){
itIsANewversion = true;
}
}
else if(field=="MAINWINDOWSIZE")
{
QStringList values;
values.clear();
values << value.split("x");
if ((values.at(0).toInt()>0) && (values.at(1).toInt()>0))
{
setWindowsSize(values.at(0).toInt(), values.at(1).toInt());
}
}
else
{
//qDebug() << "MainWindow::processConfigLine: NONE: " << endl;
@ -6231,6 +6297,7 @@ void MainWindow::slotShowAwards()
awardsWidget->showAwards();
//qDebug() << "MainWindow::slotShowAwards-3" << endl;
dxccStatusWidget->refresh();
setMainWindowTitle(QString::number(dataProxy->getHowManyQSOInLog(currentLog)));
logEvent(Q_FUNC_INFO, "END", logSeverity);
//qDebug() << "MainWindow::slotShowAwards-END" << endl;
}
@ -7119,7 +7186,7 @@ void MainWindow::slotWSJTXloggedQSO (const QString &_dxcall, const QString &_mod
const QString &_opCall, const QDateTime &_datetime, const QDateTime &_datetime_off,
const QString &_exchangeTX, const QString &_exchangeRX, const QString &_mypwr)
{
//qDebug() << "MainWindow::slotWSJTX-loggedQSO" << endl;
//logEvent(Q_FUNC_INFO, "Start", logSeverity);
bool logTheQso = false;
QString opCall = stationQRZ;

View File

@ -190,7 +190,7 @@ private slots:
void slotShowAwards();
void slotUpdateStatusBar(const QString &statusm);
void setMainWindowTitle(const QString _s);
void slotSetup(const int _page=0);
//void slotrstTXTextChanged();
@ -320,6 +320,8 @@ private slots:
void slotCaptureDebugLogs(const QString &_func, const QString &_msg, const int _level=7);
private:
//void setWidgetsOrder();
void saveWindowsSize();
void setWindowsSize(const int _width, const int _height);
bool maybeSave();
void setCleaning(const bool _c);

View File

@ -53,6 +53,11 @@ void SearchWidget::clear()
setModelFilter();
}
void SearchWidget::setCallToSearch (const QString _st)
{
searchBoxLineEdit->setText(_st);
}
void SearchWidget::setShowCallInSearch(const bool _sh)
{
stationCallSignShownInSearch = _sh;

View File

@ -51,6 +51,7 @@ public:
void showQSO(const int _q);
void showQSOs(QList<int> qsoIdList);
void setStationCallsign(const QString &_st);
void setCallToSearch (const QString _st);
void searchToolNeededQSLToSend();
void setColors (const QString &_newOne, const QString &_needed, const QString &_worked, const QString &_confirmed, const QString &_default);

View File

@ -131,6 +131,7 @@ SetupDialog::SetupDialog(DataProxy_SQLite *dp, const bool _firstTime)
setLayout(mainLayout);
setWindowTitle(tr("Config Dialog"));
windowSize.clear();
slotReadConfigData();
@ -674,6 +675,11 @@ void SetupDialog::slotOkButtonClicked()
//WSJTX
//Windows Size
if (windowSize.length()>0)
{
stream << "MainWindowSize=" << windowSize << ";" << endl;
}
file.close ();
}
//qDebug() << "SetupDialog::slotOkButtonClicked - just before leaving" << endl;
@ -1066,6 +1072,16 @@ bool SetupDialog::processConfigLine(const QString &_line)
else if(tab =="LOTWPASS"){
lotwPage->setLoTWPass(value);
}
else if(tab =="MAINWINDOWSIZE"){
QStringList values;
values.clear();
values << value.split("x");
if ((values.at(0).toInt()>0) && (values.at(1).toInt()>0))
{
windowSize = value;
}
}else{
//qDebug() << "SetupDialog::processConfigLine: NONE: " << endl;
}

View File

@ -138,6 +138,7 @@ private:
DataProxy_SQLite *dataProxy;
Utilities *util;
QString windowSize;
int constrid; // Just an id for the constructor to check who is being executed at one specific time
int logSeverity; // Manages as syslog, the severity of the application debug log

View File

@ -527,6 +527,10 @@ void SetupPageLogs::slotAnalyzeNewLogData(const QStringList _qs)
logsModel->select();
updateSelectedLogs();
}
else
{
showError(tr("The new log could not be created."));
}
// We send the data to the main tab
QStringList logData;

View File

@ -163,7 +163,7 @@ void SetupPageLogsNew::createWidget()
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."));
commentLineEdit->setToolTip(tr("Add a comment about this log. If filled, it will be shown in the main KLog title to identify the log."));
//typeLabel->setText(tr("&Type of Operation"));
//typeLabel->setWordWrap(true);
@ -813,7 +813,7 @@ void SetupPageLogsNew::setOperators(const QString &_st)
void SetupPageLogsNew::setComment(const QString &_st)
{
comment = _st;
commentLineEdit->setText(comment.toUpper());
commentLineEdit->setText(comment);
}
void SetupPageLogsNew::setDateString(const QString &_st)

View File

@ -38,8 +38,8 @@ void SetupPageUDP::createUI()
logAutomaticallyWSJTXCheckbox->setToolTip(tr("KLog will automatically log any QSO coming from WSJT-X without any manual confirmation."));
realDataFromWSJTXCheckbox->setText(tr("Receive QSOs data and update to KLog"));
realDataFromWSJTXCheckbox->setToolTip(tr("KLog will automatically show and update data coming from WSJT-X (DX callsign, locator, RPT, ...)"));
realDataFromWSJTXCheckbox->setText(tr("Update status information from WSJT-X"));
realDataFromWSJTXCheckbox->setToolTip(tr("KLog will automatically show and update data coming from WSJT-X (DX callsign, Report, mode, ...)"));
UDPServerCheckBox->setChecked(false);
logFromWSJTXCheckbox->setChecked(false);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
#include "udpserver.h"
#include <QDateTime>
//https://sourceforge.net/p/wsjt/wsjtx/ci/master/tree/UDPExamples/MessageServer.cpp
// Read Network\NetworkMessage.hpp in the WSJT-x sources wsjtx
UDPServer::UDPServer(QObject *parent) :
QObject(parent)
@ -9,7 +10,18 @@ UDPServer::UDPServer(QObject *parent) :
//address = QString("127.0.0.1");
port = 2237;
socketServer = new QUdpSocket(this);
//socketServer->bind(QHostAddress::AnyIPv4, port);
groupAddress = QHostAddress::Any;
/*
//if (socketServer->bind(QHostAddress::AnyIPv4, port, QAbstractSocket::ShareAddress))
if (socketServer->bind(port, QAbstractSocket::ShareAddress))
{
//qDebug() << "UDPServer::UDPServer - Multicast group joined OK" << endl;
}
else
{
//qDebug() << "UDPServer::UDPServer - Multicast group joined NOK" << endl;
}
*/
util = new Utilities;
logging = false;
realtime = false;
@ -35,15 +47,109 @@ void UDPServer::slotReadPendingDatagrams()
bool UDPServer::start()
{
//qDebug() << "UDPServer::start "<< endl;
socketServer->bind(QHostAddress::AnyIPv4, port, QUdpSocket::ShareAddress);
groupAddress = QHostAddress("127.0.0.1");
socketServer->joinMulticastGroup(groupAddress);
return socketServer->isValid();
// return true;
//return socketServer->bind(QHostAddress::AnyIPv4, port);
//return socketServer->bind(port, QUdpSocket::ShareAddress);
//qDebug() << "UDPServer::start " << endl;
if ( (port>0) && (port<65535) )
{
//qDebug() << "UDPServer::start: calling startNow " << endl;
return startNow(port, groupAddress);
}
else
{
//qDebug() << "UDPServer::start FALSE" << endl;
return false;
}
}
bool UDPServer::startNow(quint16 _port, QHostAddress const& _multicast_group_address)
{
//qDebug() << "UDPServer::startNow "<< endl;
//if ((_port != port) || (_multicast_group_address != groupAddress))
if (1)
{
//qDebug() << "UDPServer::startNow starting..."<< endl;
leaveMultiCastGroup();
if (socketServer->state() == QAbstractSocket::BoundState)
{
//qDebug() << "UDPServer::startNow: closing socket"<< endl;
socketServer->close();
}
groupAddress = _multicast_group_address;
auto address = _multicast_group_address.isNull ()
|| QAbstractSocket::IPv4Protocol != groupAddress.protocol () ? QHostAddress::Any : QHostAddress::AnyIPv4;
if (_port && socketServer->bind(groupAddress, _port, QAbstractSocket::ShareAddress | QAbstractSocket::ReuseAddressHint))
{
port = _port;
joinMultiCastGroup();
}
else
{
//qDebug() << "UDPServer::startNow port = 0"<< endl;
port = 0;
}
}
else
{
//qDebug() << "UDPServer::startNow exiting... "<< endl;
}
//qDebug() << "UDPServer::startNow exiting... "<< endl;
return socketServer->isValid();
}
void UDPServer::joinMultiCastGroup()
{
//qDebug() << "UDPServer::joinMultiCastGroup: "<< endl;
if ((socketServer->state() == QAbstractSocket::BoundState) && (!groupAddress.isNull()) && groupAddress.isMulticast() )
{
auto mcast_interface = socketServer->multicastInterface();
if (( groupAddress.protocol() == QAbstractSocket::IPv4Protocol ) && (socketServer->localAddress().protocol() != QAbstractSocket::IPv4Protocol ))
{
socketServer->close();
socketServer->bind(QHostAddress::AnyIPv4, port, QAbstractSocket::ShareAddress | QAbstractSocket::ReuseAddressHint);
if (socketServer->isValid())
{
//qDebug() << "UDPServer::joinMultiCastGroup socket valid"<< endl;
}
}
bool joined {false};
QList<QNetworkInterface> interfaces;
interfaces.clear();
interfaces.append(QNetworkInterface::allInterfaces());
for (int i = 0; i < interfaces.size(); ++i)
{
socketServer->setMulticastInterface(interfaces.at(i));
joined |= socketServer->joinMulticastGroup(groupAddress, interfaces.at(i));
}
if (!joined)
{
groupAddress.clear();
}
socketServer->setMulticastInterface(mcast_interface);
}
//qDebug() << "UDPServer::joinMultiCastGroup - END"<< endl;
}
void UDPServer::leaveMultiCastGroup()
{
//qDebug() << "UDPServer::leaveMultiCastGroup"<< endl;
if (groupAddress.isNull() && socketServer->state() && groupAddress.isMulticast())
{
QList<QNetworkInterface> interfaces;
interfaces.clear();
interfaces.append(QNetworkInterface::allInterfaces());
for (int i = 0; i < interfaces.size(); ++i)
{
socketServer->leaveMulticastGroup(groupAddress, interfaces.at(i));
}
}
//qDebug() << "UDPServer::leaveMultiCastGroup - END"<< endl;
}
bool UDPServer::isStarted()
@ -87,6 +193,22 @@ void UDPServer::parse(const QByteArray &msg)
bool tx_enabled = false;
bool transmitting = false;
bool decoding = false;
// WSPRDecode
bool newDecode = false;
QTime time;
qint32 snr;
double deltaTime = 0.0;
qint32 drift;
QByteArray decodedCall, decodedGrid;
qint32 power;
bool offAir;
// DECODE
QByteArray message;
bool lowConfidence = false;
qint32 rx_df = -1; // Delta frequency
qint32 tx_df = -1; // Delta time
QByteArray de_call;
@ -94,6 +216,10 @@ void UDPServer::parse(const QByteArray &msg)
bool watchdog_timeout = false;
QByteArray sub_mode;
bool fast_mode = false;
quint8 specialOpMode;
quint32 freqTolerance;
quint32 TRPeriod;
QByteArray confName;
//QByteArray msgOut;
@ -103,10 +229,6 @@ void UDPServer::parse(const QByteArray &msg)
in.setVersion(16);
in.setByteOrder(QDataStream::BigEndian);
{
//qDebug() << "UDPServer::parse: - Magic GOOD FORMAT = " << QString::number(magic)<< endl;
}
//qDebug() << "UDPServer::parse Version = " << QString::number(in.version())<< endl;
in >> magic >> schema >> type >> id;
//QByteArray ba4(QByteArray::fromRawData(cart, 6));
@ -128,10 +250,10 @@ void UDPServer::parse(const QByteArray &msg)
//QString line;
switch (type)
{
case 0:
case Heartbeat:
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - OUT/IN - Heartbeat" << endl;
break;
case 1:
case Status:
//qDebug() << "UDPServer::parse: - type" << QString::number(type) << " - OUT - Status" << endl;
// unpack message
//in >> ch;
@ -141,11 +263,23 @@ void UDPServer::parse(const QByteArray &msg)
{
in >> frequency >> mode >> dx_call >> report >> tx_mode >> tx_enabled >> transmitting >> decoding
>> rx_df >> tx_df >> de_call >> de_grid >> dx_grid >> watchdog_timeout >> sub_mode
>> fast_mode;
>> fast_mode >> specialOpMode >> freqTolerance >> TRPeriod >> confName;
frequencyDouble = (double)frequency;
frequencyDouble = frequencyDouble/1000000; // Change to MHz
//qDebug() << "UDPServer::parse: - Freq quint64 = " << QString::number(frequency) << endl;
//qDebug() << "UDPServer::parse: - Freq double = " << QString::number(frequencyDouble) << endl;
//qDebug() << "UDPServer::parse: Status - Freq double = " << QString::number(frequencyDouble) << endl;
//qDebug() << "UDPServer::parse: Status - Mode = " << mode << endl;
//qDebug() << "UDPServer::parse: Status - DXCall = " << dx_call << endl;
//qDebug() << "UDPServer::parse: Status - Report = " << report << endl;
//qDebug() << "UDPServer::parse: Status - Rx DF = " << rx_df << endl;
//qDebug() << "UDPServer::parse: Status - Tx DF = " << tx_df << endl;
//qDebug() << "UDPServer::parse: Status - De_Call = " << de_call << endl;
//qDebug() << "UDPServer::parse: Status - De_Grid = " << de_grid << endl;
//qDebug() << "UDPServer::parse: Status - SubMode = " << sub_mode << endl;
//qDebug() << "UDPServer::parse: Status - SpecialOp = " << QString::number(specialOpMode) << endl;
//qDebug() << "UDPServer::parse: Status - Freq Tol = " << QString::number(freqTolerance) << endl;
//qDebug() << "UDPServer::parse: Status - T/R Period = " << QString::number(TRPeriod) << endl;
//qDebug() << "UDPServer::parse: Status - Conf Name = " << confName << endl;
emit status_update (type, dx_call, frequencyDouble, mode, report, de_call, de_grid, dx_grid, sub_mode);
}
@ -153,42 +287,56 @@ void UDPServer::parse(const QByteArray &msg)
{
//qDebug() << "UDPServer::parse: realtime = FALSE" << endl;
}
break;
case Decode:
//() << "UDPServer::parse: - type = " << QString::number(type) << " - OUT - Decode" << endl;
in >> newDecode >> time >> snr >> deltaTime >> drift >> mode >> message >> lowConfidence >> offAir;
if (lowConfidence)
{
//qDebug() << "UDPServer::parse: Decode - Low Confidence" << endl;
}
else
{
//qDebug() << "UDPServer::parse: Decode - Time = " << time.toString("hhmmss") << endl;
//qDebug() << "UDPServer::parse: Decode - SNR = " << QString::number(snr) << endl;
//qDebug() << "UDPServer::parse: Decode - Delta = " << QString::number(deltaTime) << endl;
//qDebug() << "UDPServer::parse: Decode - Drift = " << QString::number(drift) << endl;
//qDebug() << "UDPServer::parse: Decode - Mode = " << mode << endl;
//qDebug() << "UDPServer::parse: Decode - Msg = " << message << endl;
}
break;
case 2:
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - OUT - Decode" << endl;
break;
case 3:
case Clear:
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - OUT - Clear" << endl;
//emit clearSignal();
break;
case 4:
case Reply:
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - IN - Replay " << endl;
break;
case 5:
// out << time_off << dx_call.toUtf8 () << dx_grid.toUtf8 () << dial_frequency << mode.toUtf8 ()
// << report_sent.toUtf8 () << report_received.toUtf8 () << tx_power.toUtf8 () << comments.toUtf8 ()
// << name.toUtf8 () << time_on << operator_call.toUtf8 () << my_call.toUtf8 () << my_grid.toUtf8 ()
// << exchange_sent.toUtf8 () << exchange_rcvd.toUtf8 ();
//in >> adifReceived;
//line = QString(adifReceived);
//qDebug() << "UDPServer::parse: - Line = " << line << endl;
case QSOLogged:
//qDebug() << "UDPServer::parse: - type = QSOLogged " << endl;
in >> time_off >> dx_call >> dx_grid >> frequency >> mode >> report_sent >> report_received >>
tx_power >> comments >> name >> time_on >> operatorCall >> de_call >> de_grid >>
exchange_sent >> exchange_received;
//qDebug() << "UDPServer::parse: - Time_off = " << time_off.toString("yyyyMMdd-hhmmss") << endl;
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - OUT - QSO logged" << endl;
//qDebug() << "UDPServer::parse: - DXCall = " << dx_call << endl;
//qDebug() << "UDPServer::parse: - Grid = " << dx_grid << endl;
//qDebug() << "UDPServer::parse: - Freq = " << QString::number(frequency) << endl;
//qDebug() << "UDPServer::parse: - Mode = " << mode << endl;
//qDebug() << "UDPServer::parse: - ReportSent = " << report_sent << endl;
//qDebug() << "UDPServer::parse: - ReportReceived = " << report_received << endl;
//qDebug() << "UDPServer::parse: - TX_PWR = " << tx_power << endl;
//qDebug() << "UDPServer::parse: - Comments = " << comments << endl;
//qDebug() << "UDPServer::parse: - Name = " << name << endl;
//qDebug() << "UDPServer::parse: - Time = " << time_on.toString("yyyyMMdd-hhmmss") << endl;
//qDebug() << "UDPServer::parse: QSOLogged - Time_off = " << time_off.toString("yyyyMMdd-hhmmss") << endl;
//qDebug() << "UDPServer::parse: QSOLogged - DXCall = " << dx_call << endl;
//qDebug() << "UDPServer::parse: QSOLogged - Grid = " << dx_grid << endl;
//qDebug() << "UDPServer::parse: QSOLogged - Freq = " << QString::number(frequency) << endl;
//qDebug() << "UDPServer::parse: QSOLogged - Mode = " << mode << endl;
//qDebug() << "UDPServer::parse: QSOLogged - ReportSent = " << report_sent << endl;
//qDebug() << "UDPServer::parse: QSOLogged - ReportReceived = " << report_received << endl;
//qDebug() << "UDPServer::parse: QSOLogged - TX_PWR = " << tx_power << endl;
//qDebug() << "UDPServer::parse: QSOLogged - Comments = " << comments << endl;
//qDebug() << "UDPServer::parse: QSOLogged - Name = " << name << endl;
//qDebug() << "UDPServer::parse: QSOLogged - Time = " << time_on.toString("yyyyMMdd-hhmmss") << endl;
//qDebug() << "UDPServer::parse: QSOLogged - DeCall = " << de_call << endl;
//qDebug() << "UDPServer::parse: QSOLogged - DeGrid = " << de_grid << endl;
//qDebug() << "UDPServer::parse: QSOLogged - Exch Sent = " << exchange_sent << endl;
//qDebug() << "UDPServer::parse: QSOLogged - Exch Recv = " << exchange_received << endl;
if (logging)
{
@ -208,7 +356,6 @@ void UDPServer::parse(const QByteArray &msg)
//dateTimeOff.setDate(QDate::currentDate());
//dateTimeOff.setTime(QTime::fromString(time_off, "hhmmss"));
emit logged_qso(dx_call, mode, QString(), frequencyDouble,
de_grid, dx_grid, report_sent, report_received,
comments, de_call, name, operatorCall, time_on, time_off,
@ -220,28 +367,56 @@ void UDPServer::parse(const QByteArray &msg)
}
break;
case 6:
case Close:
//qDebug() << "UDPServer::parse: - type = Close" << endl;
socketServer->close();
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - OUT - Close " << endl;
break;
case 7:
case Replay:
//qDebug() << "UDPServer::parse: - type = Reply" << endl;
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - IN - Replay" << endl;
break;
case 8:
case HaltTx:
//qDebug() << "UDPServer::parse: - type = HaltTx" << endl;
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - IN - Halt TX" << endl;
break;
case 9:
case FreeText:
//qDebug() << "UDPServer::parse: - type = FreeText" << endl;
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - IN - Free Text" << endl;
break;
case 10:
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - OUT - WSPR Decode" << endl;
case WSPRDecode:
//qDebug() << "UDPServer::parse: - type = WSPRDecode" << endl;
in >> newDecode >> time >> snr >> deltaTime >> frequency >> drift >> decodedCall >> decodedGrid >> power >> offAir;
//qDebug() << "UDPServer::parse: WSPRDecode - Time = " << time.toString("yyyyMMdd-hhmmss") << endl;
//qDebug() << "UDPServer::parse: WSPRDecode - SNR = " << QString::number(snr) << endl;
//qDebug() << "UDPServer::parse: WSPRDecode - Delta = " << QString::number(deltaTime) << endl;
//qDebug() << "UDPServer::parse: WSPRDecode - Frec = " << QString::number(frequency) << endl;
//qDebug() << "UDPServer::parse: WSPRDecode - Drift = " << QString::number(drift) << endl;
//qDebug() << "UDPServer::parse: WSPRDecode - Call = " << decodedCall << endl;
//qDebug() << "UDPServer::parse: WSPRDecode - Grid = " << decodedGrid << endl;
//qDebug() << "UDPServer::parse: WSPRDecode - Power = " << QString::number(power) << endl;
break;
case 12:
case Location:
//qDebug() << "UDPServer::parse: - type = Location" << endl;
break;
case LoggedADIF:
//qDebug() << "UDPServer::parse: - type = LoggedADIF" << endl;
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - ADIF" << endl;
in >> adifReceived;
adifParse(adifReceived);
//qDebug() << "UDPServer::parse: ADIF: " << adifReceived << endl;
// Q_SIGNAL void logged_ADIF (QString const& id, QByteArray const& ADIF);
break;
case HighlightCallsign:
//qDebug() << "UDPServer::parse: - type = HighlightCallsign" << endl;
break;
case SwitchConfiguration:
//qDebug() << "UDPServer::parse: - type = SwitchConfiguration" << endl;
break;
case Configure:
//qDebug() << "UDPServer::parse: - type = Configure" << endl;
break;
default: //NO
//qDebug() << "UDPServer::parse: - type = " << QString::number(type) << " - ERROR on Type" << endl;

View File

@ -1,12 +1,35 @@
#ifndef UDPSERVER_H
#define UDPSERVER_H
#include <QNetworkInterface>
#include <QUdpSocket>
#include <QObject>
#include <QHostAddress>
#include <QDataStream>
#include "utilities.h"
enum Type
{
Heartbeat,
Status,
Decode,
Clear,
Reply,
QSOLogged,
Close,
Replay,
HaltTx,
FreeText,
WSPRDecode,
Location,
LoggedADIF,
HighlightCallsign,
SwitchConfiguration,
Configure,
maximum_message_type_ // ONLY add new message types
// immediately before here
};
class UDPServer : public QObject
{
Q_OBJECT
@ -14,6 +37,7 @@ class UDPServer : public QObject
public:
explicit UDPServer(QObject *parent = nullptr);
bool start();
bool stop();
bool isStarted();
void setLogging(const bool _t);
@ -25,6 +49,9 @@ private:
void readPendingDatagrams();
void parse(const QByteArray &msg);
void adifParse(QByteArray &msg);
void leaveMultiCastGroup();
void joinMultiCastGroup();
bool startNow(quint16 _port, QHostAddress const& _multicast_group_address);
QUdpSocket *socketServer;
QHostAddress groupAddress;
@ -35,6 +62,15 @@ private:
Utilities *util;
#if QT_VERSION >= 0x050400
static quint32 constexpr schema_number {3};
#elif QT_VERSION >= 0x050200
static quint32 constexpr schema_number {2};
#else
// Schema 1 (Qt_5_0) is broken
#error "Qt version 5.2 or greater required"
#endif
signals:
void status_update (const int _type, const QString _dxcall, const double _freq, const QString _mode,
const QString report, const QString de_call, const QString de_grid,
@ -49,6 +85,7 @@ signals:
const QString &comment, const QString &stationcallsign, const QString &name,
const QString &_operator, const QDateTime datetime, const QDateTime datetime_off,
const QString &_exchangeTX, const QString &_exchangeRX, const QString &_txpwr);
//void clearSignal();
private slots:
void slotReadPendingDatagrams();

View File

@ -222,7 +222,7 @@ void AdifLoTWExportWidget::slotOKPushButtonClicked()
this->hide();
if (stationCallsignComboBox->currentIndex() == 0)
{
emit selection(stationCallsignComboBox->currentText(), startDate->date(), endDate->date(), currentExportMode);
emit selection("NOT", startDate->date(), endDate->date(), currentExportMode);
}
else if (stationCallsignComboBox->currentIndex() == 1)
{