OpenHantek
SpectrumDock.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 "scopesettings.h"
9 
10 class QLabel;
11 class QCheckBox;
12 class QComboBox;
13 
14 class SiSpinBox;
15 
19 class SpectrumDock : public QDockWidget {
20  Q_OBJECT
21 
22  public:
27  SpectrumDock( DsoSettingsScope *scope, QWidget *parent );
28 
33  int setMagnitude( ChannelID channel, double magnitude );
34 
39  unsigned setUsed( ChannelID channel, bool used );
40 
43  void enableSpectrum( bool enabled );
44 
47  void setFrequencybase( double timebase );
48 
49  public slots:
53 
56  void setSamplerate( double samplerate );
57 
58  private slots:
59  void frequencybaseSelected( double frequencybase );
60 
61  protected:
62  void closeEvent( QCloseEvent *event );
63 
64  QGridLayout *dockLayout;
65  QWidget *dockWidget;
66 
67  struct ChannelBlock {
68  QCheckBox *usedCheckBox;
69  QComboBox *magnitudeComboBox;
70  };
71 
72  std::vector< ChannelBlock > channelBlocks;
73 
75 
76  std::vector< double > magnitudeSteps;
77  QStringList magnitudeStrings;
80 
81  signals:
82  void magnitudeChanged( ChannelID channel, double magnitude );
83  void usedChanged( ChannelID channel, bool used );
84  void frequencybaseChanged( double frequencybase );
85 };
void usedChanged(ChannelID channel, bool used)
A spectrum has been enabled/disabled.
void magnitudeChanged(ChannelID channel, double magnitude)
A magnitude has been selected.
Definition: SpectrumDock.h:67
unsigned setUsed(ChannelID channel, bool used)
Enables/disables a channel.
Definition: SpectrumDock.cpp:129
QWidget * dockWidget
The main widget for the dock window.
Definition: SpectrumDock.h:65
std::vector< double > magnitudeSteps
The selectable magnitude steps in dB/div.
Definition: SpectrumDock.h:76
QCheckBox * usedCheckBox
Enable/disable a specific channel.
Definition: SpectrumDock.h:68
QLabel * frequencybaseLabel
The label for the frequencybase spinbox.
Definition: SpectrumDock.h:78
QComboBox * magnitudeComboBox
Select the vertical magnitude for the spectrums.
Definition: SpectrumDock.h:69
QGridLayout * dockLayout
The main layout for the dock window.
Definition: SpectrumDock.h:64
void frequencybaseSelected(double frequencybase)
Called when the frequencybase spinbox changes its value.
Definition: SpectrumDock.cpp:177
SpectrumDock(DsoSettingsScope *scope, QWidget *parent)
Initializes the spectrum view docking window.
Definition: SpectrumDock.cpp:28
int setMagnitude(ChannelID channel, double magnitude)
Sets the magnitude for a channel.
Definition: SpectrumDock.cpp:111
SiSpinBox * frequencybaseSiSpinBox
Selects the frequencybase for spectrum graphs.
Definition: SpectrumDock.h:79
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
DsoSettingsScope * scope
The settings provided by the parent class.
Definition: SpectrumDock.h:74
void loadSettings(DsoSettingsScope *scope)
Loads settings into GUI.
Definition: SpectrumDock.cpp:90
unsigned ChannelID
Definition: types.h:6
Holds the settings for the oscilloscope.
Definition: scopesettings.h:82
Dock window for the spectrum view. It contains the magnitude for all channels and allows to enable/di...
Definition: SpectrumDock.h:19
std::vector< ChannelBlock > channelBlocks
Definition: SpectrumDock.h:72
void enableSpectrum(bool enabled)
Enables/disables all channels.
Definition: SpectrumDock.cpp:142
QStringList magnitudeStrings
String representations for the magnitude steps.
Definition: SpectrumDock.h:77
void setSamplerate(double samplerate)
Called when the samplerate from horizontal dock changes its value.
Definition: SpectrumDock.cpp:157
void closeEvent(QCloseEvent *event)
Don&#39;t close the dock, just hide it.
Definition: SpectrumDock.cpp:105
void frequencybaseChanged(double frequencybase)
The frequencybase has been changed.
void setFrequencybase(double timebase)
Changes the frequencybase.
Definition: SpectrumDock.cpp:167