OpenHantek
HorizontalDock.h
1 // SPDX-License-Identifier: GPL-2.0+
2 
3 #pragma once
4 
5 #include <QDockWidget>
6 #include <QGridLayout>
7 
8 #include <vector>
9 
10 #include "hantekdso/enums.h"
11 
12 class QLabel;
13 class QCheckBox;
14 class QComboBox;
15 
16 class SiSpinBox;
17 
18 struct DsoSettingsScope;
19 
20 Q_DECLARE_METATYPE(std::vector<unsigned>)
21 Q_DECLARE_METATYPE(std::vector<double>)
22 
23 class HorizontalDock : public QDockWidget {
26  Q_OBJECT
27 
28  public:
33  HorizontalDock(DsoSettingsScope *scope, QWidget *parent, Qt::WindowFlags flags = 0);
34 
37  void setFrequencybase(double timebase);
40  void setSamplerate(double samplerate);
43  double setTimebase(double timebase);
46  void setRecordLength(unsigned int recordLength);
50  int setFormat(Dso::GraphFormat format);
53  void setAvailableRecordLengths(const std::vector<unsigned> &recordLengths);
57  void setSamplerateLimits(double minimum, double maximum);
61  void setSamplerateSteps(int mode, QList<double> sampleSteps);
62 
63  protected:
64  void closeEvent(QCloseEvent *event);
65 
66  QGridLayout *dockLayout;
67  QWidget *dockWidget;
68  QLabel *samplerateLabel;
69  QLabel *timebaseLabel;
72  QLabel *formatLabel;
76  QComboBox *recordLengthComboBox;
77  QComboBox *formatComboBox;
78 
81  QList<double> timebaseSteps;
82 
83  QStringList formatStrings;
84 
85  protected slots:
86  void frequencybaseSelected(double frequencybase);
87  void samplerateSelected(double samplerate);
88  void timebaseSelected(double timebase);
89  void recordLengthSelected(int index);
90  void formatSelected(int index);
91 
92  signals:
93  void frequencybaseChanged(double frequencybase);
94  void samplerateChanged(double samplerate);
95  void timebaseChanged(double timebase);
96  void recordLengthChanged(unsigned long recordLength);
97  void formatChanged(Dso::GraphFormat format);
98 };
void samplerateChanged(double samplerate)
The samplerate has been changed.
void setSamplerate(double samplerate)
Changes the samplerate.
Definition: HorizontalDock.cpp:103
void setFrequencybase(double timebase)
Changes the frequencybase.
Definition: HorizontalDock.cpp:98
void formatSelected(int index)
Called when the format combo box changes its value.
Definition: HorizontalDock.cpp:211
SiSpinBox * samplerateSiSpinBox
Selects the samplerate for aquisitions.
Definition: HorizontalDock.h:73
double setTimebase(double timebase)
Changes the timebase.
Definition: HorizontalDock.cpp:108
void setRecordLength(unsigned int recordLength)
Changes the record length if the new value is supported.
Definition: HorizontalDock.cpp:128
QLabel * timebaseLabel
The label for the timebase spinbox.
Definition: HorizontalDock.h:69
void formatChanged(Dso::GraphFormat format)
The viewing format has been changed.
void timebaseChanged(double timebase)
The timebase has been changed.
HorizontalDock(DsoSettingsScope *scope, QWidget *parent, Qt::WindowFlags flags=0)
Initializes the horizontal axis docking window.
Definition: HorizontalDock.cpp:27
QStringList formatStrings
Strings for the formats.
Definition: HorizontalDock.h:83
QLabel * recordLengthLabel
The label for the record length combobox.
Definition: HorizontalDock.h:71
QComboBox * recordLengthComboBox
Selects the record length for aquisitions.
Definition: HorizontalDock.h:76
QLabel * samplerateLabel
The label for the samplerate spinbox.
Definition: HorizontalDock.h:68
void setAvailableRecordLengths(const std::vector< unsigned > &recordLengths)
Updates the available record lengths in the combo box.
Definition: HorizontalDock.cpp:149
QLabel * frequencybaseLabel
The label for the frequencybase spinbox.
Definition: HorizontalDock.h:70
int setFormat(Dso::GraphFormat format)
Changes the format if the new value is supported.
Definition: HorizontalDock.cpp:139
void frequencybaseChanged(double frequencybase)
The frequencybase 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
void timebaseSelected(double timebase)
Called when the timebase spinbox changes its value.
Definition: HorizontalDock.cpp:196
void closeEvent(QCloseEvent *event)
Don&#39;t close the dock, just hide it.
Definition: HorizontalDock.cpp:92
QWidget * dockWidget
The main widget for the dock window.
Definition: HorizontalDock.h:67
SiSpinBox * frequencybaseSiSpinBox
Selects the frequencybase for spectrum graphs.
Definition: HorizontalDock.h:75
QGridLayout * dockLayout
The main layout for the dock window.
Definition: HorizontalDock.h:66
void samplerateSelected(double samplerate)
Called when the samplerate spinbox changes its value.
Definition: HorizontalDock.cpp:188
void recordLengthSelected(int index)
Called when the record length combo box changes its value.
Definition: HorizontalDock.cpp:204
QList< double > timebaseSteps
Steps for the timebase spinbox.
Definition: HorizontalDock.h:81
Holds the settings for the oscilloscope.
Definition: scopesettings.h:77
void setSamplerateSteps(int mode, QList< double > sampleSteps)
Updates the mode and steps of the samplerate spin box.
Definition: HorizontalDock.cpp:166
Dock window for the horizontal axis. It contains the settings for the timebase and the display format...
Definition: HorizontalDock.h:25
SiSpinBox * timebaseSiSpinBox
Selects the timebase for voltage graphs.
Definition: HorizontalDock.h:74
void setSamplerateLimits(double minimum, double maximum)
Updates the minimum and maximum of the samplerate spin box.
Definition: HorizontalDock.cpp:160
QLabel * formatLabel
The label for the format combobox.
Definition: HorizontalDock.h:72
void frequencybaseSelected(double frequencybase)
Called when the frequencybase spinbox changes its value.
Definition: HorizontalDock.cpp:181
DsoSettingsScope * scope
The settings provided by the parent class.
Definition: HorizontalDock.h:80
QComboBox * formatComboBox
Definition: HorizontalDock.h:77
void recordLengthChanged(unsigned long recordLength)
The recordd length has been changed.