1 /*
2  * Strawberry Music Player
3  * This file was part of Clementine.
4  * Copyright 2012, David Sansome <me@davidsansome.com>
5  * Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
6  *
7  * Strawberry is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * Strawberry is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with Strawberry.  If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef APPEARANCESETTINGSPAGE_H
23 #define APPEARANCESETTINGSPAGE_H
24 
25 #include "config.h"
26 
27 #include <QObject>
28 #include <QString>
29 #include <QColor>
30 
31 #include "settingspage.h"
32 
33 class QWidget;
34 
35 class SettingsDialog;
36 class Ui_AppearanceSettingsPage;
37 
38 class AppearanceSettingsPage : public SettingsPage {
39   Q_OBJECT
40 
41  public:
42   explicit AppearanceSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr);
43   ~AppearanceSettingsPage() override;
44 
45   static const char *kSettingsGroup;
46 
47   static const char *kStyle;
48 
49   static const char *kUseCustomColorSet;
50   static const char *kForegroundColor;
51   static const char *kBackgroundColor;
52 
53   static const char *kBackgroundImageType;
54   static const char *kBackgroundImageFilename;
55   static const char *kBackgroundImagePosition;
56   static const char *kBackgroundImageStretch;
57   static const char *kBackgroundImageDoNotCut;
58   static const char *kBackgroundImageKeepAspectRatio;
59   static const char *kBackgroundImageMaxSize;
60 
61   static const char *kBlurRadius;
62   static const char *kOpacityLevel;
63 
64   static const int kDefaultBlurRadius;
65   static const int kDefaultOpacityLevel;
66 
67   static const char *kSystemThemeIcons;
68 
69   static const char *kTabBarSystemColor;
70   static const char *kTabBarGradient;
71   static const char *kTabBarColor;
72 
73   static const char *kIconSizeTabbarSmallMode;
74   static const char *kIconSizeTabbarLargeMode;
75   static const char *kIconSizePlayControlButtons;
76   static const char *kIconSizePlaylistButtons;
77   static const char *kIconSizeLeftPanelButtons;
78   static const char *kIconSizeConfigureButtons;
79 
80   static const char *kPlaylistPlayingSongColor;
81 
82   enum BackgroundImageType {
83     BackgroundImageType_Default,
84     BackgroundImageType_None,
85     BackgroundImageType_Custom,
86     BackgroundImageType_Album,
87     BackgroundImageType_Strawbs
88   };
89 
90   enum BackgroundImagePosition {
91     BackgroundImagePosition_UpperLeft = 1,
92     BackgroundImagePosition_UpperRight = 2,
93     BackgroundImagePosition_Middle = 3,
94     BackgroundImagePosition_BottomLeft = 4,
95     BackgroundImagePosition_BottomRight = 5
96   };
97 
98   void Load() override;
99   void Save() override;
100   void Cancel() override;
101 
102   static QColor DefaultTabbarBgColor();
103 
104  private slots:
105   void SelectForegroundColor();
106   void SelectBackgroundColor();
107   void UseCustomColorSetOptionChanged(bool);
108   void SelectBackgroundImage();
109   void BlurLevelChanged(int);
110   void OpacityLevelChanged(int);
111   void TabBarSystemColor(bool checked);
112   void TabBarSelectBGColor();
113   void PlaylistPlayingSongColorSystem(bool checked);
114   void PlaylistPlayingSongSelectColor();
115 
116  private:
117   // Set the widget's background to new_color
118   static void UpdateColorSelectorColor(QWidget *color_selector, const QColor &new_color);
119   // Init (or refresh) the colorSelectors colors
120   void InitColorSelectorsColors();
121 
122   Ui_AppearanceSettingsPage *ui_;
123 
124   bool original_use_a_custom_color_set_;
125   QColor original_foreground_color_;
126   QColor original_background_color_;
127   QColor current_foreground_color_;
128   QColor current_background_color_;
129   QColor current_tabbar_bg_color_;
130   BackgroundImageType background_image_type_;
131   QString background_image_filename_;
132   QColor current_playlist_playing_song_color_;
133 
134 };
135 
136 #endif  // APPEARANCESETTINGSPAGE_H
137