##// END OF EJS Templates
Remove the catalogue from discard or remove button have now the same gui...
Remove the catalogue from discard or remove button have now the same gui behavior

File last commit:

r656:c1e80b6034b1
r1371:232b551e25db
Show More
SqpSettingsGeneralWidget.cpp
51 lines | 1.6 KiB | text/x-c | CppLexer
/ gui / src / Settings / SqpSettingsGeneralWidget.cpp
Alexandre Leroux
Creates widget for "general settings" and registers it to the dialog
r465 #include "Settings/SqpSettingsGeneralWidget.h"
Alexandre Leroux
Settings binding (2)...
r467 #include "Settings/SqpSettingsDefs.h"
Alexandre Leroux
Creates widget for "general settings" and registers it to the dialog
r465 #include "ui_SqpSettingsGeneralWidget.h"
SqpSettingsGeneralWidget::SqpSettingsGeneralWidget(QWidget *parent)
: QWidget{parent}, ui{new Ui::SqpSettingsGeneralWidget}
{
ui->setupUi(this);
Alexandre Leroux
Removes max limit on tolerance settings
r656
// Value limits
ui->toleranceInitSpinBox->setMinimum(0.);
ui->toleranceInitSpinBox->setMaximum(std::numeric_limits<double>::max());
ui->toleranceUpdateSpinBox->setMinimum(0.);
ui->toleranceUpdateSpinBox->setMaximum(std::numeric_limits<double>::max());
Alexandre Leroux
Creates widget for "general settings" and registers it to the dialog
r465 }
SqpSettingsGeneralWidget::~SqpSettingsGeneralWidget() noexcept
{
delete ui;
}
Alexandre Leroux
Settings binding (2)...
r467
void SqpSettingsGeneralWidget::loadSettings()
{
QSettings settings{};
auto loadTolerance = [&settings](const QString &key, double defaultValue) {
// Tolerance is converted to percent
auto toleranceValue = settings.value(key, defaultValue).toDouble();
return toleranceValue * 100.;
};
ui->toleranceInitSpinBox->setValue(
loadTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, GENERAL_TOLERANCE_AT_INIT_DEFAULT_VALUE));
ui->toleranceUpdateSpinBox->setValue(
loadTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE));
}
void SqpSettingsGeneralWidget::saveSettings() const
{
QSettings settings{};
auto saveTolerance = [&settings](const QString &key, double value) {
// Tolerance is converted from percent
settings.setValue(key, value * 0.01);
};
saveTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, ui->toleranceInitSpinBox->value());
saveTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, ui->toleranceUpdateSpinBox->value());
}