File: mainqsoentrywidget.h

package info (click to toggle)
klog 2.4.3-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 12,344 kB
  • sloc: cpp: 51,720; makefile: 15
file content (173 lines) | stat: -rw-r--r-- 6,414 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#ifndef KLOG_MAINQSOENTRYWIDGET_H
#define KLOG_MAINQSOENTRYWIDGET_H
/***************************************************************************
                          mainqsoentrywidget.h  -  description
                             -------------------
    begin                : january 2020
    copyright            : (C) 2020 by Jaime Robles
    email                : jaime@robles.es
 ***************************************************************************/

/*****************************************************************************
 * This file is part of KLog.                                                *
 *                                                                           *
 *    KLog is free software: you can redistribute it and/or modify           *
 *    it under the terms of the GNU General Public License as published by   *
 *    the Free Software Foundation, either version 3 of the License, or      *
 *    (at your option) any later version.                                    *
 *                                                                           *
 *    KLog is distributed in the hope that it will be useful,                *
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 *    GNU General Public License for more details.                           *
 *                                                                           *
 *    You should have received a copy of the GNU General Public License      *
 *    along with KLog.  If not, see <https://www.gnu.org/licenses/>.         *
 *                                                                           *
 *****************************************************************************/
#include <QObject>
#include <QWidget>
#include <QtWidgets>
#include "dataproxy_sqlite.h"
#include "utilities.h"
#include "qso.h"

class MainQSOEntryWidget : public QWidget
{
    Q_OBJECT
    friend class tst_MainWindow;

public:    
    explicit MainQSOEntryWidget(DataProxy_SQLite *dp, QWidget *parent = nullptr);
    ~MainQSOEntryWidget();
    void setBands(const QStringList &_bands);
    void setModes(const QStringList &_modes);

    bool setBand(const QString &_band);
    bool setFreq(const double _f, bool isRX = false);

    bool setMode(const QString &_mode);
    bool setQRZ(const QString &_qrz);
    void setCurrentQRZ(const QString &_qrz);
    bool setDateTime(const QDateTime _date);
    bool setTime(const QTime _time);
    void setCleaning (const bool _c);
    bool isModeExisting(const QString &_m);
    bool isBandExisting(const QString &_b);
    void setShowSeconds(const bool &t);
    void setQSOData(QSO _qso);
    QSO getQSOData(QSO &_qso);


    QString getQrz();
    QString getBand(int _b=-1);
    QString getMode(int _m=-1);
    QStringList getModes();
    QDate getDate();
    QTime getTime();
    QDateTime getDateTime();

    void setRealTime(const bool _realTime);
    bool getRealTime();
    void setManualMode(const bool _manualMode);
    bool getManualMode();

    void toggleRealTime();
    void setUTC(const bool _utc);
    void setModify(const bool _modify);
    bool getModifying();
    void setUpAndRunning(const bool _u);
    void selectDefaultBand(bool _init = false);
    void selectDefaultMode(bool _init = false);

    void setDuplicatedQSOSlot (const int _secs);
    void setFocusToOK();
    void setLogLevel (const DebugLogLevel _b);
    void clear();
    bool getDarkMode();

protected:
    //void keyPressEvent(QKeyEvent *event);
    //void resizeEvent(QResizeEvent *event) override;

signals:
    void debugLog (QString _func, QString _msg, DebugLogLevel _level);
    void showInfoLabel(QString _msg);
    void currentQRZSignal(QString _msg);
    void clearForNextQSOSignal(QString _func);
    void bandChanged(QString _band);
    void modeChanged(QString _mode);
    void OKClicked();
    void validBands(QStringList _bands);
    void handOverFocusSignal();
    void manualModeSignal(bool _active);
                       // Returns if we are in dark mode or not

private slots:
    void slotCaptureDebugLogs(const QString &_func, const QString &_msg, DebugLogLevel _level);
    void slotUpdateTime();
    void slotQRZTextChanged();
    void slotBandComboBoxChanged(const QString &_b);
    void slotModeComboBoxChanged(const QString &_m);
    void slotOKButtonClicked();
    void slotClearButtonClicked();
    void slotQRZButtonClicked();
    //void slotRealtimeButtonClicked();
    void slotCheckBoxClicked();
    //void slotRealTimeCheckBoxChanged();
    void slotStartDelayInputTimer();
    void slotDelayInputTimedOut();
    //void slotRealTimeButtonResize();
    void slotManualModeCheckBoxClicked();

private:
    void logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level);
    bool eventFilter(QObject *object, QEvent *event);
    void createUI();
    void setInitialData();

    //bool validCharactersInCall(const QString &_qrz);
    void clearForNextQSO();
    void checkIfDupe(const QString &_func);
    void setDateAndTimeInternally();
    bool updateBandComboBox(const QString &_band); // If a new band arrives, we add it if possible to KLog
    bool newBandNeededForFreq(const double _f);
    DataProxy_SQLite *dataProxy;
    QGroupBox *qrzgroupBox;//, *searchgroupBox;
    QLineEdit *qrzLineEdit;
    QComboBox *bandComboBox, *modeComboBox;
    QDateEdit *dateEdit;
    QTimeEdit *timeEdit;
    QPushButton *OKButton, *clearButton, *QRZButton;
    QCheckBox *realtimeCheckBox, *manualModeCheckBox;
    //QPushButton *realtimeButton;
    //DebugLogLevel logLevel;
    bool cleaning;
    bool qrzAutoChanging;
    bool InValidCharsInPrevCall;
    bool qrzSmallModDontCalculate;
    bool upAndRunning;


    QString previousQRZ;
    QString currentQrz;


    QStringList bands, modes;

    QTimer *timer;
    bool UTCTime, modify, realTime;
    QPalette palRed, palBlack, palWhite; // To paint Text in red or black(normal)
    Utilities *util;
    QPalette::ColorRole enabledCR, disabledCR;

    int duplicatedQSOSlotInSecs;
    QTimer *delayInputTimer;
    QString lastQrz;
    double freqTX, freqRX, bottomBandLimit, upperBandLimit;
    DebugLogLevel logLevel;
    bool modifyingBands;
    bool fillingQSO;        // TRUE just when a QSO is being written in the UI from a qsoToEdit
};

#endif // MAINQSOENTRYWIDGET_H