-
Notifications
You must be signed in to change notification settings - Fork 0
/
DopplerTool.h
132 lines (107 loc) · 3.5 KB
/
DopplerTool.h
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
//
// DopplerTool.h: description
// Copyright (C) 2023 Gonzalo José Carracedo Carballal
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program. If not, see
// <http://www.gnu.org/licenses/>
//
#ifndef DOPPLERTOOL_H
#define DOPPLERTOOL_H
#include <DopplerToolFactory.h>
#include <QWidget>
#include <WFHelpers.h>
namespace Ui {
class DopplerTool;
}
namespace Suscan {
class AnalyzerRequestTracker;
struct AnalyzerRequest;
}
namespace SigDigger {
class MainSpectrum;
class ChirpCorrector;
class GlobalProperty;
class DopplerToolConfig : public Suscan::Serializable {
public:
bool collapsed = false;
double velocity = 0;
double accel = 0;
double bias = 0;
bool enabled = false;
// Overriden methods
void deserialize(Suscan::Object const &conf) override;
Suscan::Object &&serialize() override;
};
class DopplerTool : public ToolWidget
{
Q_OBJECT
DopplerToolConfig *m_panelConfig = nullptr;
Suscan::Analyzer *m_analyzer = nullptr;
MainSpectrum *m_spectrum = nullptr;
ChirpCorrector *m_corrector = nullptr;
// Global properties
static bool g_propsCreated;
GlobalProperty *m_propShift = nullptr;
GlobalProperty *m_propRate = nullptr;
GlobalProperty *m_propBias = nullptr;
GlobalProperty *m_propAccel = nullptr;
GlobalProperty *m_propVel = nullptr;
GlobalProperty *m_propCorr = nullptr;
GlobalProperty *m_propEnabled = nullptr;
GlobalProperty *m_propReset = nullptr;
// This is what is actually passed to the corrector
qreal m_currResetFreq = 0;
qreal m_currRate = 0;
qreal m_correctedRate = 0;
void refreshUi();
void connectAll();
void applySpectrumState();
void setFromVelocity(qreal);
void setFromShift(qreal);
void setFromAccel(qreal);
void setFromRate(qreal);
public:
explicit DopplerTool(DopplerToolFactory *, UIMediator *, QWidget *parent = nullptr);
~DopplerTool() override;
// Configuration methods
Suscan::Serializable *allocConfig() override;
void applyConfig() override;
bool event(QEvent *) override;
// Overriden methods
void setState(int, Suscan::Analyzer *) override;
void setQth(Suscan::Location const &) override;
void setColorConfig(ColorConfig const &) override;
void setTimeStamp(struct timeval const &) override;
void setProfile(Suscan::Source::Config &) override;
public slots:
void onVelChanged();
void onAccelChanged();
void onShiftChanged();
void onRateChanged();
void onBiasChanged();
void onPropVelChanged();
void onPropAccelChanged();
void onPropShiftChanged();
void onPropRateChanged();
void onPropBiasChanged();
void onPropEnabledChanged();
void onPropResetChanged();
void onReset();
void onToggleEnabled();
void onFrequencyChanged();
private:
Ui::DopplerTool *ui;
};
}
#endif // DOPPLERTOOL_H