File: widegraph.h

package info (click to toggle)
js8call 2.5.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,720 kB
  • sloc: cpp: 562,651; sh: 898; python: 132; ansic: 102; makefile: 4
file content (150 lines) | stat: -rw-r--r-- 4,184 bytes parent folder | download
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
// -*- Mode: C++ -*-
#ifndef WIDEGRAPH_H
#define WIDEGRAPH_H

#include "JS8_Include/commons.h"
#include "JS8_Main/WF.h"
#include <QColor>
#include <QDir>
#include <QEvent>
#include <QMutex>
#include <QObject>
#include <QScopedPointer>
#include <QString>
#include <QStringView>
#include <QVector>
#include <QWidget>
#include <array>

namespace Ui {
class WideGraph;
}

class Configuration;
class QSettings;
class QTimer;

class WideGraph : public QWidget {
    Q_OBJECT

  public:
    explicit WideGraph(QSettings *, QWidget * = nullptr);
    ~WideGraph();

    // Accessors

    int centerFreq() const;
    int filterMinimum() const;
    int filterMaximum() const;
    bool filterEnabled() const;
    int freq() const;
    bool isAutoSyncEnabled() const;
    int nStartFreq() const;
    bool shouldDisplayDecodeAttempts() const;
    bool shouldAutoSyncSubmode(int) const;
    int smoothYellow() const;

    // Manipulators

    void dataSink(WF::SPlot const &, float);
    void drawDecodeLine(QColor const &, int, int);
    void drawHorizontalLine(QColor const &, int, int);
    void saveSettings();
    void setBand(QString const &);
    void setFilterCenter(int);
    void setFilterWidth(int);
    void setFilterMinimumBandwidth(int);
    void setFilterEnabled(bool);
    void setFilterOpacityPercent(int);
    void setFreq(int);
    void setPeriod(int);
    void setSubMode(int);

  signals:
    void changeFreq(int);
    void f11f12(int n);
    void setXIT(int n);
    void qsy(int);
    void want_new_drift(qint64);

  public slots:
    void setDialFreq(float);
    void setTimeControlsVisible(bool);
    bool timeControlsVisible() const;
    void setControlsVisible(bool, bool = true);
    bool controlsVisible() const;
    void onDriftChanged(qint64 drift_ms);
    void setPaused(bool paused) { m_paused = paused; }
    void notifyDriftedSignalsDecoded(int);

  protected:
    void keyPressEvent(QKeyEvent *e) override;
    void closeEvent(QCloseEvent *) override;

  private slots:

    void on_qsyPushButton_clicked();
    void on_offsetSpinBox_valueChanged(int n);
    void on_waterfallAvgSpinBox_valueChanged(int arg1);
    void on_bppSpinBox_valueChanged(int arg1);
    void on_spec2dComboBox_currentIndexChanged(int);
    void on_fStartSpinBox_valueChanged(int n);
    void on_paletteComboBox_activated(int);
    void on_cbFlatten_toggled(bool b);
    void on_adjust_palette_push_button_clicked(bool);
    void on_gainSlider_valueChanged(int value);
    void on_zeroSlider_valueChanged(int value);
    void on_gain2dSlider_valueChanged(int value);
    void on_zero2dSlider_valueChanged(int value);
    void on_smoSpinBox_valueChanged(int n);
    void on_sbPercent2dPlot_valueChanged(int n);
    void on_filterCenterSpinBox_valueChanged(int n);
    void on_filterCenterSpinBox_editingFinished();
    void on_filterWidthSpinBox_valueChanged(int n);
    void on_filterWidthSpinBox_editingFinished();
    void on_filterCenterSyncButton_clicked();
    void on_filterCheckBox_toggled(bool b);
    void on_filterOpacitySpinBox_valueChanged(int n);

    void on_autoDriftButton_toggled(bool checked);
    void on_driftSpinBox_valueChanged(int n);
    void on_driftSyncButton_clicked();
    void on_driftSyncEndButton_clicked();
    void on_driftSyncMinuteButton_clicked();
    void on_driftSyncResetButton_clicked();

  private:
    void readPalette();

    QScopedPointer<Ui::WideGraph> ui;

    int m_waterfallAvg = 1;
    int m_waterfallNow = 0;
    int m_filterCenter = 1500;
    int m_filterWidth = 120;
    int m_filterMinWidth = 120;
    int m_nsmo = 1;
    int m_TRperiod = 15;
    int m_lastSecondInPeriod = 0;
    int m_autoSyncTimeLeft = 0;
    int m_autoSyncDecodesLeft = 0;
    bool m_paused = false;
    bool m_filterEnabled = false;
    bool m_autoSyncConnected = false;

    QSettings *m_settings;
    QTimer *m_drawTimer;
    QTimer *m_autoSyncTimer;
    QDir m_palettes_path;
    WF::Palette m_userPalette;
    WF::SWide m_swide = {};
    WF::SPlot m_splot = {};
    WF::State m_state = WF::Sink::Drained;
    QMutex m_drawLock;
    QStringView m_timeFormat;
    QString m_waterfallPalette;
    QString m_band;
    QList<int> m_sizes;
};

#endif // WIDEGRAPH_H