diff options
Diffstat (limited to 'desktop-widgets/preferences')
-rw-r--r-- | desktop-widgets/preferences/preferences_language.cpp | 10 | ||||
-rw-r--r-- | desktop-widgets/preferences/prefs_language.ui | 41 |
2 files changed, 32 insertions, 19 deletions
diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp index 0cb36dc2c..5f7b5f488 100644 --- a/desktop-widgets/preferences/preferences_language.cpp +++ b/desktop-widgets/preferences/preferences_language.cpp @@ -30,6 +30,10 @@ PreferencesLanguage::PreferencesLanguage() : AbstractPreferencesWidget(tr("Langu ui->dateFormatEntry->addItem(format); connect(ui->dateFormatEntry, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(dateFormatChanged(const QString&))); + + ui->timeFormatEntry->addItem("hh:mm"); + ui->timeFormatEntry->addItem("h:mm AP"); + ui->timeFormatEntry->addItem("hh:mm AP"); } PreferencesLanguage::~PreferencesLanguage() @@ -47,7 +51,7 @@ void PreferencesLanguage::refreshSettings() ui->languageSystemDefault->setChecked(prefs.locale.use_system_language); ui->timeFormatSystemDefault->setChecked(!prefs.time_format_override); ui->dateFormatSystemDefault->setChecked(!prefs.date_format_override); - ui->timeFormatEntry->setText(prefs.time_format); + ui->timeFormatEntry->setCurrentText(prefs.time_format); ui->dateFormatEntry->setCurrentText(prefs.date_format); ui->shortDateFormatEntry->setText(prefs.date_format_short); QAbstractItemModel *m = ui->languageDropdown->model(); @@ -84,14 +88,14 @@ void PreferencesLanguage::syncSettings() lang->setUseSystemLanguage(ui->languageSystemDefault->isChecked()); lang->setTimeFormatOverride(!ui->timeFormatSystemDefault->isChecked()); lang->setDateFormatOverride(!ui->dateFormatSystemDefault->isChecked()); - lang->setTimeFormat(ui->timeFormatEntry->text()); + lang->setTimeFormat(ui->timeFormatEntry->currentText()); lang->setDateFormat(ui->dateFormatEntry->currentText()); lang->setDateFormatShort(ui->shortDateFormatEntry->text()); uiLanguage(NULL); QString qDateTimeWeb = tr("These will be used as is. This might not be what you intended.\nSee http://doc.qt.io/qt-5/qdatetime.html#toString"); QRegExp tfillegalchars("[^hHmszaApPt\\s:;\\.,]"); - if (tfillegalchars.indexIn(ui->timeFormatEntry->text()) >= 0) + if (tfillegalchars.indexIn(ui->timeFormatEntry->currentText()) >= 0) QMessageBox::warning(this, tr("Literal characters"), tr("Non-special character(s) in time format.\n") + qDateTimeWeb); diff --git a/desktop-widgets/preferences/prefs_language.ui b/desktop-widgets/preferences/prefs_language.ui index 470e8b6d1..b51dd083f 100644 --- a/desktop-widgets/preferences/prefs_language.ui +++ b/desktop-widgets/preferences/prefs_language.ui @@ -140,10 +140,19 @@ </widget> </item> <item> - <widget class="QLineEdit" name="timeFormatEntry"> + <widget class="QComboBox" name="timeFormatEntry"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="toolTip"> <string><html><head/><body><p>Preferred time format</p><p>Commonly used format specifiers are</p><p>h (hours in 12h format)</p><p>H (hours in 24h format)</p><p>mm (2 digit minutes)</p><p>ss (2 digit seconds)</p><p>t/tt (a/p or am/pm)</p></body></html></string> </property> + <property name="editable"> + <bool>true</bool> + </property> </widget> </item> <item> @@ -212,50 +221,50 @@ </hints> </connection> <connection> - <sender>timeFormatSystemDefault</sender> + <sender>dateFormatSystemDefault</sender> <signal>toggled(bool)</signal> - <receiver>timeFormatEntry</receiver> + <receiver>shortDateFormatEntry</receiver> <slot>setDisabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>79</x> - <y>210</y> + <x>99</x> + <y>132</y> </hint> <hint type="destinationlabel"> - <x>264</x> - <y>210</y> + <x>293</x> + <y>169</y> </hint> </hints> </connection> <connection> <sender>dateFormatSystemDefault</sender> <signal>toggled(bool)</signal> - <receiver>shortDateFormatEntry</receiver> + <receiver>dateFormatEntry</receiver> <slot>setDisabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>99</x> - <y>132</y> + <x>89</x> + <y>103</y> </hint> <hint type="destinationlabel"> - <x>293</x> - <y>169</y> + <x>273</x> + <y>103</y> </hint> </hints> </connection> <connection> - <sender>dateFormatSystemDefault</sender> + <sender>timeFormatSystemDefault</sender> <signal>toggled(bool)</signal> - <receiver>dateFormatEntry</receiver> + <receiver>timeFormatEntry</receiver> <slot>setDisabled(bool)</slot> <hints> <hint type="sourcelabel"> <x>89</x> - <y>103</y> + <y>190</y> </hint> <hint type="destinationlabel"> <x>273</x> - <y>103</y> + <y>190</y> </hint> </hints> </connection> |