forked from aethersdr/AetherSDR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpectrumOverlayMenu.h
More file actions
257 lines (229 loc) · 9.86 KB
/
Copy pathSpectrumOverlayMenu.h
File metadata and controls
257 lines (229 loc) · 9.86 KB
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#pragma once
#include "models/RadioModel.h"
#include <QWidget>
#include <QVector>
#include <climits>
#include <QStringList>
#include <QPoint>
#include <QPointer>
#include <QWheelEvent>
#include <QMouseEvent>
class QPushButton;
class QComboBox;
class QSlider;
class QLabel;
namespace AetherSDR {
class MemoryBrowsePanel;
class SliceModel;
// Floating overlay menu anchored to the top-left of the SpectrumWidget.
// Open by default; collapses to a single arrow button when closed.
// Buttons are placeholders — signals emitted for parent to wire.
class SpectrumOverlayMenu : public QWidget {
Q_OBJECT
public:
explicit SpectrumOverlayMenu(QWidget* parent = nullptr);
// Raise this widget and all floating panels above sibling widgets.
void raiseAll();
void setMemories(const QMap<int, MemoryEntry>& memories);
// Set the antenna list (from RadioModel::antListChanged).
void setAntennaList(const QStringList& ants);
void setRadioModel(RadioModel* model);
// Sync Display sub-panel controls with saved settings. The Black slider
// displays `black` while autoBlack is off and `autoBlackOffset` while it
// is on; both values are stored internally so toggling the AUTO button
// swaps the slider position without losing either preference.
void syncDisplaySettings(int avg, int fps, int fillPct, bool weightedAvg,
const QColor& fillColor, int gain, int black,
bool autoBlack, int autoBlackOffset, int rate,
int floorPos = 75, bool floorEnable = false,
bool heatMap = true, int colorScheme = 0,
bool showGrid = true,
float lineWidth = 2.0f);
void syncWfLineDuration(int rate);
// Sync blanker/cursor/opacity controls not covered by syncDisplaySettings.
void syncExtraDisplaySettings(bool blankerOn, float blankerThresh,
int bgOpacity,
int freqGridSpacingKhz = 0);
// Set the panadapter ID this overlay belongs to (for +RX routing).
void setPanId(const QString& id) { m_panId = id; }
QString panId() const { return m_panId; }
// Connect/disconnect the ANT panel to a slice model.
void setSlice(SliceModel* slice);
void setWnbState(bool on, int level);
void syncWnbState(bool on, int level, bool updating);
void setRfGain(int gain);
void setRfGainRange(int low, int high, int step);
void syncNoiseFloorPosition(int pos);
// Populate XVTR band sub-panel
struct XvtrBand { QString name; double rfFreqMhz; };
void setXvtrBands(const QVector<XvtrBand>& bands);
// Surface the connected radio's built-in transverter bands (4m on
// FLEX-6500 Region 1, 4m + 2m on FLEX-6700) in the band menu. Pass
// a default-constructed value when disconnected — the conditional
// VHF row will disappear. Triggers a band-panel rebuild. (#695)
void setRadioCapabilities(ModelCapabilities caps);
void syncDaxIqChannel(int channel);
// DSP button accessors and the DSP sub-panel were removed — radio-
// side DSP lives on VfoWidget only, client-side DSP lives on the
// AetherDSP applet only.
protected:
bool eventFilter(QObject* obj, QEvent* event) override;
void wheelEvent(QWheelEvent* event) override { event->accept(); }
void mousePressEvent(QMouseEvent* event) override { event->accept(); }
void mouseReleaseEvent(QMouseEvent* event) override { event->accept(); }
signals:
void addRxClicked(const QString& panId);
void addTnfClicked();
void memoryActivated(int memoryIndex, const QString& panId);
void quickAddMemoryRequested(const QString& panId);
void daxIqChannelChanged(int channel); // 0=Off, 1-4
void addPanClicked();
void daxClicked();
// DSP-related signals (nr2Toggled / rn2Toggled / bnrToggled /
// nr4Toggled / mnrToggled / dfnrToggled / bnrIntensityChanged /
// *RightClicked) were removed with the overlay's DSP panel.
// Display sub-panel signals
void fftAverageChanged(int frames);
void fftFpsChanged(int fps);
void fftWeightedAverageChanged(bool on);
void fftFillAlphaChanged(float alpha);
void fftFillColorChanged(const QColor& color);
void fftHeatMapChanged(bool on);
void showGridChanged(bool on);
void freqGridSpacingChanged(int khz);
void fftLineWidthChanged(float width);
void wfColorGainChanged(int gain);
void wfBlackLevelChanged(int level);
void wfAutoBlackChanged(bool on);
// Auto-black target offset (0-100, 50 = at noise floor). Emitted when
// the Black slider moves while AUTO is engaged.
void wfAutoBlackOffsetChanged(int offset);
void wfLineDurationChanged(int ms);
void wfColorSchemeChanged(int scheme);
void noiseFloorPositionChanged(int pos);
void noiseFloorEnableChanged(bool on);
// Emitted when user selects a band from the sub-panel.
void bandSelected(const QString& bandName, double freqMhz, const QString& mode);
// Emitted when user clicks XVTR button to open Radio Setup XVTR tab.
void xvtrSetupRequested();
// Emitted when WNB toggle changes.
void wnbToggled(bool on);
// Emitted when WNB level slider changes (0–100).
void wnbLevelChanged(int level);
// Emitted when RF gain slider changes (panadapter-level).
void rfGainChanged(int gain);
void swrSweepStartRequested(int sliceId, int sweepPowerWatts);
void swrSweepClearRequested();
// NB Waterfall Blanker (#277)
void wfBlankerEnabledChanged(bool on);
void wfBlankerThresholdChanged(float threshold);
void backgroundImageRequested();
void backgroundImageCleared();
void backgroundOpacityChanged(int pct);
void displaySettingsReset();
private:
QString m_panId;
void toggle();
void updateLayout();
void toggleBandPanel();
void buildBandPanel();
void toggleAntPanel();
void buildAntPanel();
void toggleDaxPanel();
void buildDaxPanel();
void syncDaxPanel();
void toggleDisplayPanel();
void buildDisplayPanel();
void toggleMemoryPanel();
void buildMemoryPanel();
void hideAllSubPanels();
void showBandPanelAt(const QPoint& pos);
void syncAntPanel();
void refreshAntennaCombo();
void setRxAntennaComboToken(const QString& token);
static constexpr int kBtnAddRx = 0;
static constexpr int kBtnAddTnf = 1;
static constexpr int kBtnBand = 2;
static constexpr int kBtnAnt = 3;
static constexpr int kBtnDisplay = 4;
static constexpr int kBtnMemoryBrowse = 5;
static constexpr int kBtnDax = 6;
QPushButton* m_toggleBtn{nullptr};
QVector<QPushButton*> m_menuBtns;
bool m_expanded{true};
// Band sub-panel (shown to the right of the menu)
QWidget* m_bandPanel{nullptr};
bool m_bandPanelVisible{false};
QWidget* m_xvtrPanel{nullptr};
bool m_xvtrPanelVisible{false};
QVector<QPushButton*> m_xvtrBandBtns;
// Cached state for band-panel rebuilds — setXvtrBands() and
// setRadioCapabilities() each store their argument and trigger
// a rebuild so either input changing produces a correct panel
// without the caller needing to re-supply the other half. (#695)
QVector<XvtrBand> m_lastXvtrBands;
ModelCapabilities m_radioCapabilities;
// ANT sub-panel
QWidget* m_antPanel{nullptr};
bool m_antPanelVisible{false};
QComboBox* m_rxAntCmb{nullptr};
QSlider* m_rfGainSlider{nullptr};
QLabel* m_rfGainLabel{nullptr};
QPushButton* m_wnbBtn{nullptr};
QSlider* m_wnbSlider{nullptr};
QLabel* m_wnbLabel{nullptr};
QPushButton* m_swrStartBtn{nullptr};
QPushButton* m_swrClearBtn{nullptr};
// DAX sub-panel
QWidget* m_daxPanel{nullptr};
bool m_daxPanelVisible{false};
QComboBox* m_daxIqCmb{nullptr};
// Memory browse sub-panel
MemoryBrowsePanel* m_memoryPanel{nullptr};
bool m_memoryPanelVisible{false};
// Display sub-panel
QWidget* m_displayPanel{nullptr};
bool m_displayPanelVisible{false};
QSlider* m_avgSlider{nullptr};
QLabel* m_avgLabel{nullptr};
QSlider* m_fpsSlider{nullptr};
QLabel* m_fpsLabel{nullptr};
QSlider* m_fillSlider{nullptr};
QLabel* m_fillLabel{nullptr};
QPushButton* m_fillColorBtn{nullptr};
QColor m_fillColor{0x00, 0xe5, 0xff}; // default cyan
QPushButton* m_heatMapBtn{nullptr};
QPushButton* m_showGridBtn{nullptr};
QSlider* m_lineWidthSlider{nullptr};
QLabel* m_lineWidthLabel{nullptr};
QPushButton* m_weightedAvgBtn{nullptr};
QSlider* m_gainSlider{nullptr};
QLabel* m_gainLabel{nullptr};
QSlider* m_blackSlider{nullptr};
QLabel* m_blackLabel{nullptr};
QPushButton* m_autoBlackBtn{nullptr};
// Two values backing the single Black slider; the slider shows whichever
// matches the current AUTO state. Toggling AUTO swaps the displayed
// value, edits route to the matching member + matching signal.
int m_blackManualValue{15};
int m_blackAutoOffsetValue{50};
QComboBox* m_colorSchemeCmb{nullptr};
QSlider* m_rateSlider{nullptr};
QLabel* m_rateLabel{nullptr};
// NB Waterfall Blanker (#277)
QPushButton* m_wfBlankerBtn{nullptr};
QSlider* m_wfBlankerThreshSlider{nullptr};
QLabel* m_wfBlankerThreshLabel{nullptr};
QSlider* m_floorSlider{nullptr};
QLabel* m_floorLabel{nullptr};
QPushButton* m_floorEnableBtn{nullptr};
QComboBox* m_freqGridSpacingCmb{nullptr};
QSlider* m_bgOpacitySlider{nullptr};
QLabel* m_bgOpacityLabel{nullptr};
QStringList m_antList;
RadioModel* m_radioModel{nullptr};
QPointer<SliceModel> m_slice;
bool m_updatingFromModel{false};
int m_lastEmittedRfGain{INT_MIN}; // dedupe rfgain emits across drag snap ticks (#1498)
};
} // namespace AetherSDR