##// END OF EJS Templates
Removes max limit on tolerance settings
Alexandre Leroux -
r656:c1e80b6034b1
parent child
Show More
@@ -1,45 +1,51
1 #include "Settings/SqpSettingsGeneralWidget.h"
1 #include "Settings/SqpSettingsGeneralWidget.h"
2
2
3 #include "Settings/SqpSettingsDefs.h"
3 #include "Settings/SqpSettingsDefs.h"
4
4
5 #include "ui_SqpSettingsGeneralWidget.h"
5 #include "ui_SqpSettingsGeneralWidget.h"
6
6
7 SqpSettingsGeneralWidget::SqpSettingsGeneralWidget(QWidget *parent)
7 SqpSettingsGeneralWidget::SqpSettingsGeneralWidget(QWidget *parent)
8 : QWidget{parent}, ui{new Ui::SqpSettingsGeneralWidget}
8 : QWidget{parent}, ui{new Ui::SqpSettingsGeneralWidget}
9 {
9 {
10 ui->setupUi(this);
10 ui->setupUi(this);
11
12 // Value limits
13 ui->toleranceInitSpinBox->setMinimum(0.);
14 ui->toleranceInitSpinBox->setMaximum(std::numeric_limits<double>::max());
15 ui->toleranceUpdateSpinBox->setMinimum(0.);
16 ui->toleranceUpdateSpinBox->setMaximum(std::numeric_limits<double>::max());
11 }
17 }
12
18
13 SqpSettingsGeneralWidget::~SqpSettingsGeneralWidget() noexcept
19 SqpSettingsGeneralWidget::~SqpSettingsGeneralWidget() noexcept
14 {
20 {
15 delete ui;
21 delete ui;
16 }
22 }
17
23
18 void SqpSettingsGeneralWidget::loadSettings()
24 void SqpSettingsGeneralWidget::loadSettings()
19 {
25 {
20 QSettings settings{};
26 QSettings settings{};
21
27
22 auto loadTolerance = [&settings](const QString &key, double defaultValue) {
28 auto loadTolerance = [&settings](const QString &key, double defaultValue) {
23 // Tolerance is converted to percent
29 // Tolerance is converted to percent
24 auto toleranceValue = settings.value(key, defaultValue).toDouble();
30 auto toleranceValue = settings.value(key, defaultValue).toDouble();
25 return toleranceValue * 100.;
31 return toleranceValue * 100.;
26 };
32 };
27
33
28 ui->toleranceInitSpinBox->setValue(
34 ui->toleranceInitSpinBox->setValue(
29 loadTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, GENERAL_TOLERANCE_AT_INIT_DEFAULT_VALUE));
35 loadTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, GENERAL_TOLERANCE_AT_INIT_DEFAULT_VALUE));
30 ui->toleranceUpdateSpinBox->setValue(
36 ui->toleranceUpdateSpinBox->setValue(
31 loadTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE));
37 loadTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE));
32 }
38 }
33
39
34 void SqpSettingsGeneralWidget::saveSettings() const
40 void SqpSettingsGeneralWidget::saveSettings() const
35 {
41 {
36 QSettings settings{};
42 QSettings settings{};
37
43
38 auto saveTolerance = [&settings](const QString &key, double value) {
44 auto saveTolerance = [&settings](const QString &key, double value) {
39 // Tolerance is converted from percent
45 // Tolerance is converted from percent
40 settings.setValue(key, value * 0.01);
46 settings.setValue(key, value * 0.01);
41 };
47 };
42
48
43 saveTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, ui->toleranceInitSpinBox->value());
49 saveTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, ui->toleranceInitSpinBox->value());
44 saveTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, ui->toleranceUpdateSpinBox->value());
50 saveTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, ui->toleranceUpdateSpinBox->value());
45 }
51 }
@@ -1,86 +1,74
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
2 <ui version="4.0">
3 <class>SqpSettingsGeneralWidget</class>
3 <class>SqpSettingsGeneralWidget</class>
4 <widget class="QWidget" name="SqpSettingsGeneralWidget">
4 <widget class="QWidget" name="SqpSettingsGeneralWidget">
5 <property name="geometry">
5 <property name="geometry">
6 <rect>
6 <rect>
7 <x>0</x>
7 <x>0</x>
8 <y>0</y>
8 <y>0</y>
9 <width>343</width>
9 <width>343</width>
10 <height>300</height>
10 <height>300</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="windowTitle">
13 <property name="windowTitle">
14 <string>Form</string>
14 <string>Form</string>
15 </property>
15 </property>
16 <layout class="QGridLayout" name="gridLayout">
16 <layout class="QGridLayout" name="gridLayout">
17 <item row="0" column="0">
17 <item row="0" column="0">
18 <widget class="QLabel" name="toleranceInitLabel">
18 <widget class="QLabel" name="toleranceInitLabel">
19 <property name="text">
19 <property name="text">
20 <string>Tolerance on first acquisition:</string>
20 <string>Tolerance on first acquisition:</string>
21 </property>
21 </property>
22 </widget>
22 </widget>
23 </item>
23 </item>
24 <item row="0" column="1">
24 <item row="0" column="1">
25 <widget class="QDoubleSpinBox" name="toleranceInitSpinBox">
25 <widget class="QDoubleSpinBox" name="toleranceInitSpinBox">
26 <property name="sizePolicy">
26 <property name="sizePolicy">
27 <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
27 <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
28 <horstretch>0</horstretch>
28 <horstretch>0</horstretch>
29 <verstretch>0</verstretch>
29 <verstretch>0</verstretch>
30 </sizepolicy>
30 </sizepolicy>
31 </property>
31 </property>
32 <property name="suffix">
32 <property name="suffix">
33 <string> %</string>
33 <string> %</string>
34 </property>
34 </property>
35 <property name="minimum">
36 <double>0.000000000000000</double>
37 </property>
38 <property name="maximum">
39 <double>500.000000000000000</double>
40 </property>
41 </widget>
35 </widget>
42 </item>
36 </item>
43 <item row="1" column="0">
37 <item row="1" column="0">
44 <widget class="QLabel" name="toleranceUpdateLabel">
38 <widget class="QLabel" name="toleranceUpdateLabel">
45 <property name="text">
39 <property name="text">
46 <string>Tolerance when updating acquisition:</string>
40 <string>Tolerance when updating acquisition:</string>
47 </property>
41 </property>
48 </widget>
42 </widget>
49 </item>
43 </item>
50 <item row="1" column="1">
44 <item row="1" column="1">
51 <widget class="QDoubleSpinBox" name="toleranceUpdateSpinBox">
45 <widget class="QDoubleSpinBox" name="toleranceUpdateSpinBox">
52 <property name="sizePolicy">
46 <property name="sizePolicy">
53 <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
47 <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
54 <horstretch>0</horstretch>
48 <horstretch>0</horstretch>
55 <verstretch>0</verstretch>
49 <verstretch>0</verstretch>
56 </sizepolicy>
50 </sizepolicy>
57 </property>
51 </property>
58 <property name="suffix">
52 <property name="suffix">
59 <string> %</string>
53 <string> %</string>
60 </property>
54 </property>
61 <property name="minimum">
62 <double>0.000000000000000</double>
63 </property>
64 <property name="maximum">
65 <double>500.000000000000000</double>
66 </property>
67 </widget>
55 </widget>
68 </item>
56 </item>
69 <item row="2" column="0">
57 <item row="2" column="0">
70 <spacer name="verticalSpacer">
58 <spacer name="verticalSpacer">
71 <property name="orientation">
59 <property name="orientation">
72 <enum>Qt::Vertical</enum>
60 <enum>Qt::Vertical</enum>
73 </property>
61 </property>
74 <property name="sizeHint" stdset="0">
62 <property name="sizeHint" stdset="0">
75 <size>
63 <size>
76 <width>20</width>
64 <width>20</width>
77 <height>40</height>
65 <height>40</height>
78 </size>
66 </size>
79 </property>
67 </property>
80 </spacer>
68 </spacer>
81 </item>
69 </item>
82 </layout>
70 </layout>
83 </widget>
71 </widget>
84 <resources/>
72 <resources/>
85 <connections/>
73 <connections/>
86 </ui>
74 </ui>
General Comments 0
You need to be logged in to leave comments. Login now