From c4c5861ad1d108efba139a2db769d2c899319530 Mon Sep 17 00:00:00 2001 From: lambdcalculus Date: Thu, 28 Mar 2024 01:17:49 -0300 Subject: [PATCH] make all option comboboxes work --- resource/ui/options_dialog.ui | 64 +++------------------------------ src/widgets/aooptionsdialog.cpp | 27 +++++++++++--- 2 files changed, 27 insertions(+), 64 deletions(-) diff --git a/resource/ui/options_dialog.ui b/resource/ui/options_dialog.ui index 19cbb944a..471abbc7d 100644 --- a/resource/ui/options_dialog.ui +++ b/resource/ui/options_dialog.ui @@ -23,7 +23,7 @@ Qt::NoFocus - 0 + 4 @@ -39,9 +39,9 @@ 0 - 0 + -358 394 - 828 + 858 @@ -157,43 +157,7 @@ - - - - en - - - - - de - - - - - es - - - - - pt - - - - - pl - - - - - jp - - - - - ru - - - + @@ -1012,26 +976,6 @@ Default: 0. true - - - h:mm:ss AP - - - - - hh:mm:ss - - - - - h:mm AP - - - - - hh:mm - - diff --git a/src/widgets/aooptionsdialog.cpp b/src/widgets/aooptionsdialog.cpp index 0945bb325..7bdc58583 100644 --- a/src/widgets/aooptionsdialog.cpp +++ b/src/widgets/aooptionsdialog.cpp @@ -35,7 +35,7 @@ void AOOptionsDialog::populateAudioDevices() { ui_audio_device_combobox->clear(); if (needsDefaultAudioDevice()) { - ui_audio_device_combobox->addItem("default"); + ui_audio_device_combobox->addItem("default", "default"); } BASS_DEVICEINFO info; @@ -116,7 +116,7 @@ void AOOptionsDialog::setWidgetData(QComboBox *widget, const QString &value) template <> QString AOOptionsDialog::widgetData(QComboBox *widget) const { - return widget->currentText(); + return widget->currentData().toString(); } template <> @@ -398,6 +398,15 @@ void AOOptionsDialog::setupUI() &Options::setDiscordEnabled); registerOption("language_combobox", &Options::language, &Options::setLanguage); + + ui_language_combobox->addItem("English", "en"); + ui_language_combobox->addItem("Deutsch", "de"); + ui_language_combobox->addItem("Español", "es"); + ui_language_combobox->addItem("Português", "pt"); + ui_language_combobox->addItem("Polski", "pl"); + ui_language_combobox->addItem("日本語", "jp"); + ui_language_combobox->addItem("Русский", "ru"); + registerOption("scaling_combobox", &Options::defaultScalingMode, &Options::setDefaultScalingMode); @@ -605,6 +614,12 @@ void AOOptionsDialog::setupUI() ui_log_timestamp_format_combobox->setCurrentText(l_current_format); + ui_log_timestamp_format_combobox->addItem(l_current_format); + ui_log_timestamp_format_combobox->addItem("h:mm:ss AP"); + ui_log_timestamp_format_combobox->addItem("hh:mm:ss"); + ui_log_timestamp_format_combobox->addItem("h:mm AP"); + ui_log_timestamp_format_combobox->addItem("hh:mm"); + if (!Options::getInstance().logTimestampEnabled()) { ui_log_timestamp_format_combobox->setDisabled(true); } @@ -633,10 +648,14 @@ void AOOptionsDialog::setupUI() void AOOptionsDialog::onTimestampFormatEdited() { + const QString format = ui_log_timestamp_format_combobox->currentText(); + const int index = ui_log_timestamp_format_combobox->currentIndex(); + + ui_log_timestamp_format_combobox->setItemText(index, format); + ui_log_timestamp_format_combobox->setItemData(index, format); ui_log_timestamp_format_lbl->setText( tr("Log timestamp format:\n") + - QDateTime::currentDateTime().toString( - ui_log_timestamp_format_combobox->currentText())); + QDateTime::currentDateTime().toString(format)); } void AOOptionsDialog::timestampCbChanged(int state)