|
30 | 30 | #include "settingsdialog.h" |
31 | 31 | #include "applicationdialog.h" |
32 | 32 | #include "applicationlist.h" |
| 33 | +#include "translationhandler.h" |
33 | 34 | #include "common.h" |
34 | 35 |
|
35 | 36 | SettingsDialog::SettingsDialog(QSettings *programSettings, |
36 | 37 | ApplicationList *list, |
| 38 | + TranslationHandler *translator, |
37 | 39 | QWidget *parent) : |
38 | 40 | QDialog(parent), |
39 | 41 | mSettings(programSettings), |
40 | 42 | mApplications(list), |
| 43 | + mTranslator(translator), |
41 | 44 | mTempApplications(new ApplicationList(this)) |
42 | 45 | { |
43 | 46 | mUI.setupUi(this); |
@@ -78,13 +81,25 @@ SettingsDialog::SettingsDialog(QSettings *programSettings, |
78 | 81 | mUI.mLblIdealThreads->setText(tr("N/A")); |
79 | 82 |
|
80 | 83 | LoadSettings(); |
| 84 | + InitTranslationsList(); |
81 | 85 | } |
82 | 86 |
|
83 | 87 | SettingsDialog::~SettingsDialog() |
84 | 88 | { |
85 | 89 | SaveSettings(); |
86 | 90 | } |
87 | 91 |
|
| 92 | +void SettingsDialog::InitTranslationsList() |
| 93 | +{ |
| 94 | + QStringList languages = mTranslator->GetNames(); |
| 95 | + foreach(const QString lang, languages) |
| 96 | + { |
| 97 | + mUI.mListLanguages->addItem(lang); |
| 98 | + } |
| 99 | + const int current = mTranslator->GetCurrentLanguage(); |
| 100 | + mUI.mListLanguages->setCurrentRow(current); |
| 101 | +} |
| 102 | + |
88 | 103 | Qt::CheckState SettingsDialog::BoolToCheckState(bool yes) const |
89 | 104 | { |
90 | 105 | if (yes) |
@@ -133,6 +148,7 @@ void SettingsDialog::SaveSettingValues() |
133 | 148 | SaveCheckboxValue(mUI.mShowDebugWarnings, SETTINGS_SHOW_DEBUG_WARNINGS); |
134 | 149 | SaveCheckboxValue(mUI.mInlineSuppressions, SETTINGS_INLINE_SUPPRESSIONS); |
135 | 150 | mSettings->setValue(SETTINGS_GLOBAL_INCLUDE_PATHS, mUI.mEditIncludePaths->text()); |
| 151 | + mSettings->setValue(SETTINGS_LANGUAGE, mUI.mListLanguages->currentRow()); |
136 | 152 | } |
137 | 153 |
|
138 | 154 | void SettingsDialog::SaveCheckboxValue(QCheckBox *box, const QString &name) |
|
0 commit comments