summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/models.cpp8
-rw-r--r--qt-ui/preferences.cpp13
-rw-r--r--qt-ui/preferences.ui134
3 files changed, 95 insertions, 60 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 985d213f6..e57ececd4 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1772,24 +1772,24 @@ LanguageModel::LanguageModel(QObject* parent): QAbstractListModel(parent)
if ( !s.endsWith(".qm") ){
continue;
}
- languages.push_back(s);
+ languages.push_back( (s == "subsurface_source.qm") ? "English" : s);
}
}
QVariant LanguageModel::data(const QModelIndex& index, int role) const
{
QLocale loc;
+ QString currentString = languages.at(index.row());
if(!index.isValid())
return QVariant();
switch(role){
case Qt::DisplayRole:{
- QString currentString = languages.at(index.row());
QLocale l( currentString.remove("subsurface_"));
- return l.countryToString(l.country());
+ return currentString == "English" ? currentString : l.countryToString(l.country());
}break;
case Qt::UserRole:{
QString currentString = languages.at(index.row());
- return currentString.remove("subsurface_");
+ return currentString == "English" ? "en_US" : currentString.remove("subsurface_");
}break;
}
return QVariant();
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 45777d320..930a263a1 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -114,10 +114,11 @@ void PreferencesDialog::setUiFromPrefs()
QSettings s;
s.beginGroup("Language");
- QAbstractItemModel *m = ui.languageView->model();
- QModelIndexList languages = m->match( m->index(0,0), Qt::DisplayRole, s.value("UiLanguage").toString());
- if (languages.count())
- ui.languageView->setCurrentIndex(languages.first());
+ ui.languageSystemDefault->setChecked(s.value("UseSystemLanguage").toBool());
+ QAbstractItemModel *m = ui.languageView->model();
+ QModelIndexList languages = m->match( m->index(0,0), Qt::UserRole, s.value("UiLanguage").toString());
+ if (languages.count())
+ ui.languageView->setCurrentIndex(languages.first());
}
void PreferencesDialog::restorePrefs()
@@ -187,10 +188,12 @@ void PreferencesDialog::syncSettings()
QLocale loc;
s.beginGroup("Language");
- if (s.value("UiLanguage").toString() != ui.languageView->currentIndex().data(Qt::UserRole)){
+ if (s.value("UiLanguage").toString() != ui.languageView->currentIndex().data(Qt::UserRole) ||
+ s.value("UseSystemLanguage").toBool() != ui.languageSystemDefault->isChecked()) {
QMessageBox::warning(mainWindow(), 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));
emit settingsChanged();
diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index 50a0f7ab0..bdd37acca 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -943,12 +943,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>187</x>
- <y>77</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>581</x>
- <y>80</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -959,12 +959,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>187</x>
- <y>77</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>668</x>
- <y>80</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -975,12 +975,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>186</x>
- <y>121</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>581</x>
- <y>124</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -991,12 +991,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>186</x>
- <y>121</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>668</x>
- <y>124</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -1007,12 +1007,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>184</x>
- <y>165</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>581</x>
- <y>168</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -1023,12 +1023,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>184</x>
- <y>165</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>668</x>
- <y>168</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -1040,11 +1040,11 @@
<hints>
<hint type="sourcelabel">
<x>195</x>
- <y>209</y>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>591</x>
- <y>212</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -1056,11 +1056,11 @@
<hints>
<hint type="sourcelabel">
<x>195</x>
- <y>209</y>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>668</x>
- <y>212</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -1071,12 +1071,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>298</x>
- <y>327</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>512</x>
- <y>327</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -1087,12 +1087,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>298</x>
- <y>327</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>668</x>
- <y>327</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -1103,12 +1103,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>298</x>
- <y>327</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>668</x>
- <y>327</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -1119,12 +1119,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>362</x>
- <y>275</y>
+ <x>195</x>
+ <y>39</y>
</hint>
<hint type="destinationlabel">
- <x>586</x>
- <y>270</y>
+ <x>195</x>
+ <y>39</y>
</hint>
</hints>
</connection>
@@ -1135,23 +1135,55 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>613</x>
- <y>41</y>
+ <x>195</x>
+ <y>39</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>195</x>
+ <y>39</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>languageSystemDefault</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>languageView</receiver>
+ <slot>setDisabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>176</x>
+ <y>30</y>
</hint>
<hint type="destinationlabel">
- <x>634</x>
- <y>72</y>
+ <x>171</x>
+ <y>79</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>languageSystemDefault</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>languageFilter</receiver>
+ <slot>setDisabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>209</x>
+ <y>34</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>599</x>
+ <y>33</y>
</hint>
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroup"/>
- <buttongroup name="verticalSpeed"/>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup_3"/>
<buttongroup name="buttonGroup_4"/>
<buttongroup name="buttonGroup_5"/>
<buttongroup name="buttonGroup_6"/>
+ <buttongroup name="verticalSpeed"/>
</buttongroups>
</ui>