OpenHantek
HorizontalDock.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 
8 #include <vector>
9 
11 #include "hantekdso/enums.h"
12 
13 class QLabel;
14 class QCheckBox;
15 class QComboBox;
16 
17 class SiSpinBox;
18 
19 struct DsoSettingsScope;
20 // struct ControlSpecification;
21 
22 Q_DECLARE_METATYPE( std::vector< unsigned > )
23 Q_DECLARE_METATYPE( std::vector< double > )
24 
25 class HorizontalDock : public QDockWidget {
28  Q_OBJECT
29 
30  public:
35  HorizontalDock( DsoSettingsScope *scope, const Dso::ControlSpecification *spec, QWidget *parent );
36 
39  double setSamplerate( double samplerate );
42  double setTimebase( double timebase );
45  void setRecordLength( unsigned int recordLength );
49  int setFormat( Dso::GraphFormat format );
53  void setSamplerateLimits( double minimum, double maximum );
56  void setSamplerateSteps( int mode, QList< double > sampleSteps );
57  void calculateSamplerateSteps( double timebase );
60  double setCalfreq( double calfreq );
61 
62  public slots:
66 
67  protected:
68  void closeEvent( QCloseEvent *event );
69  QGridLayout *dockLayout;
70  QWidget *dockWidget;
71  QLabel *samplerateLabel;
72  QLabel *timebaseLabel;
73  QLabel *formatLabel;
74  QLabel *calfreqLabel;
77  QComboBox *formatComboBox;
78  QComboBox *calfreqComboBox;
80 
82  QList< double > timebaseSteps;
83  QList< double > calfreqSteps;
84  QList< double > samplerateSteps;
85 
86  QStringList formatStrings;
87 
88  protected slots:
89  void samplerateSelected( double samplerate );
90  void timebaseSelected( double timebase );
91  void formatSelected( int index );
92  void calfreqIndexSelected( int index );
93 
94  private:
95  double samplerateRequest = 0;
96 
97  signals:
98  void samplerateChanged( double samplerate );
99  void timebaseChanged( double timebase );
100  void recordLengthChanged( unsigned long recordLength );
101  void formatChanged( Dso::GraphFormat format );
102  void calfreqChanged( double calfreq );
103 };
void samplerateChanged(double samplerate)
The samplerate has been changed.
double samplerateRequest
Definition: HorizontalDock.h:95
void formatSelected(int index)
Called when the format combo box changes its value.
Definition: HorizontalDock.cpp:255
SiSpinBox * samplerateSiSpinBox
Selects the samplerate for aquisitions.
Definition: HorizontalDock.h:75
void calculateSamplerateSteps(double timebase)
Definition: HorizontalDock.cpp:220
QList< double > timebaseSteps
Steps for the timebase spinbox.
Definition: HorizontalDock.h:82
HorizontalDock(DsoSettingsScope *scope, const Dso::ControlSpecification *spec, QWidget *parent)
Initializes the horizontal axis docking window.
Definition: HorizontalDock.cpp:29
void loadSettings(DsoSettingsScope *scope)
Loads settings into GUI.
Definition: HorizontalDock.cpp:95
QLabel * calfreqLabel
The label for the calibration frequency spinbox.
Definition: HorizontalDock.h:74
double setTimebase(double timebase)
Changes the timebase.
Definition: HorizontalDock.cpp:124
void calfreqIndexSelected(int index)
Called when the calfreq combobox changes its value.
Definition: HorizontalDock.cpp:265
void setRecordLength(unsigned int recordLength)
Changes the record length if the new value is supported.
QLabel * timebaseLabel
The label for the timebase spinbox.
Definition: HorizontalDock.h:72
void formatChanged(Dso::GraphFormat format)
The viewing format has been changed.
void timebaseChanged(double timebase)
The timebase has been changed.
GraphFormat
The possible viewing formats for the graphs on the scope.
Definition: enums.h:18
QStringList formatStrings
Strings for the formats.
Definition: HorizontalDock.h:86
QLabel * samplerateLabel
The label for the samplerate spinbox.
Definition: HorizontalDock.h:71
int setFormat(Dso::GraphFormat format)
Changes the format if the new value is supported.
Definition: HorizontalDock.cpp:142
QList< double > calfreqSteps
Steps for the calfreq spinbox.
Definition: HorizontalDock.h:83
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:211
double setSamplerate(double samplerate)
Changes the samplerate.
Definition: HorizontalDock.cpp:112
Stores the specifications of the currently connected device.
Definition: controlspecification.h:42
void closeEvent(QCloseEvent *event)
Don&#39;t close the dock, just hide it.
Definition: HorizontalDock.cpp:106
QComboBox * calfreqComboBox
Selects the calibration frequency.
Definition: HorizontalDock.h:79
QWidget * dockWidget
The main widget for the dock window.
Definition: HorizontalDock.h:70
void calfreqChanged(double calfreq)
The timebase has been changed.
QGridLayout * dockLayout
The main layout for the dock window.
Definition: HorizontalDock.h:69
QList< double > samplerateSteps
Possible sampe rates.
Definition: HorizontalDock.h:84
void samplerateSelected(double samplerate)
Called when the samplerate spinbox changes its value.
Definition: HorizontalDock.cpp:201
Holds the settings for the oscilloscope.
Definition: scopesettings.h:82
void setSamplerateSteps(int mode, QList< double > sampleSteps)
Updates the mode and steps of the samplerate spin box.
Definition: HorizontalDock.cpp:178
double setCalfreq(double calfreq)
Changes the calibration frequency.
Definition: HorizontalDock.cpp:154
Dock window for the horizontal axis. It contains the settings for the timebase and the display format...
Definition: HorizontalDock.h:27
SiSpinBox * timebaseSiSpinBox
Selects the timebase for voltage graphs.
Definition: HorizontalDock.h:76
void setSamplerateLimits(double minimum, double maximum)
Updates the minimum and maximum of the samplerate spin box.
Definition: HorizontalDock.cpp:167
QLabel * formatLabel
The label for the format combobox.
Definition: HorizontalDock.h:73
DsoSettingsScope * scope
The settings provided by the parent class.
Definition: HorizontalDock.h:81
QComboBox * formatComboBox
Definition: HorizontalDock.h:77
void recordLengthChanged(unsigned long recordLength)
The recordd length has been changed.