Work on Freq and structs

This commit is contained in:
d 2024-04-27 10:55:00 +02:00
parent b9857d43b4
commit 3a74502626
17 changed files with 338 additions and 322 deletions

View File

@ -312,12 +312,12 @@ int Awards::getWAZConfirmed(const int _logNumber)
}
}
bool Awards::isThisSpotConfirmed(const QStringList &_qs)
bool Awards::isThisSpotConfirmed(EntityStatus _entityStatus)
{
return (getDXStatus(_qs) == 13);
return (getDXStatus(_entityStatus) == 13);
}
int Awards::getDXStatus (const QStringList &_qs)
int Awards::getDXStatus (EntityStatus _entityStatus)
{
//qDebug() << Q_FUNC_INFO<< ": Entity: " << _qs.at(0) << "/ Band: " << _qs.at(1) << "/ Mode: " << _qs.at(2) << "/ Log: " << _qs.at(3) << QT_ENDL;
// Receives: QStringList _qs;
@ -357,38 +357,28 @@ int Awards::getDXStatus (const QStringList &_qs)
2 - Worked - Worked in this band but not confirmed - YELLOW
3 - Confirmed - Confirmed in this band - GREEN
*/
if (_qs.length() != 4 )
{
//qDebug() << Q_FUNC_INFO<< ": Length != 4, return -1";
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 = (_qs.at(0)).toInt();
//qDebug() << Q_FUNC_INFO<< ": dxccEntity: " << QString::number(dxccEntity);
if (dxccEntity<=0)
if (_entityStatus.entityId<=0)
{
//qDebug() << Q_FUNC_INFO<< ": dxccEntity <= 0, return -1";
return -1;
}
bool checkingMode = true;
if ( (_mode==-1) || (manageModes==false))
if ( (_entityStatus.modeId==-1) || (manageModes==false))
{
checkingMode = false;
//qDebug() << Q_FUNC_INFO<< ": checkingMode = FALSE";
}
int wb = dxccStatusBand(dxccEntity, _band, _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed
int wb = dxccStatusBand(_entityStatus.entityId, _entityStatus.bandId, _entityStatus.log); //-1 error / 0 Not worked / 1 worked / 2 confirmed
int wm = -1;
if (checkingMode)
{
wm = dxccStatusMode(dxccEntity, _mode, _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed
wm = dxccStatusMode(_entityStatus.entityId, _entityStatus.modeId, _entityStatus.log); //-1 error / 0 Not worked / 1 worked / 2 confirmed
}
// int wm = dxccStatusMode(dxccEntity, _mode, _logNumber); //-1 error / 0 Not worked / 1 worked / 2 confirmed
@ -400,7 +390,7 @@ int Awards::getDXStatus (const QStringList &_qs)
//qDebug() << Q_FUNC_INFO<< ": wb=" << QString::number(wb) << " - wm=" << QString::number(wm);
//qDebug() << Q_FUNC_INFO<< ": dxccStatus: " << QString::number(dxccStatus(dxccEntity, _logNumber));
switch(dxccStatus(dxccEntity, _logNumber))
switch(dxccStatus(_entityStatus.entityId, _entityStatus.log))
{
case 0:
//qDebug() << Q_FUNC_INFO<< ": return 0";
@ -740,15 +730,9 @@ int Awards::dxccStatus(const int _ent, const int _logNumber)
}
*/
QColor Awards::getQRZDXStatusColor(const QStringList &_qs)
QColor Awards::getQRZDXStatusColor(EntityStatus _entitystatus)
{
//qs << Entity << spotBand << "-1" << QString::number(currentLog) ;
//qDebug() << Q_FUNC_INFO<< ": qs.length: " << QString::number(_qs.length());
//From Search QSO to QSL: q << _call << bandid << _mode << QString::number(currentLog);
//qDebug() << Q_FUNC_INFO<< ": " << _qs.at(0) << "/" << _qs.at(1) << "/" << _qs.at(2) << _qs.at(3);
// Receives: QStringList _qs;
//_qs << Entity << BandID << ModeId << lognumber;
//qDebug() << Q_FUNC_INFO << " - Start";
/*
0 - New One
@ -759,7 +743,7 @@ QColor Awards::getQRZDXStatusColor(const QStringList &_qs)
QColor returnedColor;
int status = getDXStatus(_qs);
int status = getDXStatus(_entitystatus);
//qDebug() << Q_FUNC_INFO<< ": status: " << QString::number(status) << "/" << getDXStatusString(status);
//qDebug() << Q_FUNC_INFO<< ": status: " << QString::number(status);

View File

@ -47,6 +47,12 @@
class QProgressDialog;
struct EntityStatus { // Used to pass the Data of the status of an Entity
int entityId = -1;
int bandId = -1;
int modeId = -1;
int log = -1;
};
class Awards : public QObject {
Q_OBJECT
@ -76,7 +82,7 @@ public:
int getQSOsInLog(const int _logNumber);
bool getIsDXCCConfirmed(const int _dxcc, const int _logNumber);
bool isThisSpotConfirmed(const QStringList &_qs);
bool isThisSpotConfirmed(EntityStatus _entityStatus);
QString checkIfValidIOTA(const QString &_tiota); //TODO: There is an equivalent function in the MainWindowInputOthers class. I should use only one!
@ -84,14 +90,14 @@ public:
QString getQSOofAward (const int _enti, const int _bandid, const int _log, const bool _confirmed);
int getQSOIdofAward (const int _enti, const int _bandid, const int _log, const bool _confirmed);
int getDXStatus (const QStringList &_qs);
int getDXStatus (EntityStatus _entitystatus);
QSOStatus getQSOStatus(const int &_status); // Needs to be called with the output of getDXStatus)
QString getDXStatusString (const int &_status); // Needs to be called with the output of getDXStatus
QString getDXCCStatusBand2(const int _dxcc, const int _band, const int _logNumber=0); // Returns -, W or C (Not worked, worked, Confirmed)
QString getDXCCStatusBand(const int _dxcc, const int _band); // Returns -, W or C (Not worked, worked, Confirmed)
void setColors (const QString &_newOne, const QString &_needed, const QString &_worked, const QString &_confirmed, const QString &_default);
QColor getQRZDXStatusColor(const QStringList &_qs); // Receives Entity, band, mode & log
QColor getQRZDXStatusColor(EntityStatus _entitystatus); // Receives Entity, band, mode & log
QColor getDefaultColor();
int getDXMarathonQSO(const int _year, const int _logNumber);

View File

@ -92,7 +92,7 @@ DXClusterWidget::DXClusterWidget(DataProxy_SQLite *dp, QWidget *parent)
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() ) );
connect(dxClusterListWidget, SIGNAL(customContextMenuRequested( const QPoint& ) ), this, SLOT(slotRighButton( const QPoint& ) ) );
connect(dxClusterListWidget, SIGNAL(customContextMenuRequested( const QPoint& ) ), this, SLOT(slotRightButton( const QPoint& ) ) );
//TESTADDSPOT();
//qDebug() << "DXClusterWidget::DXClusterWidget2 - END" ;
}
@ -184,28 +184,19 @@ void DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetIt
{
//qDebug() << Q_FUNC_INFO << item->text();
DXSpot spot;
QStringList ql;
ql.clear();
if (item)
{
ql = readItem(item);
//qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: Length: " << QString::number(ql.length()) ;
if (ql.length()==2)
{
ql << "double";
//qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: EMMITED" ;
emit dxspotclicked(ql);
}
else
{
//qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: NOT EMMITED-1" ;
}
}
else
{
//qDebug() << "DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked: NOT EMMITED-2 (no item)" ;
}
if (!item)
return;
spot = readItem(((item->data(0)).toString()).simplified());
if (!spot.valid)
return;
spot.clickStatus = DoubleClick;
emit dxspotclicked(spot);
}
void DXClusterWidget::connectToDXCluster()
@ -219,7 +210,8 @@ void DXClusterWidget::connectToDXCluster()
connect(tcpSocket, SIGNAL(connected()), SLOT(slotClusterSocketConnected()) );
connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(slotClusterDataArrived() ));
connect(tcpSocket, SIGNAL(errorOcurred(QAbstractSocket::SocketError)), this, SLOT(slotClusterDisplayError(QAbstractSocket::SocketError)));
connect(tcpSocket, SIGNAL(errorOccurred(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()) );
@ -258,76 +250,71 @@ void DXClusterWidget::slotClusterDisplayError(QAbstractSocket::SocketError socke
}
}
bool DXClusterWidget::checkIfNeedsToBePrinted(const QString &_DXEntity, int const _band, const int _mode)
bool DXClusterWidget::checkIfNeedsToBePrinted(EntityStatus _entityStatus)
{
//qDebug() << Q_FUNC_INFO << _DXEntity << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< QT_ENDL;
QStringList qs;
qs.clear();
qs << _DXEntity << QString::number(_band) << QString::number(_mode) << QString::number(currentLog);
//bool isConfirmed = false;
bool status = awards->isThisSpotConfirmed (qs);
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: Status: " << _DXEntity << "/" << QString::number(status);
bool status = awards->isThisSpotConfirmed (_entityStatus);
//qDebug() << Q_FUNC_INFO << "Status: " << _DXEntity << "/" << QString::number(status);
if (!showconfirmed)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is confirmed? ("<< QString::number(status)<< ")";
//qDebug() << Q_FUNC_INFO << " is confirmed? ("<< QString::number(status)<< ")";
if (status)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: It is confirmed: DON'T' print: " << _DXEntity <<"/" << dataProxy->getNameFromBandId(_band);
//qDebug() << Q_FUNC_INFO << " It is confirmed: DON'T' print: " << _DXEntity <<"/" << dataProxy->getNameFromBandId(_band);
return false;
}
}
if (!showhf)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is HF?";
if (dataProxy->isHF(_band))
//qDebug() << Q_FUNC_INFO << " is HF?";
if (dataProxy->isHF(_entityStatus.bandId))
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: Not showing HF but... is it WARC?";
if ( (showwarc) && dataProxy->isWARC(_band) )
//qDebug() << Q_FUNC_INFO << ": Not showing HF but... is it WARC?";
if ( (showwarc) && dataProxy->isWARC(_entityStatus.bandId) )
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: Not showing HF but... is WARC, print!";
//qDebug() << Q_FUNC_INFO << ": Not showing HF but... is WARC, print!";
return true;
}
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is HF: DON'T print: "<< _DXEntity << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< QT_ENDL;
//qDebug() << Q_FUNC_INFO << ": is HF: DON'T print: "<< _DXEntity << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< QT_ENDL;
return false;
}
else
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is NOT HF";
//qDebug() << Q_FUNC_INFO << ": is NOT HF";
}
}
if (!showwarc)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is WARC?";
if (dataProxy->isWARC(_band))
//qDebug() << Q_FUNC_INFO << ": is WARC?";
if (dataProxy->isWARC(_entityStatus.bandId))
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is WARC, DON'T print: "<< _DXEntity << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< QT_ENDL;
//qDebug() << Q_FUNC_INFO << ": is WARC, DON'T print: "<< _DXEntity << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< QT_ENDL;
return false;
}
else
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is NOT WARC";
//qDebug() << Q_FUNC_INFO << ": is NOT WARC";
}
}
if (!showvhf)
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is VHF?";
if (dataProxy->isVHF(_band))
//qDebug() << Q_FUNC_INFO << ": is VHF?";
if (dataProxy->isVHF(_entityStatus.bandId))
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is VHF, DON'T print: "<< _DXEntity << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< QT_ENDL;
//qDebug() << Q_FUNC_INFO << ": is VHF, DON'T print: "<< _DXEntity << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< QT_ENDL;
return false;
}
else
{
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: is NOT VHF ";
//qDebug() << Q_FUNC_INFO << ": is NOT VHF ";
}
}
//qDebug() << "DXClusterWidget::checkIfNeedsToBePrinted: returns TRUE and will be printed: " << _DXEntity << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< QT_ENDL;
//qDebug() << Q_FUNC_INFO << ": returns TRUE and will be printed: " << _DXEntity << "/" << dataProxy->getNameFromBandId(_band) << QString::number(_mode)<< QT_ENDL;
return true;
}
@ -347,93 +334,54 @@ void DXClusterWidget::setCurrentLog(const int _log)
void DXClusterWidget::slotClusterDataArrived()
{
qDebug() << Q_FUNC_INFO;
QStringList qs;
//QStringList qs;
QString dxClusterString;
QString dxCall;
QString spotBand;
Frequency freq;
bool dxSpot = false;
spotBand = "-1";
//bool isADXSpot = false;
int dxEntity = -1;
QString spotter;
DXSpot spot;
spotBand = "-1";
QString spotter;
EntityStatus _entityStatus;
while ( tcpSocket->canReadLine() )
{
spotter.clear();
dxCall.clear();
dxEntity = -1;
_entityStatus.entityId = -1;
dxClusterString = tcpSocket->readLine();
dxClusterString = dxClusterString.trimmed();
// Remove BELL-string if exists
dxClusterString = dxClusterString.remove("\a");
saveSpot(dxClusterString);
spot = readItem(dxClusterString);
QStringList tokens = dxClusterString.split(" ", QT_SKIP);
if (tokens.size()<2){
qDebug() << Q_FUNC_INFO << " - Tokens < 2";
return;
}
// It is a "DX de SP0TTER FREC DXCALL"
//0 = DX, 1 = de, 2 = spotter, 3 = Freq, 4 = dxcall, 5 = comment
qDebug() << Q_FUNC_INFO << " - DXCLUSTER->" << dxClusterString << "\nTOKENS: " << tokens;
if (spot.valid)
{
_entityStatus.entityId = world->getQRZARRLId(dxCall);
if ((tokens[0] == "DX") && (tokens[1] == "de"))
{ // Dx de EA0AA EA0XX
qDebug() << Q_FUNC_INFO << " - Identified: DX de";
dxSpot = true;
spotter = tokens[2];
spotter.truncate(spotter.size() - 1);
bool freqOK = freq.fromQString(tokens[3], KHz) ;
if (!freqOK)
{
qDebug() << Q_FUNC_INFO << " - freqOK false";
return;
}
qDebug() << Q_FUNC_INFO << ": FREQ(if): " << freq.toQString();
dxCall = tokens[4];
dxEntity = world->getQRZARRLId(dxCall);
spotBand = QString::number(dataProxy->getBandIdFromFreq(freq.toDouble()) );
}
else if(freq.fromQString(tokens[0], KHz))
{// 18.000 EA0XX
qDebug() << Q_FUNC_INFO << " - Identified: Freq Call";
dxSpot = true;
dxCall = tokens[1];
spotter = cleanSpotter(tokens.last());
}
else
{
qDebug() << Q_FUNC_INFO << " - Identified: Not a DXSpot";
dxSpot = false;
dxSpotColor = awards->getDefaultColor();
}
if (dxSpot)
{
qs.clear();
qs << QString::number(dxEntity) << spotBand << "-1" << QString::number(currentLog) ;
qDebug() << Q_FUNC_INFO << " - DX_Entity: " << QString::number(dxEntity);
qDebug() << Q_FUNC_INFO << " - DX Spotter: " << spotter ;
qDebug() << Q_FUNC_INFO << " - Freq: " << freq.toQString();
qDebug() << Q_FUNC_INFO << " - DX: " << dxCall;
dxSpotColor = awards->getQRZDXStatusColor(qs);
dxSpotColor = awards->getQRZDXStatusColor(_entityStatus);
if (showDxMarathon)
{
if (awards->isDXMarathonNeed(dxEntity, world->getQRZCqz(dxCall), QDateTime::currentDateTime().date().year(), currentLog))
if (awards->isDXMarathonNeed(_entityStatus.entityId, world->getQRZCqz(dxCall), QDateTime::currentDateTime().date().year(), currentLog))
{
dxClusterString = dxClusterString + " ### Needed for DXMarathon - " + QString::number(QDateTime::currentDateTime().date().year()) + " ###";
}
}
}
else
{
dxSpotColor = awards->getDefaultColor();
}
//TODO: Change the "-1" by the mode
if (!checkIfNeedsToBePrinted(QString::number(dxEntity), spotBand.toInt(), -1))
_entityStatus.bandId = spotBand.toInt();
_entityStatus.modeId = -1;
if (!checkIfNeedsToBePrinted(_entityStatus))
{
qDebug() << Q_FUNC_INFO << " - Not to be printed!: " << dxCall;
return;
@ -445,13 +393,13 @@ void DXClusterWidget::slotClusterDataArrived()
item->setText(dxClusterString);
dxClusterListWidget->insertItem(0,item);
if (!dxSpot)
if (!spot.valid)
return;
qDebug() << Q_FUNC_INFO << " - Freq-string: " << freq.toQString();
qDebug() << Q_FUNC_INFO << " - Freq-double: " << QString::number(freq.toDouble());
qDebug() << Q_FUNC_INFO << " - Everything OK emitting...";
emit dxspotArrived(dxCall, freq.toDouble());
emit dxspotArrived(spot.dxcall, freq);
}
qDebug() << Q_FUNC_INFO << " - END";
@ -605,15 +553,15 @@ void DXClusterWidget::slotClusterDXClusterWidgetItemSelected()
{
//qDebug() << Q_FUNC_INFO;
QListWidgetItem * item = dxClusterListWidget->currentItem();
DXSpot spot;
QStringList ql;
ql.clear();
ql = readItem(item);
spot = readItem(((item->data(0)).toString()).simplified());
if (ql.length()==2)
{
ql << "selected";
emit dxspotclicked(ql);
emit dxspotclicked(spot);
}
}
@ -623,17 +571,16 @@ void DXClusterWidget::slotClusterDXClusterWidgetItemEntered( QListWidgetItem * i
/*
This code comes from slotClusterDXClusterWidgetItemDoubleClicked
*/
DXSpot spot;
QString tip;
tip.clear();
QStringList ql;
ql.clear();
if (item)
{
ql = readItem(item);
if (ql.length()==2)
spot = readItem(((item->data(0)).toString()).simplified());
if (spot.valid)
{
tip = world->getQRZEntityName(ql.at(0));
tip = world->getQRZEntityName(spot.dxcall);
item->setToolTip(tip);
}
}
@ -646,39 +593,73 @@ bool DXClusterWidget::isConnected()
return dxClusterConnected;
}
QStringList DXClusterWidget::readItem(QListWidgetItem * item)
DXSpot DXClusterWidget::readItem(const QString _stringSpot)
{
//qDebug() << Q_FUNC_INFO;
// Returns: fields << dxCallsign << dxFreq;
// Returns: dxSpot
DXSpot spot;
if (_stringSpot.length()<5)
return spot;
Frequency _fr;
//dxClusterString = ((item->data(0)).toString()).simplified();
QString dxClusterString = _stringSpot;
QStringList fields;
QString dxClusterString;
fields.clear();
fields << dxClusterString.split(" ");
if ( (fields.at(0) == "DX" ) && (fields.at(1) == "de" ) )
{ // DX de EA0XXX: 21200.1 EA0K The comment 1550
qDebug() << Q_FUNC_INFO << ": Identified: DX de";
spot.spotter = fields.at(2);
spot.freq.fromQString((fields.at(3)), KHz);
spot.dxcall = fields.at(4);
spot.valid = true;
}
else if (fields.last().endsWith(">"))
{ // 14250.0 EA0XXX 12-Apr-2020 2140Z Comment <EA0XX>
qDebug() << Q_FUNC_INFO << ": Identified: ENDS with >";
spot.spotter = fields.last();
spot.freq.fromQString((fields.at(0)), KHz);
spot.dxcall = fields.at(1);
spot.valid = true;
}
else if ((fields.at(0) == "To" ) && (fields.at(1) == "ALL" ))
{ // To ALL Comment
qDebug() << Q_FUNC_INFO << ": Identified: To ALL";
spot.valid = false;
}
else
{
qDebug() << Q_FUNC_INFO << ": Identified: Default";
spot.valid = false;
}
return spot;
/*
/////// NEW CODE
//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 (!item)
return spot;
if ( (fields.at(0) == "DX" ) && (fields.at(1) == "de" ) )
{ // DX de EA0XXX: 21200.1 EA0K The comment 1550
if ( world->getQRZARRLId(fields.at(4))> 0 )
{
//qDebug() << Q_FUNC_INFO << "- ARRLid: " << QString::number(world->getQRZARRLId(fields.at(4))) ;
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;
fields.clear();
dxClusterString = ((item->data(0)).toString()).simplified();
fields << dxClusterString.split(" ");
if ( (fields.at(0) == "DX" ) && (fields.at(1) == "de" ) )
{ // DX de EA0XXX: 21200.1 EA0K The comment 1550
if ( world->getQRZARRLId(fields.at(4))> 0 )
{
spot.dxcall = (fields.at(4)).toUpper();
spot.freq().fromQString(fields.at(3), KHz);
if (spot.freq().isValid())
{ // The frecuency is valid
return spot;
}
else
{ // the frecuency is not a number!
@ -691,9 +672,10 @@ QStringList DXClusterWidget::readItem(QListWidgetItem * item)
{ // The callsign is not from a valid country
// TODO: if it is from a new entity/prefix it would not work.
//qDebug() << Q_FUNC_INFO << " Entity not valid" ;
dxCallsign.clear();
dxFreq.clear();
fields.clear();
spot.dxcall = QString();
spot.spotter = QString();
spot.comment = QString();
spot.freq().clear();
}
}
//else if (( isAFrecuency(fields.at(0) ) ) && ( isACall(fields.at(1)) ) )
@ -703,20 +685,22 @@ QStringList DXClusterWidget::readItem(QListWidgetItem * item)
dxFreq = fields.at(0);
fields.clear();
fields << dxCallsign << dxFreq;
return fields;
spot.dxcall = dxCallsign;
spot.freq().fromQString(dxFreq, KHz);
return spot;
}
else
{
dxCallsign.clear();
dxFreq.clear();
fields.clear();
spot.dxcall = QString();
spot.spotter = QString();
spot.comment = QString();
spot.freq().clear();
spot.clickStatus = NoClick;
spot.dateTime = QDateTime();
}
}
else
{ // No Item
}
return fields;
return spot;
*/
}
void DXClusterWidget::setDXClusterServer(const QString &clusterToConnect, const int portToConnect)
@ -767,29 +751,27 @@ bool DXClusterWidget::openFile()
}
}
void DXClusterWidget::slotRighButton(const QPoint& pos)
void DXClusterWidget::slotRightButton(const QPoint& pos)
{
//qDebug() << Q_FUNC_INFO;
Q_UNUSED(pos);
//int row = (dxClusterListWidget->indexAt(pos)).row();
//qDebug() << Q_FUNC_INFO << " row: " << QString::number(row);
QListWidgetItem * item = dxClusterListWidget->currentItem();
DXSpot spot;
QStringList ql;
ql.clear();
ql = readItem(item); //qstringlist << dxCallsign << dxFreq;
if (ql.length()==2)
spot = readItem(((item->data(0)).toString()).simplified());
if ((spot.valid) && (spot.clickStatus == RightClick) )
{
rightButtonFromLogMenu(ql);
rightButtonFromLogMenu(spot);
}
}
void DXClusterWidget::rightButtonFromLogMenu(const QStringList _ql)
void DXClusterWidget::rightButtonFromLogMenu(DXSpot _spot)
{
// This function creates the context menu
//qDebug() << Q_FUNC_INFO;
checkQRZCOMFromLogAct->setData (_ql.at(0));
checkQRZCOMFromLogAct->setData (_spot.dxcall);
QMenu menu(this);
menu.addAction(checkQRZCOMFromLogAct);
menu.exec(QCursor::pos());

View File

@ -34,12 +34,24 @@ email : jaime@robles.es
#include "../awards.h"
#include "../world.h"
#include "../utilities.h"
#include "../frequency.h"
#include "../dataproxy_sqlite.h"
#include "../frequency.h"
#include "../klogdefinitions.h"
class QWidget;
class QTcpSocket;
struct DXSpot { // Used to pass a list of data from Awards to dxccstatuswidget
QString dxcall = QString();
Frequency freq = Frequency();
QString spotter = QString();
QString comment = QString();
QDateTime dateTime = QDateTime();
MouseClicks clickStatus = SingleClick;
bool valid = false;
};
class DXClusterWidget : public QWidget
{
Q_OBJECT
@ -60,7 +72,7 @@ class DXClusterWidget : public QWidget
void loadSettings();
void setDXClusterServer(const QString &clusterToConnect, const int portToConnect);
void rightButtonFromLogMenu(const QStringList _ql);
void rightButtonFromLogMenu(DXSpot _spot);
//void sendSpotToCluster(const QString &_dx, const QString &_freq);
private slots:
@ -75,12 +87,12 @@ private slots:
void slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetItem * item );
void slotClusterDXClusterWidgetItemEntered( QListWidgetItem * item);
void slotClusterDXClusterWidgetItemSelected();
void slotRighButton (const QPoint& pos);
void slotRightButton (const QPoint& pos);
void slotCheckQRZCom();
signals:
void dxspotclicked(const QStringList &_qs); // DXSpotCall, DX-Freq, doubleClicked
void dxspotArrived(const QString &_call, const double _freq);
void dxspotclicked(DXSpot _dxSpot); // DXSpotCall, DX-Freq, doubleClicked
void dxspotArrived(const QString &_call, Frequency _freq);
//void dxspot(const QString &_spot); // The text string to be saved
private:
@ -88,14 +100,14 @@ private:
void createActions();
void connectToDXCluster();
QStringList readItem(QListWidgetItem * item);
bool checkIfNeedsToBePrinted(const QString &_DXEntity, const int _band, const int _mode);
//QStringList readItem(QListWidgetItem * _stringSpot);
DXSpot readItem (const QString _stringSpot);
bool checkIfNeedsToBePrinted(EntityStatus _entityStatus);
void saveSpot (const QString &_spot);
bool openFile();
QString cleanSpotter(const QString _call);
void addData(); //TO BE DELETED, JUST FOR TESTING PURPOSES
QTcpSocket *tcpSocket;
QListWidget *dxClusterListWidget;
QLineEdit *inputCommand;

View File

@ -73,10 +73,20 @@ bool DXClusterAssistant::createUI()
//qDebug() << Q_FUNC_INFO << " - END";
}
void DXClusterAssistant::newDXClusterSpot(const QString &_call, const double _freq, const QSOStatus _status)
void DXClusterAssistant::newDXClusterSpot(proposedQSOs _q)
{
list.append(_q);
//qDebug() << Q_FUNC_INFO << " - 50";
//qDebug() << Q_FUNC_INFO << " - 60";
//qDebug() << Q_FUNC_INFO << QString("Data received: Call: %1 - Freq: %2 - Status: %3").arg(_call).arg(_freq).arg(getStringFromStatus(_status));
addCall();
}
/*
void DXClusterAssistant::newDXClusterSpot(const QString &_call, const QSOStatus _status, double _freq)
{
//qDebug() << Q_FUNC_INFO << " - Start";
Utilities util(Q_FUNC_INFO);
//Utilities util(Q_FUNC_INFO);
//if (!util.isValidCall(_call, true))
//{
// //qDebug() << Q_FUNC_INFO << " - Not Valid Call: " << _call;
@ -88,7 +98,7 @@ void DXClusterAssistant::newDXClusterSpot(const QString &_call, const double _fr
//qDebug() << Q_FUNC_INFO << ": Status: " << ;
proposedQSOs newArrival;
newArrival.call = _call;
newArrival.freq = _freq;
newArrival.freq().fromDouble(_freq);
newArrival.status = _status;
newArrival.priority = 1;
list.append(newArrival);
@ -99,6 +109,7 @@ void DXClusterAssistant::newDXClusterSpot(const QString &_call, const double _fr
addCall();
//qDebug() << Q_FUNC_INFO << " - END";
}
*/
QString DXClusterAssistant::getStringFromStatus(QSOStatus _s)
{
@ -135,13 +146,13 @@ void DXClusterAssistant::addCall()
{
//qDebug() << Q_FUNC_INFO << "Call: " << aux.call;
QTableWidgetItem *newItemCall = new QTableWidgetItem(aux.call, QTableWidgetItem::Type);
QTableWidgetItem *newItemFreq = new QTableWidgetItem(QString::number(aux.freq), QTableWidgetItem::Type);
//QTableWidgetItem *newItemFreq = new QTableWidgetItem(aux.freq().toQString(), QTableWidgetItem::Type);
QTableWidgetItem *newItemStatus = new QTableWidgetItem(getStringFromStatus(aux.status), QTableWidgetItem::Type);
tableWidget->insertRow(tableWidget->rowCount());
int row = tableWidget->rowCount();
tableWidget->setItem(row-1, 0, newItemCall);
tableWidget->setItem(row-1, 1, newItemFreq);
//tableWidget->setItem(row-1, 1, newItemFreq);
tableWidget->setItem(row-1, 2, newItemStatus);
}

View File

@ -38,12 +38,13 @@ email : jaime@robles.es
#include "../global.h"
#include "../klogdefinitions.h"
#include "../utilities.h"
#include "../frequency.h"
struct proposedQSOs { // Used to pass a list of data from Awards to dxccstatuswidget
QString call;
double freq;
int priority;
QSOStatus status;
QString call = QString();
Frequency freq;
int priority = -1;
QSOStatus status = unknown;
};
class DXClusterAssistant : public QWidget
@ -53,7 +54,8 @@ public:
explicit DXClusterAssistant(const QString &_parentFunction, QWidget *parent = nullptr);
~DXClusterAssistant();
bool init();
void newDXClusterSpot(const QString &_call, const double _freq, const QSOStatus _status);
void newDXClusterSpot(proposedQSOs _q);
//void newDXClusterSpot(const QString &_call, const QSOStatus _status, double _freq);
signals:

View File

@ -24,13 +24,17 @@
* *
*****************************************************************************/
#include "frequency.h"
#include <QDebug>
Frequency::Frequency(){}
//Frequency::Frequency(double _f)
//{
// freq = _f;
//}
Frequency::Frequency(const Frequency &_f)
{
if(this != &_f)
{
*this = _f;
}
}
Frequency::~Frequency(){}
@ -55,6 +59,7 @@ bool Frequency::fromQString(const QString &_f, FreqUnits _u)
freq = normalize(freq, _u);
return isValid();
}
/*
bool Frequency::fromBand(const QString &_bandName)
{
@ -83,6 +88,9 @@ double Frequency::toDouble(FreqUnits _u)
QString Frequency::toQString(int _decimals, FreqUnits _u)
{
double d = toDouble(_u);
qDebug() << Q_FUNC_INFO << ": " << QString::number(toDouble());
qDebug() << Q_FUNC_INFO << ": " << QString::number(fmod(toDouble(), 1.0));
return QString("%1").arg(d, 0, 'f', _decimals);
}
@ -131,7 +139,13 @@ int Frequency::bandId()
return dataProxy.getBandIdFromFreq(toDouble());
}
*/
bool Frequency::isValid()
{
return (freq>=0);
}
void Frequency::operator=(Frequency const &_f2)
{
freq = _f2.freq;
}

View File

@ -26,8 +26,7 @@
* *
*****************************************************************************/
/*
This class implements Frequency
This classs hould not need to query the DB neither the DataProxy Class
This class implements Frequency.
*/
#include <QObject>
@ -37,7 +36,7 @@ class Frequency: public QObject {
Q_OBJECT
public:
Frequency();
//Frequency(double _f);
Frequency(const Frequency &_f);
~Frequency();
void clear();
bool fromDouble(const double _f, FreqUnits _u = MHz);
@ -49,6 +48,7 @@ public:
//QString band(); // Returns the band
//int bandId(); // Returns the bandId
bool isValid();
void operator=(Frequency const &_f2); // Redefinition of =
private:
@ -56,7 +56,6 @@ private:
double freq; // This must be in MHz
QString bandInMHz; //
double tolerance; // This must be in Hz
};
#endif // FREQUENCY_H

View File

@ -368,16 +368,18 @@ void InfoWidget::setImperialSystem (const bool _imp)
}
}
QString InfoWidget::getStyleColorToLabelFromBand(const QString &_b, const QString &_q)
QString InfoWidget::getStyleColorToLabelFromBand(const int _bandId, const int _entityId)
{ // Receives band name, Entity number (as a String)
//qDebug() << Q_FUNC_INFO << ": " << _b << "/" << _q;
QStringList _qs;
_qs.clear();
EntityStatus _entityStatus;
_entityStatus.entityId = _entityId;
_entityStatus.bandId = _bandId;
_entityStatus.modeId = -1;
_entityStatus.log = currentLog;
_qs << _q << QString::number(dataProxy->getIdFromBandName(_b)) << QString::number(-1) << QString::number(currentLog);
//TODO: Check if we can know the mode and replace the -1
//qDebug() << Q_FUNC_INFO << ": (Band/background-color): " << _b << (awards->getQRZDXStatusColor(_qs)).name(QColor::HexRgb) ;
return "* { background-color: " + (awards->getQRZDXStatusColor(_qs)).name(QColor::HexRgb) + "; }";
return "* { background-color: " + (awards->getQRZDXStatusColor(_entityStatus)).name(QColor::HexRgb) + "; }";
}
@ -393,18 +395,18 @@ void InfoWidget::showInfo(const int _entity)
clearBandLabels();
}
bandLabel1->setStyleSheet(getStyleColorToLabelFromBand(bandLabel1->text(), QString::number(_entity)));
bandLabel2->setStyleSheet(getStyleColorToLabelFromBand(bandLabel2->text(), QString::number(_entity)));
bandLabel3->setStyleSheet(getStyleColorToLabelFromBand(bandLabel3->text(), QString::number(_entity)));
bandLabel4->setStyleSheet(getStyleColorToLabelFromBand(bandLabel4->text(), QString::number(_entity)));
bandLabel5->setStyleSheet(getStyleColorToLabelFromBand(bandLabel5->text(), QString::number(_entity)));
bandLabel6->setStyleSheet(getStyleColorToLabelFromBand(bandLabel6->text(), QString::number(_entity)));
bandLabel7->setStyleSheet(getStyleColorToLabelFromBand(bandLabel7->text(), QString::number(_entity)));
bandLabel8->setStyleSheet(getStyleColorToLabelFromBand(bandLabel8->text(), QString::number(_entity)));
bandLabel9->setStyleSheet(getStyleColorToLabelFromBand(bandLabel9->text(), QString::number(_entity)));
bandLabel10->setStyleSheet(getStyleColorToLabelFromBand(bandLabel10->text(), QString::number(_entity)));
bandLabel11->setStyleSheet(getStyleColorToLabelFromBand(bandLabel11->text(), QString::number(_entity)));
bandLabel12->setStyleSheet(getStyleColorToLabelFromBand(bandLabel12->text(), QString::number(_entity)));
bandLabel1->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel1->text()), _entity));
bandLabel2->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel2->text()), _entity));
bandLabel3->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel3->text()), _entity));
bandLabel4->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel4->text()), _entity));
bandLabel5->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel5->text()), _entity));
bandLabel6->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel6->text()), _entity));
bandLabel7->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel7->text()), _entity));
bandLabel8->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel8->text()), _entity));
bandLabel9->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel9->text()), _entity));
bandLabel10->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel10->text()), _entity));
bandLabel11->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel11->text()), _entity));
bandLabel12->setStyleSheet(getStyleColorToLabelFromBand(dataProxy->getIdFromBandName(bandLabel12->text()), _entity));
//qDebug() << Q_FUNC_INFO << " - END";
}

View File

@ -63,7 +63,7 @@ public:
private:
void clearBandLabels();
void clearInfoFromLocators();
QString getStyleColorToLabelFromBand(const QString &_b, const QString &_q);
QString getStyleColorToLabelFromBand(const int _bandId, const int _entityId);
QLabel *bandLabel1, *bandLabel2, *bandLabel3, *bandLabel4;
QLabel *bandLabel5, *bandLabel6, *bandLabel7, *bandLabel8;

View File

@ -39,6 +39,7 @@ enum ValidFieldsForStats {DXCC, GridSquare};
enum FilesToDownload {CTY, Sats};
enum QSOStatus {unknown, ATNO, needed, worked, confirmed};
enum FreqUnits {Hz, KHz, MHz, GHz, THz};
enum MouseClicks {NoClick, RightClick, SingleClick, DoubleClick};
struct EntityData { // Used to pass a list of data from World to dxccstatuswidget
int dxcc;

View File

@ -638,8 +638,7 @@ void MainWindow::createActionsCommon(){
//Buttons Actions
connect(mainQSOEntryWidget, SIGNAL(handOverFocusSignal()), this, SLOT(slotTakeOverFocu
sToQSOTabWidget()));
connect(mainQSOEntryWidget, SIGNAL(handOverFocusSignal()), this, SLOT(slotTakeOverFocusToQSOTabWidget()));
connect(mainQSOEntryWidget, SIGNAL(currentQRZSignal(QString)), this, SLOT(slotQRZTextChanged(QString)));
connect(mainQSOEntryWidget, SIGNAL(debugLog(QString, QString, DebugLogLevel)), this, SLOT(slotCaptureDebugLogs(QString, QString, DebugLogLevel)) );
connect(mainQSOEntryWidget, SIGNAL(showInfoLabel(QString)), this, SLOT(slotShowInfoLabel(QString)) );
@ -659,8 +658,8 @@ void MainWindow::createActionsCommon(){
connect(logWindow, SIGNAL(queryError(QString, QString, QString, QString)), this, SLOT(slotQueryErrorManagement(QString, QString, QString, QString)) );
//CLUSTER
connect(dxClusterWidget, SIGNAL(dxspotclicked(QStringList)), this, SLOT(slotAnalyzeDxClusterSignal(QStringList) ) );
connect(dxClusterWidget, SIGNAL(dxspotArrived(QString, double)), this, SLOT(slotDXClusterSpotArrived(QString, double) ) );
connect(dxClusterWidget, SIGNAL(dxspotclicked(DXSpot)), this, SLOT(slotAnalyzeDxClusterSignal(DXSpot) ) );
connect(dxClusterWidget, SIGNAL(dxspotArrived(QString, Frequency)), this, SLOT(slotDXClusterSpotArrived(QString, Frequency) ) );
// CLUBLOG
connect (elogClublog, SIGNAL (showMessage(QString)), this, SLOT (slotElogClubLogShowMessage(QString)));
@ -1011,15 +1010,15 @@ void MainWindow::slotBandChanged (const QString &_b)
}
//qDebug() << "MainWindow::slotBandChanged: Checking to update Freq - DONE" ;
QStringList _qs; //for the showStatusOfDXCC(const QStringList _qs)
_qs.clear();
_qs << QString::number(currentEntity) << QString::number(currentBandShown) << QString::number(currentModeShown) << QString::number(currentLog);
EntityStatus _entityStatus;
_entityStatus.entityId = currentEntity;
_entityStatus.bandId = currentBandShown;
_entityStatus.modeId = currentModeShown;
_entityStatus.log = currentLog;
//qDebug() << "MainWindow:: - calling showStatusOfDXCC-02 " ;
if (currentEntity>0)
{
showStatusOfDXCC(_qs);
showStatusOfDXCC(_entityStatus);
}
logEvent(Q_FUNC_INFO, "END", Debug);
@ -1041,11 +1040,13 @@ void MainWindow::slotModeChanged (const QString &_m)
currentBand = currentBandShown;
currentMode = currentModeShown;
QStringList _qs; //for the showStatusOfDXCC(const QStringList _qs)
_qs.clear();
//qDebug() << "MainWindow:: - calling showStatusOfDXCC-01 " ;
_qs << QString::number(currentEntity) << QString::number(currentBandShown) << QString::number(currentModeShown) << QString::number(currentLog);
showStatusOfDXCC(_qs);
EntityStatus _entityStatus;
_entityStatus.entityId = currentEntity;
_entityStatus.bandId = currentBandShown;
_entityStatus.modeId = currentModeShown;
_entityStatus.log = currentLog;
showStatusOfDXCC(_entityStatus);
if (!modify)
{
QSOTabWidget->setRSTToMode(mainQSOEntryWidget->getMode(), readingTheUI);
@ -2080,9 +2081,11 @@ void MainWindow::slotQRZTextChanged(QString _qrz)
dx_ITUz = dxE_ITUz;
}
QStringList _qs; //for the showStatusOfDXCC(const QStringList _qs)
_qs.clear();
_qs << QString::number(currentEntity) << QString::number(currentBand) << QString::number(currentMode) << QString::number(currentLog);
EntityStatus _entityStatus;
_entityStatus.entityId = currentEntity;
_entityStatus.bandId = currentBandShown;
_entityStatus.modeId = currentModeShown;
_entityStatus.log = currentLog;
qDebug()<< Q_FUNC_INFO << ": 60 - currentEntity: " << QString::number(currentEntity) ;
if ( locator->isValidLocator(QSOTabWidget->getDXLocator()))
@ -2106,7 +2109,8 @@ void MainWindow::slotQRZTextChanged(QString _qrz)
infoWidget->showEntityInfo(currentEntity, dx_CQz, dx_ITUz);
infoWidget->showDistanceAndBearing(myDataTabWidget->getMyLocator(), dxLocator);
qDebug()<< Q_FUNC_INFO << ": 70";
showStatusOfDXCC(_qs);
showStatusOfDXCC(_entityStatus);
showDXMarathonNeeded(currentEntity, dx_CQz, mainQSOEntryWidget->getDate().year(), currentLog);
othersTabWidget->setIOTAContinentFromEntity(currentEntity);
}
@ -4763,16 +4767,15 @@ void MainWindow::qsoToEdit (const int _qso)
othersTabWidget->setEntity(currentEntity);
//qDebug() << Q_FUNC_INFO << " - in default - 101" ;
QStringList _qs; //for the showStatusOfDXCC(const QStringList _qs)
_qs.clear();
//TODO: The band sometimes fails here. Check
_qs << QString::number(currentEntity) << QString::number(dataProxy->getIdFromBandName(mainQSOEntryWidget->getBand())) << QString::number(dataProxy->getIdFromBandName(mainQSOEntryWidget->getMode())) << QString::number(currentLog);
EntityStatus _entityStatus;
_entityStatus.entityId = currentEntity;
_entityStatus.bandId = currentBandShown;
_entityStatus.modeId = currentModeShown;
_entityStatus.log = currentLog;
//qDebug() << Q_FUNC_INFO << " - in default - 104" ;
//qDebug() << Q_FUNC_INFO << " - calling showStatusOfDXCC-05 " ;
showStatusOfDXCC(_qs);
showStatusOfDXCC(_entityStatus);
//qDebug() << Q_FUNC_INFO << " - in default - END" ;
readingTheUI = false;
@ -4820,9 +4823,9 @@ void MainWindow::slotMyLocatorTextChanged(const QString &_loc)
logEvent(Q_FUNC_INFO, "END", Debug);
}
void MainWindow::showStatusOfDXCC(const QStringList _qs)
void MainWindow::showStatusOfDXCC(EntityStatus _entityStatus)
{
qDebug() << Q_FUNC_INFO << " - Entity: " << _qs.at(0) << "/ Bandid :" << _qs.at(1) << "/Modeid: " << _qs.at(2) ;
//qDebug() << Q_FUNC_INFO << " - Entity: " << _entityStatus.en << "/ Bandid :" << _entityStatus.at(1) << "/Modeid: " << _entityStatus.at(2) ;
logEvent(Q_FUNC_INFO, "Start", Debug);
// Receives: QStringList _qs;
//_qs << Entity << BandId << ModeId << lognumber;
@ -4838,7 +4841,7 @@ void MainWindow::showStatusOfDXCC(const QStringList _qs)
3 - Confirmed
*/
qDebug() << Q_FUNC_INFO << " - 10";
if ((_qs.length() != 4) || (_qs.at(1) == "-1")) // is the qs valid?
if (_entityStatus.bandId <= 0) // is the status valid?
{
qDebug() << Q_FUNC_INFO << " - 20";
infoWidget->clear();
@ -4850,7 +4853,7 @@ void MainWindow::showStatusOfDXCC(const QStringList _qs)
}
qDebug() << Q_FUNC_INFO << " - 30";
// Set the status bar with the appropriate message
int status = awards->getDXStatus (_qs);
int status = awards->getDXStatus (_entityStatus);
qDebug() << Q_FUNC_INFO << " - " << QString::number(status) ;
@ -4861,7 +4864,7 @@ void MainWindow::showStatusOfDXCC(const QStringList _qs)
//infoLabel1->setText(message);
//infoWidget->showInfo((_qs.at(0)).toInt(), (_qs.at(1)).toInt(), (_qs.at(2)).toInt(), (_qs.at(3)).toInt() );
qDebug() << Q_FUNC_INFO << " - 50";
infoWidget->showInfo((_qs.at(0)).toInt());
infoWidget->showInfo(_entityStatus.entityId);
qDebug() << Q_FUNC_INFO << " - 51";
qDebug() << Q_FUNC_INFO << " - END-2" ;
logEvent(Q_FUNC_INFO, "END", Debug);
@ -5282,68 +5285,71 @@ void MainWindow::slotFilePrint()
//DX-CLUSTER - DXCLUSTER
void MainWindow::slotAnalyzeDxClusterSignal(QStringList ql)
void MainWindow::slotAnalyzeDxClusterSignal(DXSpot _spot)
{
//qDebug() << "MainWindow::slotAnalyzeDxClusterSignal: 1: " << ql.at(0) <<"/1: " << ql.at(1) << "/2: " << ql.at(2) ;
logEvent(Q_FUNC_INFO, "Start", Debug);
QStringList qls;
int _entity = world->getQRZARRLId(ql.at(0));
qls.clear();
QString _mode = "-1";
EntityStatus _entityStatus;
_entityStatus.entityId = world->getQRZARRLId(_spot.dxcall);
if (!manageMode)
{
_mode = "-1";
_entityStatus.modeId = -1;
}
double freq = ql.at(1).toDouble()/1000;
if (ql.length()==3)
if (_spot.clickStatus == SingleClick)
{
if ((ql.at(2)) == "double")
{
clusterSpotToLog(ql.at(0), ql.at(1));
}
else if ((ql.at(2)) == "selected")
{
infoLabel2->setText(world->getEntityName(_entity));
infoWidget->showEntityInfo( _entity );
infoLabel2->setText(world->getEntityName(_entityStatus.entityId));
infoWidget->showEntityInfo(_entityStatus.entityId );
// Becareful, he Frecuency arrives in KHz instead of bandid!!
// db.getBandFromFreq expects a MHz!
//(ql.at(1)).toDouble()
qls << QString::number(_entity) << QString::number(dataProxy->getBandIdFromFreq((freq))) << _mode << QString::number(currentLog);
// We use a mode = -1 because we don't know the mode info from the DXCluster spot
// Becareful, he Frecuency arrives in KHz instead of bandid!!
// db.getBandFromFreq expects a MHz!
//(ql.at(1)).toDouble()
_entityStatus.bandId = dataProxy->getBandIdFromFreq((_spot.freq.toDouble()));
//qls << QRZ << BandId << ModeId << lognumber;
showStatusOfDXCC(_entityStatus);
}
else if (_spot.clickStatus == DoubleClick)
{
clusterSpotToLog(_spot.dxcall, _spot.freq.toQString());
// TODO: Check if we can know the mode and replace the "-1" in previous sentence
//qls << QRZ << BandId << ModeId << lognumber;
showStatusOfDXCC(qls);
}
}
//_qs << Entity << BandId << ModeId << lognumber;
int statusI = awards->getDXStatus (qls);
int statusI = awards->getDXStatus (_entityStatus);
if (util->isValidCall(ql.at(0), true))
dxClusterAssistant->newDXClusterSpot(ql.at(0), freq, awards->getQSOStatus(statusI));
proposedQSOs pQSO;
//else
//{ // Signal was not properly emited
//}
pQSO.status = awards->getQSOStatus(statusI);
if (util->isValidCall(_spot.dxcall, true))
{
pQSO.call = _spot.dxcall;
dxClusterAssistant->newDXClusterSpot(pQSO);
}
logEvent(Q_FUNC_INFO, "END", Debug);
}
void MainWindow::slotDXClusterSpotArrived(const QString _dxCall, const double _freq)
void MainWindow::slotDXClusterSpotArrived(const QString _dxCall, Frequency _freq)
{
qDebug() << Q_FUNC_INFO << ": " << _dxCall;
qDebug() << Q_FUNC_INFO << ": " << QString::number(_freq);
qDebug() << Q_FUNC_INFO << ": " << _freq.toQString();
//(void)_dxCall;
//(void)_freq;
if (util->isValidCall(_dxCall, true))
{
proposedQSOs pQSO;
pQSO.call = _dxCall;
pQSO.status = ATNO;
pQSO.freq = _freq;
dxClusterAssistant->newDXClusterSpot(pQSO);
qDebug() << Q_FUNC_INFO << ": Calling assistant with DXCall Valid: " << _dxCall;
qDebug() << Q_FUNC_INFO << ": Calling assistant with Freq: " << QString::number(_freq);
dxClusterAssistant->newDXClusterSpot(_dxCall, _freq, ATNO);
qDebug() << Q_FUNC_INFO << ": Calling assistant with Freq: " << _freq.toQString();
//dxClusterAssistant->newDXClusterSpot(_dxCall, ATNO, _freq.toDouble());
}
else

View File

@ -45,6 +45,7 @@
#include "locator.h"
#include "dxcluster/dxcluster.h"
#include "dxcluster/dxclusterassistant.h"
#include "frequency.h"
#include "awards.h"
#include "inputwidgets/mainwindowsattab.h"
#include "inputwidgets/mainwindowmydatatab.h"
@ -260,8 +261,8 @@ private slots:
//SEARCH
// CLUSTER
void slotAnalyzeDxClusterSignal(const QStringList _qs);
void slotDXClusterSpotArrived(const QString _dxCall, const double _freq);
void slotAnalyzeDxClusterSignal(DXSpot _spot);
void slotDXClusterSpotArrived(const QString _dxCall, Frequency _freq);
// CLUSTER
//CLUBLOG
@ -403,7 +404,7 @@ private:
//void checkIfWorkedB4(const QString &_qrz);
//bool checkContest();
void showStatusOfDXCC(const QStringList _qs);
void showStatusOfDXCC(EntityStatus _entityStatus);
void showDXMarathonNeeded(const int _dxcc, const int _cqz, const int _year, const int _log);
bool createConnection();

View File

@ -199,22 +199,13 @@ QVariant SearchModel::data( const QModelIndex &index, int role ) const
{
if ( index.column() == 2 )
{
//QString _qrz = data(index, Qt::DisplayRole).toString();
//From Search QSO to QSL: q << _call << bandid << _mode << QString::number(currentLog);
EntityStatus _entityStatus;
_entityStatus.entityId = index.siblingAtColumn(dxcc).data().toInt();
_entityStatus.bandId = index.siblingAtColumn(bandid).data().toInt();
_entityStatus.modeId = index.siblingAtColumn(modeid).data().toInt();
_entityStatus.log = index.siblingAtColumn(logn).data().toInt();
QString _dxcc = index.siblingAtColumn(dxcc).data().toString();
QString _bandid = index.siblingAtColumn(bandid).data().toString();
QString _modeid = index.siblingAtColumn(modeid).data().toString();
QString _log = index.siblingAtColumn(logn).data().toString();
QStringList qs;
qs.clear();
qs << _dxcc << QString::number(dataProxy->getIdFromBandName(_bandid)) << "-1" << _log ;
//spotBand = QString::number(world->getBandIdFromFreq( dxFrequency ) );
//qs << QString::number(dxEntity) << spotBand << "-1" << QString::number(currentLog) ;
return QVariant( award->getQRZDXStatusColor(qs) );
return QVariant( award->getQRZDXStatusColor(_entityStatus) );
// return QVariant( QColor( Qt::red ) );
}
return QVariant( QColor( Qt::black ) );

View File

@ -45,6 +45,7 @@ HEADERS += ../../src/setupdialog.h \
../../src/downloadcty.h \
../../src/dxcluster/dxcluster.h \
../../src/dxcluster/dxclusterassistant.h \
../../src/frequency.h \
../../src/dxccstatuswidget.h \
../../src/elogqrzlog.h \
../../src/eqslutilities.h \
@ -141,6 +142,7 @@ SOURCES += tst_main.cpp \
../../src/dxcluster/dxcluster.cpp \
../../src/dxcluster/dxclusterassistant.cpp \
../../src/dxccstatuswidget.cpp \
../../src/frequency.cpp \
../../src/elogqrzlog.cpp \
../../src/eqslutilities.cpp \
../../src/hamlibclass.cpp \

View File

@ -42,6 +42,7 @@
#include "../../src/locator.h"
#include "../../src/dxcluster/dxcluster.h"
#include "../../src/dxcluster/dxclusterassistant.h"
#include "../../src/frequency.h"
#include "../../src/awards.h"
#include "../../src/awarddxmarathon.h"
#include "../../src/inputwidgets/mainwindowsattab.h"

View File

@ -44,6 +44,7 @@ HEADERS += \
../../src/locator.h \
../../src/dxcluster/dxcluster.h \
../../src/dxcluster/dxclusterassistant.h \
../../src/frequency.h \
../../src/awards.h \
../../src/awarddxmarathon.h \
../../src/inputwidgets/mainwindowsattab.h \
@ -116,6 +117,7 @@ SOURCES += tst_mainwindow.cpp \
../../src/locator.cpp \
../../src/dxcluster/dxcluster.cpp \
../../src/dxcluster/dxclusterassistant.cpp \
../../src/frequency.cpp \
../../src/awards.cpp \
../../src/awarddxmarathon.cpp \
../../src/inputwidgets/mainwindowsattab.cpp \