Commit 94420ee9 authored by Lorenz Meier's avatar Lorenz Meier

Added option to reset all settings

parent 9a0ff6ea
......@@ -35,6 +35,9 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) :
this->window()->setWindowTitle(tr("QGroundControl Settings"));
// Settings reset
connect(ui->resetSettingsButton, SIGNAL(clicked()), this, SLOT(resetSettings()));
// Audio preferences
ui->audioMuteCheckBox->setChecked(GAudioOutput::instance()->isMuted());
connect(ui->audioMuteCheckBox, SIGNAL(toggled(bool)), GAudioOutput::instance(), SLOT(mute(bool)));
......@@ -193,3 +196,13 @@ void QGCSettingsWidget::selectCustomMode(int mode)
MainWindow::instance()->setCustomMode(static_cast<enum MainWindow::CUSTOM_MODE>(ui->customModeComboBox->itemData(mode).toInt()));
MainWindow::instance()->showInfoMessage(tr("Please restart QGroundControl"), tr("The optimization selection was changed. The application needs to be closed and restarted to put all optimizations into effect."));
}
void QGCSettingsWidget::resetSettings()
{
QSettings settings;
settings.sync();
settings.clear();
// Write current application version
settings.setValue("QGC_APPLICATION_VERSION", QGC_APPLICATION_VERSION);
settings.sync();
}
......@@ -23,6 +23,7 @@ public slots:
void setDefaultStyle();
void selectStylesheet();
void selectCustomMode(int mode);
void resetSettings();
private:
MainWindow* mainWindow;
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>528</width>
<height>455</height>
<width>534</width>
<height>517</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -159,11 +159,34 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Danger Zone</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="10,0">
<item row="1" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Delete all settings, layouts and restore defaults</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="resetSettingsButton">
<property name="text">
<string>Reset Settings</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment