dockwindows.h
9.5 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
////////////////////////////////////////////////////////////////////////////////
//
// OpenHantek
/// \file dockwindows.h
/// \brief Declares the docking window classes.
//
// Copyright (C) 2010 Oliver Haag
// oliver.haag@gmail.com
//
// This program 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.
//
// 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 General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program. If not, see <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
#ifndef DOCKWINDOWS_H
#define DOCKWINDOWS_H
#include <QDockWidget>
#include <QGridLayout>
#include "definitions.h"
#include "settings.h"
class QLabel;
class QCheckBox;
class QComboBox;
class SiSpinBox;
////////////////////////////////////////////////////////////////////////////////
/// \class HorizontalDock dockwindows.h
/// \brief Dock window for the horizontal axis.
/// It contains the settings for the timebase and the display format.
class HorizontalDock : public QDockWidget {
Q_OBJECT
public:
HorizontalDock(DsoSettings *settings, QWidget *parent = 0,
Qt::WindowFlags flags = 0);
~HorizontalDock();
void setFrequencybase(double timebase);
void setSamplerate(double samplerate);
double setTimebase(double timebase);
void setRecordLength(unsigned int recordLength);
int setFormat(Dso::GraphFormat format);
protected:
void closeEvent(QCloseEvent *event);
QGridLayout *dockLayout; ///< The main layout for the dock window
QWidget *dockWidget; ///< The main widget for the dock window
QLabel *samplerateLabel; ///< The label for the samplerate spinbox
QLabel *timebaseLabel; ///< The label for the timebase spinbox
QLabel *frequencybaseLabel; ///< The label for the frequencybase spinbox
QLabel *recordLengthLabel; ///< The label for the record length combobox
QLabel *formatLabel; ///< The label for the format combobox
SiSpinBox *samplerateSiSpinBox; ///< Selects the samplerate for aquisitions
SiSpinBox *timebaseSiSpinBox; ///< Selects the timebase for voltage graphs
SiSpinBox *
frequencybaseSiSpinBox; ///< Selects the frequencybase for spectrum graphs
QComboBox
*recordLengthComboBox; ///< Selects the record length for aquisitions
QComboBox *formatComboBox; ///< Selects the way the sampled data is
///interpreted and shown
DsoSettings *settings; ///< The settings provided by the parent class
QList<double> timebaseSteps; ///< Steps for the timebase spinbox
QStringList formatStrings; ///< Strings for the formats
bool suppressSignals; ///< Disable changed-signals temporarily
public slots:
void availableRecordLengthsChanged(const QList<unsigned int> &recordLengths);
void samplerateLimitsChanged(double minimum, double maximum);
void samplerateSet(int mode, QList<double> sampleSteps);
protected slots:
void frequencybaseSelected(double frequencybase);
void samplerateSelected(double samplerate);
void timebaseSelected(double timebase);
void recordLengthSelected(int index);
void formatSelected(int index);
signals:
void frequencybaseChanged(
double frequencybase); ///< The frequencybase has been changed
void
samplerateChanged(double samplerate); ///< The samplerate has been changed
void timebaseChanged(double timebase); ///< The timebase has been changed
void recordLengthChanged(
unsigned long recordLength); ///< The recordd length has been changed
void formatChanged(
Dso::GraphFormat format); ///< The viewing format has been changed
};
////////////////////////////////////////////////////////////////////////////////
/// \class TriggerDock dockwindows.h
/// \brief Dock window for the trigger settings.
/// It contains the settings for the trigger mode, source and slope.
class TriggerDock : public QDockWidget {
Q_OBJECT
public:
TriggerDock(DsoSettings *settings, const QStringList *specialTriggers,
QWidget *parent = 0, Qt::WindowFlags flags = 0);
~TriggerDock();
int setMode(Dso::TriggerMode mode);
int setSource(bool special, unsigned int id);
int setSlope(Dso::Slope slope);
protected:
void closeEvent(QCloseEvent *event);
QGridLayout *dockLayout; ///< The main layout for the dock window
QWidget *dockWidget; ///< The main widget for the dock window
QLabel *modeLabel; ///< The label for the trigger mode combobox
QLabel *sourceLabel; ///< The label for the trigger source combobox
QLabel *slopeLabel; ///< The label for the trigger slope combobox
QComboBox *modeComboBox; ///< Select the triggering mode
QComboBox *sourceComboBox; ///< Select the source for triggering
QComboBox *slopeComboBox; ///< Select the slope that causes triggering
DsoSettings *settings; ///< The settings provided by the parent class
QStringList modeStrings; ///< Strings for the trigger modes
QStringList
sourceStandardStrings; ///< Strings for the standard trigger sources
QStringList sourceSpecialStrings; ///< Strings for the special trigger sources
QStringList slopeStrings; ///< Strings for the trigger slopes
protected slots:
void modeSelected(int index);
void slopeSelected(int index);
void sourceSelected(int index);
signals:
void modeChanged(Dso::TriggerMode); ///< The trigger mode has been changed
void sourceChanged(bool special,
unsigned int id); ///< The trigger source has been changed
void slopeChanged(Dso::Slope); ///< The trigger slope has been changed
};
////////////////////////////////////////////////////////////////////////////////
/// \class VoltageDock dockwindows.h
/// \brief Dock window for the voltage channel settings.
/// It contains the settings for gain and coupling for both channels and
/// allows to enable/disable the channels.
class VoltageDock : public QDockWidget {
Q_OBJECT
public:
VoltageDock(DsoSettings *settings, QWidget *parent = 0,
Qt::WindowFlags flags = 0);
~VoltageDock();
int setCoupling(int channel, Dso::Coupling coupling);
int setGain(int channel, double gain);
int setMode(Dso::MathMode mode);
int setUsed(int channel, bool used);
protected:
void closeEvent(QCloseEvent *event);
QGridLayout *dockLayout; ///< The main layout for the dock window
QWidget *dockWidget; ///< The main widget for the dock window
QList<QCheckBox *> usedCheckBox; ///< Enable/disable a specific channel
QList<QComboBox *>
gainComboBox; ///< Select the vertical gain for the channels
QList<QComboBox *>
miscComboBox; ///< Select coupling for real and mode for math channels
DsoSettings *settings; ///< The settings provided by the parent class
QStringList couplingStrings; ///< The strings for the couplings
QStringList modeStrings; ///< The strings for the math mode
QList<double> gainSteps; ///< The selectable gain steps
QStringList gainStrings; ///< String representations for the gain steps
protected slots:
void gainSelected(int index);
void miscSelected(int index);
void usedSwitched(bool checked);
signals:
void
couplingChanged(unsigned int channel,
Dso::Coupling coupling); ///< A coupling has been selected
void gainChanged(unsigned int channel,
double gain); ///< A gain has been selected
void modeChanged(
Dso::MathMode mode); ///< The mode for the math channels has been changed
void usedChanged(unsigned int channel,
bool used); ///< A channel has been enabled/disabled
};
////////////////////////////////////////////////////////////////////////////////
/// \class SpectrumDock dockwindows.h
/// \brief Dock window for the spectrum view.
/// It contains the magnitude for all channels and allows to enable/disable the
/// channels.
class SpectrumDock : public QDockWidget {
Q_OBJECT
public:
SpectrumDock(DsoSettings *settings, QWidget *parent = 0,
Qt::WindowFlags flags = 0);
~SpectrumDock();
int setMagnitude(int channel, double magnitude);
int setUsed(int channel, bool used);
protected:
void closeEvent(QCloseEvent *event);
QGridLayout *dockLayout; ///< The main layout for the dock window
QWidget *dockWidget; ///< The main widget for the dock window
QList<QCheckBox *> usedCheckBox; ///< Enable/disable spectrum for a channel
QList<QComboBox *>
magnitudeComboBox; ///< Select the vertical magnitude for the spectrums
DsoSettings *settings; ///< The settings provided by the parent class
QList<double> magnitudeSteps; ///< The selectable magnitude steps
QStringList
magnitudeStrings; ///< String representations for the magnitude steps
public slots:
void magnitudeSelected(int index);
void usedSwitched(bool checked);
signals:
void magnitudeChanged(unsigned int channel,
double magnitude); ///< A magnitude has been selected
void usedChanged(unsigned int channel,
bool used); ///< A spectrum has been enabled/disabled
};
#endif