mirror of
https://github.com/ea4k/klog.git
synced 2024-09-21 10:28:06 +00:00
DXCluster Assistant working
This commit is contained in:
parent
7db76cbc6e
commit
9527565ec4
@ -413,6 +413,7 @@ int DataProxy_SQLite::getBandIdFromFreq(const double _n)
|
||||
{
|
||||
//Freq should be in MHz
|
||||
logEvent (Q_FUNC_INFO, "Start", Debug);
|
||||
qDebug() << Q_FUNC_INFO << ": " << QString::number(_n);
|
||||
bool sqlOk = false;
|
||||
QString queryString = QString("SELECT id FROM band WHERE lower <= :freq and upper >= :freq");
|
||||
|
||||
|
@ -190,11 +190,10 @@ void DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetIt
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
DXSpot spot = readItem(((item->data(0)).toString()).simplified());
|
||||
if (!spot.valid)
|
||||
DXSpot spot = readItem(((item->data(0)).toString()).simplified());
|
||||
if (!spot.isValid())
|
||||
return;
|
||||
|
||||
spot.clickStatus = DoubleClick;
|
||||
spot.setClickStatus(DoubleClick);
|
||||
emit dxspotclicked(spot);
|
||||
}
|
||||
|
||||
@ -329,79 +328,81 @@ void DXClusterWidget::setCurrentLog(const int _log)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DXClusterWidget::slotClusterDataArrived()
|
||||
{
|
||||
//qDebug() << Q_FUNC_INFO;
|
||||
//qDebug() << Q_FUNC_INFO;
|
||||
//QStringList qs;
|
||||
QString dxClusterString;
|
||||
QString spotBand = "-1";
|
||||
|
||||
//QString spotter;
|
||||
EntityStatus _entityStatus;
|
||||
while ( tcpSocket->canReadLine() )
|
||||
dxClusterString = tcpSocket->readAll();
|
||||
|
||||
//qDebug() << Q_FUNC_INFO << " Line: " << dxClusterString;
|
||||
dxClusterString = dxClusterString.trimmed();
|
||||
//qDebug() << Q_FUNC_INFO << " Line-0.5: " << dxClusterString;
|
||||
dxClusterString = dxClusterString.simplified();
|
||||
//qDebug() << Q_FUNC_INFO << " Line-1: " << dxClusterString;
|
||||
|
||||
if (dxClusterString.endsWith("\x07\x07\r\n"))
|
||||
dxClusterString = dxClusterString.remove("\x07\x07\r\n");
|
||||
//qDebug() << Q_FUNC_INFO << " Line-2: " << dxClusterString;
|
||||
|
||||
if (dxClusterString.endsWith("\u0007\u0007\r\n"))
|
||||
dxClusterString = dxClusterString.remove("\u0007\u0007\r\n");
|
||||
//qDebug() << Q_FUNC_INFO << " Line-3: " << dxClusterString;
|
||||
|
||||
saveSpot(dxClusterString);
|
||||
//qDebug() << Q_FUNC_INFO << " - While 10";
|
||||
DXSpot spot = readItem(dxClusterString);
|
||||
//qDebug() << Q_FUNC_INFO << " - While 11";
|
||||
|
||||
_entityStatus.entityId = -1;
|
||||
|
||||
if (spot.isValid())
|
||||
{
|
||||
_entityStatus.entityId = -1;
|
||||
//qDebug() << Q_FUNC_INFO << " - Spot is Valid";
|
||||
_entityStatus.entityId = world->getQRZARRLId(spot.getDxCall());
|
||||
spotBand = QString::number(dataProxy->getBandIdFromFreq(spot.getFrequency().toDouble()) );
|
||||
_entityStatus.bandId = spotBand.toInt();
|
||||
|
||||
dxClusterString = tcpSocket->readLine();
|
||||
dxClusterString = dxClusterString.trimmed();
|
||||
// Remove BELL-string if exists
|
||||
dxClusterString = dxClusterString.remove("\a");
|
||||
//qDebug() << Q_FUNC_INFO << ": Line: " << dxClusterString;
|
||||
saveSpot(dxClusterString);
|
||||
DXSpot spot = readItem(dxClusterString);
|
||||
|
||||
if (spot.valid)
|
||||
dxSpotColor = awards->getQRZDXStatusColor(_entityStatus);
|
||||
if (showDxMarathon)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << " - Spot IS valid";
|
||||
qDebug() << Q_FUNC_INFO << " - Spot Freq: " << spot.freq.toQString();
|
||||
|
||||
_entityStatus.entityId = world->getQRZARRLId(spot.dxcall);
|
||||
spotBand = QString::number(dataProxy->getBandIdFromFreq(spot.freq.toDouble()) );
|
||||
|
||||
dxSpotColor = awards->getQRZDXStatusColor(_entityStatus);
|
||||
if (showDxMarathon)
|
||||
if (awards->isDXMarathonNeed(_entityStatus.entityId, world->getQRZCqz(spot.getDxCall()), QDateTime::currentDateTime().date().year(), currentLog))
|
||||
{
|
||||
if (awards->isDXMarathonNeed(_entityStatus.entityId, world->getQRZCqz(spot.dxcall), QDateTime::currentDateTime().date().year(), currentLog))
|
||||
{
|
||||
dxClusterString = dxClusterString + " ### Needed for DXMarathon - " + QString::number(QDateTime::currentDateTime().date().year()) + " ###";
|
||||
}
|
||||
dxClusterString = dxClusterString + " ### Needed for DXMarathon - " + QString::number(QDateTime::currentDateTime().date().year()) + " ###";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << " - Spot IS NOT valid";
|
||||
dxSpotColor = awards->getDefaultColor();
|
||||
}
|
||||
|
||||
//TODO: Change the "-1" by the mode
|
||||
|
||||
_entityStatus.bandId = spotBand.toInt();
|
||||
emit dxspotArrived(spot);
|
||||
_entityStatus.modeId = -1;
|
||||
if (!checkIfNeedsToBePrinted(_entityStatus))
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << " - Not to be printed!: " << spot.dxcall;
|
||||
//qDebug() << Q_FUNC_INFO << " - Not to be printed!: " << spot.getDxCall();
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setForeground(QBrush(dxSpotColor));
|
||||
item->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||
item->setText(dxClusterString);
|
||||
dxClusterListWidget->insertItem(0,item);
|
||||
|
||||
if (!spot.valid)
|
||||
return;
|
||||
|
||||
qDebug() << Q_FUNC_INFO << " - DXCall: " << spot.dxcall;
|
||||
qDebug() << Q_FUNC_INFO << " - Freq-string: " << spot.freq.toQString();
|
||||
qDebug() << Q_FUNC_INFO << " - Freq-double: " << QString::number(spot.freq.toDouble());
|
||||
qDebug() << Q_FUNC_INFO << " - Everything OK emitting...";
|
||||
emit dxspotArrived(spot.dxcall, spot.freq.toDouble());
|
||||
}
|
||||
else
|
||||
{
|
||||
//qDebug() << Q_FUNC_INFO << " - Spot is NOT Valid";
|
||||
dxSpotColor = awards->getDefaultColor();
|
||||
}
|
||||
|
||||
qDebug() << Q_FUNC_INFO << " - END";
|
||||
//qDebug() << Q_FUNC_INFO << " - While 70";
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setForeground(QBrush(dxSpotColor));
|
||||
item->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||
item->setText(dxClusterString);
|
||||
dxClusterListWidget->insertItem(0,item);
|
||||
|
||||
//qDebug() << Q_FUNC_INFO << " - END";
|
||||
}
|
||||
|
||||
|
||||
QString DXClusterWidget::cleanSpotter(const QString _call)
|
||||
{
|
||||
QString spotter = _call;
|
||||
@ -422,7 +423,7 @@ void DXClusterWidget::slotClusterSocketConnected()
|
||||
// dxClusterSpotItem * item = new dxClusterSpotItem(dxclusterListWidget, i18n("Connected to server"), awards->getDefaultColor());
|
||||
dxClusterConnected = true;
|
||||
inputCommand->setFocus(Qt::OtherFocusReason);
|
||||
|
||||
qDebug() << Q_FUNC_INFO << " - myQRZ: " << myQrz;
|
||||
if (( dxClusterConnected ) && (!dxClusterAlreadyConnected) ){
|
||||
bool ok;
|
||||
QString callsignText;
|
||||
@ -552,7 +553,7 @@ void DXClusterWidget::slotClusterDXClusterWidgetItemSelected()
|
||||
QListWidgetItem * item = dxClusterListWidget->currentItem();
|
||||
|
||||
DXSpot spot = readItem(((item->data(0)).toString()).simplified());
|
||||
if (spot.valid)
|
||||
if (spot.isValid())
|
||||
emit dxspotclicked(spot);
|
||||
}
|
||||
|
||||
@ -569,9 +570,9 @@ void DXClusterWidget::slotClusterDXClusterWidgetItemEntered( QListWidgetItem * i
|
||||
if (item)
|
||||
{
|
||||
DXSpot spot = readItem(((item->data(0)).toString()).simplified());
|
||||
if (spot.valid)
|
||||
if (spot.isValid())
|
||||
{
|
||||
tip = world->getQRZEntityName(spot.dxcall);
|
||||
tip = world->getQRZEntityName(spot.getDxCall());
|
||||
item->setToolTip(tip);
|
||||
}
|
||||
}
|
||||
@ -586,58 +587,79 @@ bool DXClusterWidget::isConnected()
|
||||
|
||||
DXSpot DXClusterWidget::readItem(const QString _stringSpot)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
//qDebug() << Q_FUNC_INFO << _stringSpot;
|
||||
|
||||
DXSpot spot = DXSpot();
|
||||
spot.valid = false;
|
||||
spot.clear();
|
||||
|
||||
if (_stringSpot.length()<5)
|
||||
return spot;
|
||||
//Frequency _fr;
|
||||
|
||||
//dxClusterString = ((item->data(0)).toString()).simplified();
|
||||
|
||||
//qDebug() << Q_FUNC_INFO << "05";
|
||||
QString dxClusterString = _stringSpot;
|
||||
QStringList fields;
|
||||
fields.clear();
|
||||
fields << dxClusterString.split(" ");
|
||||
|
||||
//qDebug() << Q_FUNC_INFO << "10";
|
||||
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";
|
||||
//qDebug() << Q_FUNC_INFO << ": 0: " << fields.at(0);
|
||||
//qDebug() << Q_FUNC_INFO << ": 1: " << fields.at(1);
|
||||
//qDebug() << Q_FUNC_INFO << ": 2: " << fields.at(2);
|
||||
qDebug() << Q_FUNC_INFO << ": 3: " << fields.at(3);
|
||||
//qDebug() << Q_FUNC_INFO << ": 4: " << fields.at(4);
|
||||
//qDebug() << Q_FUNC_INFO << ": 5: " << fields.at(5);
|
||||
spot.spotter = fields.at(2);
|
||||
spot.freq.fromQString((fields.at(3)), KHz);
|
||||
spot.dxcall = fields.at(4);
|
||||
spot.valid = true;
|
||||
qDebug() << Q_FUNC_INFO << ": Identified: Freq1: " << spot.freq.toQString();
|
||||
//qDebug() << Q_FUNC_INFO << ": Identified: DX de";
|
||||
//qDebug() << Q_FUNC_INFO << ": 0: " << fields.at(0);
|
||||
//qDebug() << Q_FUNC_INFO << ": 1: " << fields.at(1);
|
||||
//qDebug() << Q_FUNC_INFO << ": 2: " << fields.at(2);
|
||||
//qDebug() << Q_FUNC_INFO << ": 3: " << fields.at(3);
|
||||
//qDebug() << Q_FUNC_INFO << ": 4: " << fields.at(4);
|
||||
//qDebug() << Q_FUNC_INFO << ": 5: " << fields.at(5);
|
||||
spot.setSpotter(fields.at(2));
|
||||
//qDebug() << Q_FUNC_INFO << "11";
|
||||
Frequency freq;
|
||||
freq.fromQString((fields.at(3)), KHz);
|
||||
spot.setFrequency(freq);
|
||||
//qDebug() << Q_FUNC_INFO << "12";
|
||||
spot.setDXCall(fields.at(4));
|
||||
//qDebug() << Q_FUNC_INFO << "13";
|
||||
spot.setValid(true);
|
||||
//qDebug() << Q_FUNC_INFO << "14";
|
||||
//qDebug() << Q_FUNC_INFO << ": Identified: Freq1: " << spot.getFrequency().toQString();
|
||||
}
|
||||
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;
|
||||
//qDebug() << Q_FUNC_INFO << ": Identified: ENDS with >";
|
||||
//qDebug() << Q_FUNC_INFO << "20";
|
||||
//qDebug() << Q_FUNC_INFO << " - Spotter: " << fields.last().removeLast();
|
||||
spot.setSpotter(fields.last());
|
||||
//qDebug() << Q_FUNC_INFO << " - Freq: " << fields.at(0);
|
||||
Frequency freq;
|
||||
//qDebug() << Q_FUNC_INFO << "21";
|
||||
if (!freq.fromQString((fields.at(0)), KHz))
|
||||
return spot;
|
||||
//qDebug() << Q_FUNC_INFO << "22";
|
||||
//qDebug() << Q_FUNC_INFO << " - Freq imported ";
|
||||
if (!freq.isValid())
|
||||
return spot;
|
||||
//qDebug() << Q_FUNC_INFO << "23";
|
||||
//qDebug() << Q_FUNC_INFO << " - Freq looks valid";
|
||||
spot.setFrequency(freq);
|
||||
|
||||
qDebug() << Q_FUNC_INFO << ": Identified: Freq2: " << spot.freq.toQString();
|
||||
//qDebug() << Q_FUNC_INFO << " - DXCall: " << fields.at(1);
|
||||
spot.setDXCall(fields.at(1));
|
||||
//qDebug() << Q_FUNC_INFO << "24";
|
||||
spot.setValid(true);
|
||||
//qDebug() << Q_FUNC_INFO << ": Identified: Freq2: " << spot.getFrequency().toQString();
|
||||
}
|
||||
else if ((fields.at(0) == "To" ) && (fields.at(1) == "ALL" ))
|
||||
{ // To ALL Comment
|
||||
//qDebug() << Q_FUNC_INFO << ": Identified: To ALL";
|
||||
spot.valid = false;
|
||||
//qDebug() << Q_FUNC_INFO << ": Identified: To ALL";
|
||||
//qDebug() << Q_FUNC_INFO << "30";
|
||||
spot.setValid(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//qDebug() << Q_FUNC_INFO << ": Identified: Default";
|
||||
spot.valid = false;
|
||||
//qDebug() << Q_FUNC_INFO << ": Identified: just Text: " << _stringSpot;
|
||||
//qDebug() << Q_FUNC_INFO << "40";
|
||||
spot.setValid(false);
|
||||
}
|
||||
|
||||
//qDebug() << Q_FUNC_INFO << "100";
|
||||
//qDebug() << Q_FUNC_INFO << " - END";
|
||||
return spot;
|
||||
}
|
||||
|
||||
@ -698,7 +720,7 @@ void DXClusterWidget::slotRightButton(const QPoint& pos)
|
||||
QListWidgetItem * item = dxClusterListWidget->currentItem();
|
||||
|
||||
DXSpot spot = readItem(((item->data(0)).toString()).simplified());
|
||||
if ((spot.valid) && (spot.clickStatus == RightClick) )
|
||||
if ((spot.isValid()) && (spot.getClickStatus() == RightClick) )
|
||||
{
|
||||
rightButtonFromLogMenu(spot);
|
||||
}
|
||||
@ -708,7 +730,8 @@ void DXClusterWidget::rightButtonFromLogMenu(const DXSpot &_spot)
|
||||
{
|
||||
// This function creates the context menu
|
||||
//qDebug() << Q_FUNC_INFO;
|
||||
checkQRZCOMFromLogAct->setData (_spot.dxcall);
|
||||
DXSpot spot = _spot;
|
||||
checkQRZCOMFromLogAct->setData (spot.getDxCall());
|
||||
QMenu menu(this);
|
||||
menu.addAction(checkQRZCOMFromLogAct);
|
||||
menu.exec(QCursor::pos());
|
||||
|
@ -32,6 +32,7 @@ email : jaime@robles.es
|
||||
#include <QTcpSocket>
|
||||
#include <QObject>
|
||||
#include "../awards.h"
|
||||
#include "dxspot.h"
|
||||
#include "../world.h"
|
||||
#include "../utilities.h"
|
||||
#include "../dataproxy_sqlite.h"
|
||||
@ -40,28 +41,8 @@ email : jaime@robles.es
|
||||
|
||||
class QWidget;
|
||||
class QTcpSocket;
|
||||
|
||||
class Frequency;
|
||||
|
||||
struct DXSpot { // Used to pass a list of data from Awards to dxccstatuswidget
|
||||
QString dxcall;
|
||||
Frequency freq;
|
||||
QString spotter;
|
||||
QString comment;
|
||||
QDateTime dateTime;
|
||||
MouseClicks clickStatus;
|
||||
bool valid;
|
||||
DXSpot() {valid = false;}
|
||||
DXSpot(const DXSpot& other) {
|
||||
dxcall = other.dxcall;
|
||||
freq = other.freq; // Might need a copy constructor for Frequency as well
|
||||
spotter = other.spotter;
|
||||
comment = other.comment;
|
||||
dateTime = other.dateTime;
|
||||
clickStatus = other.clickStatus;
|
||||
valid = other.valid;
|
||||
}
|
||||
};
|
||||
|
||||
class DXClusterWidget : public QWidget
|
||||
{
|
||||
@ -103,7 +84,9 @@ private slots:
|
||||
|
||||
signals:
|
||||
void dxspotclicked(const DXSpot &_dxSpot); // DXSpotCall, DX-Freq, doubleClicked
|
||||
void dxspotArrived(const QString &_call, double _f);
|
||||
//void dxspotArrived(const QString &_call, double _f);
|
||||
void dxspotArrived(const QString &_call, const Frequency &_f);
|
||||
void dxspotArrived(const DXSpot &_sp);
|
||||
//void dxspot(const QString &_spot); // The text string to be saved
|
||||
|
||||
private:
|
||||
@ -119,7 +102,7 @@ private:
|
||||
QString cleanSpotter(const QString _call);
|
||||
void addData(); //TO BE DELETED, JUST FOR TESTING PURPOSES
|
||||
|
||||
QTcpSocket *tcpSocket;
|
||||
QTcpSocket *tcpSocket = nullptr;
|
||||
QListWidget *dxClusterListWidget;
|
||||
QLineEdit *inputCommand;
|
||||
QPushButton *sendButton;
|
||||
|
@ -70,7 +70,7 @@ bool DXClusterAssistant::createUI()
|
||||
return true;
|
||||
|
||||
//connect(cancelButton, SIGNAL(clicked()), this, SLOT(slotCancelPushButtonClicked() ) );
|
||||
//qDebug() << Q_FUNC_INFO << " - END";
|
||||
//qDebug() << Q_FUNC_INFO << " - END";
|
||||
}
|
||||
|
||||
void DXClusterAssistant::newDXClusterSpot(proposedQSOs _q)
|
||||
@ -140,19 +140,20 @@ void DXClusterAssistant::addCall()
|
||||
//qDebug() << Q_FUNC_INFO << " - Start";
|
||||
tableWidget->clearContents();
|
||||
tableWidget->setRowCount(0);
|
||||
//qDebug() << Q_FUNC_INFO << ": Lenght of list: " << QString::number(list.count());
|
||||
|
||||
proposedQSOs aux;
|
||||
|
||||
foreach(aux, list)
|
||||
{
|
||||
//qDebug() << Q_FUNC_INFO << "Call: " << aux.call;
|
||||
QTableWidgetItem *newItemCall = new QTableWidgetItem(aux.call, QTableWidgetItem::Type);
|
||||
//QTableWidgetItem *newItemFreq = new QTableWidgetItem(aux.freq().toQString(), 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);
|
||||
}
|
||||
//qDebug() << Q_FUNC_INFO << " - END";
|
||||
|
@ -45,7 +45,7 @@ class Frequency;
|
||||
struct proposedQSOs
|
||||
{ // Used to pass a list of data from Awards to dxccstatuswidget
|
||||
QString call;
|
||||
//Frequency freq;
|
||||
Frequency freq;
|
||||
int priority;
|
||||
QSOStatus status;
|
||||
};
|
||||
|
@ -29,17 +29,20 @@ DXSpot::DXSpot()
|
||||
{
|
||||
valid = false;
|
||||
}
|
||||
|
||||
/*
|
||||
DXSpot::DXSpot(DXSpot *_other)
|
||||
{
|
||||
dxcall = _other->dxcall;
|
||||
spotter = _other->spotter;
|
||||
freq = _other->freq; // Might need a copy constructor for Frequency as well
|
||||
if (_other->freq.isValid())
|
||||
freq = _other->freq; // Might need a copy constructor for Frequency as well
|
||||
comment = _other->comment;
|
||||
dateTime = _other->dateTime;
|
||||
if (_other->dateTime.isValid())
|
||||
dateTime = _other->dateTime;
|
||||
clickStatus = _other->clickStatus;
|
||||
valid = _other->valid;
|
||||
}
|
||||
*/
|
||||
|
||||
DXSpot::~DXSpot(){}
|
||||
|
||||
@ -59,7 +62,8 @@ void DXSpot::operator=(DXSpot const &_other)
|
||||
freq = _other.freq; // Might need a copy constructor for Frequency as well
|
||||
spotter = _other.spotter;
|
||||
comment = _other.comment;
|
||||
dateTime = _other.dateTime;
|
||||
if (_other.dateTime.isValid())
|
||||
dateTime = _other.dateTime;
|
||||
clickStatus = _other.clickStatus;
|
||||
valid = _other.valid;
|
||||
}
|
||||
@ -68,7 +72,7 @@ void DXSpot::setValid(const bool _v){valid = _v;}
|
||||
bool DXSpot::isValid(){return valid;}
|
||||
|
||||
void DXSpot::setDXCall(const QString &_c){dxcall = _c;}
|
||||
QString DXSpot::getDxCall(){return dxcall;}
|
||||
QString DXSpot::getDxCall() {return dxcall;}
|
||||
|
||||
void DXSpot::setSpotter(const QString &_c){spotter = _c;}
|
||||
QString DXSpot::getSpotter(){return spotter;}
|
||||
@ -80,14 +84,16 @@ void DXSpot::setDateTime(const QDateTime &d){if (d.isValid()) dateTime = d;}
|
||||
QDateTime DXSpot::getDateTime(){ return dateTime;}
|
||||
|
||||
void DXSpot::setClickStatus(const MouseClicks &_s ){clickStatus = _s;}
|
||||
bool DXSpot::getClickStatus(){return clickStatus;}
|
||||
MouseClicks DXSpot::getClickStatus(){return clickStatus;}
|
||||
|
||||
void DXSpot::setFrequency(Frequency f)
|
||||
{
|
||||
if (f.isValid())
|
||||
freq = f;
|
||||
}
|
||||
|
||||
Frequency DXSpot::getFrequency()
|
||||
{
|
||||
return &freq;
|
||||
// Return the frequency stored in the object
|
||||
return freq;
|
||||
}
|
||||
|
@ -40,16 +40,18 @@ class DXSpot : public QObject
|
||||
|
||||
public:
|
||||
DXSpot();
|
||||
DXSpot(DXSpot *_other);
|
||||
//DXSpot(DXSpot *_other);
|
||||
DXSpot(const DXSpot& other) : dxcall(other.dxcall), freq(other.freq), spotter(other.spotter), comment(other.comment), dateTime(other.dateTime), clickStatus(other.clickStatus), valid(other.valid) {};
|
||||
|
||||
~DXSpot();
|
||||
void operator=(DXSpot const &_other);
|
||||
void clear();
|
||||
|
||||
void setValid(const bool _v);
|
||||
bool isValid();
|
||||
bool isValid ();
|
||||
|
||||
void setDXCall(const QString &c);
|
||||
QString getDxCall();
|
||||
QString getDxCall ();
|
||||
void setSpotter(const QString &c);
|
||||
QString getSpotter();
|
||||
|
||||
@ -60,7 +62,7 @@ public:
|
||||
QDateTime getDateTime();
|
||||
|
||||
void setClickStatus(const MouseClicks &_s );
|
||||
bool getClickStatus();
|
||||
MouseClicks getClickStatus();
|
||||
|
||||
void setFrequency(Frequency f);
|
||||
Frequency getFrequency();
|
||||
|
@ -28,8 +28,8 @@
|
||||
|
||||
Frequency::Frequency(){}
|
||||
|
||||
Frequency::Frequency(Frequency *f){
|
||||
freq = f->freq;
|
||||
Frequency::Frequency(const Frequency &f){
|
||||
freq = f.freq;
|
||||
}
|
||||
|
||||
Frequency::Frequency(const double _f, FreqUnits _u)
|
||||
@ -53,11 +53,15 @@ bool Frequency::fromDouble(const double _f, FreqUnits _u)
|
||||
|
||||
bool Frequency::fromQString(const QString &_f, FreqUnits _u)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << ": " << _f;
|
||||
bool ok;
|
||||
freq =_f.toDouble(&ok);
|
||||
qDebug() << Q_FUNC_INFO << " - freq: " << _f;
|
||||
if (!ok)
|
||||
return false;
|
||||
qDebug() << Q_FUNC_INFO << " - Trying to normalize...";
|
||||
freq = normalize(freq, _u);
|
||||
qDebug() << Q_FUNC_INFO << " - freqNormalized: " << _f;
|
||||
return isValid();
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,9 @@ class Frequency: public QObject
|
||||
friend class tst_Frequency;
|
||||
|
||||
public:
|
||||
//Frequency() : freq(0.0), bandInMHz(""), tolerance(0.0) {};
|
||||
Frequency();
|
||||
Frequency(Frequency *f);
|
||||
Frequency(const Frequency &f);
|
||||
Frequency(const double _f, FreqUnits _u = MHz);
|
||||
//Frequency(const QString &_parentName);
|
||||
//Frequency(const QString &_parentName, const Frequency &_f);
|
||||
|
@ -659,7 +659,7 @@ void MainWindow::createActionsCommon(){
|
||||
|
||||
//CLUSTER
|
||||
connect(dxClusterWidget, SIGNAL(dxspotclicked(DXSpot)), this, SLOT(slotAnalyzeDxClusterSignal(DXSpot) ) );
|
||||
connect(dxClusterWidget, SIGNAL(dxspotArrived(QString, double)), this, SLOT(slotDXClusterSpotArrived(QString, Frequency) ) );
|
||||
connect(dxClusterWidget, SIGNAL(dxspotArrived(DXSpot)), this, SLOT(slotDXClusterSpotArrived(DXSpot) ) );
|
||||
|
||||
// CLUBLOG
|
||||
connect (elogClublog, SIGNAL (showMessage(QString)), this, SLOT (slotElogClubLogShowMessage(QString)));
|
||||
@ -898,7 +898,7 @@ void MainWindow::setMainWindowTitle()
|
||||
{
|
||||
QString aux = dataProxy->getCommentsFromLog(currentLog);
|
||||
int numberOfQSOs = dataProxy->getHowManyQSOInLog (currentLog);
|
||||
//qDebug() << Q_FUNC_INFO << " - (comment): " << aux ;
|
||||
//qDebug() << Q_FUNC_INFO << " - (comment): " << aux ;
|
||||
QString msg;
|
||||
|
||||
if (mainQRZ == stationCallsign)
|
||||
@ -3246,7 +3246,7 @@ void MainWindow::slotSetupDialogFinished (const int _s)
|
||||
logWindow->createlogPanel(currentLog);
|
||||
//qDebug() << Q_FUNC_INFO << " - 012 - " << (QTime::currentTime()).toString ("HH:mm:ss");
|
||||
logEvent(Q_FUNC_INFO, "logmodel has been created-2", Debug);
|
||||
defineStationCallsign(stationCallsign);
|
||||
//defineStationCallsign(stationCallsign);
|
||||
//qDebug() << Q_FUNC_INFO << " - 013 - " << (QTime::currentTime()).toString ("HH:mm:ss");
|
||||
logEvent(Q_FUNC_INFO, "before db->reConnect", Debug);
|
||||
//qDebug() << "MainWindow::openSetup: before db->reConnect" ;
|
||||
@ -5285,20 +5285,21 @@ void MainWindow::slotFilePrint()
|
||||
|
||||
//DX-CLUSTER - DXCLUSTER
|
||||
|
||||
void MainWindow::slotAnalyzeDxClusterSignal(DXSpot _spot)
|
||||
void MainWindow::slotAnalyzeDxClusterSignal(const DXSpot &_spot)
|
||||
{
|
||||
//qDebug() << "MainWindow::slotAnalyzeDxClusterSignal: 1: " << ql.at(0) <<"/1: " << ql.at(1) << "/2: " << ql.at(2) ;
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
logEvent(Q_FUNC_INFO, "Start", Debug);
|
||||
|
||||
DXSpot sp = _spot;
|
||||
EntityStatus _entityStatus;
|
||||
_entityStatus.entityId = world->getQRZARRLId(_spot.dxcall);
|
||||
_entityStatus.entityId = world->getQRZARRLId(sp.getDxCall());
|
||||
|
||||
if (!manageMode)
|
||||
{
|
||||
_entityStatus.modeId = -1;
|
||||
}
|
||||
|
||||
if (_spot.clickStatus == SingleClick)
|
||||
if (sp.getClickStatus() == SingleClick)
|
||||
{
|
||||
infoLabel2->setText(world->getEntityName(_entityStatus.entityId));
|
||||
infoWidget->showEntityInfo(_entityStatus.entityId );
|
||||
@ -5306,13 +5307,13 @@ void MainWindow::slotAnalyzeDxClusterSignal(DXSpot _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()));
|
||||
_entityStatus.bandId = dataProxy->getBandIdFromFreq((sp.getFrequency().toDouble()));
|
||||
//qls << QRZ << BandId << ModeId << lognumber;
|
||||
showStatusOfDXCC(_entityStatus);
|
||||
}
|
||||
else if (_spot.clickStatus == DoubleClick)
|
||||
else if (sp.getClickStatus() == DoubleClick)
|
||||
{
|
||||
clusterSpotToLog(_spot.dxcall, _spot.freq.toQString());
|
||||
clusterSpotToLog(sp.getDxCall(), sp.getFrequency().toQString());
|
||||
|
||||
}
|
||||
|
||||
@ -5323,29 +5324,31 @@ void MainWindow::slotAnalyzeDxClusterSignal(DXSpot _spot)
|
||||
|
||||
pQSO.status = awards->getQSOStatus(statusI);
|
||||
|
||||
if (util->isValidCall(_spot.dxcall, true))
|
||||
if (util->isValidCall(sp.getDxCall(), true))
|
||||
{
|
||||
pQSO.call = _spot.dxcall;
|
||||
pQSO.call = sp.getDxCall();
|
||||
dxClusterAssistant->newDXClusterSpot(pQSO);
|
||||
}
|
||||
|
||||
logEvent(Q_FUNC_INFO, "END", Debug);
|
||||
}
|
||||
|
||||
void MainWindow::slotDXClusterSpotArrived(const QString _dxCall, const double _freq)
|
||||
void MainWindow::slotDXClusterSpotArrived(const DXSpot &_spot)
|
||||
{
|
||||
//qDebug() << Q_FUNC_INFO << ": " << _dxCall;
|
||||
//qDebug() << Q_FUNC_INFO << ": " << _freq.toQString();
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
//(void)_dxCall;
|
||||
//(void)_freq;
|
||||
|
||||
DXSpot sp = _spot;
|
||||
if (!sp.isValid())
|
||||
return;
|
||||
|
||||
if (util->isValidCall(_dxCall, true))
|
||||
if (util->isValidCall(sp.getDxCall(), true))
|
||||
{
|
||||
proposedQSOs pQSO;
|
||||
pQSO.call = _dxCall;
|
||||
pQSO.call = sp.getDxCall();
|
||||
pQSO.status = ATNO;
|
||||
//pQSO.freq = _freq;
|
||||
pQSO.freq = sp.getFrequency();
|
||||
dxClusterAssistant->newDXClusterSpot(pQSO);
|
||||
//qDebug() << Q_FUNC_INFO << ": Calling assistant with DXCall Valid: " << _dxCall;
|
||||
//qDebug() << Q_FUNC_INFO << ": Calling assistant with Freq: " << _freq.toQString();
|
||||
@ -5362,7 +5365,7 @@ void MainWindow::slotDXClusterSpotArrived(const QString _dxCall, const double _f
|
||||
return;
|
||||
}
|
||||
logEvent(Q_FUNC_INFO, "Start", Debug);
|
||||
QString dxGrid = world->getQRZLocator (_dxCall);
|
||||
QString dxGrid = world->getQRZLocator (sp.getDxCall());
|
||||
|
||||
Coordinate coord = locator->getLocatorCoordinate (dxGrid);
|
||||
//qDebug() << Q_FUNC_INFO << QString(" %1: Locator: %2 - (lat/lon)=>(%3/%4)").arg(_dxCall).arg(_dxGrid).arg(coord.lat).arg(coord.lon);
|
||||
@ -5445,33 +5448,31 @@ void MainWindow::updateQSLRecAndSent()
|
||||
//qDebug() << "MainWindow::updateQSLRecAndSent - END" ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::defineStationCallsign(const QString &_call)
|
||||
QString MainWindow::findStationCallsignToUse()
|
||||
{
|
||||
//qDebug() << "MainWindow::defineStationCallsign (currentLog): " << QString::number(currentLog) ;
|
||||
QString foundCall = dataProxy->getStationCallSignFromLog (currentLog);
|
||||
if (util->isValidCall(foundCall))
|
||||
return foundCall;
|
||||
|
||||
return mainQRZ;
|
||||
}
|
||||
|
||||
void MainWindow::defineStationCallsign()
|
||||
{
|
||||
|
||||
logEvent(Q_FUNC_INFO, "Start", Debug);
|
||||
if (util->isValidCall (_call))
|
||||
QString logQRZ = findStationCallsignToUse();
|
||||
qDebug() << Q_FUNC_INFO << ": StationCallsign: " << logQRZ;
|
||||
if (!util->isValidCall (logQRZ))
|
||||
{
|
||||
stationCallsign = _call;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{ // If no call is detected, qwe try to find it from the log
|
||||
QString logQRZ;
|
||||
logQRZ = dataProxy->getStationCallSignFromLog(currentLog);
|
||||
//qDebug() << "MainWindow::defineStationCallsign (logQrz): " << logQRZ ;
|
||||
stationCallsign = logQRZ;
|
||||
|
||||
if (util->isValidCall(logQRZ))
|
||||
{
|
||||
//qDebug() << "MainWindow::defineStationCallsign TRUE " ;
|
||||
stationCallsign = logQRZ;
|
||||
}
|
||||
}
|
||||
|
||||
//qDebug() << "MainWindow::defineStationCallsign: " << stationCallsign ;
|
||||
qDebug() << Q_FUNC_INFO << ": " << stationCallsign ;
|
||||
|
||||
filemanager->setStationCallSign(stationCallsign);
|
||||
//qDebug() << "MainWindow::defineStationCallsign: AFTER" ;
|
||||
//qDebug() << Q_FUNC_INFO << ": AFTER" ;
|
||||
myDataTabWidget->setData(stationCallsign, operatorQRZ, myDataTabWidget->getMyLocator());
|
||||
dxccStatusWidget->setMyLocator(myDataTabWidget->getMyLocator());
|
||||
searchWidget->setStationCallsign(stationCallsign);
|
||||
@ -5479,10 +5480,11 @@ void MainWindow::defineStationCallsign(const QString &_call)
|
||||
{
|
||||
lotwUtilities->setStationCallSign(stationCallsign);
|
||||
}
|
||||
dxClusterWidget->setMyQRZ(stationCallsign);
|
||||
adifLoTWExportWidget->setDefaultStationCallsign(stationCallsign);
|
||||
|
||||
logEvent(Q_FUNC_INFO, "END", Debug);
|
||||
//qDebug() << "MainWindow::defineStationCallsign: " << stationCallsign << " - END" ;
|
||||
//qDebug() << Q_FUNC_INFO << ": " << stationCallsign << " - END" ;
|
||||
}
|
||||
|
||||
void MainWindow::slotSetPropModeFromSat(const QString &_p, bool _keep)
|
||||
@ -6494,16 +6496,20 @@ bool MainWindow::loadSettings()
|
||||
//qDebug() << Q_FUNC_INFO << QString("softwareversion: %1 / version: %2").arg(softwareVersion).arg(value);
|
||||
itIsANewversion = true;
|
||||
}
|
||||
selectTheLog(currentLog = settings.value ("SelectedLog").toInt());
|
||||
currentLog = settings.value ("SelectedLog").toInt();
|
||||
|
||||
setWindowSize (settings.value ("MainWindowSize").toSize ());
|
||||
|
||||
//qDebug() << Q_FUNC_INFO << " - 20 - user";
|
||||
settings.beginGroup ("UserData");
|
||||
value = settings.value ("CallSign").toString ();
|
||||
value = settings.value ("Callsign").toString ();
|
||||
qDebug() << Q_FUNC_INFO << " stationCallSign: " << value;
|
||||
if (util->isValidCall(value))
|
||||
{
|
||||
mainQRZ = value;
|
||||
}
|
||||
selectTheLog(currentLog); // We Select the log after the mainQRZ is defined
|
||||
|
||||
value = settings.value ("StationLocator").toString ();
|
||||
if ( locator->isValidLocator(value) )
|
||||
{
|
||||
@ -6708,8 +6714,8 @@ void MainWindow::selectTheLog(const int _i)
|
||||
}
|
||||
}
|
||||
}
|
||||
stationCallsign = dataProxy->getStationCallSignFromLog (currentLog);
|
||||
defineStationCallsign (stationCallsign);
|
||||
|
||||
defineStationCallsign ();
|
||||
dxClusterWidget->setCurrentLog(currentLog);
|
||||
dxccStatusWidget->setCurrentLog(currentLog);
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "dataproxy_sqlite.h"
|
||||
#include "locator.h"
|
||||
#include "dxcluster/dxcluster.h"
|
||||
#include "dxcluster/dxspot.h"
|
||||
#include "dxcluster/dxclusterassistant.h"
|
||||
#include "frequency.h"
|
||||
#include "awards.h"
|
||||
@ -261,8 +262,8 @@ private slots:
|
||||
//SEARCH
|
||||
|
||||
// CLUSTER
|
||||
void slotAnalyzeDxClusterSignal(DXSpot _spot);
|
||||
void slotDXClusterSpotArrived(const QString _dxCall, const double _freq);
|
||||
void slotAnalyzeDxClusterSignal(const DXSpot &_spot);
|
||||
void slotDXClusterSpotArrived(const DXSpot &_spot);
|
||||
|
||||
// CLUSTER
|
||||
//CLUBLOG
|
||||
@ -414,7 +415,8 @@ private:
|
||||
bool loadSettings();
|
||||
bool applySettings();
|
||||
void selectTheLog(const int _i); // Receives a log number from loadSettings and setups all about the logN
|
||||
void defineStationCallsign(const QString &_call);
|
||||
void defineStationCallsign();
|
||||
QString findStationCallsignToUse(); // Used to select the station Callsign used
|
||||
QString selectStationCallsign();
|
||||
|
||||
void checkIfNewBandOrMode();
|
||||
|
@ -80,7 +80,7 @@ void tst_DXSpot::test_Constructors()
|
||||
DXSpot spot1;
|
||||
QVERIFY2(!spot1.isValid(), "Constructor-1 not working");
|
||||
spot1.setValid(true);
|
||||
DXSpot spot2(&spot1);
|
||||
DXSpot spot2(spot1);
|
||||
QVERIFY2(spot2.isValid(), "Constructor-2 not working");
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ void tst_Frequency::cleanupTestCase()
|
||||
|
||||
void tst_Frequency::test_Constructors()
|
||||
{
|
||||
Frequency freq3(freq);
|
||||
Frequency freq3(*freq);
|
||||
QVERIFY2(qFuzzyCompare(freq->toDouble(),freq3.toDouble()), "Freq assignment (freq) not working");
|
||||
Frequency freq4(7.090,MHz);
|
||||
QVERIFY2(qFuzzyCompare(freq4.toDouble(),(double)7.090), "Freq assignment (double,unit) not working");
|
||||
|
@ -45,6 +45,7 @@ HEADERS += ../../src/setupdialog.h \
|
||||
../../src/downloadcty.h \
|
||||
../../src/dxcluster/dxcluster.h \
|
||||
../../src/dxcluster/dxclusterassistant.h \
|
||||
../../src/dxcluster/dxspot.h \
|
||||
../../src/frequency.h \
|
||||
../../src/dxccstatuswidget.h \
|
||||
../../src/elogqrzlog.h \
|
||||
@ -141,6 +142,7 @@ SOURCES += tst_main.cpp \
|
||||
../../src/downloadcty.cpp \
|
||||
../../src/dxcluster/dxcluster.cpp \
|
||||
../../src/dxcluster/dxclusterassistant.cpp \
|
||||
../../src/dxcluster/dxspot.cpp \
|
||||
../../src/dxccstatuswidget.cpp \
|
||||
../../src/frequency.cpp \
|
||||
../../src/elogqrzlog.cpp \
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "../../src/locator.h"
|
||||
#include "../../src/dxcluster/dxcluster.h"
|
||||
#include "../../src/dxcluster/dxclusterassistant.h"
|
||||
#include "../../src/dxcluster/dxspot.h"
|
||||
#include "../../src/frequency.h"
|
||||
#include "../../src/awards.h"
|
||||
#include "../../src/awarddxmarathon.h"
|
||||
|
@ -44,6 +44,7 @@ HEADERS += \
|
||||
../../src/locator.h \
|
||||
../../src/dxcluster/dxcluster.h \
|
||||
../../src/dxcluster/dxclusterassistant.h \
|
||||
../../src/dxcluster/dxspot.h \
|
||||
../../src/frequency.h \
|
||||
../../src/awards.h \
|
||||
../../src/awarddxmarathon.h \
|
||||
@ -117,6 +118,7 @@ SOURCES += tst_mainwindow.cpp \
|
||||
../../src/locator.cpp \
|
||||
../../src/dxcluster/dxcluster.cpp \
|
||||
../../src/dxcluster/dxclusterassistant.cpp \
|
||||
../../src/dxcluster/dxspot.cpp \
|
||||
../../src/frequency.cpp \
|
||||
../../src/awards.cpp \
|
||||
../../src/awarddxmarathon.cpp \
|
||||
|
Loading…
Reference in New Issue
Block a user