diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 0f516ef0..e378fd59 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -78,6 +78,7 @@ MainWindow::MainWindow(Camera * camera, QWidget * parent) : connect(ui_->actionSave_objects, SIGNAL(triggered()), this, SLOT(saveObjects())); connect(ui_->actionLoad_objects, SIGNAL(triggered()), this, SLOT(loadObjects())); connect(ui_->actionAbout, SIGNAL(triggered()), aboutDialog_ , SLOT(exec())); + connect(ui_->actionRestore_all_default_settings, SIGNAL(triggered()), ui_->toolBox, SLOT(resetAllPages())); QTimer::singleShot(10, this, SLOT(startProcessing())); } diff --git a/src/ParametersToolBox.cpp b/src/ParametersToolBox.cpp index 80415ccf..2258293d 100644 --- a/src/ParametersToolBox.cpp +++ b/src/ParametersToolBox.cpp @@ -57,6 +57,43 @@ void ParametersToolBox::resetCurrentPage() } } +void ParametersToolBox::resetAllPages() +{ + for(int i=0; i< this->count(); ++i) + { + const QObjectList & children = this->widget(i)->children(); + for(int j=0; jobjectName(); + // ignore only the nextObjID setting, to avoid problem with saved objects + if(key.compare(Settings::kGeneral_nextObjID()) != 0) + { + QVariant value = Settings::getDefaultParameters().value(key, QVariant()); + if(value.isValid()) + { + if(qobject_cast(children.at(j))) + { + ((QComboBox*)children.at(j))->setCurrentIndex(value.toString().split(':').first().toInt()); + } + else if(qobject_cast(children.at(j))) + { + ((QSpinBox*)children.at(j))->setValue(value.toInt()); + } + else if(qobject_cast(children.at(j))) + { + ((QDoubleSpinBox*)children.at(j))->setValue(value.toDouble()); + } + else if(qobject_cast(children.at(j))) + { + ((QCheckBox*)children.at(j))->setChecked(value.toBool()); + } + Settings::setParameter(key, value); + } + } + } + } +} + void ParametersToolBox::setupUi() { QWidget * currentItem = 0; diff --git a/src/ParametersToolBox.h b/src/ParametersToolBox.h index 7ada01b7..c40fd13d 100644 --- a/src/ParametersToolBox.h +++ b/src/ParametersToolBox.h @@ -34,6 +34,7 @@ private slots: void changeParameter(const QString & value); void changeParameter(const int & value); void resetCurrentPage(); + void resetAllPages(); }; #endif /* PARAMETERSTOOLBOX_H_ */ diff --git a/src/ui/mainWindow.ui b/src/ui/mainWindow.ui index c21cfc65..af6e92b6 100644 --- a/src/ui/mainWindow.ui +++ b/src/ui/mainWindow.ui @@ -150,6 +150,8 @@ + + @@ -467,6 +469,11 @@ About... + + + Restore all default settings + +