Skip to content

Commit c3d2f9f

Browse files
author
David Graeff
committed
Split settings files
1 parent 4672a44 commit c3d2f9f

File tree

4 files changed

+116
-134
lines changed

4 files changed

+116
-134
lines changed

openhantek/src/scopesettings.h

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#pragma once
2+
3+
#include "definitions.h"
4+
#include <QList>
5+
6+
////////////////////////////////////////////////////////////////////////////////
7+
/// \struct DsoSettingsScopeHorizontal settings.h
8+
/// \brief Holds the settings for the horizontal axis.
9+
struct DsoSettingsScopeHorizontal {
10+
Dso::GraphFormat format; ///< Graph drawing mode of the scope
11+
double frequencybase; ///< Frequencybase in Hz/div
12+
double marker[MARKER_COUNT]; ///< Marker positions in div
13+
bool marker_visible[MARKER_COUNT];
14+
double timebase; ///< Timebase in s/div
15+
unsigned int recordLength; ///< Sample count
16+
double samplerate; ///< The samplerate of the oscilloscope in S
17+
bool samplerateSet; ///< The samplerate was set by the user, not the timebase
18+
};
19+
20+
////////////////////////////////////////////////////////////////////////////////
21+
/// \struct DsoSettingsScopeTrigger settings.h
22+
/// \brief Holds the settings for the trigger.
23+
struct DsoSettingsScopeTrigger {
24+
bool filter; ///< Not sure what this is good for...
25+
Dso::TriggerMode mode; ///< Automatic, normal or single trigger
26+
double position; ///< Horizontal position for pretrigger
27+
Dso::Slope slope; ///< Rising or falling edge causes trigger
28+
unsigned int source; ///< Channel that is used as trigger source
29+
bool special; ///< true if the trigger source is not a standard channel
30+
};
31+
32+
////////////////////////////////////////////////////////////////////////////////
33+
/// \struct DsoSettingsScopeSpectrum settings.h
34+
/// \brief Holds the settings for the spectrum analysis.
35+
struct DsoSettingsScopeSpectrum {
36+
double magnitude; ///< The vertical resolution in dB/div
37+
QString name; ///< Name of this channel
38+
double offset; ///< Vertical offset in divs
39+
bool used; ///< true if the spectrum is turned on
40+
};
41+
42+
////////////////////////////////////////////////////////////////////////////////
43+
/// \struct DsoSettingsScopeVoltage settings.h
44+
/// \brief Holds the settings for the normal voltage graphs.
45+
struct DsoSettingsScopeVoltage {
46+
double gain; ///< The vertical resolution in V/div
47+
int misc; ///< Different enums, coupling for real- and mode for math-channels
48+
QString name; ///< Name of this channel
49+
double offset; ///< Vertical offset in divs
50+
double trigger; ///< Trigger level in V
51+
bool used; ///< true if this channel is enabled
52+
};
53+
54+
////////////////////////////////////////////////////////////////////////////////
55+
/// \struct DsoSettingsScope settings.h
56+
/// \brief Holds the settings for the oscilloscope.
57+
struct DsoSettingsScope {
58+
DsoSettingsScopeHorizontal horizontal; ///< Settings for the horizontal axis
59+
DsoSettingsScopeTrigger trigger; ///< Settings for the trigger
60+
QList<DsoSettingsScopeSpectrum> spectrum; ///< Spectrum analysis settings
61+
QList<DsoSettingsScopeVoltage> voltage; ///< Settings for the normal graphs
62+
63+
unsigned int physicalChannels; ///< Number of real channels (No math etc.)
64+
Dso::WindowFunction spectrumWindow; ///< Window function for DFT
65+
double spectrumReference; ///< Reference level for spectrum in dBm
66+
double spectrumLimit; ///< Minimum magnitude of the spectrum (Avoids peaks)
67+
};
68+

openhantek/src/settings.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ DsoSettings::DsoSettings(QWidget *parent) : QObject(parent) {
8585
this->view.zoom = false;
8686
}
8787

88-
/// \brief Cleans up.
89-
DsoSettings::~DsoSettings() {}
90-
9188
/// \brief Set the number of channels.
9289
/// \param channels The new channel count, that will be applied to lists.
9390
void DsoSettings::setChannelCount(unsigned int channels) {

openhantek/src/settings.h

+4-131
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,12 @@
1-
////////////////////////////////////////////////////////////////////////////////
2-
//
3-
// OpenHantek
4-
/// \file settings.h
5-
/// \brief Declares the DsoSettings class.
6-
//
7-
// Copyright (C) 2010, 2011 Oliver Haag
8-
// oliver.haag@gmail.com
9-
//
10-
// This program is free software: you can redistribute it and/or modify it
11-
// under the terms of the GNU General Public License as published by the Free
12-
// Software Foundation, either version 3 of the License, or (at your option)
13-
// any later version.
14-
//
15-
// This program is distributed in the hope that it will be useful, but WITHOUT
16-
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17-
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18-
// more details.
19-
//
20-
// You should have received a copy of the GNU General Public License along with
21-
// this program. If not, see <http://www.gnu.org/licenses/>.
22-
//
23-
////////////////////////////////////////////////////////////////////////////////
1+
// SPDX-License-Identifier: GPL-2.0+
242

25-
#ifndef SETTINGS_H
26-
#define SETTINGS_H
3+
#pragma once
274

28-
#include <QColor>
29-
#include <QList>
30-
#include <QObject>
31-
#include <QPoint>
325
#include <QSize>
336
#include <QString>
347

35-
#include "definitions.h"
8+
#include "scopesettings.h"
9+
#include "viewsettings.h"
3610

3711
////////////////////////////////////////////////////////////////////////////////
3812
/// \struct DsoSettingsOptions settings.h
@@ -42,104 +16,6 @@ struct DsoSettingsOptions {
4216
QSize imageSize; ///< Size of exported images in pixels
4317
};
4418

45-
////////////////////////////////////////////////////////////////////////////////
46-
/// \struct DsoSettingsScopeHorizontal settings.h
47-
/// \brief Holds the settings for the horizontal axis.
48-
struct DsoSettingsScopeHorizontal {
49-
Dso::GraphFormat format; ///< Graph drawing mode of the scope
50-
double frequencybase; ///< Frequencybase in Hz/div
51-
double marker[MARKER_COUNT]; ///< Marker positions in div
52-
bool marker_visible[MARKER_COUNT];
53-
double timebase; ///< Timebase in s/div
54-
unsigned int recordLength; ///< Sample count
55-
double samplerate; ///< The samplerate of the oscilloscope in S
56-
bool samplerateSet; ///< The samplerate was set by the user, not the timebase
57-
};
58-
59-
////////////////////////////////////////////////////////////////////////////////
60-
/// \struct DsoSettingsScopeTrigger settings.h
61-
/// \brief Holds the settings for the trigger.
62-
struct DsoSettingsScopeTrigger {
63-
bool filter; ///< Not sure what this is good for...
64-
Dso::TriggerMode mode; ///< Automatic, normal or single trigger
65-
double position; ///< Horizontal position for pretrigger
66-
Dso::Slope slope; ///< Rising or falling edge causes trigger
67-
unsigned int source; ///< Channel that is used as trigger source
68-
bool special; ///< true if the trigger source is not a standard channel
69-
};
70-
71-
////////////////////////////////////////////////////////////////////////////////
72-
/// \struct DsoSettingsScopeSpectrum settings.h
73-
/// \brief Holds the settings for the spectrum analysis.
74-
struct DsoSettingsScopeSpectrum {
75-
double magnitude; ///< The vertical resolution in dB/div
76-
QString name; ///< Name of this channel
77-
double offset; ///< Vertical offset in divs
78-
bool used; ///< true if the spectrum is turned on
79-
};
80-
81-
////////////////////////////////////////////////////////////////////////////////
82-
/// \struct DsoSettingsScopeVoltage settings.h
83-
/// \brief Holds the settings for the normal voltage graphs.
84-
struct DsoSettingsScopeVoltage {
85-
double gain; ///< The vertical resolution in V/div
86-
int misc; ///< Different enums, coupling for real- and mode for math-channels
87-
QString name; ///< Name of this channel
88-
double offset; ///< Vertical offset in divs
89-
double trigger; ///< Trigger level in V
90-
bool used; ///< true if this channel is enabled
91-
};
92-
93-
////////////////////////////////////////////////////////////////////////////////
94-
/// \struct DsoSettingsScope settings.h
95-
/// \brief Holds the settings for the oscilloscope.
96-
struct DsoSettingsScope {
97-
DsoSettingsScopeHorizontal horizontal; ///< Settings for the horizontal axis
98-
DsoSettingsScopeTrigger trigger; ///< Settings for the trigger
99-
QList<DsoSettingsScopeSpectrum> spectrum; ///< Spectrum analysis settings
100-
QList<DsoSettingsScopeVoltage> voltage; ///< Settings for the normal graphs
101-
102-
unsigned int physicalChannels; ///< Number of real channels (No math etc.)
103-
Dso::WindowFunction spectrumWindow; ///< Window function for DFT
104-
double spectrumReference; ///< Reference level for spectrum in dBm
105-
double spectrumLimit; ///< Minimum magnitude of the spectrum (Avoids peaks)
106-
};
107-
108-
////////////////////////////////////////////////////////////////////////////////
109-
/// \struct DsoSettingsColorValues settings.h
110-
/// \brief Holds the color values for the oscilloscope screen.
111-
struct DsoSettingsColorValues {
112-
QColor axes; ///< X- and Y-axis and subdiv lines on them
113-
QColor background; ///< The scope background
114-
QColor border; ///< The border of the scope screen
115-
QColor grid; ///< The color of the grid
116-
QColor markers; ///< The color of the markers
117-
QList<QColor> spectrum; ///< The colors of the spectrum graphs
118-
QColor text; ///< The default text color
119-
QList<QColor> voltage; ///< The colors of the voltage graphs
120-
};
121-
122-
////////////////////////////////////////////////////////////////////////////////
123-
/// \struct DsoSettingsViewColor settings.h
124-
/// \brief Holds the settings for the used colors on the screen and on paper.
125-
struct DsoSettingsViewColor {
126-
DsoSettingsColorValues screen; ///< Colors for the screen
127-
DsoSettingsColorValues print; ///< Colors for printout
128-
};
129-
130-
////////////////////////////////////////////////////////////////////////////////
131-
/// \struct DsoSettingsView settings.h
132-
/// \brief Holds all view settings.
133-
struct DsoSettingsView {
134-
DsoSettingsViewColor color; ///< Used colors
135-
bool antialiasing; ///< Antialiasing for the graphs
136-
bool digitalPhosphor; ///< true slowly fades out the previous graphs
137-
int digitalPhosphorDepth; ///< Number of channels shown at one time
138-
Dso::InterpolationMode interpolation; ///< Interpolation mode for the graph
139-
bool screenColorImages; ///< true exports images with screen colors
140-
bool zoom; ///< true if the magnified scope is enabled
141-
};
142-
14319
////////////////////////////////////////////////////////////////////////////////
14420
/// \class DsoSettings settings.h
14521
/// \brief Holds the settings of the program.
@@ -148,7 +24,6 @@ class DsoSettings : public QObject {
14824

14925
public:
15026
DsoSettings(QWidget *parent = 0);
151-
~DsoSettings();
15227

15328
void setChannelCount(unsigned int channels);
15429

@@ -164,5 +39,3 @@ public slots:
16439
int load(const QString &fileName = QString());
16540
int save(const QString &fileName = QString());
16641
};
167-
168-
#endif

openhantek/src/viewsettings.h

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#pragma once
2+
3+
#include "definitions.h"
4+
#include <QColor>
5+
#include <QList>
6+
#include <QObject>
7+
#include <QPoint>
8+
#include <QString>
9+
10+
////////////////////////////////////////////////////////////////////////////////
11+
/// \struct DsoSettingsColorValues settings.h
12+
/// \brief Holds the color values for the oscilloscope screen.
13+
struct DsoSettingsColorValues {
14+
QColor axes; ///< X- and Y-axis and subdiv lines on them
15+
QColor background; ///< The scope background
16+
QColor border; ///< The border of the scope screen
17+
QColor grid; ///< The color of the grid
18+
QColor markers; ///< The color of the markers
19+
QList<QColor> spectrum; ///< The colors of the spectrum graphs
20+
QColor text; ///< The default text color
21+
QList<QColor> voltage; ///< The colors of the voltage graphs
22+
};
23+
24+
////////////////////////////////////////////////////////////////////////////////
25+
/// \struct DsoSettingsViewColor settings.h
26+
/// \brief Holds the settings for the used colors on the screen and on paper.
27+
struct DsoSettingsViewColor {
28+
DsoSettingsColorValues screen; ///< Colors for the screen
29+
DsoSettingsColorValues print; ///< Colors for printout
30+
};
31+
32+
////////////////////////////////////////////////////////////////////////////////
33+
/// \struct DsoSettingsView settings.h
34+
/// \brief Holds all view settings.
35+
struct DsoSettingsView {
36+
DsoSettingsViewColor color; ///< Used colors
37+
bool antialiasing; ///< Antialiasing for the graphs
38+
bool digitalPhosphor; ///< true slowly fades out the previous graphs
39+
int digitalPhosphorDepth; ///< Number of channels shown at one time
40+
Dso::InterpolationMode interpolation; ///< Interpolation mode for the graph
41+
bool screenColorImages; ///< true exports images with screen colors
42+
bool zoom; ///< true if the magnified scope is enabled
43+
};
44+

0 commit comments

Comments
 (0)