mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-23 23:37:48 -05:00
Migrate from QSS to QPalette
This commit is contained in:
@@ -195,6 +195,7 @@ HEADERS +=
|
||||
qt/OpenRGBSoftwareInfoPage.h \
|
||||
qt/OpenRGBSupportedDevicesPage.h \
|
||||
qt/OpenRGBSystemInfoPage.h \
|
||||
qt/OpenRGBThemeManager.h \
|
||||
qt/OpenRGBZoneResizeDialog.h \
|
||||
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsEntry.h \
|
||||
qt/OpenRGBE131SettingsPage/OpenRGBE131SettingsPage.h \
|
||||
@@ -575,6 +576,7 @@ SOURCES +=
|
||||
qt/OpenRGBSoftwareInfoPage.cpp \
|
||||
qt/OpenRGBSupportedDevicesPage.cpp \
|
||||
qt/OpenRGBSystemInfoPage.cpp \
|
||||
qt/OpenRGBThemeManager.cpp \
|
||||
qt/OpenRGBZoneResizeDialog.cpp \
|
||||
qt/OpenRGBZonesBulkResizer.cpp \
|
||||
qt/TabLabel.cpp \
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "LogManager.h"
|
||||
#include "PluginManager.h"
|
||||
#include "OpenRGBThemeManager.h"
|
||||
|
||||
PluginManager::PluginManager(bool dark_theme_val)
|
||||
PluginManager::PluginManager()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Initialize plugin manager class variables |
|
||||
\*---------------------------------------------------------*/
|
||||
dark_theme = dark_theme_val;
|
||||
AddPluginCallbackVal = nullptr;
|
||||
AddPluginCallbackArg = nullptr;
|
||||
RemovePluginCallbackVal = nullptr;
|
||||
@@ -259,6 +259,8 @@ void PluginManager::LoadPlugin(std::string path)
|
||||
|
||||
QObject* instance = ActivePlugins[plugin_idx].loader->instance();
|
||||
|
||||
bool dark_theme = OpenRGBThemeManager::IsDarkTheme();
|
||||
|
||||
if(instance)
|
||||
{
|
||||
OpenRGBPluginInterface* plugin = qobject_cast<OpenRGBPluginInterface*>(instance);
|
||||
|
||||
@@ -29,7 +29,7 @@ typedef void (*RemovePluginCallback)(void *, OpenRGBPluginEntry* plugin);
|
||||
class PluginManager
|
||||
{
|
||||
public:
|
||||
PluginManager(bool dark_theme);
|
||||
PluginManager();
|
||||
|
||||
void RegisterAddPluginCallback(AddPluginCallback new_callback, void * new_callback_arg);
|
||||
void RegisterRemovePluginCallback(RemovePluginCallback new_callback, void * new_callback_arg);
|
||||
@@ -47,8 +47,6 @@ public:
|
||||
std::vector<OpenRGBPluginEntry> ActivePlugins;
|
||||
|
||||
private:
|
||||
bool dark_theme;
|
||||
|
||||
AddPluginCallback AddPluginCallbackVal;
|
||||
void * AddPluginCallbackArg;
|
||||
|
||||
|
||||
@@ -11,16 +11,13 @@
|
||||
#include "ResourceManager.h"
|
||||
#include "TabLabel.h"
|
||||
#include "OpenRGBZonesBulkResizer.h"
|
||||
#include "OpenRGBThemeManager.h"
|
||||
#include <QLabel>
|
||||
#include <QTabBar>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QStyleFactory>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <QSettings>
|
||||
#endif
|
||||
|
||||
using namespace Ui;
|
||||
|
||||
static QString GetIconString(device_type type, bool dark)
|
||||
@@ -132,60 +129,6 @@ static void DialogShowCallback(void * this_ptr, PLogMessage msg)
|
||||
QMetaObject::invokeMethod(this_obj, "onShowDialogMessage", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
bool OpenRGBDialog2::IsDarkTheme()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/*-------------------------------------------------*\
|
||||
| Windows dark theme settings |
|
||||
\*-------------------------------------------------*/
|
||||
json theme_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get prefered theme from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
theme_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Theme");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Read the theme key and adjust accordingly |
|
||||
\*-------------------------------------------------*/
|
||||
std::string current_theme = "light";
|
||||
|
||||
if(theme_settings.contains("theme"))
|
||||
{
|
||||
current_theme = theme_settings["theme"];
|
||||
}
|
||||
|
||||
if((current_theme == "auto") || (current_theme == "dark"))
|
||||
{
|
||||
if(current_theme == "auto")
|
||||
{
|
||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat);
|
||||
|
||||
if(settings.value("AppsUseLightTheme") != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(settings.value("AppsUseLightTheme") == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(current_theme == "dark")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
#else
|
||||
if(QPalette().window().color().value() < 127)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OpenRGBDialog2::IsMinimizeOnClose()
|
||||
{
|
||||
@@ -386,30 +329,7 @@ OpenRGBDialog2::OpenRGBDialog2(QWidget *parent) : QMainWindow(parent), ui(new Op
|
||||
trayIcon->setContextMenu(trayIconMenu);
|
||||
trayIcon->show();
|
||||
|
||||
#ifdef _WIN32
|
||||
/*-------------------------------------------------*\
|
||||
| Apply dark theme on Windows if configured |
|
||||
\*-------------------------------------------------*/
|
||||
if(IsDarkTheme())
|
||||
{
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::WindowText, Qt::white);
|
||||
pal.setColor(QPalette::Link, QColor(0,127,220));
|
||||
pal.setColor(QPalette::LinkVisited, QColor(64,196,220));
|
||||
QApplication::setPalette(pal);
|
||||
QFile darkTheme(":/windows_dark.qss");
|
||||
darkTheme.open(QFile::ReadOnly);
|
||||
setStyleSheet(darkTheme.readAll());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*-------------------------------------------------*\
|
||||
| Apply Qt Fusion theme on MacOS, as the MacOS |
|
||||
| default theme does not handle vertical tabs well |
|
||||
\*-------------------------------------------------*/
|
||||
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
||||
#endif
|
||||
OpenRGBThemeManager::Init();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Update the profile list |
|
||||
@@ -450,7 +370,7 @@ OpenRGBDialog2::OpenRGBDialog2(QWidget *parent) : QMainWindow(parent), ui(new Op
|
||||
/*-----------------------------------------------------*\
|
||||
| Initialize the plugin manager |
|
||||
\*-----------------------------------------------------*/
|
||||
plugin_manager = new PluginManager(IsDarkTheme());
|
||||
plugin_manager = new PluginManager();
|
||||
plugin_manager->RegisterAddPluginCallback(&CreatePluginCallback, this);
|
||||
plugin_manager->RegisterRemovePluginCallback(&DeletePluginCallback, this);
|
||||
plugin_manager->ScanAndLoadPlugins();
|
||||
@@ -585,7 +505,7 @@ void OpenRGBDialog2::AddPluginsPage()
|
||||
|
||||
QString PluginsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
PluginsLabelString = "plugin_dark.png";
|
||||
}
|
||||
@@ -613,7 +533,7 @@ void OpenRGBDialog2::AddSoftwareInfoPage()
|
||||
|
||||
QString SoftwareLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SoftwareLabelString = "software_dark.png";
|
||||
}
|
||||
@@ -641,7 +561,7 @@ void OpenRGBDialog2::AddSupportedDevicesPage()
|
||||
|
||||
QString SettingsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SettingsLabelString = "software_dark.png";
|
||||
}
|
||||
@@ -670,7 +590,7 @@ void OpenRGBDialog2::AddSettingsPage()
|
||||
|
||||
QString SettingsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SettingsLabelString = "settings_dark.png";
|
||||
}
|
||||
@@ -698,7 +618,7 @@ void OpenRGBDialog2::AddE131SettingsPage()
|
||||
|
||||
QString SettingsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SettingsLabelString = "wireless_dark.png";
|
||||
}
|
||||
@@ -726,7 +646,7 @@ void OpenRGBDialog2::AddLIFXSettingsPage()
|
||||
|
||||
QString SettingsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SettingsLabelString = "light_dark.png";
|
||||
}
|
||||
@@ -754,7 +674,7 @@ void OpenRGBDialog2::AddPhilipsHueSettingsPage()
|
||||
|
||||
QString SettingsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SettingsLabelString = "light_dark.png";
|
||||
}
|
||||
@@ -782,7 +702,7 @@ void OpenRGBDialog2::AddPhilipsWizSettingsPage()
|
||||
|
||||
QString SettingsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SettingsLabelString = "light_dark.png";
|
||||
}
|
||||
@@ -810,7 +730,7 @@ void OpenRGBDialog2::AddQMKORGBSettingsPage()
|
||||
|
||||
QString SettingsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SettingsLabelString = "keyboard_dark.png";
|
||||
}
|
||||
@@ -838,7 +758,7 @@ void OpenRGBDialog2::AddSerialSettingsPage()
|
||||
|
||||
QString SettingsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SettingsLabelString = "serial_dark.png";
|
||||
}
|
||||
@@ -866,7 +786,7 @@ void OpenRGBDialog2::AddYeelightSettingsPage()
|
||||
|
||||
QString SettingsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SettingsLabelString = "light_dark.png";
|
||||
}
|
||||
@@ -896,7 +816,7 @@ void OpenRGBDialog2::AddPlugin(OpenRGBPluginEntry* plugin)
|
||||
\*-----------------------------------------------------*/
|
||||
QString PluginLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
PluginLabelString = "plugin_dark.png";
|
||||
}
|
||||
@@ -1080,7 +1000,7 @@ void OpenRGBDialog2::AddI2CToolsPage()
|
||||
|
||||
QString SMBusToolsLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
SMBusToolsLabelString = "tools_dark.png";
|
||||
}
|
||||
@@ -1211,7 +1131,7 @@ void OpenRGBDialog2::UpdateDevicesList()
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* NewTabLabel = new TabLabel(GetIconString(controllers[controller_idx]->type, IsDarkTheme()), QString::fromStdString(controllers[controller_idx]->name));
|
||||
TabLabel* NewTabLabel = new TabLabel(GetIconString(controllers[controller_idx]->type, OpenRGBThemeManager::IsDarkTheme()), QString::fromStdString(controllers[controller_idx]->name));
|
||||
|
||||
ui->DevicesTabBar->tabBar()->setTabButton(ui->DevicesTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel);
|
||||
ui->DevicesTabBar->tabBar()->setTabToolTip(ui->DevicesTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->name));
|
||||
@@ -1262,7 +1182,7 @@ void OpenRGBDialog2::UpdateDevicesList()
|
||||
/*-----------------------------------------------------*\
|
||||
| Create the tab label |
|
||||
\*-----------------------------------------------------*/
|
||||
TabLabel* NewTabLabel = new TabLabel(GetIconString(controllers[controller_idx]->type, IsDarkTheme()), QString::fromStdString(controllers[controller_idx]->name));
|
||||
TabLabel* NewTabLabel = new TabLabel(GetIconString(controllers[controller_idx]->type, OpenRGBThemeManager::IsDarkTheme()), QString::fromStdString(controllers[controller_idx]->name));
|
||||
|
||||
ui->InformationTabBar->tabBar()->setTabButton(ui->InformationTabBar->count() - 1, QTabBar::LeftSide, NewTabLabel);
|
||||
ui->InformationTabBar->tabBar()->setTabToolTip(ui->InformationTabBar->count() - 1, QString::fromStdString(controllers[controller_idx]->name));
|
||||
@@ -1499,16 +1419,6 @@ void OpenRGBDialog2::onShowDialogMessage()
|
||||
|
||||
QMessageBox box;
|
||||
|
||||
if(IsDarkTheme())
|
||||
{
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::WindowText, Qt::white);
|
||||
box.setPalette(pal);
|
||||
QFile darkTheme(":/windows_dark.qss");
|
||||
darkTheme.open(QFile::ReadOnly);
|
||||
box.setStyleSheet(darkTheme.readAll());
|
||||
}
|
||||
|
||||
box.setInformativeText(dialog_message);
|
||||
|
||||
QCheckBox* CheckBox_DontShowAgain = new QCheckBox("Don't show this message again");
|
||||
@@ -1868,7 +1778,7 @@ void Ui::OpenRGBDialog2::AddConsolePage()
|
||||
|
||||
QString ConsoleLabelString;
|
||||
|
||||
if(IsDarkTheme())
|
||||
if(OpenRGBThemeManager::IsDarkTheme())
|
||||
{
|
||||
ConsoleLabelString = "console_dark.png";
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ public:
|
||||
|
||||
void setMode(unsigned char mode_val);
|
||||
|
||||
static bool IsDarkTheme();
|
||||
static bool IsMinimizeOnClose();
|
||||
|
||||
void SetDialogMessage(PLogMessage msg);
|
||||
|
||||
@@ -11,22 +11,6 @@
|
||||
Ui::OpenRGBProfileSaveDialog::OpenRGBProfileSaveDialog(QWidget *parent) :
|
||||
QDialog(parent), ui(new Ui::OpenRGBProfileSaveDialogUi)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
bool DarkTheme = OpenRGBDialog2::IsDarkTheme();
|
||||
/*-------------------------------------------------*\
|
||||
| Apply dark theme on Windows if configured |
|
||||
\*-------------------------------------------------*/
|
||||
if(DarkTheme)
|
||||
{
|
||||
darkTheme = 1;
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::WindowText, Qt::white);
|
||||
QApplication::setPalette(pal);
|
||||
QFile darkTheme(":/windows_dark.qss");
|
||||
darkTheme.open(QFile::ReadOnly);
|
||||
setStyleSheet(darkTheme.readAll());
|
||||
}
|
||||
#endif
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ public:
|
||||
|
||||
private:
|
||||
Ui::OpenRGBProfileSaveDialogUi *ui;
|
||||
bool darkTheme = false;
|
||||
};
|
||||
|
||||
#endif // OPENRGBPROFILESAVEDIALOG_H
|
||||
|
||||
@@ -14,9 +14,8 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Load theme settings (Windows only) |
|
||||
| Load theme settings |
|
||||
\*---------------------------------------------------------*/
|
||||
#ifdef _WIN32
|
||||
ui->ComboBoxTheme->addItems({"auto", "light", "dark"});
|
||||
|
||||
json theme_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Theme");
|
||||
@@ -32,10 +31,6 @@ OpenRGBSettingsPage::OpenRGBSettingsPage(QWidget *parent) :
|
||||
}
|
||||
|
||||
theme_initialized = true;
|
||||
#else
|
||||
ui->ComboBoxTheme->hide();
|
||||
ui->ThemeLabel->hide();
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Load user interface settings |
|
||||
|
||||
117
qt/OpenRGBThemeManager.cpp
Normal file
117
qt/OpenRGBThemeManager.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
#include "OpenRGBThemeManager.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "PluginManager.h"
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QStyle>
|
||||
#include <QPalette>
|
||||
#include <QStyleFactory>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <QSettings>
|
||||
#endif
|
||||
|
||||
void OpenRGBThemeManager::Init()
|
||||
{
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*-------------------------------------------------*\
|
||||
| Apply Qt Fusion theme on MacOS, as the MacOS |
|
||||
| default theme does not handle vertical tabs well |
|
||||
\*-------------------------------------------------*/
|
||||
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
||||
#else
|
||||
/*---------------------------------------------------*\
|
||||
| Apply dark theme on Windows and Linux if configured |
|
||||
\*---------------------------------------------------*/
|
||||
if(IsDarkTheme())
|
||||
{
|
||||
SetDarkTheme();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void OpenRGBThemeManager::SetDarkTheme()
|
||||
{
|
||||
QPalette pal;
|
||||
|
||||
pal.setColor(QPalette::WindowText, Qt::white);
|
||||
pal.setColor(QPalette::Link, QColor(0,127,220));
|
||||
pal.setColor(QPalette::LinkVisited, QColor(64,196,220));
|
||||
pal.setColor(QPalette::Window, QColor(53,53,53));
|
||||
pal.setColor(QPalette::Base, QColor(42,42,42));
|
||||
pal.setColor(QPalette::AlternateBase, QColor(66,66,66));
|
||||
pal.setColor(QPalette::ToolTipBase, Qt::white);
|
||||
pal.setColor(QPalette::ToolTipText, Qt::white);
|
||||
pal.setColor(QPalette::Text, Qt::white);
|
||||
pal.setColor(QPalette::Dark, QColor(35,35,35));
|
||||
pal.setColor(QPalette::Shadow, QColor(20,20,20));
|
||||
pal.setColor(QPalette::Button, QColor(53,53,53));
|
||||
pal.setColor(QPalette::ButtonText, Qt::white);
|
||||
pal.setColor(QPalette::BrightText, Qt::red);
|
||||
pal.setColor(QPalette::Highlight, QColor(42,130,218));
|
||||
pal.setColor(QPalette::HighlightedText, Qt::white);
|
||||
|
||||
pal.setColor(QPalette::Disabled, QPalette::Text, QColor(127,127,127));
|
||||
pal.setColor(QPalette::Disabled, QPalette::WindowText, QColor(127,127,127));
|
||||
pal.setColor(QPalette::Disabled, QPalette::Highlight, QColor(80,80,80) );
|
||||
pal.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(127,127,127));
|
||||
pal.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(127,127,127));
|
||||
pal.setColor(QPalette::Disabled, QPalette::Text, QColor(127,127,127));
|
||||
pal.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(127,127,127));
|
||||
|
||||
#ifdef _WIN32
|
||||
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
||||
#endif
|
||||
|
||||
QApplication::setPalette(pal);
|
||||
}
|
||||
|
||||
bool OpenRGBThemeManager::IsDarkTheme()
|
||||
{
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Dark theme settings |
|
||||
\*-------------------------------------------------*/
|
||||
json theme_settings;
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Get prefered theme from settings manager |
|
||||
\*-------------------------------------------------*/
|
||||
theme_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Theme");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Read the theme key and adjust accordingly |
|
||||
\*-------------------------------------------------*/
|
||||
std::string current_theme = "light";
|
||||
|
||||
if(theme_settings.contains("theme"))
|
||||
{
|
||||
current_theme = theme_settings["theme"];
|
||||
}
|
||||
|
||||
if(current_theme == "dark")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
else if(current_theme == "auto")
|
||||
{
|
||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", QSettings::NativeFormat);
|
||||
|
||||
if(settings.value("AppsUseLightTheme") != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
14
qt/OpenRGBThemeManager.h
Normal file
14
qt/OpenRGBThemeManager.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef OPENRGBTHEMEMANAGER_H
|
||||
#define OPENRGBTHEMEMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class OpenRGBThemeManager
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
static void SetDarkTheme();
|
||||
static bool IsDarkTheme();
|
||||
};
|
||||
|
||||
#endif // OPENRGBTHEMEMANAGER_H
|
||||
@@ -65,17 +65,6 @@ void OpenRGBZonesBulkResizer::RunChecks(QWidget *parent)
|
||||
QDialog* dialog = new QDialog(parent);
|
||||
dialog->setWindowTitle("Resize the zones");
|
||||
|
||||
if (OpenRGBDialog2::IsDarkTheme())
|
||||
{
|
||||
QPalette pal;
|
||||
pal.setColor(QPalette::WindowText, Qt::white);
|
||||
dialog->setPalette(pal);
|
||||
QFile dark_theme(":/windows_dark.qss");
|
||||
dark_theme.open(QFile::ReadOnly);
|
||||
dialog->setStyleSheet(dark_theme.readAll());
|
||||
dark_theme.close();
|
||||
}
|
||||
|
||||
dialog->setMinimumSize(600,480);
|
||||
dialog->setModal(true);
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
<file>gamepad_dark.png</file>
|
||||
<file>light.png</file>
|
||||
<file>light_dark.png</file>
|
||||
<file>windows_dark.qss</file>
|
||||
<file>arrow-down.png</file>
|
||||
<file>arrow-up.png</file>
|
||||
<file>plugin.png</file>
|
||||
|
||||
@@ -1,332 +0,0 @@
|
||||
QMainWindow
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QLabel
|
||||
{
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* External QTabWidget */
|
||||
|
||||
QTabBar
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
}
|
||||
|
||||
QTabBar::tab
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
border: 1px solid #2e2e2e;
|
||||
margin-right: 1px;
|
||||
}
|
||||
|
||||
QTabBar::tab:selected
|
||||
{
|
||||
background-color: #454545;
|
||||
border: 1px solid #2e2e2e;
|
||||
border-bottom: 1px solid #191919;
|
||||
}
|
||||
|
||||
QTabBar::tab:hover
|
||||
{
|
||||
background-color: #757575;
|
||||
border: 1px solid #404040;
|
||||
}
|
||||
|
||||
QTabWidget::pane
|
||||
{
|
||||
/* This is the housing for all of the tabs*/
|
||||
background-color: #5c5c5c;
|
||||
border: 1px solid #2e2e2e;
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
}
|
||||
|
||||
/* Internal QTabWidget */
|
||||
|
||||
QTabWidget::pane QTabBar
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
border-right: 1px solid #2e2e2e;
|
||||
}
|
||||
|
||||
QTabWidget QWidget QTabBar::tab
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 5px;
|
||||
height: 50px;
|
||||
border: 10px;
|
||||
border: 1px solid #5c5c5c;
|
||||
border-right: 1px solid #2e2e2e;
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
QTabWidget QWidget QTabBar::tab:!selected
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
border-right: 1px solid #2e2e2e;
|
||||
border-left: 1px solid #2e2e2e;
|
||||
border-top: 1px solid #2e2e2e;
|
||||
}
|
||||
|
||||
QTabWidget QWidget QTabBar::tab:selected
|
||||
{
|
||||
background-color: #454545;
|
||||
border: 1px solid #2e2e2e;
|
||||
border-right: 1px solid #454545;
|
||||
}
|
||||
|
||||
QTabWidget QWidget QTabBar::tab:last:!selected
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
border: 1px solid #2e2e2e;
|
||||
}
|
||||
|
||||
QTabWidget QWidget QTabBar::tab:hover
|
||||
{
|
||||
background-color: #757575;
|
||||
border: 1px solid #5c5c5c;
|
||||
border-right: 1px solid #2e2e2e;
|
||||
}
|
||||
|
||||
QTabWidget QWidget QTabBar::tab:last:hover
|
||||
{
|
||||
background-color: #757575;
|
||||
border: 1px solid #5c5c5c;
|
||||
border-right: 1px solid #2e2e2e;
|
||||
}
|
||||
|
||||
QTabWidget QWidget QTabWidget::pane /* The contents of the tab (colors, modes, leds, etc.) */
|
||||
{
|
||||
background-color: #454545;
|
||||
border-top: 1px solid #2e2e2e;
|
||||
border: 1px solid #2e2e2e;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: -1px;
|
||||
}
|
||||
|
||||
/* QDialog boxes */
|
||||
|
||||
QDialog::QWidget
|
||||
{
|
||||
background: #454545;
|
||||
background-color: #454545;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QDialog QWidget::QDialogButtonBox
|
||||
{
|
||||
background-color: #454545;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QDialog QWidget::QLabel
|
||||
{
|
||||
background-color: #454545;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QDialog QWidget::QLineEdit
|
||||
{
|
||||
background-color: #454545;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Buttons and combo boxes */
|
||||
|
||||
QPushButton, QToolButton
|
||||
{
|
||||
padding: 3px;
|
||||
background-color: #404040;
|
||||
border: 1px solid #2e2e2e;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QToolButton:hover
|
||||
{
|
||||
background-color: #454545;
|
||||
}
|
||||
|
||||
QMenu
|
||||
{
|
||||
background-color: #404040;
|
||||
border: 1px solid #2e2e2e;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QMenu::item:selected
|
||||
{
|
||||
background-color: #454545;
|
||||
}
|
||||
|
||||
QComboBox
|
||||
{
|
||||
padding: 1px;
|
||||
background-color: #404040;
|
||||
border: 1px solid #2e2e2e;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QComboBox QAbstractItemView
|
||||
{
|
||||
background-color: #404040;
|
||||
color: white;
|
||||
border: 1px solid #2e2e2e;
|
||||
selection-background-color: #303030;
|
||||
}
|
||||
|
||||
QScrollBar:vertical
|
||||
{
|
||||
background: #454545;
|
||||
border: 0px;
|
||||
margin: 0px 0px;
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
/* Arrow images
|
||||
QScrollBar::up-arrow
|
||||
{
|
||||
image: url(":/arrow-up.png");
|
||||
}
|
||||
|
||||
QScrollBar::down-arrow
|
||||
{
|
||||
image: url(":/arrow-down.png");
|
||||
} */
|
||||
|
||||
QScrollBar::handle:vertical
|
||||
{
|
||||
background-color: #454545;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical:hover
|
||||
{
|
||||
background-color: #757575;
|
||||
}
|
||||
|
||||
QComboBox::drop-down
|
||||
{
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
QComboBox::down-arrow
|
||||
{
|
||||
image: url(":/arrow-down.png");
|
||||
}
|
||||
|
||||
QPushButton:!disabled:hover, QComboBox:!disabled:hover
|
||||
{
|
||||
background-color: #4F4F4F;
|
||||
}
|
||||
|
||||
|
||||
QComboBox QAbstractItemView QScrollBar::handle:hover
|
||||
{
|
||||
background-color: #7A7A7A;
|
||||
}
|
||||
|
||||
QPushButton:!disabled:hover, QComboBox:!disabled:hover
|
||||
{
|
||||
background-color: #4F4F4F;
|
||||
}
|
||||
|
||||
QPushButton:disabled, QComboBox:disabled
|
||||
{
|
||||
background-color: #404040;
|
||||
color: #5B5B5B;
|
||||
}
|
||||
|
||||
QPushButton:flat
|
||||
{
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
QRadioButton
|
||||
{
|
||||
color: white;
|
||||
}
|
||||
|
||||
QRadioButton::disabled
|
||||
{
|
||||
color: #5B5B5B;
|
||||
}
|
||||
|
||||
/* Line edits and block edits */
|
||||
|
||||
QLineEdit, QSpinBox
|
||||
{
|
||||
background-color: #4F4F4F;
|
||||
border: 1px solid #5B5B5B;
|
||||
color: white;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
QTreeView
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QHeaderView::section
|
||||
{
|
||||
background-color: #454545;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QPlainTextEdit, QTextEdit
|
||||
{
|
||||
background: #454545;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* QProgressBar and QSlider */
|
||||
|
||||
QProgressBar
|
||||
{
|
||||
border: 1px solid #2e2e2e;
|
||||
background-color: #404040;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QDialog
|
||||
{
|
||||
background-color: #5c5c5c
|
||||
}
|
||||
|
||||
/* QTableWidgets */
|
||||
|
||||
QTableView, QTableWidget, QTableWidget *
|
||||
{
|
||||
background-color: #454545;
|
||||
color: white;
|
||||
}
|
||||
|
||||
QTableWidget QTableCornerButton::section
|
||||
{
|
||||
background-color: #444444;
|
||||
}
|
||||
|
||||
/* QScrollAreas */
|
||||
|
||||
QScrollArea QWidget
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* QListWidgets */
|
||||
|
||||
QListWidget
|
||||
{
|
||||
background-color: #5c5c5c;
|
||||
color: white;
|
||||
}
|
||||
Reference in New Issue
Block a user