src/settingseditor/settingseditor.cpp

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

mercurial