From 234856fbb5a1b2bbb89d196fec86e729c6afc70b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dutkiewicz?= Date: Tue, 16 Apr 2024 16:10:31 +0200 Subject: [PATCH] Switch to radios --- .../preferences/AdvancedPreferencesPage.cpp | 19 +++--- .../preferences/AdvancedPreferencesPage.ui | 58 +++++++++++++++---- 2 files changed, 58 insertions(+), 19 deletions(-) diff --git a/src/modules/windows/preferences/AdvancedPreferencesPage.cpp b/src/modules/windows/preferences/AdvancedPreferencesPage.cpp index e3701ba95c..f64107b50e 100644 --- a/src/modules/windows/preferences/AdvancedPreferencesPage.cpp +++ b/src/modules/windows/preferences/AdvancedPreferencesPage.cpp @@ -86,8 +86,6 @@ void AdvancedPreferencesPage::changeEvent(QEvent *event) const QStringList navigationTitles({tr("Browsing"), tr("Notifications"), tr("Appearance"), {}, tr("Downloads"), tr("Programs"), {}, tr("History"), tr("Network"), tr("Scripting"), tr("Security"), tr("Updates"), {}, tr("Mouse")}); m_ui->retranslateUi(this); - m_ui->browsingDisplayModeComboBox->setItemText(0, tr("Compact")); - m_ui->browsingDisplayModeComboBox->setItemText(1, tr("Columns")); m_ui->appearranceWidgetStyleComboBox->setItemText(0, tr("System Style")); m_ui->notificationsPlaySoundFilePathWidget->setFilters({tr("WAV files (*.wav)")}); m_ui->appearranceStyleSheetFilePathWidget->setFilters({tr("Style sheets (*.css)")}); @@ -1014,14 +1012,17 @@ void AdvancedPreferencesPage::load() m_ui->browsingSuggestBookmarksCheckBox->setChecked(SettingsManager::getOption(SettingsManager::AddressField_SuggestBookmarksOption).toBool()); m_ui->browsingSuggestHistoryCheckBox->setChecked(SettingsManager::getOption(SettingsManager::AddressField_SuggestHistoryOption).toBool()); m_ui->browsingSuggestLocalPathsCheckBox->setChecked(SettingsManager::getOption(SettingsManager::AddressField_SuggestLocalPathsOption).toBool()); - m_ui->browsingCategoriesCheckBox->setChecked(SettingsManager::getOption(SettingsManager::AddressField_ShowCompletionCategoriesOption).toBool()); - - m_ui->browsingDisplayModeComboBox->addItem(tr("Compact"), QLatin1String("compact")); - m_ui->browsingDisplayModeComboBox->addItem(tr("Columns"), QLatin1String("columns")); - const int displayModeIndex(m_ui->browsingDisplayModeComboBox->findData(SettingsManager::getOption(SettingsManager::AddressField_CompletionDisplayModeOption).toString())); + if (SettingsManager::getOption(SettingsManager::AddressField_CompletionDisplayModeOption).toString() == QLatin1String("columns")) + { + m_ui->browsingDisplayModeColumnsRadioButton->setChecked(true); + } + else + { + m_ui->browsingDisplayModeCompactRadioButton->setChecked(true); + } - m_ui->browsingDisplayModeComboBox->setCurrentIndex((displayModeIndex < 0) ? 1 : displayModeIndex); + m_ui->browsingCategoriesCheckBox->setChecked(SettingsManager::getOption(SettingsManager::AddressField_ShowCompletionCategoriesOption).toBool()); m_ui->notificationsPlaySoundButton->setIcon(ThemesManager::createIcon(QLatin1String("media-playback-start"))); m_ui->notificationsPlaySoundFilePathWidget->setFilters({tr("WAV files (*.wav)")}); @@ -1344,8 +1345,8 @@ void AdvancedPreferencesPage::save() SettingsManager::setOption(SettingsManager::AddressField_SuggestBookmarksOption, m_ui->browsingSuggestBookmarksCheckBox->isChecked()); SettingsManager::setOption(SettingsManager::AddressField_SuggestHistoryOption, m_ui->browsingSuggestHistoryCheckBox->isChecked()); SettingsManager::setOption(SettingsManager::AddressField_SuggestLocalPathsOption, m_ui->browsingSuggestLocalPathsCheckBox->isChecked()); + SettingsManager::setOption(SettingsManager::AddressField_CompletionDisplayModeOption, (m_ui->browsingDisplayModeColumnsRadioButton->isChecked() ? QLatin1String("columns") : QLatin1String("compact"))); SettingsManager::setOption(SettingsManager::AddressField_ShowCompletionCategoriesOption, m_ui->browsingCategoriesCheckBox->isChecked()); - SettingsManager::setOption(SettingsManager::AddressField_CompletionDisplayModeOption, m_ui->browsingDisplayModeComboBox->currentData(Qt::UserRole).toString()); QSettings notificationsSettings(SessionsManager::getWritableDataPath(QLatin1String("notifications.ini")), QSettings::IniFormat); notificationsSettings.setIniCodec("UTF-8"); diff --git a/src/modules/windows/preferences/AdvancedPreferencesPage.ui b/src/modules/windows/preferences/AdvancedPreferencesPage.ui index 5dadb11283..d531ab0866 100644 --- a/src/modules/windows/preferences/AdvancedPreferencesPage.ui +++ b/src/modules/windows/preferences/AdvancedPreferencesPage.ui @@ -134,26 +134,63 @@ - + - Show category headers + Display mode: - - - - - Display mode: + + + + + Qt::Horizontal - + + QSizePolicy::Fixed + + + + 20 + 0 + + + - - + + + + + + Compact + + + browsingDisplayModeButtonGroup + + + + + + + Columns + + + browsingDisplayModeButtonGroup + + + + + + + + Show category headers + + + @@ -1356,6 +1393,7 @@ +