diff --git a/src/main.cpp b/src/main.cpp index 955c77d3..a727cace 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -97,6 +97,7 @@ # include "core/translations.h" #endif #include "settings/behavioursettingspage.h" +#include "settings/appearancesettingspage.h" #ifdef HAVE_DBUS # include "osd/osddbus.h" @@ -197,6 +198,16 @@ int main(int argc, char* argv[]) { // Gnome on Ubuntu has menu icons disabled by default. I think that's a bad idea, and makes some menus in Strawberry look confusing. QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, false); + { + QSettings s; + s.beginGroup(AppearanceSettingsPage::kSettingsGroup); + QString style = s.value(AppearanceSettingsPage::kStyle, "default").toString(); + s.endGroup(); + if (style != "default") { + QApplication::setStyle(style); + } + } + // Set the permissions on the config file on Unix - it can contain passwords for internet services so it's important that other users can't read it. // On Windows these are stored in the registry instead. #ifdef Q_OS_UNIX diff --git a/src/settings/appearancesettingspage.cpp b/src/settings/appearancesettingspage.cpp index a8164086..9753dc66 100644 --- a/src/settings/appearancesettingspage.cpp +++ b/src/settings/appearancesettingspage.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -51,6 +52,9 @@ const char *AppearanceSettingsPage::kSettingsGroup = "Appearance"; +const char *AppearanceSettingsPage::kStyle = "style"; +const char *AppearanceSettingsPage::kSystemThemeIcons = "system_icons"; + const char *AppearanceSettingsPage::kUseCustomColorSet = "use-custom-set"; const char *AppearanceSettingsPage::kForegroundColor = "foreground-color"; const char *AppearanceSettingsPage::kBackgroundColor = "background-color"; @@ -69,8 +73,6 @@ const char *AppearanceSettingsPage::kOpacityLevel = "opacity_level"; const int AppearanceSettingsPage::kDefaultBlurRadius = 0; const int AppearanceSettingsPage::kDefaultOpacityLevel = 40; -const char *AppearanceSettingsPage::kSystemThemeIcons = "system_icons"; - const char *AppearanceSettingsPage::kTabBarSystemColor= "tab_system_color"; const char *AppearanceSettingsPage::kTabBarGradient = "tab_gradient"; const char *AppearanceSettingsPage::kTabBarColor = "tab_color"; @@ -91,6 +93,11 @@ AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog) ui_->setupUi(this); setWindowIcon(IconLoader::Load("view-media-visualization")); + ui_->combobox_style->addItem("default", "default"); + for (const QString &style : QStyleFactory::keys()) { + ui_->combobox_style->addItem(style, style); + } + ui_->combobox_backgroundimageposition->setItemData(0, BackgroundImagePosition_UpperLeft); ui_->combobox_backgroundimageposition->setItemData(1, BackgroundImagePosition_UpperRight); ui_->combobox_backgroundimageposition->setItemData(2, BackgroundImagePosition_Middle); @@ -140,6 +147,12 @@ void AppearanceSettingsPage::Load() { QSettings s; s.beginGroup(kSettingsGroup); + ComboBoxLoadFromSettings(s, ui_->combobox_style, kStyle, "default"); + +#if !defined(Q_OS_MACOS) && !defined(Q_OS_WIN) + ui_->checkbox_system_icons->setChecked(s.value(kSystemThemeIcons, false).toBool()); +#endif + QPalette p = QApplication::palette(); // Keep in mind originals colors, in case the user clicks on Cancel, to be able to restore colors @@ -197,10 +210,6 @@ void AppearanceSettingsPage::Load() { ui_->blur_slider->setValue(s.value(kBlurRadius, kDefaultBlurRadius).toInt()); ui_->opacity_slider->setValue(s.value(kOpacityLevel, kDefaultOpacityLevel).toInt()); -#if !defined(Q_OS_MACOS) && !defined(Q_OS_WIN) - ui_->checkbox_system_icons->setChecked(s.value(kSystemThemeIcons, false).toBool()); -#endif - ui_->checkbox_background_image_keep_aspect_ratio->setEnabled(ui_->checkbox_background_image_stretch->isChecked()); ui_->checkbox_background_image_do_not_cut->setEnabled(ui_->checkbox_background_image_stretch->isChecked() && ui_->checkbox_background_image_keep_aspect_ratio->isChecked()); @@ -222,8 +231,16 @@ void AppearanceSettingsPage::Load() { void AppearanceSettingsPage::Save() { QSettings s; - s.beginGroup(kSettingsGroup); + + s.setValue("style", ui_->combobox_style->currentText()); + +#if defined(Q_OS_MACOS) || defined(Q_OS_WIN) + s.setValue(kSystemThemeIcons, false); +#else + s.setValue(kSystemThemeIcons, ui_->checkbox_system_icons->isChecked()); +#endif + bool use_a_custom_color_set = ui_->use_a_custom_color_set->isChecked(); s.setValue(kUseCustomColorSet, use_a_custom_color_set); if (use_a_custom_color_set) { @@ -269,12 +286,6 @@ void AppearanceSettingsPage::Save() { s.setValue(kBlurRadius, ui_->blur_slider->value()); s.setValue(kOpacityLevel, ui_->opacity_slider->value()); -#if defined(Q_OS_MACOS) || defined(Q_OS_WIN) - s.setValue(kSystemThemeIcons, false); -#else - s.setValue(kSystemThemeIcons, ui_->checkbox_system_icons->isChecked()); -#endif - s.setValue(kTabBarSystemColor, ui_->tabbar_system_color->isChecked()); s.setValue(kTabBarGradient, ui_->tabbar_gradient->isChecked()); s.setValue(kTabBarColor, current_tabbar_bg_color_); diff --git a/src/settings/appearancesettingspage.h b/src/settings/appearancesettingspage.h index d33e2394..f8a77033 100644 --- a/src/settings/appearancesettingspage.h +++ b/src/settings/appearancesettingspage.h @@ -44,6 +44,8 @@ class AppearanceSettingsPage : public SettingsPage { static const char *kSettingsGroup; + static const char *kStyle; + static const char *kUseCustomColorSet; static const char *kForegroundColor; static const char *kBackgroundColor; diff --git a/src/settings/appearancesettingspage.ui b/src/settings/appearancesettingspage.ui index ea710c51..078a1144 100644 --- a/src/settings/appearancesettingspage.ui +++ b/src/settings/appearancesettingspage.ui @@ -14,6 +14,56 @@ Appearance + + + + Style + + + + + + + + Style + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Use system theme icons + + + + + + + Settings require restart. + + + + + + @@ -562,13 +612,6 @@ - - - - Use system theme icons - - - @@ -613,7 +656,6 @@ spinbox_icon_size_playlist_buttons spinbox_icon_size_left_panel_buttons spinbox_icon_size_configure_buttons - checkbox_system_icons