OpenHantek
Loading...
Searching...
No Matches
dsowidget.h
1// SPDX-License-Identifier: GPL-2.0+
2
3#pragma once
4
5#include <QHBoxLayout>
6#include <QLabel>
7#include <QList>
8#include <QGridLayout>
9#include <memory>
10
11#include "glscope.h"
12#include "levelslider.h"
13#include "hantekdso/controlspecification.h"
14
16struct DsoSettingsScope;
17struct DsoSettingsView;
18class DataGrid;
19
22class DsoWidget : public QWidget {
23 Q_OBJECT
24
25 public:
26
33
39 DsoWidget(DsoSettingsScope* scope, DsoSettingsView* view, const Dso::ControlSpecification* spec, QWidget *parent = 0, Qt::WindowFlags flags = 0);
40
41 // Data arrived
42 void showNew(std::shared_ptr<PPresult> data);
43
44 protected:
45 virtual void showEvent(QShowEvent *event);
46 void setupSliders(Sliders &sliders);
47 void adaptTriggerLevelSlider(DsoWidget::Sliders &sliders, ChannelID channel);
49 void setMeasurementVisible(ChannelID channel);
51 void updateSpectrumDetails(ChannelID channel);
53 void updateVoltageDetails(ChannelID channel);
54
55 double mainToZoom(double position) const;
56 double zoomToMain(double position) const;
57
58 Sliders mainSliders;
59 Sliders zoomSliders;
60
61 QGridLayout *mainLayout;
62
63 QHBoxLayout *settingsLayout;
69
71
72 QHBoxLayout *markerLayout;
78
79 QGridLayout *measurementLayout;
80 std::vector<QLabel *> measurementNameLabel;
81 std::vector<QLabel *> measurementGainLabel;
82 std::vector<QLabel *> measurementMagnitudeLabel;
83 std::vector<QLabel *> measurementMiscLabel;
84 std::vector<QLabel *> measurementAmplitudeLabel;
85 std::vector<QLabel *> measurementFrequencyLabel;
86
87 DataGrid *cursorDataGrid;
88
89 DsoSettingsScope* scope;
90 DsoSettingsView* view;
91 const Dso::ControlSpecification* spec;
92
95
96 public slots:
97 // Horizontal axis
98 // void horizontalFormatChanged(HorizontalFormat format);
99 void updateFrequencybase(double frequencybase);
100 void updateSamplerate(double samplerate);
101 void updateTimebase(double timebase);
102
103 // Trigger
104 void updateTriggerMode();
105 void updateTriggerSlope();
106 void updateTriggerSource();
107
108 // Spectrum
109 void updateSpectrumMagnitude(ChannelID channel);
110 void updateSpectrumUsed(ChannelID channel, bool used);
111
112 // Vertical axis
113 void updateVoltageCoupling(ChannelID channel);
114 void updateMathMode();
115 void updateVoltageGain(ChannelID channel);
116 void updateVoltageUsed(ChannelID channel, bool used);
117
118 // Menus
119 void updateRecordLength(unsigned long size);
120
121 // Scope control
122 void updateZoom(bool enabled);
123 void updateCursorGrid(bool enabled);
124
125 private slots:
126 // Sliders
127 void updateOffset(ChannelID channel, double value);
128 void updateTriggerPosition(int index, double value, bool mainView = true);
129 void updateTriggerLevel(ChannelID channel, double value);
130 void updateMarker(int marker, double value);
131
132 signals:
133 // Sliders
134 void offsetChanged(ChannelID channel, double value);
135 void triggerPositionChanged(double value);
136 void triggerLevelChanged(ChannelID channel, double value);
137};
Definition datagrid.h:14
The widget for the oszilloscope-screen This widget contains the scopes and all level sliders.
Definition dsowidget.h:22
void showNew(std::shared_ptr< PPresult > data)
Prints analyzed data.
Definition dsowidget.cpp:618
QLabel * markerTimebaseLabel
The timebase for the zoomed scope.
Definition dsowidget.h:76
void updateVoltageDetails(ChannelID channel)
Update the label about the trigger settings.
Definition dsowidget.cpp:463
QLabel * markerFrequencybaseLabel
The frequencybase for the zoomed scope.
Definition dsowidget.h:77
QGridLayout * mainLayout
The main layout for this widget.
Definition dsowidget.h:61
GlScope * zoomScope
The optional magnified scope screen.
Definition dsowidget.h:94
QLabel * markerInfoLabel
The info about the zoom factor.
Definition dsowidget.h:73
QLabel * markerTimeLabel
The time period between the markers.
Definition dsowidget.h:74
std::vector< QLabel * > measurementNameLabel
The name of the channel.
Definition dsowidget.h:80
void updateRecordLength(unsigned long size)
Change the record length.
Definition dsowidget.cpp:588
QLabel * settingsFrequencybaseLabel
The frequencybase of the main scope.
Definition dsowidget.h:68
std::vector< QLabel * > measurementGainLabel
The gain for the voltage (V/div)
Definition dsowidget.h:81
std::vector< QLabel * > measurementFrequencyLabel
Frequency of the signal (Hz)
Definition dsowidget.h:85
void updateMarkerDetails()
Update the label about the marker measurements.
Definition dsowidget.cpp:389
QLabel * swTriggerStatus
The status of SW trigger.
Definition dsowidget.h:70
QLabel * settingsSamplerateLabel
The samplerate.
Definition dsowidget.h:66
void updateTriggerDetails()
Update the label about the trigger settings.
Definition dsowidget.cpp:448
QLabel * settingsTriggerLabel
The trigger details.
Definition dsowidget.h:64
void updateSamplerate(double samplerate)
Updates the samplerate field after changing the samplerate.
Definition dsowidget.cpp:482
void offsetChanged(ChannelID channel, double value)
A graph offset has been changed.
void updateTriggerSlope()
Handles slopeChanged signal from the trigger dock.
Definition dsowidget.cpp:517
void updateTriggerMode()
Handles modeChanged signal from the trigger dock.
Definition dsowidget.cpp:514
void triggerLevelChanged(ChannelID channel, double value)
A trigger level has been changed.
DsoWidget(DsoSettingsScope *scope, DsoSettingsView *view, const Dso::ControlSpecification *spec, QWidget *parent=0, Qt::WindowFlags flags=0)
Initializes the components of the oszilloscope-screen.
Definition dsowidget.cpp:29
void updateMathMode()
Handles modeChanged signal from the voltage dock.
Definition dsowidget.cpp:550
std::vector< QLabel * > measurementMagnitudeLabel
The magnitude for the spectrum (dB/div)
Definition dsowidget.h:82
void setMeasurementVisible(ChannelID channel)
Show/Hide a line of the measurement table.
Definition dsowidget.cpp:350
QLabel * settingsRecordLengthLabel
The record length.
Definition dsowidget.h:65
double zoomToMain(double position) const
Translate horizontal position (0..1) from zoom view to main view.
Definition dsowidget.cpp:695
void adaptTriggerLevelSlider(DsoWidget::Sliders &sliders, ChannelID channel)
Set the trigger level sliders minimum and maximum to the new values.
Definition dsowidget.cpp:342
QLabel * markerFrequencyLabel
The frequency for the time period.
Definition dsowidget.h:75
void updateVoltageUsed(ChannelID channel, bool used)
Handles usedChanged signal from the voltage dock.
Definition dsowidget.cpp:571
std::vector< QLabel * > measurementAmplitudeLabel
Amplitude of the signal (V)
Definition dsowidget.h:84
void updateVoltageCoupling(ChannelID channel)
Handles couplingChanged signal from the voltage dock.
Definition dsowidget.cpp:543
void triggerPositionChanged(double value)
The pretrigger has been changed.
void updateSpectrumUsed(ChannelID channel, bool used)
Handles usedChanged signal from the spectrum dock.
Definition dsowidget.cpp:501
QHBoxLayout * settingsLayout
The table for the settings info.
Definition dsowidget.h:63
void adaptTriggerPositionSlider()
Handles signals affecting trigger position in the zoom view.
Definition dsowidget.cpp:703
void updateSpectrumMagnitude(ChannelID channel)
Handles magnitudeChanged signal from the spectrum dock.
Definition dsowidget.cpp:496
void updateTimebase(double timebase)
Handles timebaseChanged signal from the horizontal dock.
Definition dsowidget.cpp:488
std::vector< QLabel * > measurementMiscLabel
Coupling or math mode.
Definition dsowidget.h:83
QHBoxLayout * markerLayout
The table for the marker details.
Definition dsowidget.h:72
GlScope * mainScope
The main scope screen.
Definition dsowidget.h:93
QLabel * settingsTimebaseLabel
The timebase of the main scope.
Definition dsowidget.h:67
double mainToZoom(double position) const
Translate horizontal position (0..1) from main view to zoom view.
Definition dsowidget.cpp:687
QGridLayout * measurementLayout
The table for the signal details.
Definition dsowidget.h:79
void updateZoom(bool enabled)
Show/hide the zoom view.
Definition dsowidget.cpp:593
void updateVoltageGain(ChannelID channel)
Handles gainChanged signal from the voltage dock.
Definition dsowidget.cpp:557
void updateSpectrumDetails(ChannelID channel)
Update the label about the trigger settings.
Definition dsowidget.cpp:437
void updateTriggerSource()
Handles sourceChanged signal from the trigger dock.
Definition dsowidget.cpp:520
void updateFrequencybase(double frequencybase)
Handles frequencybaseChanged signal from the horizontal dock.
Definition dsowidget.cpp:476
OpenGL accelerated widget that displays the oscilloscope screen.
Definition glscope.h:25
Slider widget for multiple level sliders. These are used for the trigger levels, offsets and so on.
Definition levelslider.h:28
Analyzes the data from the dso. Calculates the spectrum and various data about the signal and saves t...
Definition spectrumgenerator.h:24
Holds the settings for the oscilloscope.
Definition scopesettings.h:77
Holds all view settings.
Definition viewsettings.h:30
Definition dsowidget.h:27
LevelSlider * offsetSlider
The sliders for the graph offsets.
Definition dsowidget.h:28
LevelSlider * markerSlider
The sliders for the markers.
Definition dsowidget.h:31
LevelSlider * triggerPositionSlider
The slider for the pretrigger.
Definition dsowidget.h:29
LevelSlider * triggerLevelSlider
The sliders for the trigger level.
Definition dsowidget.h:30
Stores the specifications of the currently connected device.
Definition controlspecification.h:47