parent
f632e95600
commit
a2b5c3ea08
|
@ -130,11 +130,6 @@ Copyright: 2012, David Sansome <me@davidsansome.com>
|
||||||
2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: src/core/appearance.cpp
|
|
||||||
src/core/appearance.h
|
|
||||||
Copyright: 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
|
|
||||||
License: GPL-3+
|
|
||||||
|
|
||||||
Files: src/covermanager/discogscoverprovider.cpp
|
Files: src/covermanager/discogscoverprovider.cpp
|
||||||
src/covermanager/discogscoverprovider.h
|
src/covermanager/discogscoverprovider.h
|
||||||
Copyright: 2012, Martin Björklund <mbj4668@gmail.com>
|
Copyright: 2012, Martin Björklund <mbj4668@gmail.com>
|
||||||
|
|
|
@ -7,7 +7,6 @@ endif()
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
core/mainwindow.cpp
|
core/mainwindow.cpp
|
||||||
core/application.cpp
|
core/application.cpp
|
||||||
core/appearance.cpp
|
|
||||||
core/player.cpp
|
core/player.cpp
|
||||||
core/commandlineoptions.cpp
|
core/commandlineoptions.cpp
|
||||||
core/database.cpp
|
core/database.cpp
|
||||||
|
@ -278,7 +277,6 @@ set(SOURCES
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
core/mainwindow.h
|
core/mainwindow.h
|
||||||
core/application.h
|
core/application.h
|
||||||
core/appearance.h
|
|
||||||
core/player.h
|
core/player.h
|
||||||
core/database.h
|
core/database.h
|
||||||
core/deletefiles.h
|
core/deletefiles.h
|
||||||
|
|
|
@ -1,92 +0,0 @@
|
||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
|
|
||||||
*
|
|
||||||
* Strawberry is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Strawberry is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QPalette>
|
|
||||||
#include <QColor>
|
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
#include "appearance.h"
|
|
||||||
#include "settings/appearancesettingspage.h"
|
|
||||||
|
|
||||||
const QPalette Appearance::kDefaultPalette = QPalette();
|
|
||||||
|
|
||||||
Appearance::Appearance(QObject *parent) : QObject(parent) {
|
|
||||||
|
|
||||||
QPalette p = QApplication::palette();
|
|
||||||
|
|
||||||
QSettings s;
|
|
||||||
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
|
|
||||||
background_color_ = s.value(AppearanceSettingsPage::kBackgroundColor, p.color(QPalette::WindowText)).value<QColor>();
|
|
||||||
foreground_color_ = s.value(AppearanceSettingsPage::kForegroundColor, p.color(QPalette::Window)).value<QColor>();
|
|
||||||
s.endGroup();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Appearance::LoadUserTheme() {
|
|
||||||
|
|
||||||
QSettings s;
|
|
||||||
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
|
|
||||||
bool use_a_custom_color_set = s.value(AppearanceSettingsPage::kUseCustomColorSet).toBool();
|
|
||||||
s.endGroup();
|
|
||||||
|
|
||||||
if (use_a_custom_color_set) {
|
|
||||||
ChangeForegroundColor(foreground_color_);
|
|
||||||
ChangeBackgroundColor(background_color_);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Appearance::ResetToSystemDefaultTheme() {
|
|
||||||
QApplication::setPalette(kDefaultPalette);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Appearance::ChangeForegroundColor(const QColor &color) {
|
|
||||||
|
|
||||||
// Get the application palette
|
|
||||||
QPalette p = QApplication::palette();
|
|
||||||
|
|
||||||
// Modify the palette
|
|
||||||
p.setColor(QPalette::WindowText, color);
|
|
||||||
p.setColor(QPalette::Text, color);
|
|
||||||
|
|
||||||
// Make the modified palette the new application's palette
|
|
||||||
QApplication::setPalette(p);
|
|
||||||
foreground_color_ = color;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Appearance::ChangeBackgroundColor(const QColor &color) {
|
|
||||||
|
|
||||||
// Get the application palette
|
|
||||||
QPalette p = QApplication::palette();
|
|
||||||
|
|
||||||
// Modify the palette
|
|
||||||
p.setColor(QPalette::Window, color);
|
|
||||||
p.setColor(QPalette::Base, color);
|
|
||||||
|
|
||||||
// Make the modified palette the new application's palette
|
|
||||||
QApplication::setPalette(p);
|
|
||||||
background_color_ = color;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
|
|
||||||
*
|
|
||||||
* Strawberry is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Strawberry is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef APPEARANCE_H
|
|
||||||
#define APPEARANCE_H
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QColor>
|
|
||||||
#include <QPalette>
|
|
||||||
|
|
||||||
class Appearance : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit Appearance(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
static const QPalette kDefaultPalette;
|
|
||||||
|
|
||||||
void LoadUserTheme();
|
|
||||||
static void ResetToSystemDefaultTheme();
|
|
||||||
void ChangeForegroundColor(const QColor &color);
|
|
||||||
void ChangeBackgroundColor(const QColor &color);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QColor foreground_color_;
|
|
||||||
QColor background_color_;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // APPEARANCE_H
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "taskmanager.h"
|
#include "taskmanager.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "appearance.h"
|
|
||||||
|
|
||||||
#include "engine/devicefinders.h"
|
#include "engine/devicefinders.h"
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
|
@ -109,7 +108,6 @@ class ApplicationImpl {
|
||||||
QTimer::singleShot(30s, db, &Database::DoBackup);
|
QTimer::singleShot(30s, db, &Database::DoBackup);
|
||||||
return db;
|
return db;
|
||||||
}),
|
}),
|
||||||
appearance_([app]() { return new Appearance(app); }),
|
|
||||||
task_manager_([app]() { return new TaskManager(app); }),
|
task_manager_([app]() { return new TaskManager(app); }),
|
||||||
player_([app]() { return new Player(app, app); }),
|
player_([app]() { return new Player(app, app); }),
|
||||||
device_finders_([app]() { return new DeviceFinders(app); }),
|
device_finders_([app]() { return new DeviceFinders(app); }),
|
||||||
|
@ -183,7 +181,6 @@ class ApplicationImpl {
|
||||||
|
|
||||||
Lazy<TagReaderClient> tag_reader_client_;
|
Lazy<TagReaderClient> tag_reader_client_;
|
||||||
Lazy<Database> database_;
|
Lazy<Database> database_;
|
||||||
Lazy<Appearance> appearance_;
|
|
||||||
Lazy<TaskManager> task_manager_;
|
Lazy<TaskManager> task_manager_;
|
||||||
Lazy<Player> player_;
|
Lazy<Player> player_;
|
||||||
Lazy<DeviceFinders> device_finders_;
|
Lazy<DeviceFinders> device_finders_;
|
||||||
|
@ -315,7 +312,6 @@ void Application::ReloadSettings() { emit SettingsChanged(); }
|
||||||
void Application::OpenSettingsDialogAtPage(SettingsDialog::Page page) { emit SettingsDialogRequested(page); }
|
void Application::OpenSettingsDialogAtPage(SettingsDialog::Page page) { emit SettingsDialogRequested(page); }
|
||||||
|
|
||||||
TagReaderClient *Application::tag_reader_client() const { return p_->tag_reader_client_.get(); }
|
TagReaderClient *Application::tag_reader_client() const { return p_->tag_reader_client_.get(); }
|
||||||
Appearance *Application::appearance() const { return p_->appearance_.get(); }
|
|
||||||
Database *Application::database() const { return p_->database_.get(); }
|
Database *Application::database() const { return p_->database_.get(); }
|
||||||
TaskManager *Application::task_manager() const { return p_->task_manager_.get(); }
|
TaskManager *Application::task_manager() const { return p_->task_manager_.get(); }
|
||||||
Player *Application::player() const { return p_->player_.get(); }
|
Player *Application::player() const { return p_->player_.get(); }
|
||||||
|
|
|
@ -41,7 +41,6 @@ class TagReaderClient;
|
||||||
class Database;
|
class Database;
|
||||||
class DeviceFinders;
|
class DeviceFinders;
|
||||||
class Player;
|
class Player;
|
||||||
class Appearance;
|
|
||||||
class SCollection;
|
class SCollection;
|
||||||
class CollectionBackend;
|
class CollectionBackend;
|
||||||
class CollectionModel;
|
class CollectionModel;
|
||||||
|
@ -73,7 +72,6 @@ class Application : public QObject {
|
||||||
|
|
||||||
TagReaderClient *tag_reader_client() const;
|
TagReaderClient *tag_reader_client() const;
|
||||||
Database *database() const;
|
Database *database() const;
|
||||||
Appearance *appearance() const;
|
|
||||||
TaskManager *task_manager() const;
|
TaskManager *task_manager() const;
|
||||||
Player *player() const;
|
Player *player() const;
|
||||||
DeviceFinders *device_finders() const;
|
DeviceFinders *device_finders() const;
|
||||||
|
|
|
@ -88,7 +88,6 @@
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "appearance.h"
|
|
||||||
#include "filesystemmusicstorage.h"
|
#include "filesystemmusicstorage.h"
|
||||||
#include "deletefiles.h"
|
#include "deletefiles.h"
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
@ -874,11 +873,6 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
||||||
QObject::connect(ui_->action_console, &QAction::triggered, this, &MainWindow::ShowConsole);
|
QObject::connect(ui_->action_console, &QAction::triggered, this, &MainWindow::ShowConsole);
|
||||||
PlayingWidgetPositionChanged(ui_->widget_playing->show_above_status_bar());
|
PlayingWidgetPositionChanged(ui_->widget_playing->show_above_status_bar());
|
||||||
|
|
||||||
// Load theme
|
|
||||||
// This is tricky: we need to save the default/system palette now,
|
|
||||||
// before loading user preferred theme (which will override it), to be able to restore it later
|
|
||||||
const_cast<QPalette&>(Appearance::kDefaultPalette) = QApplication::palette();
|
|
||||||
app_->appearance()->LoadUserTheme();
|
|
||||||
StyleSheetLoader *css_loader = new StyleSheetLoader(this);
|
StyleSheetLoader *css_loader = new StyleSheetLoader(this);
|
||||||
css_loader->SetStyleSheet(this, ":/style/strawberry.css");
|
css_loader->SetStyleSheet(this, ":/style/strawberry.css");
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
#include "appearancesettingspage.h"
|
#include "appearancesettingspage.h"
|
||||||
#include "utilities/colorutils.h"
|
#include "utilities/colorutils.h"
|
||||||
#include "core/appearance.h"
|
|
||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
#include "core/stylehelper.h"
|
#include "core/stylehelper.h"
|
||||||
#include "covermanager/albumcoverchoicecontroller.h"
|
#include "covermanager/albumcoverchoicecontroller.h"
|
||||||
|
@ -55,10 +54,6 @@ const char *AppearanceSettingsPage::kSettingsGroup = "Appearance";
|
||||||
const char *AppearanceSettingsPage::kStyle = "style";
|
const char *AppearanceSettingsPage::kStyle = "style";
|
||||||
const char *AppearanceSettingsPage::kSystemThemeIcons = "system_icons";
|
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::kBackgroundImageType = "background_image_type";
|
||||||
const char *AppearanceSettingsPage::kBackgroundImageFilename = "background_image_file";
|
const char *AppearanceSettingsPage::kBackgroundImageFilename = "background_image_file";
|
||||||
const char *AppearanceSettingsPage::kBackgroundImagePosition = "background_image_position";
|
const char *AppearanceSettingsPage::kBackgroundImagePosition = "background_image_position";
|
||||||
|
@ -89,7 +84,6 @@ const char *AppearanceSettingsPage::kPlaylistPlayingSongColor = "playlist_playin
|
||||||
AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog, QWidget *parent)
|
AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog, QWidget *parent)
|
||||||
: SettingsPage(dialog, parent),
|
: SettingsPage(dialog, parent),
|
||||||
ui_(new Ui_AppearanceSettingsPage),
|
ui_(new Ui_AppearanceSettingsPage),
|
||||||
original_use_a_custom_color_set_(false),
|
|
||||||
background_image_type_(BackgroundImageType_Default) {
|
background_image_type_(BackgroundImageType_Default) {
|
||||||
|
|
||||||
ui_->setupUi(this);
|
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_->blur_slider, &QSlider::valueChanged, this, &AppearanceSettingsPage::BlurLevelChanged);
|
||||||
QObject::connect(ui_->opacity_slider, &QSlider::valueChanged, this, &AppearanceSettingsPage::OpacityLevelChanged);
|
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_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_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);
|
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());
|
ui_->checkbox_system_icons->setChecked(s.value(kSystemThemeIcons, false).toBool());
|
||||||
#endif
|
#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.
|
// Tab widget BG color settings.
|
||||||
bool tabbar_system_color = s.value(kTabBarSystemColor, true).toBool();
|
bool tabbar_system_color = s.value(kTabBarSystemColor, true).toBool();
|
||||||
ui_->tabbar_gradient->setChecked(s.value(kTabBarGradient, 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_type_ = static_cast<BackgroundImageType>(s.value(kBackgroundImageType).toInt());
|
||||||
background_image_filename_ = s.value(kBackgroundImageFilename).toString();
|
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_) {
|
switch (background_image_type_) {
|
||||||
case BackgroundImageType_Default:
|
case BackgroundImageType_Default:
|
||||||
ui_->use_default_background->setChecked(true);
|
ui_->use_default_background->setChecked(true);
|
||||||
|
@ -257,18 +232,6 @@ void AppearanceSettingsPage::Save() {
|
||||||
s.setValue(kSystemThemeIcons, ui_->checkbox_system_icons->isChecked());
|
s.setValue(kSystemThemeIcons, ui_->checkbox_system_icons->isChecked());
|
||||||
#endif
|
#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();
|
background_image_filename_ = ui_->background_image_filename->text();
|
||||||
if (ui_->use_default_background->isChecked()) {
|
if (ui_->use_default_background->isChecked()) {
|
||||||
background_image_type_ = BackgroundImageType_Default;
|
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) {
|
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());
|
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 *kStyle;
|
||||||
|
|
||||||
static const char *kUseCustomColorSet;
|
|
||||||
static const char *kForegroundColor;
|
|
||||||
static const char *kBackgroundColor;
|
|
||||||
|
|
||||||
static const char *kBackgroundImageType;
|
static const char *kBackgroundImageType;
|
||||||
static const char *kBackgroundImageFilename;
|
static const char *kBackgroundImageFilename;
|
||||||
static const char *kBackgroundImagePosition;
|
static const char *kBackgroundImagePosition;
|
||||||
|
@ -97,14 +93,10 @@ class AppearanceSettingsPage : public SettingsPage {
|
||||||
|
|
||||||
void Load() override;
|
void Load() override;
|
||||||
void Save() override;
|
void Save() override;
|
||||||
void Cancel() override;
|
|
||||||
|
|
||||||
static QColor DefaultTabbarBgColor();
|
static QColor DefaultTabbarBgColor();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SelectForegroundColor();
|
|
||||||
void SelectBackgroundColor();
|
|
||||||
void UseCustomColorSetOptionChanged(bool);
|
|
||||||
void SelectBackgroundImage();
|
void SelectBackgroundImage();
|
||||||
void BlurLevelChanged(int);
|
void BlurLevelChanged(int);
|
||||||
void OpacityLevelChanged(int);
|
void OpacityLevelChanged(int);
|
||||||
|
@ -116,16 +108,9 @@ class AppearanceSettingsPage : public SettingsPage {
|
||||||
private:
|
private:
|
||||||
// Set the widget's background to new_color
|
// Set the widget's background to new_color
|
||||||
static void UpdateColorSelectorColor(QWidget *color_selector, const QColor &new_color);
|
static void UpdateColorSelectorColor(QWidget *color_selector, const QColor &new_color);
|
||||||
// Init (or refresh) the colorSelectors colors
|
|
||||||
void InitColorSelectorsColors();
|
|
||||||
|
|
||||||
Ui_AppearanceSettingsPage *ui_;
|
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_;
|
QColor current_tabbar_bg_color_;
|
||||||
BackgroundImageType background_image_type_;
|
BackgroundImageType background_image_type_;
|
||||||
QString background_image_filename_;
|
QString background_image_filename_;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>612</width>
|
<width>612</width>
|
||||||
<height>1166</height>
|
<height>1186</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -64,77 +64,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupbox_tabbar_colors">
|
<widget class="QGroupBox" name="groupbox_tabbar_colors">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -669,10 +598,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<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_system_color</tabstop>
|
||||||
<tabstop>tabbar_custom_color</tabstop>
|
<tabstop>tabbar_custom_color</tabstop>
|
||||||
<tabstop>tabbar_gradient</tabstop>
|
<tabstop>tabbar_gradient</tabstop>
|
||||||
|
@ -699,38 +624,5 @@
|
||||||
<tabstop>spinbox_icon_size_configure_buttons</tabstop>
|
<tabstop>spinbox_icon_size_configure_buttons</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<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>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -122,7 +122,6 @@ SettingsDialog::SettingsDialog(Application *app, OSDBase *osd, QMainWindow *main
|
||||||
engine_(app_->player()->engine()),
|
engine_(app_->player()->engine()),
|
||||||
model_(app_->collection_model()->directory_model()),
|
model_(app_->collection_model()->directory_model()),
|
||||||
manager_(nullptr),
|
manager_(nullptr),
|
||||||
appearance_(app_->appearance()),
|
|
||||||
ui_(new Ui_SettingsDialog),
|
ui_(new Ui_SettingsDialog),
|
||||||
loading_settings_(false) {
|
loading_settings_(false) {
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ class QCloseEvent;
|
||||||
|
|
||||||
class Application;
|
class Application;
|
||||||
class Player;
|
class Player;
|
||||||
class Appearance;
|
|
||||||
class CollectionDirectoryModel;
|
class CollectionDirectoryModel;
|
||||||
class GlobalShortcutsManager;
|
class GlobalShortcutsManager;
|
||||||
class SettingsPage;
|
class SettingsPage;
|
||||||
|
@ -110,7 +109,6 @@ class SettingsDialog : public QDialog {
|
||||||
EngineBase *engine() const { return engine_; }
|
EngineBase *engine() const { return engine_; }
|
||||||
CollectionDirectoryModel *collection_directory_model() const { return model_; }
|
CollectionDirectoryModel *collection_directory_model() const { return model_; }
|
||||||
GlobalShortcutsManager *global_shortcuts_manager() const { return manager_; }
|
GlobalShortcutsManager *global_shortcuts_manager() const { return manager_; }
|
||||||
Appearance *appearance() const { return appearance_; }
|
|
||||||
|
|
||||||
void OpenAtPage(Page page);
|
void OpenAtPage(Page page);
|
||||||
|
|
||||||
|
@ -157,7 +155,6 @@ class SettingsDialog : public QDialog {
|
||||||
EngineBase *engine_;
|
EngineBase *engine_;
|
||||||
CollectionDirectoryModel *model_;
|
CollectionDirectoryModel *model_;
|
||||||
GlobalShortcutsManager *manager_;
|
GlobalShortcutsManager *manager_;
|
||||||
Appearance *appearance_;
|
|
||||||
|
|
||||||
Ui_SettingsDialog *ui_;
|
Ui_SettingsDialog *ui_;
|
||||||
bool loading_settings_;
|
bool loading_settings_;
|
||||||
|
|
Loading…
Reference in New Issue