add option to set date label as system locale format

This commit is contained in:
dries.k
2023-05-22 23:22:23 +02:00
parent 42f3cfcd9d
commit 234557df46
5 changed files with 20 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ class MessageWidget(QtWidgets.QWidget, Ui_Form):
# Display message contents
self.label_title.setText(message.title)
self.label_date.setText(message.date.strftime("%Y-%m-%d, %H:%M"))
self.label_date.setText(message.date.strftime("%x, %X" if settings.value("locale", type=bool) else "%Y-%m-%d, %H:%M"))
if message.get("extras", {}).get("client::display", {}).get("contentType") == "text/markdown":
self.label_message.setTextFormat(QtCore.Qt.TextFormat.MarkdownText)

View File

@@ -65,6 +65,7 @@ class SettingsDialog(QtWidgets.QDialog, Ui_Dialog):
self.combo_theme.addItems(get_themes())
self.combo_theme.setCurrentText(settings.value("theme", type=str))
self.cb_priority_colors.setChecked(settings.value("MessageWidget/priority_color", type=bool))
self.cb_locale.setChecked(settings.value("locale", type=bool))
# Logging
self.combo_logging.addItems(
@@ -197,6 +198,7 @@ class SettingsDialog(QtWidgets.QDialog, Ui_Dialog):
# Interface
self.combo_theme.currentTextChanged.connect(self.settings_changed_callback)
self.cb_priority_colors.stateChanged.connect(self.settings_changed_callback)
self.cb_locale.stateChanged.connect(self.settings_changed_callback)
# Server info
self.pb_change_server_info.clicked.connect(self.change_server_info_callback)
@@ -238,6 +240,7 @@ class SettingsDialog(QtWidgets.QDialog, Ui_Dialog):
self.theme_change_requested.emit(selected_theme)
settings.setValue("MessageWidget/priority_color", self.cb_priority_colors.isChecked())
settings.setValue("locale", self.cb_locale.isChecked())
# Logging
selected_level = self.combo_logging.currentText()