src/settingseditor/settingseditor.cpp

changeset 40
30cb5e836736
parent 39
caac957e9834
child 41
0abada2a9802
equal deleted inserted replaced
39:caac957e9834 40:30cb5e836736
1 #include <QSettings> 1 #include <QSettings>
2 #include "gl/common.h"
2 #include "keyboardshortcutseditor.h" 3 #include "keyboardshortcutseditor.h"
3 #include "settingseditor.h" 4 #include "settingseditor.h"
4 #include "ui_settingseditor.h" 5 #include "ui_settingseditor.h"
5 6
6 SettingsEditor::SettingsEditor( 7 SettingsEditor::SettingsEditor(
36 37
37 void SettingsEditor::handleAccepted() 38 void SettingsEditor::handleAccepted()
38 { 39 {
39 this->settings->setValue("locale", this->ui.language->currentData().toString()); 40 this->settings->setValue("locale", this->ui.language->currentData().toString());
40 this->settings->setValue("Render/MainColor", this->ui.mainColorButton->selectedColor().name()); 41 this->settings->setValue("Render/MainColor", this->ui.mainColorButton->selectedColor().name());
42 this->settings->setValue("Render/BackgroundColor", this->ui.backgroundColorButton->selectedColor().name());
41 this->librariesEditor.saveSettings(this->settings); 43 this->librariesEditor.saveSettings(this->settings);
42 } 44 }
43 45
44 void SettingsEditor::loadLocales() 46 void SettingsEditor::loadLocales()
45 { 47 {
64 } 66 }
65 67
66 void SettingsEditor::setDefaults() 68 void SettingsEditor::setDefaults()
67 { 69 {
68 this->setCurrentLanguage(this->settings->value("locale", QLocale::system().name()).toString()); 70 this->setCurrentLanguage(this->settings->value("locale", QLocale::system().name()).toString());
69 this->ui.mainColorButton->setSelectedColor(this->settings->value("Render/MainColor").toString()); 71 this->ui.mainColorButton->setSelectedColor(this->settings->value(
72 "Render/MainColor",
73 gl::RenderPreferences{}.mainColor).toString());
74 this->ui.backgroundColorButton->setSelectedColor(this->settings->value(
75 "Render/BackgroundColor",
76 gl::RenderPreferences{}.backgroundColor).toString());
70 } 77 }
71 78
72 void SettingsEditor::setCurrentLanguage(const QString& localeCode) 79 void SettingsEditor::setCurrentLanguage(const QString& localeCode)
73 { 80 {
74 for (int i = 0; i < this->ui.language->count(); i += 1) 81 for (int i = 0; i < this->ui.language->count(); i += 1)

mercurial