Commit dcd2a3c41fd547dc987f2ffddd748b5690bf6033

Authored by David Graeff
Committed by David Gräff
1 parent 5add000e

Some small changes to widgets

openhantek/src/configdialog/DsoConfigFilesPage.cpp
... ... @@ -11,12 +11,12 @@ DsoConfigFilesPage::DsoConfigFilesPage(DsoSettings *settings, QWidget *parent) :
11 11 imageWidthSpinBox = new QSpinBox();
12 12 imageWidthSpinBox->setMinimum(100);
13 13 imageWidthSpinBox->setMaximum(9999);
14   - imageWidthSpinBox->setValue(settings->options.imageSize.width());
  14 + imageWidthSpinBox->setValue(settings->exporting.imageSize.width());
15 15 imageHeightLabel = new QLabel(tr("Image height"));
16 16 imageHeightSpinBox = new QSpinBox();
17 17 imageHeightSpinBox->setMinimum(100);
18 18 imageHeightSpinBox->setMaximum(9999);
19   - imageHeightSpinBox->setValue(settings->options.imageSize.height());
  19 + imageHeightSpinBox->setValue(settings->exporting.imageSize.height());
20 20  
21 21 exportLayout = new QGridLayout();
22 22 exportLayout->addWidget(screenColorCheckBox, 0, 0, 1, 2);
... ... @@ -30,7 +30,7 @@ DsoConfigFilesPage::DsoConfigFilesPage(DsoSettings *settings, QWidget *parent) :
30 30  
31 31 // Configuration group
32 32 saveOnExitCheckBox = new QCheckBox(tr("Save default settings on exit"));
33   - saveOnExitCheckBox->setChecked(settings->options.alwaysSave);
  33 + saveOnExitCheckBox->setChecked(settings->alwaysSave);
34 34 saveNowButton = new QPushButton(tr("Save default settings now"));
35 35  
36 36 configurationLayout = new QVBoxLayout();
... ... @@ -53,8 +53,8 @@ DsoConfigFilesPage::DsoConfigFilesPage(DsoSettings *settings, QWidget *parent) :
53 53  
54 54 /// \brief Saves the new settings.
55 55 void DsoConfigFilesPage::saveSettings() {
56   - settings->options.alwaysSave = saveOnExitCheckBox->isChecked();
  56 + settings->alwaysSave = saveOnExitCheckBox->isChecked();
57 57 settings->view.screenColorImages = screenColorCheckBox->isChecked();
58   - settings->options.imageSize.setWidth(imageWidthSpinBox->value());
59   - settings->options.imageSize.setHeight(imageHeightSpinBox->value());
  58 + settings->exporting.imageSize.setWidth(imageWidthSpinBox->value());
  59 + settings->exporting.imageSize.setHeight(imageHeightSpinBox->value());
60 60 }
... ...
openhantek/src/docks/TriggerDock.cpp
... ... @@ -12,32 +12,30 @@
12 12 #include "TriggerDock.h"
13 13 #include "dockwindows.h"
14 14  
  15 +#include "hantekdso/controlspecification.h"
15 16 #include "settings.h"
16 17 #include "sispinbox.h"
17 18 #include "utils/dsoStrings.h"
18 19 #include "utils/printutils.h"
19   -#include "hantekdso/controlspecification.h"
20 20  
21   -TriggerDock::TriggerDock(DsoSettingsScope *scope, const Dso::ControlSpecification* spec, QWidget *parent,
  21 +TriggerDock::TriggerDock(DsoSettingsScope *scope, const Dso::ControlSpecification *spec, QWidget *parent,
22 22 Qt::WindowFlags flags)
23   - : QDockWidget(tr("Trigger"), parent, flags), scope(scope), spec(spec) {
  23 + : QDockWidget(tr("Trigger"), parent, flags), scope(scope), mSpec(spec) {
24 24  
25 25 // Initialize lists for comboboxes
26   - for (ChannelID channel = 0; channel < spec->channels; ++channel)
  26 + for (ChannelID channel = 0; channel < mSpec->channels; ++channel)
27 27 this->sourceStandardStrings << tr("CH%1").arg(channel + 1);
28   - for(const Dso::SpecialTriggerChannel& specialTrigger: spec->specialTriggerChannels)
  28 + for (const Dso::SpecialTriggerChannel &specialTrigger : mSpec->specialTriggerChannels)
29 29 this->sourceSpecialStrings.append(QString::fromStdString(specialTrigger.name));
30 30  
31 31 // Initialize elements
32 32 this->modeLabel = new QLabel(tr("Mode"));
33 33 this->modeComboBox = new QComboBox();
34   - for (Dso::TriggerMode mode: spec->triggerModes)
35   - this->modeComboBox->addItem(Dso::triggerModeString(mode));
  34 + for (Dso::TriggerMode mode : mSpec->triggerModes) this->modeComboBox->addItem(Dso::triggerModeString(mode));
36 35  
37 36 this->slopeLabel = new QLabel(tr("Slope"));
38 37 this->slopeComboBox = new QComboBox();
39   - for (Dso::Slope slope: Dso::SlopeEnum)
40   - this->slopeComboBox->addItem(Dso::slopeString(slope));
  38 + for (Dso::Slope slope : Dso::SlopeEnum) this->slopeComboBox->addItem(Dso::slopeString(slope));
41 39  
42 40 this->sourceLabel = new QLabel(tr("Source"));
43 41 this->sourceComboBox = new QComboBox();
... ... @@ -63,26 +61,29 @@ TriggerDock::TriggerDock(DsoSettingsScope *scope, const Dso::ControlSpecificatio
63 61 setSource(scope->trigger.special, scope->trigger.source);
64 62  
65 63 // Connect signals and slots
66   - connect(this->modeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this,spec](int index) {
67   - this->scope->trigger.mode = spec->triggerModes[(unsigned)index];
68   - emit modeChanged(this->scope->trigger.mode);
69   - });
70   - connect(this->slopeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this](int index) {
71   - this->scope->trigger.slope = (Dso::Slope)index;
72   - emit slopeChanged(this->scope->trigger.slope);
73   - });
74   - connect(this->sourceComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this](int index) {
75   - bool special = false;
76   -
77   - if (index >= this->sourceStandardStrings.count()) {
78   - index -= this->sourceStandardStrings.count();
79   - special = true;
80   - }
81   -
82   - this->scope->trigger.source = (unsigned) index;
83   - this->scope->trigger.special = special;
84   - emit sourceChanged(special, (unsigned)index);
85   - });
  64 + connect(this->modeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  65 + [this, spec](int index) {
  66 + this->scope->trigger.mode = mSpec->triggerModes[(unsigned)index];
  67 + emit modeChanged(this->scope->trigger.mode);
  68 + });
  69 + connect(this->slopeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  70 + [this](int index) {
  71 + this->scope->trigger.slope = (Dso::Slope)index;
  72 + emit slopeChanged(this->scope->trigger.slope);
  73 + });
  74 + connect(this->sourceComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
  75 + [this](int index) {
  76 + bool special = false;
  77 +
  78 + if (index >= this->sourceStandardStrings.count()) {
  79 + index -= this->sourceStandardStrings.count();
  80 + special = true;
  81 + }
  82 +
  83 + this->scope->trigger.source = (unsigned)index;
  84 + this->scope->trigger.special = special;
  85 + emit sourceChanged(special, (unsigned)index);
  86 + });
86 87 }
87 88  
88 89 /// \brief Don't close the dock, just hide it
... ... @@ -94,7 +95,7 @@ void TriggerDock::closeEvent(QCloseEvent *event) {
94 95 }
95 96  
96 97 void TriggerDock::setMode(Dso::TriggerMode mode) {
97   - int index = std::find(spec->triggerModes.begin(),spec->triggerModes.end(), mode) - spec->triggerModes.begin();
  98 + int index = std::find(mSpec->triggerModes.begin(), mSpec->triggerModes.end(), mode) - mSpec->triggerModes.begin();
98 99 QSignalBlocker blocker(modeComboBox);
99 100 modeComboBox->setCurrentIndex(index);
100 101 }
... ...
openhantek/src/docks/TriggerDock.h
... ... @@ -11,7 +11,7 @@
11 11 #include "hantekdso/enums.h"
12 12  
13 13 class SiSpinBox;
14   -class DsoSettingsScope;
  14 +struct DsoSettingsScope;
15 15 namespace Dso {
16 16 struct ControlSpecification;
17 17 }
... ... @@ -27,7 +27,7 @@ class TriggerDock : public QDockWidget {
27 27 /// \param spec
28 28 /// \param parent The parent widget.
29 29 /// \param flags Flags for the window manager.
30   - TriggerDock(DsoSettingsScope *scope, const Dso::ControlSpecification* spec, QWidget *parent, Qt::WindowFlags flags = 0);
  30 + TriggerDock(DsoSettingsScope *scope, const Dso::ControlSpecification* mSpec, QWidget *parent, Qt::WindowFlags flags = 0);
31 31  
32 32 /// \brief Changes the trigger mode if the new mode is supported.
33 33 /// \param mode The trigger mode.
... ... @@ -55,7 +55,7 @@ class TriggerDock : public QDockWidget {
55 55 QComboBox *slopeComboBox; ///< Select the slope that causes triggering
56 56  
57 57 DsoSettingsScope *scope; ///< The settings provided by the parent class
58   - const Dso::ControlSpecification* spec;
  58 + const Dso::ControlSpecification* mSpec;
59 59  
60 60 QStringList sourceStandardStrings; ///< Strings for the standard trigger sources
61 61 QStringList sourceSpecialStrings; ///< Strings for the special trigger sources
... ...
openhantek/src/docks/dockwindows.cpp
... ... @@ -8,9 +8,9 @@
8 8  
9 9 #include <cmath>
10 10  
11   -#include "analyse/enums.h"
  11 +#include "post/enums.h"
12 12 #include "hantekdso/enums.h"
13   -#include "hantekprotocol/definitions.h"
  13 +#include "hantekprotocol/types.h"
14 14 #include "dockwindows.h"
15 15  
16 16 void SetupDockWidget(QDockWidget *dockWindow, QWidget *dockWidget, QLayout *layout) {
... ...