mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-232 GCS Configuration: Add general Option to not save settings on exit.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2737 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
afdaf88d4a
commit
0ab4ccef9d
@ -44,7 +44,8 @@ using namespace Utils;
|
||||
using namespace Core::Internal;
|
||||
|
||||
GeneralSettings::GeneralSettings():
|
||||
m_dialog(0)
|
||||
m_dialog(0),
|
||||
m_saveSettingsOnExit(true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -112,6 +113,7 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
|
||||
m_page->setupUi(w);
|
||||
|
||||
fillLanguageBox();
|
||||
m_page->checkBoxSaveOnExit->setChecked(m_saveSettingsOnExit);
|
||||
|
||||
m_page->colorButton->setColor(StyleHelper::baseColor());
|
||||
#ifdef Q_OS_UNIX
|
||||
@ -142,6 +144,8 @@ void GeneralSettings::apply()
|
||||
setLanguage(m_page->languageBox->itemData(currentIndex, Qt::UserRole).toString());
|
||||
// Apply the new base color if accepted
|
||||
StyleHelper::setBaseColor(m_page->colorButton->color());
|
||||
|
||||
m_saveSettingsOnExit = m_page->checkBoxSaveOnExit->isChecked();
|
||||
#ifdef Q_OS_UNIX
|
||||
ConsoleProcess::setTerminalEmulator(Core::ICore::instance()->settings(),
|
||||
m_page->terminalEdit->text());
|
||||
@ -158,6 +162,7 @@ void GeneralSettings::readSettings(QSettings* qs)
|
||||
{
|
||||
qs->beginGroup(QLatin1String("General"));
|
||||
m_language = qs->value(QLatin1String("OverrideLanguage"),QLocale::system().name()).toString();
|
||||
m_saveSettingsOnExit = qs->value(QLatin1String("SaveSettingsOnExit"),m_saveSettingsOnExit).toBool();
|
||||
qs->endGroup();
|
||||
|
||||
}
|
||||
@ -171,6 +176,7 @@ void GeneralSettings::saveSettings(QSettings* qs)
|
||||
else
|
||||
qs->setValue(QLatin1String("OverrideLanguage"), m_language);
|
||||
|
||||
qs->setValue(QLatin1String("SaveSettingsOnExit"), m_saveSettingsOnExit);
|
||||
qs->endGroup();
|
||||
}
|
||||
|
||||
@ -230,3 +236,8 @@ void GeneralSettings::setLanguage(const QString &locale)
|
||||
m_language = locale;
|
||||
}
|
||||
}
|
||||
|
||||
bool GeneralSettings::saveSettingsOnExit() const
|
||||
{
|
||||
return m_saveSettingsOnExit;
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
QWidget* createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
bool saveSettingsOnExit() const;
|
||||
void readSettings(QSettings* qs);
|
||||
void saveSettings(QSettings* qs);
|
||||
|
||||
@ -73,6 +74,7 @@ private:
|
||||
void setLanguage(const QString&);
|
||||
Ui::GeneralSettings *m_page;
|
||||
QString m_language;
|
||||
bool m_saveSettingsOnExit;
|
||||
QPointer<QWidget> m_dialog;
|
||||
QList<QTextCodec *> m_codecs;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>536</width>
|
||||
<height>233</height>
|
||||
<height>322</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
@ -221,6 +221,26 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="checkBoxSaveOnExit">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Save configuration settings on on exit</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -306,6 +306,9 @@ void MainWindow::extensionsInitialized()
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if ( !m_generalSettings->saveSettingsOnExit() ){
|
||||
m_dontSaveSettings = true;
|
||||
}
|
||||
if ( !m_dontSaveSettings ){
|
||||
emit m_coreImpl->saveSettingsRequested();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user