src/settingseditor/settingseditor.cpp

changeset 41
0abada2a9802
parent 40
30cb5e836736
child 44
c6114b3af3a6
--- a/src/settingseditor/settingseditor.cpp	Sat Feb 01 17:20:10 2020 +0200
+++ b/src/settingseditor/settingseditor.cpp	Sun Feb 02 00:30:48 2020 +0200
@@ -5,7 +5,7 @@
 #include "ui_settingseditor.h"
 
 SettingsEditor::SettingsEditor(
-	QSettings* settings,
+	Configuration* settings,
 	const uiutilities::KeySequenceMap& defaultKeyboardShortcuts,
 	QWidget* parent
 ) :
@@ -37,9 +37,9 @@
 
 void SettingsEditor::handleAccepted()
 {
-	this->settings->setValue("locale", this->ui.language->currentData().toString());
-	this->settings->setValue("Render/MainColor", this->ui.mainColorButton->selectedColor().name());
-	this->settings->setValue("Render/BackgroundColor", this->ui.backgroundColorButton->selectedColor().name());
+	this->settings->setLocale(this->ui.language->currentData().toString());
+	this->settings->setMainColor(this->ui.mainColorButton->selectedColor());
+	this->settings->setBackgroundColor(this->ui.backgroundColorButton->selectedColor());
 	this->librariesEditor.saveSettings(this->settings);
 }
 
@@ -67,13 +67,9 @@
 
 void SettingsEditor::setDefaults()
 {
-	this->setCurrentLanguage(this->settings->value("locale", QLocale::system().name()).toString());
-	this->ui.mainColorButton->setSelectedColor(this->settings->value(
-		"Render/MainColor",
-		gl::RenderPreferences{}.mainColor).toString());
-	this->ui.backgroundColorButton->setSelectedColor(this->settings->value(
-		"Render/BackgroundColor",
-		gl::RenderPreferences{}.backgroundColor).toString());
+	this->setCurrentLanguage(this->settings->locale());
+	this->ui.mainColorButton->setSelectedColor(this->settings->mainColor());
+	this->ui.backgroundColorButton->setSelectedColor(this->settings->backgroundColor());
 }
 
 void SettingsEditor::setCurrentLanguage(const QString& localeCode)

mercurial