OpenHantek
VoltageDock.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0+
2 
3 #pragma once
4 
5 #include <QDockWidget>
6 #include <QGridLayout>
7 #include <QCheckBox>
8 #include <QComboBox>
9 #include <QLabel>
10 #include <QSpinBox>
11 
12 #include "scopesettings.h"
15 
16 #define ATTENUATION_MIN 1
17 #define ATTENUATION_MAX 1000
18 
19 class SiSpinBox;
20 
24 class VoltageDock : public QDockWidget {
25  Q_OBJECT
26 
27  public:
32  VoltageDock(DsoSettingsScope *scope, const Dso::ControlSpecification* spec, QWidget *parent, Qt::WindowFlags flags = nullptr);
33 
37  void setCoupling(ChannelID channel, unsigned couplingIndex);
38 
42  void setGain(ChannelID channel, unsigned gainStepIndex);
43 
47  void setAttn(ChannelID channel, double attnValue);
48 
51  void setMode(unsigned mathModeIndex);
52 
56  void setUsed(ChannelID channel, bool used);
57 
61  void setInverted(ChannelID channel, bool inverted);
62 
63  public slots:
68 
69  protected:
70  void closeEvent(QCloseEvent *event);
71 
72  QGridLayout *dockLayout;
73  QWidget *dockWidget;
74 
75  struct ChannelBlock {
76  QCheckBox *usedCheckBox;
77  QComboBox *gainComboBox;
78  QComboBox *miscComboBox;
79  QCheckBox *invertCheckBox;
80  QSpinBox *attnSpinBox;
81  };
82 
83  std::vector<ChannelBlock> channelBlocks;
84 
87 
88  QStringList couplingStrings;
89  QStringList modeStrings;
90  QStringList gainStrings;
91  QStringList attnStrings;
92 
93  signals:
94  void couplingChanged(ChannelID channel, Dso::Coupling coupling);
95  void gainChanged(ChannelID channel, double gain);
96  void modeChanged(Dso::MathMode mode);
97  void usedChanged(ChannelID channel, bool used);
98  void probeAttnChanged(ChannelID channel, double probeAttn);
99  void invertedChanged(ChannelID channel, bool inverted);
100 };
void setMode(unsigned mathModeIndex)
Sets the mode for the math channel.
Definition: VoltageDock.cpp:178
std::vector< ChannelBlock > channelBlocks
Definition: VoltageDock.h:83
QStringList couplingStrings
The strings for the couplings.
Definition: VoltageDock.h:88
QWidget * dockWidget
The main widget for the dock window.
Definition: VoltageDock.h:73
QCheckBox * invertCheckBox
Select if the channels should be displayed inverted.
Definition: VoltageDock.h:79
Coupling
The coupling modes for the channels.
Definition: enums.h:27
QStringList attnStrings
String representations for the probe attn steps.
Definition: VoltageDock.h:91
void couplingChanged(ChannelID channel, Dso::Coupling coupling)
A coupling has been selected.
void setUsed(ChannelID channel, bool used)
Enables/disables a channel.
Definition: VoltageDock.cpp:183
QCheckBox * usedCheckBox
Enable/disable a specific channel.
Definition: VoltageDock.h:76
void probeAttnChanged(ChannelID channel, double probeAttn)
A channel probe attenuation has been changed.
QSpinBox * attnSpinBox
Enter the attenuation probe value.
Definition: VoltageDock.h:80
QStringList gainStrings
String representations for the gain steps.
Definition: VoltageDock.h:90
void setCoupling(ChannelID channel, unsigned couplingIndex)
Sets the coupling for a channel.
Definition: VoltageDock.cpp:149
void usedChanged(ChannelID channel, bool used)
A channel has been enabled/disabled.
void gainChanged(ChannelID channel, double gain)
A gain has been selected.
Definition: VoltageDock.h:75
MathMode
The different math modes for the math-channel.
Definition: postprocessingsettings.h:11
QStringList modeStrings
The strings for the math mode.
Definition: VoltageDock.h:89
void invertedChanged(ChannelID channel, bool inverted)
A channel "inverted" has been toggled.
void setInverted(ChannelID channel, bool inverted)
Set channel inverted.
Definition: VoltageDock.cpp:189
QGridLayout * dockLayout
The main layout for the dock window.
Definition: VoltageDock.h:72
void modeChanged(Dso::MathMode mode)
The mode for the math channels has been changed.
A spin box with SI prefix support. This spin box supports the SI prefixes (k/M/G/T) after its value a...
Definition: sispinbox.h:14
Stores the specifications of the currently connected device.
Definition: controlspecification.h:42
void loadSettings(DsoSettingsScope *scope, const Dso::ControlSpecification *spec)
Loads settings into GUI.
Definition: VoltageDock.cpp:125
void closeEvent(QCloseEvent *event)
Don&#39;t close the dock, just hide it.
Definition: VoltageDock.cpp:144
DsoSettingsScope * scope
The settings provided by the parent class.
Definition: VoltageDock.h:85
Dock window for the voltage channel settings. It contains the settings for gain and coupling for both...
Definition: VoltageDock.h:24
unsigned ChannelID
Definition: types.h:6
void setAttn(ChannelID channel, double attnValue)
Sets the probe attenuation for a channel.
Definition: VoltageDock.cpp:163
QComboBox * miscComboBox
Select coupling for real and mode for math channels.
Definition: VoltageDock.h:78
Holds the settings for the oscilloscope.
Definition: scopesettings.h:75
VoltageDock(DsoSettingsScope *scope, const Dso::ControlSpecification *spec, QWidget *parent, Qt::WindowFlags flags=nullptr)
Initializes the vertical axis docking window.
Definition: VoltageDock.cpp:25
void setGain(ChannelID channel, unsigned gainStepIndex)
Sets the gain for a channel.
Definition: VoltageDock.cpp:156
QComboBox * gainComboBox
Select the vertical gain for the channels.
Definition: VoltageDock.h:77
const Dso::ControlSpecification * spec
Definition: VoltageDock.h:86