summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/preferences
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/preferences')
-rw-r--r--desktop-widgets/preferences/preferences_language.cpp14
-rw-r--r--desktop-widgets/preferences/prefs_language.ui65
2 files changed, 60 insertions, 19 deletions
diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp
index 07b60c3a3..ec4eed471 100644
--- a/desktop-widgets/preferences/preferences_language.cpp
+++ b/desktop-widgets/preferences/preferences_language.cpp
@@ -16,7 +16,7 @@ PreferencesLanguage::PreferencesLanguage() : AbstractPreferencesWidget(tr("Langu
QSortFilterProxyModel *filterModel = new QSortFilterProxyModel();
filterModel->setSourceModel(LanguageModel::instance());
filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
- ui->languageView->setModel(filterModel);
+ ui->languageDropdown->setModel(filterModel);
filterModel->sort(0);
connect(ui->languageFilter, &QLineEdit::textChanged,
filterModel, &QSortFilterProxyModel::setFilterFixedString);
@@ -32,10 +32,10 @@ void PreferencesLanguage::refreshSettings()
QSettings s;
s.beginGroup("Language");
ui->languageSystemDefault->setChecked(s.value("UseSystemLanguage", true).toBool());
- QAbstractItemModel *m = ui->languageView->model();
+ QAbstractItemModel *m = ui->languageDropdown->model();
QModelIndexList languages = m->match(m->index(0, 0), Qt::UserRole, s.value("UiLanguage").toString());
if (languages.count())
- ui->languageView->setCurrentIndex(languages.first());
+ ui->languageDropdown->setCurrentIndex(languages.first().row());
s.endGroup();
}
@@ -44,12 +44,14 @@ void PreferencesLanguage::syncSettings()
QSettings s;
s.beginGroup("Language");
bool useSystemLang = s.value("UseSystemLanguage", true).toBool();
+ QAbstractItemModel *m = ui->languageDropdown->model();
+ QString currentText = m->data(m->index(ui->languageDropdown->currentIndex(),0), Qt::UserRole).toString();
if (useSystemLang != ui->languageSystemDefault->isChecked() ||
- (!useSystemLang && s.value("UiLanguage").toString() != ui->languageView->currentIndex().data(Qt::UserRole))) {
+ (!useSystemLang && s.value("UiLanguage").toString() != currentText)) {
QMessageBox::warning(this, tr("Restart required"),
tr("To correctly load a new language you must restart Subsurface."));
}
s.setValue("UseSystemLanguage", ui->languageSystemDefault->isChecked());
- s.setValue("UiLanguage", ui->languageView->currentIndex().data(Qt::UserRole));
+ s.setValue("UiLanguage", currentText);
s.endGroup();
-} \ No newline at end of file
+}
diff --git a/desktop-widgets/preferences/prefs_language.ui b/desktop-widgets/preferences/prefs_language.ui
index 80671fca8..650d543f6 100644
--- a/desktop-widgets/preferences/prefs_language.ui
+++ b/desktop-widgets/preferences/prefs_language.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>576</width>
+ <width>621</width>
<height>523</height>
</rect>
</property>
@@ -17,7 +17,7 @@
<item>
<widget class="QGroupBox" name="language_group">
<property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -34,6 +34,9 @@
</widget>
</item>
<item>
+ <widget class="QComboBox" name="languageDropdown"/>
+ </item>
+ <item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -59,18 +62,54 @@
</layout>
</widget>
</item>
- <item>
- <widget class="QListView" name="languageView">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>languageSystemDefault</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>languageDropdown</receiver>
+ <slot>setDisabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>73</x>
+ <y>273</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>179</x>
+ <y>273</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>languageSystemDefault</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>languageFilter</receiver>
+ <slot>setDisabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>73</x>
+ <y>273</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>539</x>
+ <y>273</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>