44 delete &this->ui; |
44 delete &this->ui; |
45 } |
45 } |
46 |
46 |
47 void SettingsEditor::saveSettings() |
47 void SettingsEditor::saveSettings() |
48 { |
48 { |
49 setSetting<Setting::Locale>(this->ui.language->currentData().toString()); |
49 //setSetting<Setting::Locale>(this->ui.language->currentData().toString()); |
50 setSetting<Setting::MainColor>(this->ui.mainColorButton->color()); |
50 setSetting<Setting::MainColor>(this->ui.mainColorButton->color()); |
51 setSetting<Setting::BackgroundColor>(this->ui.backgroundColorButton->color()); |
51 setSetting<Setting::BackgroundColor>(this->ui.backgroundColorButton->color()); |
52 setSetting<Setting::SelectedColor>(this->ui.selectedColorButton->color()); |
52 setSetting<Setting::SelectedColor>(this->ui.selectedColorButton->color()); |
53 setSetting<Setting::LineThickness>(static_cast<GLfloat>(this->ui.lineThickness->value())); |
53 setSetting<Setting::LineThickness>(static_cast<GLfloat>(this->ui.lineThickness->value())); |
54 setSetting<Setting::LineAntiAliasing>(this->ui.lineAntiAliasing->isChecked()); |
54 setSetting<Setting::LineAntiAliasing>(this->ui.lineAntiAliasing->isChecked()); |
61 Q_EMIT this->settingsChanged(); |
61 Q_EMIT this->settingsChanged(); |
62 } |
62 } |
63 |
63 |
64 void SettingsEditor::loadLocales() |
64 void SettingsEditor::loadLocales() |
65 { |
65 { |
|
66 /* |
66 this->ui.language->clear(); |
67 this->ui.language->clear(); |
67 QDir dir{":/locale"}; |
68 QDir dir{":/locale"}; |
68 // Collect translation files in built-in resources |
69 // Collect translation files in built-in resources |
69 QVector<QString> localeCodes = {"en"}; // English is the default locale |
70 QVector<QString> localeCodes = {"en"}; // English is the default locale |
70 for (const QFileInfo& file : dir.entryInfoList(QDir::Files)) |
71 for (const QFileInfo& file : dir.entryInfoList(QDir::Files)) |
79 const QString languageName = QLocale::languageToString(locale.language()); |
80 const QString languageName = QLocale::languageToString(locale.language()); |
80 const QIcon flag{":/flags/" + localeCode + ".png"}; |
81 const QIcon flag{":/flags/" + localeCode + ".png"}; |
81 this->ui.language->addItem(languageName, localeCode); |
82 this->ui.language->addItem(languageName, localeCode); |
82 this->ui.language->setItemIcon(this->ui.language->count() - 1, flag); |
83 this->ui.language->setItemIcon(this->ui.language->count() - 1, flag); |
83 } |
84 } |
|
85 */ |
84 } |
86 } |
85 |
87 |
86 void SettingsEditor::loadSettings() |
88 void SettingsEditor::loadSettings() |
87 { |
89 { |
88 this->libraries.restoreFromSettings(); |
90 this->libraries.restoreFromSettings(); |
89 this->setCurrentLanguage(setting<Setting::Locale>()); |
91 //this->setCurrentLanguage(setting<Setting::Locale>()); |
90 this->ui.mainColorButton->setColor(setting<Setting::MainColor>()); |
92 this->ui.mainColorButton->setColor(setting<Setting::MainColor>()); |
91 this->ui.backgroundColorButton->setColor(setting<Setting::BackgroundColor>()); |
93 this->ui.backgroundColorButton->setColor(setting<Setting::BackgroundColor>()); |
92 this->ui.selectedColorButton->setColor(setting<Setting::SelectedColor>()); |
94 this->ui.selectedColorButton->setColor(setting<Setting::SelectedColor>()); |
93 this->ui.lineThickness->setValue(double_cast(setting<Setting::LineThickness>())); |
95 this->ui.lineThickness->setValue(double_cast(setting<Setting::LineThickness>())); |
94 this->ui.lineAntiAliasing->setChecked(setting<Setting::LineAntiAliasing>()); |
96 this->ui.lineAntiAliasing->setChecked(setting<Setting::LineAntiAliasing>()); |