1 #ifndef MAINQSOENTRYWIDGET_H 2 #define MAINQSOENTRYWIDGET_H 3 /*************************************************************************** 4 mainqsoentrywidget.h - description 5 ------------------- 6 begin : january 2020 7 copyright : (C) 2020 by Jaime Robles 8 email : jaime@robles.es 9 ***************************************************************************/ 10 11 /***************************************************************************** 12 * This file is part of KLog. * 13 * * 14 * KLog is free software: you can redistribute it and/or modify * 15 * it under the terms of the GNU General Public License as published by * 16 * the Free Software Foundation, either version 3 of the License, or * 17 * (at your option) any later version. * 18 * * 19 * KLog is distributed in the hope that it will be useful, * 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 22 * GNU General Public License for more details. * 23 * * 24 * You should have received a copy of the GNU General Public License * 25 * along with KLog. If not, see <https://www.gnu.org/licenses/>. * 26 * * 27 *****************************************************************************/ 28 #include <QObject> 29 #include <QWidget> 30 #include <QtWidgets> 31 #include "dataproxy_sqlite.h" 32 #include "utilities.h" 33 34 class MainQSOEntryWidget : public QWidget 35 { 36 Q_OBJECT 37 public: 38 explicit MainQSOEntryWidget(DataProxy_SQLite *dp, QWidget *parent = nullptr); 39 void setBands(const QStringList _bands); 40 void setModes(const QStringList _modes); 41 42 bool setBand(const QString &_band); 43 bool setFreq(const double _f, bool isRX = false); 44 45 bool setMode(const QString &_mode); 46 bool setQRZ(const QString &_qrz); 47 void setCurrentQRZ(const QString &_qrz); 48 bool setDateTime(const QDateTime _date); 49 bool setTime(const QTime _time); 50 void setCleaning (const bool _c); 51 bool isModeExisting(const QString &_m); 52 bool isBandExisting(const QString &_b); 53 54 QString getQrz(); 55 QString getBand(const int _b=-1); 56 QString getMode(const int _m=-1); 57 QStringList getModes(); 58 QDate getDate(); 59 QTime getTime(); 60 QDateTime getDateTime(); 61 62 void setRealTime(const bool _realTime); 63 bool getRealTime(); 64 void toggleRealTime(); 65 void setUTC(const bool _utc); 66 void setModify(const bool _modify); 67 bool getModifying(); 68 void setUpAndRunning(const bool _u); 69 void selectDefaultBand(const bool _init = false); 70 void selectDefaultMode(const bool _init = false); 71 72 void setDuplicatedQSOSlot (const int _secs); 73 void setFocusToOK(); 74 void clear(); 75 76 protected: 77 //void keyPressEvent(QKeyEvent *event); 78 //void resizeEvent(QResizeEvent *event) override; 79 80 signals: 81 void debugLog (QString _func, QString _msg, DebugLogLevel _level); 82 void showInfoLabel(QString _msg); 83 void currentQRZSignal(QString _msg); 84 void clearForNextQSOSignal(); 85 void bandChanged(QString _band); 86 void modeChanged(QString _mode); 87 void OKClicked(); 88 void validBands(QStringList _bands); 89 void handOverFocusSignal(); 90 91 private slots: 92 void slotUpdateTime(); 93 void slotQRZTextChanged(); 94 void slotBandComboBoxChanged(const QString &_b); 95 void slotModeComboBoxChanged(const QString &_m); 96 void slotOKButtonClicked(); 97 void slotClearButtonClicked(); 98 //void slotRealtimeButtonClicked(); 99 void slotCheckBoxClicked(); 100 //void slotRealTimeCheckBoxChanged(); 101 void slotStartDelayInputTimer(); 102 void slotDelayInputTimedOut(); 103 //void slotRealTimeButtonResize(); 104 105 106 private: 107 bool eventFilter(QObject *object, QEvent *event); 108 void createUI(); 109 void setInitialData(); 110 111 bool validCharactersInCall(const QString &_qrz); 112 void clearForNextQSO(); 113 void checkIfDupe(const QString &_func); 114 void setDateAndTimeInternally(); 115 bool updateBandComboBox(const QString &_band); // If a new band arrives, we add it if possible to KLog 116 bool newBandNeededForFreq(const double _f); 117 DataProxy_SQLite *dataProxy; 118 QGroupBox *qrzgroupBox;//, *searchgroupBox; 119 QLineEdit *qrzLineEdit; 120 QComboBox *bandComboBox, *modeComboBox; 121 QDateEdit *dateEdit; 122 QTimeEdit *timeEdit; 123 QPushButton *OKButton, *clearButton; 124 QCheckBox *realtimeCheckBox; 125 //QPushButton *realtimeButton; 126 //DebugLogLevel logSeverity; 127 bool cleaning; 128 bool qrzAutoChanging; 129 bool InValidCharsInPrevCall; 130 bool qrzSmallModDontCalculate; 131 bool upAndRunning; 132 bool getDarkMode(); 133 134 QString previousQRZ; 135 QString currentQrz; 136 137 138 QStringList bands, modes; 139 140 QTimer *timer; 141 bool UTCTime, modify, realTime; 142 QPalette palRed, palBlack, palWhite; // To paint Text in red or black(normal) 143 Utilities *util; 144 QPalette::ColorRole enabledCR, disabledCR; 145 146 int duplicatedQSOSlotInSecs; 147 QTimer *delayInputTimer; 148 QString lastQrz; 149 double freqTX, freqRX, bottomBandLimit, upperBandLimit; 150 151 }; 152 153 #endif // MAINQSOENTRYWIDGET_H 154