@@ -42,7 +42,6 @@
|
||||
|
||||
#include "appearancesettingspage.h"
|
||||
#include "utilities/colorutils.h"
|
||||
#include "core/appearance.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "core/stylehelper.h"
|
||||
#include "covermanager/albumcoverchoicecontroller.h"
|
||||
@@ -55,10 +54,6 @@ 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";
|
||||
|
||||
const char *AppearanceSettingsPage::kBackgroundImageType = "background_image_type";
|
||||
const char *AppearanceSettingsPage::kBackgroundImageFilename = "background_image_file";
|
||||
const char *AppearanceSettingsPage::kBackgroundImagePosition = "background_image_position";
|
||||
@@ -89,7 +84,6 @@ const char *AppearanceSettingsPage::kPlaylistPlayingSongColor = "playlist_playin
|
||||
AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog, QWidget *parent)
|
||||
: SettingsPage(dialog, parent),
|
||||
ui_(new Ui_AppearanceSettingsPage),
|
||||
original_use_a_custom_color_set_(false),
|
||||
background_image_type_(BackgroundImageType_Default) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
@@ -109,10 +103,6 @@ AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog, QWidget *
|
||||
QObject::connect(ui_->blur_slider, &QSlider::valueChanged, this, &AppearanceSettingsPage::BlurLevelChanged);
|
||||
QObject::connect(ui_->opacity_slider, &QSlider::valueChanged, this, &AppearanceSettingsPage::OpacityLevelChanged);
|
||||
|
||||
QObject::connect(ui_->use_a_custom_color_set, &QRadioButton::toggled, this, &AppearanceSettingsPage::UseCustomColorSetOptionChanged);
|
||||
QObject::connect(ui_->select_foreground_color, &QPushButton::pressed, this, &AppearanceSettingsPage::SelectForegroundColor);
|
||||
QObject::connect(ui_->select_background_color, &QPushButton::pressed, this, &AppearanceSettingsPage::SelectBackgroundColor);
|
||||
|
||||
QObject::connect(ui_->use_default_background, &QRadioButton::toggled, ui_->widget_custom_background_image_options, &AppearanceSettingsPage::setDisabled);
|
||||
QObject::connect(ui_->use_no_background, &QRadioButton::toggled, ui_->widget_custom_background_image_options, &AppearanceSettingsPage::setDisabled);
|
||||
QObject::connect(ui_->use_album_cover_background, &QRadioButton::toggled, ui_->widget_custom_background_image_options, &AppearanceSettingsPage::setEnabled);
|
||||
@@ -158,18 +148,6 @@ void AppearanceSettingsPage::Load() {
|
||||
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
|
||||
original_use_a_custom_color_set_ = s.value(kUseCustomColorSet, false).toBool();
|
||||
|
||||
original_foreground_color_ = s.value(kForegroundColor, p.color(QPalette::WindowText)).value<QColor>();
|
||||
current_foreground_color_ = original_foreground_color_;
|
||||
original_background_color_ = s.value(kBackgroundColor, p.color(QPalette::Window)).value<QColor>();
|
||||
current_background_color_ = original_background_color_;
|
||||
|
||||
InitColorSelectorsColors();
|
||||
|
||||
// Tab widget BG color settings.
|
||||
bool tabbar_system_color = s.value(kTabBarSystemColor, true).toBool();
|
||||
ui_->tabbar_gradient->setChecked(s.value(kTabBarGradient, true).toBool());
|
||||
@@ -185,9 +163,6 @@ void AppearanceSettingsPage::Load() {
|
||||
background_image_type_ = static_cast<BackgroundImageType>(s.value(kBackgroundImageType).toInt());
|
||||
background_image_filename_ = s.value(kBackgroundImageFilename).toString();
|
||||
|
||||
ui_->use_system_color_set->setChecked(!original_use_a_custom_color_set_);
|
||||
ui_->use_a_custom_color_set->setChecked(original_use_a_custom_color_set_);
|
||||
|
||||
switch (background_image_type_) {
|
||||
case BackgroundImageType_Default:
|
||||
ui_->use_default_background->setChecked(true);
|
||||
@@ -257,18 +232,6 @@ void AppearanceSettingsPage::Save() {
|
||||
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) {
|
||||
s.setValue(kBackgroundColor, current_background_color_);
|
||||
s.setValue(kForegroundColor, current_foreground_color_);
|
||||
}
|
||||
else {
|
||||
dialog()->appearance()->ResetToSystemDefaultTheme();
|
||||
s.remove(kBackgroundColor);
|
||||
s.remove(kForegroundColor);
|
||||
}
|
||||
|
||||
background_image_filename_ = ui_->background_image_filename->text();
|
||||
if (ui_->use_default_background->isChecked()) {
|
||||
background_image_type_ = BackgroundImageType_Default;
|
||||
@@ -326,70 +289,6 @@ void AppearanceSettingsPage::Save() {
|
||||
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::Cancel() {
|
||||
|
||||
if (original_use_a_custom_color_set_) {
|
||||
dialog()->appearance()->ChangeForegroundColor(original_foreground_color_);
|
||||
dialog()->appearance()->ChangeBackgroundColor(original_background_color_);
|
||||
}
|
||||
else {
|
||||
dialog()->appearance()->ResetToSystemDefaultTheme();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::SelectForegroundColor() {
|
||||
|
||||
QColor color_selected = QColorDialog::getColor(current_foreground_color_);
|
||||
if (!color_selected.isValid()) return;
|
||||
|
||||
current_foreground_color_ = color_selected;
|
||||
dialog()->appearance()->ChangeForegroundColor(color_selected);
|
||||
|
||||
UpdateColorSelectorColor(ui_->select_foreground_color, color_selected);
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::SelectBackgroundColor() {
|
||||
|
||||
QColor color_selected = QColorDialog::getColor(current_background_color_);
|
||||
if (!color_selected.isValid()) return;
|
||||
|
||||
current_background_color_ = color_selected;
|
||||
dialog()->appearance()->ChangeBackgroundColor(color_selected);
|
||||
|
||||
UpdateColorSelectorColor(ui_->select_background_color, color_selected);
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::UseCustomColorSetOptionChanged(bool checked) {
|
||||
|
||||
if (checked) {
|
||||
dialog()->appearance()->ChangeForegroundColor(current_foreground_color_);
|
||||
dialog()->appearance()->ChangeBackgroundColor(current_background_color_);
|
||||
}
|
||||
else {
|
||||
dialog()->appearance()->ResetToSystemDefaultTheme();
|
||||
QPalette p = QApplication::palette();
|
||||
current_foreground_color_ = p.color(QPalette::WindowText);
|
||||
current_background_color_ = p.color(QPalette::Window);
|
||||
UpdateColorSelectorColor(ui_->select_foreground_color, current_foreground_color_);
|
||||
UpdateColorSelectorColor(ui_->select_background_color, current_background_color_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::InitColorSelectorsColors() {
|
||||
|
||||
UpdateColorSelectorColor(ui_->select_foreground_color, current_foreground_color_);
|
||||
UpdateColorSelectorColor(ui_->select_background_color, current_background_color_);
|
||||
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::UpdateColorSelectorColor(QWidget *color_selector, const QColor &color) {
|
||||
|
||||
QString css = QString("background-color: rgb(%1, %2, %3); color: rgb(255, 255, 255); border: 1px dotted black;").arg(color.red()).arg(color.green()).arg(color.blue());
|
||||
|
||||
@@ -46,10 +46,6 @@ class AppearanceSettingsPage : public SettingsPage {
|
||||
|
||||
static const char *kStyle;
|
||||
|
||||
static const char *kUseCustomColorSet;
|
||||
static const char *kForegroundColor;
|
||||
static const char *kBackgroundColor;
|
||||
|
||||
static const char *kBackgroundImageType;
|
||||
static const char *kBackgroundImageFilename;
|
||||
static const char *kBackgroundImagePosition;
|
||||
@@ -97,14 +93,10 @@ class AppearanceSettingsPage : public SettingsPage {
|
||||
|
||||
void Load() override;
|
||||
void Save() override;
|
||||
void Cancel() override;
|
||||
|
||||
static QColor DefaultTabbarBgColor();
|
||||
|
||||
private slots:
|
||||
void SelectForegroundColor();
|
||||
void SelectBackgroundColor();
|
||||
void UseCustomColorSetOptionChanged(bool);
|
||||
void SelectBackgroundImage();
|
||||
void BlurLevelChanged(int);
|
||||
void OpacityLevelChanged(int);
|
||||
@@ -116,16 +108,9 @@ class AppearanceSettingsPage : public SettingsPage {
|
||||
private:
|
||||
// Set the widget's background to new_color
|
||||
static void UpdateColorSelectorColor(QWidget *color_selector, const QColor &new_color);
|
||||
// Init (or refresh) the colorSelectors colors
|
||||
void InitColorSelectorsColors();
|
||||
|
||||
Ui_AppearanceSettingsPage *ui_;
|
||||
|
||||
bool original_use_a_custom_color_set_;
|
||||
QColor original_foreground_color_;
|
||||
QColor original_background_color_;
|
||||
QColor current_foreground_color_;
|
||||
QColor current_background_color_;
|
||||
QColor current_tabbar_bg_color_;
|
||||
BackgroundImageType background_image_type_;
|
||||
QString background_image_filename_;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>612</width>
|
||||
<height>1166</height>
|
||||
<height>1186</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -64,77 +64,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_colors">
|
||||
<property name="title">
|
||||
<string>Colors</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="layout_colors">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="use_system_color_set">
|
||||
<property name="text">
|
||||
<string>&Use the system default color set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="use_a_custom_color_set">
|
||||
<property name="text">
|
||||
<string>Use a custom color set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_foreground_color">
|
||||
<item>
|
||||
<widget class="QLabel" name="select_foreground_color_label">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select foreground color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="select_foreground_color">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_background_color">
|
||||
<item>
|
||||
<widget class="QLabel" name="select_background_color_label">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select background color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="select_background_color">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_tabbar_colors">
|
||||
<property name="title">
|
||||
@@ -669,10 +598,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>use_system_color_set</tabstop>
|
||||
<tabstop>use_a_custom_color_set</tabstop>
|
||||
<tabstop>select_foreground_color</tabstop>
|
||||
<tabstop>select_background_color</tabstop>
|
||||
<tabstop>tabbar_system_color</tabstop>
|
||||
<tabstop>tabbar_custom_color</tabstop>
|
||||
<tabstop>tabbar_gradient</tabstop>
|
||||
@@ -699,38 +624,5 @@
|
||||
<tabstop>spinbox_icon_size_configure_buttons</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>use_a_custom_color_set</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>select_background_color</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>301</x>
|
||||
<y>72</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>440</x>
|
||||
<y>139</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>use_a_custom_color_set</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>select_foreground_color</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>301</x>
|
||||
<y>72</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>440</x>
|
||||
<y>104</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -122,7 +122,6 @@ SettingsDialog::SettingsDialog(Application *app, OSDBase *osd, QMainWindow *main
|
||||
engine_(app_->player()->engine()),
|
||||
model_(app_->collection_model()->directory_model()),
|
||||
manager_(nullptr),
|
||||
appearance_(app_->appearance()),
|
||||
ui_(new Ui_SettingsDialog),
|
||||
loading_settings_(false) {
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ class QCloseEvent;
|
||||
|
||||
class Application;
|
||||
class Player;
|
||||
class Appearance;
|
||||
class CollectionDirectoryModel;
|
||||
class GlobalShortcutsManager;
|
||||
class SettingsPage;
|
||||
@@ -110,7 +109,6 @@ class SettingsDialog : public QDialog {
|
||||
EngineBase *engine() const { return engine_; }
|
||||
CollectionDirectoryModel *collection_directory_model() const { return model_; }
|
||||
GlobalShortcutsManager *global_shortcuts_manager() const { return manager_; }
|
||||
Appearance *appearance() const { return appearance_; }
|
||||
|
||||
void OpenAtPage(Page page);
|
||||
|
||||
@@ -157,7 +155,6 @@ class SettingsDialog : public QDialog {
|
||||
EngineBase *engine_;
|
||||
CollectionDirectoryModel *model_;
|
||||
GlobalShortcutsManager *manager_;
|
||||
Appearance *appearance_;
|
||||
|
||||
Ui_SettingsDialog *ui_;
|
||||
bool loading_settings_;
|
||||
|
||||
Reference in New Issue
Block a user