1 #ifndef SEARCHWINDOW_H 2 #define SEARCHWINDOW_H 3 4 /*************************************************************************** 5 searchwindow.h - description 6 ------------------- 7 begin : sept 2020 8 copyright : (C) 2020 by Jaime Robles 9 email : jaime@robles.es 10 ***************************************************************************/ 11 12 /***************************************************************************** 13 * This file is part of KLog. * 14 * * 15 * KLog is free software: you can redistribute it and/or modify * 16 * it under the terms of the GNU General Public License as published by * 17 * the Free Software Foundation, either version 3 of the License, or * 18 * (at your option) any later version. * 19 * * 20 * KLog is distributed in the hope that it will be useful, * 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 23 * GNU General Public License for more details. * 24 * * 25 * You should have received a copy of the GNU General Public License * 26 * along with KLog. If not, see <https://www.gnu.org/licenses/>. * 27 * * 28 *****************************************************************************/ 29 30 #include <QtWidgets> 31 #include <QWidget> 32 //#include <QTableView> 33 #include <QTreeView> 34 #include <QAction> 35 #include <QSqlQuery> 36 #include <QSqlRecord> 37 #include <QSqlRelationalDelegate> 38 #include <QDesktopServices> 39 #include "dataproxy_sqlite.h" 40 #include "searchmodel.h" 41 #include "awards.h" 42 //#include "elogclublog.h" 43 #include "utilities.h" 44 45 class SearchWindow : public QWidget 46 { 47 Q_OBJECT 48 49 public: 50 explicit SearchWindow(DataProxy_SQLite *dp, QWidget *parent = nullptr); 51 ~SearchWindow(); 52 void createlogPanel(const int _currentLog); 53 void clear(); 54 void refresh(); 55 56 void selectAll(); 57 void clearSelection(); 58 void setStationCallsignInHeader(const bool _h); 59 60 61 void qslSentViaBureau(const int _qsoId); //Maybe this could be defined as private and call it with an action, if needed. 62 void qslRecViaBureau(const int _qsoId); //Maybe this could be defined as private and call it with an action, if needed. 63 void qslRecViaDirect(const int _qsoId); 64 65 bool isQSLReceived(const int _qsoId); 66 bool isQSLSent(const int _qsoId); 67 //void setProxyModel (const bool _p); 68 void sortColumn(const int _c); 69 void setFilterString(const QString &_st); 70 QList<int> getSelectedQSOs(); 71 void setNeedingQSL(bool const _q); 72 void slotToolSearchQSL(const int actionQSL); 73 void setColors (const QString &_newOne, const QString &_needed, const QString &_worked, const QString &_confirmed, const QString &_default); 74 75 76 77 signals: 78 void actionQSODoubleClicked(const int _qsoid); 79 void actionDeleteQSO(const int _qsoid); 80 void updateAwards(); 81 void updateSearchText(); 82 void updateSearchLineEdit(); 83 void requestFocus(); 84 void queryError(QString functionFailed, QString errorCodeS, QString nativeError, QString failedQuery); // To alert about any failed query execution 85 86 private slots: 87 88 void slotDoubleClickLog(const QModelIndex & index); 89 90 void slotRighButtonFromLog(const QPoint& pos); 91 void slotQSLSentViaBureauFromLog(); 92 void slotQSLSentViaDirectFromLog(); 93 void slotQSLRecViaDirectFromLog(); 94 void slotQSLRecViaBureauFromLog(); 95 void slotQSLSentMarkAsRequested(); 96 void slotQSLRecMarkAsRequested(); 97 void slotQsoDeleteFromLog(); 98 void slotQSOToEditFromLog(); 99 void slotQueryErrorManagement(QString functionFailed, QString errorCodeS, QString nativeError, QString failedQuery); 100 void slotCheckQRZCom(); 101 void slotCheckDXHeatCom(); 102 103 void slotQSLSentViaDirectMarkDXReqFromSearch(); 104 void slotQSLSentViaBureauMarkDXReqFromSearch(); 105 //void slotQSLRecMarkAsRequested(); 106 void slotQSLRecViaDirectMarkReqFromSearch(); 107 void slotQSLRecViaBureauMarkReqFromSearch(); 108 109 110 private: 111 void createUI(); 112 void createActionsCommon(); 113 void createActions(); 114 115 //void deleteQSO(const int _qsoID); 116 void rightButtonFromLogMenu(const int row); 117 void showMenuRightButtonFromLogCreateActions(); 118 //void slotToolSearchQSL(const int actionQSL); 119 void searchToolNeededQSLToSend(); 120 void setDefaultData(); 121 void setColumnsToDX(); 122 //void qslRecViaDirectMarkReq(const int _qsoId); 123 //void qslRecViaBureauMarkReq(const int _qsoId); 124 //void colorTheList(); 125 126 bool qslingNeeded; 127 DataProxy_SQLite *dataProxy; 128 SearchModel *searchModel; 129 Awards *awards; 130 131 //eLogClubLog *elogClublog; 132 133 //QTableView *logView; 134 QTreeView *treeView; 135 QLabel *logLabel; 136 137 QAction *delQSOFromLogAct; 138 QAction *qsoToEditFromLogAct; 139 QAction *qslSentViaBureauFromLogAct; 140 QAction *qslSentViaDirectFromLogAct; 141 QAction *qslRecViaBureauFromLogAct; 142 QAction *qslRecViaDirectFromLogAct; 143 QAction *checkQRZCOMFromLogAct; 144 QAction *checkDXHeatFromLogAct; 145 146 QAction *qslSentRequestedAct; 147 QAction *qslSentViaDirectMarkRcvReqFromSearchAct; 148 QAction *qslSentViaBureauMarkRcvReqFromSearchAct; 149 QAction *qslRecViaBureauMarkReqFromSearchAct; 150 QAction *qslRecViaDirectMarkReqFromSearchAct; 151 QAction *qslRecRequestedAct; 152 153 int currentLog; 154 155 Utilities *util; 156 bool showStationCallsignInHeader; 157 158 }; 159 160 #endif // SEARCHWINDOW_H 161