Skip to content

Commit f87540f

Browse files
committed
Added the award instance to searchWindow
1 parent c27a8ae commit f87540f

File tree

10 files changed

+57
-70
lines changed

10 files changed

+57
-70
lines changed

src/awards.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ int Awards::getQSOsInLog(const int _logNumber)
989989
}
990990
}
991991

992-
void Awards::setAwards(const int _qsoId)
992+
void Awards::setAwards()
993993
{
994994
//qDebug() << Q_FUNC_INFO << " - " << QString::number(_qsoId);
995995
//dataProxy->setDXCCAwardStatus(_qsoId);

src/awards.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Awards : public QObject {
5353
public:
5454
Awards(DataProxy_SQLite *dp, const QString &_parentFunction);
5555
~Awards();
56-
void setAwards(const int _qsoId);
56+
void setAwards();
5757
void setAwards(const int _dxcc, const int _waz, const int _band, const int _mode, const int _workedOrConfirmed, const int _logNumber, const int _qsoId);
5858
/*
5959
_workedOrConfirmed = 0 Set as Worked

src/dxccstatuswidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private slots:
8888
// void righButtonFromLogMenu(const int trow);
8989

9090
QTableWidget *dxccView;
91-
Awards *awards; // Reference to the Awards instance
91+
Awards *awards; // Reference to the Awards instance
9292
World *world;
9393
DataProxy_SQLite *dataProxy;
9494
Locator *locator;

src/logwindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ void LogWindow::qslRecViaBureau(const int _qsoId)
697697
{
698698
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_qsoId);
699699
dataProxy->qslRecViaBureau(_qsoId, QDate::currentDate(), false);
700-
awards->setAwards(_qsoId); //Update the Award status
700+
awards->setAwards(); //Update the Award status
701701

702702
refresh();
703703
emit updateAwards();
@@ -709,7 +709,7 @@ void LogWindow::qslRecViaDirect(const int _qsoId)
709709
{
710710
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_qsoId);
711711
dataProxy->qslRecViaDirect(_qsoId, QDate::currentDate(), false);
712-
awards->setAwards(_qsoId);
712+
awards->setAwards();
713713

714714
refresh();
715715
emit updateAwards();

src/mainwindow.cpp

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ MainWindow::MainWindow(DataProxy_SQLite *dp):
4646
//logEvent(Q_FUNC_INFO, "Start: " + _klogDir + "/" + tversion, Debug);
4747
dxccStatusWidget = std::make_unique<DXCCStatusWidget>(&awards, this);
4848
dxClusterWidget = std::make_unique<DXClusterWidget>(&awards, this);
49+
searchWidget = std::make_unique<SearchWidget>(&awards, this);
4950

5051
showKLogLogWidget = new ShowKLogLogWidget;
5152
showErrorDialog = new ShowErrorDialog();
@@ -107,7 +108,7 @@ MainWindow::MainWindow(DataProxy_SQLite *dp):
107108
logWindow = new LogWindow(dataProxy, this);
108109
//qDebug() << Q_FUNC_INFO << ": 00087: " << QTime::currentTime().toString("hh:mm:ss") ;
109110

110-
searchWidget = new SearchWidget(dataProxy, this);
111+
//searchWidget = new SearchWidget(dataProxy, this);
111112
//qDebug() << Q_FUNC_INFO << ": 00087.1: " << QTime::currentTime().toString("hh:mm:ss") ;
112113
//advancedSearchWidget = new AdvancedSearchWidget(dataProxy, this);
113114
//qDebug() << "MainWindow::MainWindow: 00087.2" << QTime::currentTime().toString("hh:mm:ss") ;
@@ -629,13 +630,13 @@ void MainWindow::createActionsCommon(){
629630
// QSL TAB
630631
connect(QSLTabWidget, SIGNAL(returnPressed()), this, SLOT(slotQRZReturnPressed()) );
631632
// SEARCH TAB
632-
connect(searchWidget, SIGNAL(actionQSODoubleClicked ( int ) ), this, SLOT(slotDoubleClickLog( const int ) ) );
633-
connect(searchWidget, SIGNAL(updateAwards() ), this, SLOT(slotShowAwards() ) );
634-
connect(searchWidget, SIGNAL(logRefresh() ), this, SLOT(slotLogRefresh() ) );
635-
connect(searchWidget, SIGNAL(toStatusBar(QString) ), this, SLOT(slotUpdateStatusBar(QString) ) );
636-
connect(searchWidget, SIGNAL(requestBeingShown() ), this, SLOT(slotShowSearchWidget() ) );
637-
connect(searchWidget, SIGNAL(actionQSODelete( int ) ), this, SLOT(slotQSODelete(int) ) );
638-
connect(searchWidget, SIGNAL(queryError(QString, QString, QString, QString)), this, SLOT(slotQueryErrorManagement(QString, QString, QString, QString)) );
633+
connect(searchWidget.get(), SIGNAL(actionQSODoubleClicked ( int ) ), this, SLOT(slotDoubleClickLog( const int ) ) );
634+
connect(searchWidget.get(), SIGNAL(updateAwards() ), this, SLOT(slotShowAwards() ) );
635+
connect(searchWidget.get(), SIGNAL(logRefresh() ), this, SLOT(slotLogRefresh() ) );
636+
connect(searchWidget.get(), SIGNAL(toStatusBar(QString) ), this, SLOT(slotUpdateStatusBar(QString) ) );
637+
connect(searchWidget.get(), SIGNAL(requestBeingShown() ), this, SLOT(slotShowSearchWidget() ) );
638+
connect(searchWidget.get(), SIGNAL(actionQSODelete( int ) ), this, SLOT(slotQSODelete(int) ) );
639+
connect(searchWidget.get(), SIGNAL(queryError(QString, QString, QString, QString)), this, SLOT(slotQueryErrorManagement(QString, QString, QString, QString)) );
639640
connect(&awards, SIGNAL(queryError(QString, QString, QString, QString)), this, SLOT(slotQueryErrorManagement(QString, QString, QString, QString)) );
640641
connect(&awards, SIGNAL(awardDXCCUpdated()), this, SLOT(slotRefreshDXCCWidget()) );
641642
connect(awardsWidget, SIGNAL(debugLog(QString, QString, DebugLogLevel)), this, SLOT(slotCaptureDebugLogs(QString, QString, DebugLogLevel)) );
@@ -1039,31 +1040,13 @@ void MainWindow::slotQRZReturnPressed()
10391040
qso->clear();
10401041
*qso = readQSOFromUI(modify);
10411042

1042-
/*
1043-
if (modify)
1044-
{
1045-
qDebug() << Q_FUNC_INFO << " - reading modifyingQSO" ;
1046-
*qso = readQSOFromUI(modify);
1047-
qDebug() << Q_FUNC_INFO << " - rm: " << modifyingQSO->getMyCity() ;
1048-
qDebug() << Q_FUNC_INFO << " - rq: " << qso->getMyCity() ;
1049-
//*qso = readQSOFromUI(qso);
1050-
}
1051-
else
1052-
{
1053-
qDebug() << Q_FUNC_INFO << " - reading qso" ;
1054-
*qso = readQSOFromUI(qso);
1055-
}
1056-
*/
1043+
10571044
if (!qso->isValid())
10581045
{
10591046
qDebug() << Q_FUNC_INFO << " - QSO Not valid!";
10601047
return;
10611048
}
10621049

1063-
1064-
//qDebug() << Q_FUNC_INFO << " - Clublog: " << qso->getClubLogStatus();
1065-
//qDebug() << Q_FUNC_INFO << ": " << QString("Modifying QSO %1").arg(modifyingQSOid);
1066-
10671050
int addedOK = qso->toDB (modifyingQSOid);
10681051
//qDebug() << Q_FUNC_INFO << ": id: " << QString::number(addedOK);
10691052
if (addedOK>0)
@@ -1095,7 +1078,7 @@ void MainWindow::actionsJustAfterAddingOneQSO()
10951078
needToSave = true;
10961079
if(modifyingQSOid>0)
10971080
{
1098-
awards.setAwards(modifyingQSOid);
1081+
awards.setAwards();
10991082
if (yearChangedDuringModification)
11001083
{
11011084
awardsWidget->fillOperatingYears();
@@ -1113,7 +1096,7 @@ void MainWindow::actionsJustAfterAddingOneQSO()
11131096
{
11141097
//qDebug() << Q_FUNC_INFO << " - (No ClubLog) Lastid: "<< QString::number(lastId) ;
11151098
}
1116-
awards.setAwards(modifyingQSOid); //Update the DXCC award status
1099+
awards.setAwards(); //Update the DXCC award status
11171100
}
11181101
// CHECK WHAT WAS THE QSOID to add the awards, if needed
11191102
}
@@ -1124,7 +1107,7 @@ void MainWindow::actionsJustAfterAddingOneQSO()
11241107
if (lastId>=0)
11251108
{
11261109
//qDebug() << Q_FUNC_INFO << " - Lastid: "<< QString::number(lastId) ;
1127-
awards.setAwards(lastId); //Update the DXCC award status
1110+
awards.setAwards(); //Update the DXCC award status
11281111
// Send to CLUBLOG if enabled
11291112
if ((clublogActive) && (clublogRealTime))
11301113
{
@@ -1249,19 +1232,17 @@ QSO MainWindow::readQSOFromUI(const bool _mod) // _mod = true if we want to use
12491232
qDebug() << Q_FUNC_INFO << " - Start : " << util->boolToQString(_mod);
12501233

12511234
logEvent(Q_FUNC_INFO, "Start", Debug);
1252-
qDebug() << Q_FUNC_INFO << ": ClubLog: antes de leer QSO: " << eQSLTabWidget->getClubLogStatus();
12531235
QSO qq;
12541236
if (_mod)
12551237
{
12561238
qq.copy(modifyingQSO);
12571239
}
12581240
else
12591241
{
1260-
qq.copy(qso);
1242+
qq.clear();
12611243
}
1262-
//qq.clear();
12631244

1264-
qDebug() << Q_FUNC_INFO << " - MY_CITY-00 - QSO : " << qso->getMyCity();
1245+
//qDebug() << Q_FUNC_INFO << " - MY_CITY-00 - QSO : " << qso->getMyCity();
12651246
qDebug() << Q_FUNC_INFO << " - MY_CITY-02 - Mod : " << modifyingQSO->getMyCity();
12661247
qDebug() << Q_FUNC_INFO << " - MY_CITY-03 - _qso: " << qq.getMyCity();
12671248
if (!checkValidCallBeforeAddingToLog(mainQSOEntryWidget->getQrz()))
@@ -1460,7 +1441,7 @@ void MainWindow::slotQSODelete(const int _id)
14601441
void MainWindow::slotShowSearchWidget()
14611442
{
14621443
logEvent(Q_FUNC_INFO, "Start", Debug);
1463-
dxUpRightTab->setCurrentIndex(dxUpRightTab->indexOf(searchWidget));
1444+
dxUpRightTab->setCurrentIndex(dxUpRightTab->indexOf(searchWidget.get()));
14641445
logEvent(Q_FUNC_INFO, "END", Debug);
14651446
}
14661447

@@ -3750,7 +3731,7 @@ void MainWindow::createUIDX()
37503731

37513732
//qDebug() << "MainWindow::createUIDX-122" ;
37523733
dxUpRightTab->addTab(awardsWidget, tr("Awards"));
3753-
dxUpRightTab->addTab(searchWidget, tr("Search"));
3734+
dxUpRightTab->addTab(searchWidget.get(), tr("Search"));
37543735

37553736
dxBottonTab->addTab(logWindow, tr("Log"));
37563737
dxBottonTab->addTab(dxClusterWidget.get(), tr("DX-Cluster"));

src/mainwindow.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ private slots:
474474
TipsDialog *tipsDialog;
475475
ShowKLogLogWidget * showKLogLogWidget;
476476
StatisticsWidget *statsWidget;
477-
std::unique_ptr<DXCCStatusWidget> dxccStatusWidget;
478-
std::unique_ptr<DXClusterWidget> dxClusterWidget;
479-
477+
std::unique_ptr<DXCCStatusWidget> dxccStatusWidget; // Defined like this to send the same award instance
478+
std::unique_ptr<DXClusterWidget> dxClusterWidget; // Defined like this to send the same award instance
479+
std::unique_ptr<SearchWidget> searchWidget; // Defined like this to send the same award instance
480480

481481
//DXClusterWidget *dxClusterWidget;
482482
//DXCCStatusWidget *dxccStatusWidget;
@@ -611,7 +611,7 @@ private slots:
611611
MainQSOEntryWidget *mainQSOEntryWidget;
612612

613613
AwardsWidget *awardsWidget;
614-
SearchWidget *searchWidget;
614+
//SearchWidget *searchWidget;
615615
InfoWidget *infoWidget;
616616

617617
//AdvancedSearchWidget *advancedSearchWidget;

src/searchwidget.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@
2727
#include "searchwidget.h"
2828
#include "callsign.h"
2929

30-
SearchWidget::SearchWidget(DataProxy_SQLite *dp, QWidget *parent) :
31-
QWidget(parent)
30+
SearchWidget::SearchWidget(Awards *awards, QWidget *parent) :
31+
QWidget(parent),
32+
awards(awards) // Initialize Awards reference
3233
{
3334
//qDebug() << "SearchWidget::SearchWidget" ;
3435
searchBoxLineEdit = new QLineEdit;
35-
dataProxy = dp;
36+
dataProxy = awards->dataProxy;
3637
delayInputTimer = new QTimer;
37-
searchWindow = new SearchWindow(dataProxy, this);
38+
searchWindow = std::make_unique<SearchWindow>(awards, this);
39+
//searchWindow = new SearchWindow(dataProxy, this);
3840

39-
awards = new Awards(dataProxy, Q_FUNC_INFO);
41+
//awards = new Awards(dataProxy, Q_FUNC_INFO);
4042
util = new Utilities(Q_FUNC_INFO);
4143
//util->setLongPrefixes(dataProxy->getLongPrefixes());
4244
//util->setSpecialCalls(dataProxy->getSpecialCallsigns());
@@ -66,9 +68,9 @@ SearchWidget::SearchWidget(DataProxy_SQLite *dp, QWidget *parent) :
6668

6769
SearchWidget::~SearchWidget()
6870
{
69-
delete(dataProxy);
70-
delete(searchWindow);
71-
delete(awards);
71+
//delete(dataProxy);
72+
//delete(searchWindow);
73+
//delete(awards);
7274
delete(util);
7375
delete(filemanager);
7476
delete(world);
@@ -199,7 +201,7 @@ void SearchWidget::createUI()
199201
dxUpRightSearchTabLayout->addLayout(dxUpRightSearchTopLayout);
200202
dxUpRightSearchTabLayout->addLayout(dxUpRightButtonsLayout);
201203
//dxUpRightSearchTabLayout->addWidget(searchResultsTreeWidget);
202-
dxUpRightSearchTabLayout->addWidget(searchWindow);
204+
dxUpRightSearchTabLayout->addWidget(searchWindow.get());
203205

204206
setLayout(dxUpRightSearchTabLayout);
205207

@@ -218,10 +220,10 @@ void SearchWidget::createUI()
218220
connect(stationCallsignComboBox, SIGNAL(currentIndexChanged (int)), this, SLOT(slotStationCallsignChanged() ) ) ;
219221
connect(searchAllQCheckbox, SIGNAL(toggled(bool)), this, SLOT(slotQCheckboxToggled() ) ) ;
220222

221-
connect(searchWindow, SIGNAL( actionQSODoubleClicked(int)), this, SLOT(slotQSOToEditFromSearch(int)));
222-
connect(searchWindow, SIGNAL( actionDeleteQSO(int)), this, SLOT( slotQsoDeleteFromSearch(int) ));
223-
connect(searchWindow, SIGNAL( updateSearchLineEdit()), this, SLOT( slotSearchBoxTextChanged() ));
224-
connect(searchWindow, SIGNAL( requestFocus()), this, SLOT( slotRequestFocus() ));
223+
connect(searchWindow.get(), SIGNAL( actionQSODoubleClicked(int)), this, SLOT(slotQSOToEditFromSearch(int)));
224+
connect(searchWindow.get(), SIGNAL( actionDeleteQSO(int)), this, SLOT( slotQsoDeleteFromSearch(int) ));
225+
connect(searchWindow.get(), SIGNAL( updateSearchLineEdit()), this, SLOT( slotSearchBoxTextChanged() ));
226+
connect(searchWindow.get(), SIGNAL( requestFocus()), this, SLOT( slotRequestFocus() ));
225227
}
226228

227229

src/searchwidget.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class SearchWidget : public QWidget
4141
{
4242
Q_OBJECT
4343
public:
44-
explicit SearchWidget(DataProxy_SQLite *dp, QWidget *parent = nullptr);
44+
explicit SearchWidget(Awards *awards, QWidget *parent = nullptr);
4545
~SearchWidget();
4646
void setCurrentLog(const int _log);
4747
//void setColors (const QString &_newOne, const QString &_needed, const QString &_worked, const QString &_confirmed, const QString &_default);
@@ -127,7 +127,9 @@ private slots:
127127
//QTreeWidget *searchResultsTreeWidget;
128128
QComboBox *stationCallsignComboBox;
129129

130-
SearchWindow *searchWindow;
130+
//SearchWindow *searchWindow;
131+
std::unique_ptr<SearchWindow> searchWindow; // Defined like this to send the same award instance
132+
131133

132134
bool qslingNeeded;
133135
bool searchSelectAllClicked, stationCallSignShownInSearch;

src/searchwindow.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727

2828
#include "searchwindow.h"
2929

30-
31-
SearchWindow::SearchWindow(DataProxy_SQLite *dp, QWidget *parent) : QWidget(parent)
30+
SearchWindow::SearchWindow(Awards *awards, QWidget *parent) :
31+
QWidget(parent),
32+
awards(awards) // Initialize Awards reference
3233
{
3334
//qDebug() << "SearchWindow::SearchWindow: " ;
34-
dataProxy = dp;
35+
dataProxy = awards->dataProxy;
3536
showStationCallsignInHeader = true;
3637
//sortingThroughProxyModel = false;
3738
searchModel = new SearchModel(dataProxy, this);
@@ -45,7 +46,7 @@ SearchWindow::SearchWindow(DataProxy_SQLite *dp, QWidget *parent) : QWidget(pare
4546
//proxyModel = new LogViewSortFilterProxyModel(this);
4647

4748

48-
awards = new Awards(dataProxy, Q_FUNC_INFO);
49+
//awards = new Awards(dataProxy, Q_FUNC_INFO);
4950

5051
createUI();
5152
createActions();
@@ -56,9 +57,9 @@ SearchWindow::SearchWindow(DataProxy_SQLite *dp, QWidget *parent) : QWidget(pare
5657
SearchWindow::~SearchWindow()
5758
{
5859
// emit clearError();
59-
delete(dataProxy);
60+
//delete(dataProxy);
6061
delete(util);
61-
delete(awards);
62+
//delete(awards);
6263
}
6364

6465

@@ -517,7 +518,7 @@ void SearchWindow::qslRecViaBureau(const int _qsoId)
517518
{
518519
// //qDebug() << "LogWyyyy-MM-ddRecViaBureau: " << QString::number(_qsoIyyyy-MM-dd<< (dateTime->currentDateTime()).toString("yyyy/MM/dd");
519520
dataProxy->qslRecViaBureau(_qsoId, QDate::currentDate(), false);
520-
awards->setAwards(_qsoId); //Update the Award status
521+
awards->setAwards(); //Update the Award status
521522
searchModel->select();
522523
//refresh();
523524
emit updateAwards();
@@ -527,7 +528,7 @@ void SearchWindow::qslRecViaDirect(const int _qsoId)
527528
{
528529
//qDebug() << "SearchWindow::qslRecViaDirect: " << QString::number(_qsoId)yyyy-MM-dd
529530
dataProxy->qslRecViaDirect(_qsoId, QDate::currentDate(), false);
530-
awards->setAwards(_qsoId);
531+
awards->setAwards();
531532
searchModel->select();
532533
//refresh();
533534
emit updateAwards();

src/searchwindow.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class SearchWindow : public QWidget
4747
Q_OBJECT
4848

4949
public:
50-
explicit SearchWindow(DataProxy_SQLite *dp, QWidget *parent = nullptr);
50+
//explicit SearchWidget(Awards *awards, QWidget *parent = nullptr);
51+
explicit SearchWindow(Awards *awards, QWidget *parent = nullptr);
5152
~SearchWindow();
5253
void createlogPanel(const int _currentLog);
5354
void clear();
@@ -126,7 +127,7 @@ private slots:
126127
bool qslingNeeded;
127128
DataProxy_SQLite *dataProxy;
128129
SearchModel *searchModel;
129-
Awards *awards;
130+
Awards *awards; // Reference to the Awards instance
130131

131132
//eLogClubLog *elogClublog;
132133

0 commit comments

Comments
 (0)