Skip to content

Commit

Permalink
Minor theme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Jan 27, 2024
1 parent 848a2ad commit 111e49f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
8 changes: 1 addition & 7 deletions src/powerkit_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ Dialog::Dialog(QWidget *parent,
, resumeLockScreen(nullptr)
, bypassKernel(nullptr)
{

#if QT_VERSION >= 0x050000
qApp->setStyle("Fusion");
#else
qApp->setStyle("Clearlooks");
#endif

// setup dialog
if (quitOnClose) { setAttribute(Qt::WA_QuitOnClose, true); }
setWindowTitle(tr("Power Manager"));
Expand All @@ -81,6 +74,7 @@ Dialog::Dialog(QWidget *parent,
PowerSettings::getConf();

// setup theme
Theme::setAppTheme();
Theme::setIconTheme();
setWindowIcon(QIcon::fromTheme(DEFAULT_AC_ICON));

Expand Down
22 changes: 1 addition & 21 deletions src/powerkit_systray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,6 @@ SysTray::SysTray(QObject *parent)
, pstateMaxSlider(nullptr)
, pstateTurboCheckbox(nullptr)
{
// TODO: we should not force theme
qApp->setStyle("Fusion");
// set (dark) colors
QPalette palette;
palette.setColor(QPalette::Window, QColor(53,53,53));
palette.setColor(QPalette::WindowText, Qt::white);
palette.setColor(QPalette::Base, QColor(15,15,15));
palette.setColor(QPalette::AlternateBase, QColor(53,53,53));
palette.setColor(QPalette::Link, Qt::white);
palette.setColor(QPalette::LinkVisited, Qt::white);
palette.setColor(QPalette::ToolTipText, Qt::black);
palette.setColor(QPalette::Text, Qt::white);
palette.setColor(QPalette::Button, QColor(53,53,53));
palette.setColor(QPalette::ButtonText, Qt::white);
palette.setColor(QPalette::BrightText, Qt::red);
palette.setColor(QPalette::Highlight, QColor(196,110,33));
palette.setColor(QPalette::HighlightedText, Qt::white);
palette.setColor(QPalette::Disabled, QPalette::Text, Qt::darkGray);
palette.setColor(QPalette::Disabled, QPalette::ButtonText, Qt::darkGray);
qApp->setPalette(palette);

// setup tray
tray = new TrayIcon(this);
connect(tray,
Expand Down Expand Up @@ -226,6 +205,7 @@ SysTray::SysTray(QObject *parent)
PowerSettings::getConf();

// setup theme
Theme::setAppTheme();
Theme::setIconTheme();
if (tray->icon().isNull()) {
tray->setIcon(QIcon::fromTheme(DEFAULT_BATTERY_ICON));
Expand Down
25 changes: 25 additions & 0 deletions src/powerkit_theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,36 @@
#include <QApplication>
#include <QDir>
#include <QSettings>
#include <QPalette>
#include <QDebug>

#include "powerkit_def.h"
#include "powerkit_settings.h"

void Theme::setAppTheme()
{
bool native = PowerSettings::getValue("native_theme", false).toBool();
if (native) { return; }
qApp->setStyle("Fusion");
QPalette palette;
palette.setColor(QPalette::Window, QColor(53,53,53));
palette.setColor(QPalette::WindowText, Qt::white);
palette.setColor(QPalette::Base, QColor(15,15,15));
palette.setColor(QPalette::AlternateBase, QColor(53,53,53));
palette.setColor(QPalette::Link, Qt::white);
palette.setColor(QPalette::LinkVisited, Qt::white);
palette.setColor(QPalette::ToolTipText, Qt::black);
palette.setColor(QPalette::Text, Qt::white);
palette.setColor(QPalette::Button, QColor(53,53,53));
palette.setColor(QPalette::ButtonText, Qt::white);
palette.setColor(QPalette::BrightText, Qt::red);
palette.setColor(QPalette::Highlight, QColor(196,110,33));
palette.setColor(QPalette::HighlightedText, Qt::white);
palette.setColor(QPalette::Disabled, QPalette::Text, Qt::darkGray);
palette.setColor(QPalette::Disabled, QPalette::ButtonText, Qt::darkGray);
qApp->setPalette(palette);
}

void Theme::setIconTheme()
{
// setup icon theme search path
Expand Down
1 change: 1 addition & 0 deletions src/powerkit_theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class Theme
{
public:
static void setAppTheme();
static void setIconTheme();
};

Expand Down

0 comments on commit 111e49f

Please sign in to comment.