mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-05 20:03:31 +01:00
optional dark style
This commit is contained in:
parent
6b1a93b66c
commit
41e1af64e5
@ -26,7 +26,7 @@
|
||||
<url type="donation">https://github.com/sponsors/martinrotter</url>
|
||||
<content_rating type="oars-1.1" />
|
||||
<releases>
|
||||
<release version="4.0.4" date="2021-11-10"/>
|
||||
<release version="4.0.4" date="2021-11-12"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.0">
|
||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||
|
@ -35,12 +35,18 @@ SettingsGui::SettingsGui(Settings* settings, QWidget* parent) : SettingsPanel(se
|
||||
m_ui->m_treeSkins->header()->setSectionResizeMode(1, QHeaderView::ResizeMode::ResizeToContents);
|
||||
m_ui->m_treeSkins->header()->setSectionResizeMode(2, QHeaderView::ResizeMode::ResizeToContents);
|
||||
|
||||
connect(m_ui->m_cmbStyles, &QComboBox::currentTextChanged, this, [this](const QString& txt) {
|
||||
m_ui->m_checkForceDarkFusion->setVisible(txt.toLower() == QSL("fusion"));
|
||||
});
|
||||
|
||||
connect(m_ui->m_cmbIconTheme, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsGui::requireRestart);
|
||||
connect(m_ui->m_cmbIconTheme, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&SettingsGui::dirtifySettings);
|
||||
connect(m_ui->m_treeSkins, &QTreeWidget::currentItemChanged, this, &SettingsGui::dirtifySettings);
|
||||
connect(m_ui->m_grpTray, &QGroupBox::toggled, this, &SettingsGui::dirtifySettings);
|
||||
connect(m_ui->m_checkHidden, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
|
||||
connect(m_ui->m_checkForceDarkFusion, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
|
||||
connect(m_ui->m_checkForceDarkFusion, &QCheckBox::toggled, this, &SettingsGui::requireRestart);
|
||||
connect(m_ui->m_checkMonochromeIcons, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
|
||||
connect(m_ui->m_checkCountUnreadMessages, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
|
||||
connect(m_ui->m_checkHideWhenMinimized, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
|
||||
@ -97,6 +103,9 @@ void SettingsGui::loadSettings() {
|
||||
m_ui->m_checkHidden->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::MainWindowStartsHidden)).toBool());
|
||||
m_ui->m_checkHideWhenMinimized->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::HideMainWindowWhenMinimized)).toBool());
|
||||
|
||||
m_ui->m_checkForceDarkFusion->setChecked(settings()->value(GROUP(GUI),
|
||||
SETTING(GUI::ForceDarkFusion)).toBool());
|
||||
|
||||
// Load settings of icon theme.
|
||||
const QString current_theme = qApp->icons()->currentIconTheme();
|
||||
auto icons = qApp->icons()->installedIconThemes();
|
||||
@ -222,6 +231,8 @@ void SettingsGui::saveSettings() {
|
||||
settings()->setValue(GROUP(GUI), GUI::MainWindowStartsHidden, m_ui->m_checkHidden->isChecked());
|
||||
settings()->setValue(GROUP(GUI), GUI::HideMainWindowWhenMinimized, m_ui->m_checkHideWhenMinimized->isChecked());
|
||||
|
||||
settings()->setValue(GROUP(GUI), GUI::ForceDarkFusion, m_ui->m_checkForceDarkFusion->isChecked());
|
||||
|
||||
// Make sure that number of unread messages is shown in tray icon as requested.
|
||||
qApp->feedReader()->feedsModel()->notifyWithCounts();
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>667</width>
|
||||
<width>685</width>
|
||||
<height>394</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -53,7 +53,7 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="m_cmbStyles"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="m_lblSkin">
|
||||
<property name="text">
|
||||
<string>Skin</string>
|
||||
@ -63,7 +63,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QTreeWidget" name="m_treeSkins">
|
||||
<property name="indentation">
|
||||
<number>0</number>
|
||||
@ -87,7 +87,7 @@
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -100,6 +100,13 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="m_checkForceDarkFusion">
|
||||
<property name="text">
|
||||
<string>Force dark look</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="m_tabNotifications">
|
||||
@ -381,6 +388,10 @@
|
||||
<tabstop>m_checkHideTabBarIfOneTabVisible</tabstop>
|
||||
<tabstop>m_cmbToolbarButtonStyle</tabstop>
|
||||
<tabstop>m_cmbSelectToolBar</tabstop>
|
||||
<tabstop>m_cmbIconTheme</tabstop>
|
||||
<tabstop>m_cmbStyles</tabstop>
|
||||
<tabstop>m_checkForceDarkFusion</tabstop>
|
||||
<tabstop>m_treeSkins</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -211,6 +211,9 @@ DVALUE(bool) GUI::HideMainWindowWhenMinimizedDef = false;
|
||||
DKEY GUI::MonochromeTrayIcon = "monochrome_tray_icon";
|
||||
DVALUE(bool) GUI::MonochromeTrayIconDef = false;
|
||||
|
||||
DKEY GUI::ForceDarkFusion = "force_dark_fusion";
|
||||
DVALUE(bool) GUI::ForceDarkFusionDef = false;
|
||||
|
||||
DKEY GUI::UnreadNumbersInTrayIcon = "show_unread_numbers_in_tray_icon";
|
||||
DVALUE(bool) GUI::UnreadNumbersInTrayIconDef = true;
|
||||
|
||||
|
@ -217,6 +217,9 @@ namespace GUI {
|
||||
KEY HideMainWindowWhenMinimized;
|
||||
VALUE(bool) HideMainWindowWhenMinimizedDef;
|
||||
|
||||
KEY ForceDarkFusion;
|
||||
VALUE(bool) ForceDarkFusionDef;
|
||||
|
||||
KEY AlternateRowColorsInLists;
|
||||
VALUE(bool) AlternateRowColorsInListsDef;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <QDomDocument>
|
||||
#include <QDomElement>
|
||||
#include <QStyleFactory>
|
||||
#include <QToolTip>
|
||||
|
||||
SkinFactory::SkinFactory(QObject* parent) : QObject(parent) {}
|
||||
|
||||
@ -52,7 +53,52 @@ void SkinFactory::loadSkinFromData(const Skin& skin) {
|
||||
}
|
||||
}
|
||||
|
||||
qApp->setStyle(qApp->settings()->value(GROUP(GUI), SETTING(GUI::Style)).toString());
|
||||
QString style_name = qApp->settings()->value(GROUP(GUI), SETTING(GUI::Style)).toString();
|
||||
|
||||
qApp->setStyle(style_name);
|
||||
|
||||
if (style_name.toLower() == QSL("fusion") &&
|
||||
qApp->settings()->value(GROUP(GUI), SETTING(GUI::ForceDarkFusion)).toBool()) {
|
||||
qDebugNN << LOGSEC_GUI << "Activating dark palette for Fusion style.";
|
||||
|
||||
QPalette fusion_palette = qApp->palette();
|
||||
QColor clr_bg(QSL("#2D2F32"));
|
||||
QColor clr_altbg(QSL("#323437"));
|
||||
QColor clr_selbg(QSL("#8291AD"));
|
||||
QColor clr_fg(QSL("#D8D8D8"));
|
||||
QColor clr_brdr(QSL("#585C65"));
|
||||
QColor clr_tooltip_brdr(QSL("#707580"));
|
||||
QColor clr_link(QSL("#a1acc1"));
|
||||
QColor clr_dis_fg(QSL("#727272"));
|
||||
|
||||
// Normal state.
|
||||
fusion_palette.setColor(QPalette::Window, clr_bg);
|
||||
fusion_palette.setColor(QPalette::WindowText, clr_fg);
|
||||
fusion_palette.setColor(QPalette::Base, clr_bg);
|
||||
fusion_palette.setColor(QPalette::AlternateBase, clr_altbg);
|
||||
fusion_palette.setColor(QPalette::ToolTipBase, clr_altbg);
|
||||
fusion_palette.setColor(QPalette::ToolTipText, clr_fg);
|
||||
fusion_palette.setColor(QPalette::Text, clr_fg);
|
||||
fusion_palette.setColor(QPalette::Button, clr_altbg);
|
||||
fusion_palette.setColor(QPalette::ButtonText, clr_fg);
|
||||
fusion_palette.setColor(QPalette::BrightText, clr_fg);
|
||||
fusion_palette.setColor(QPalette::Link, clr_link);
|
||||
fusion_palette.setColor(QPalette::Highlight, clr_selbg);
|
||||
fusion_palette.setColor(QPalette::HighlightedText, clr_fg);
|
||||
|
||||
// Disabled state.
|
||||
fusion_palette.setColor(QPalette::Disabled, QPalette::Text, clr_dis_fg);
|
||||
fusion_palette.setColor(QPalette::Disabled, QPalette::WindowText, clr_dis_fg);
|
||||
fusion_palette.setColor(QPalette::Disabled, QPalette::ButtonText, clr_dis_fg);
|
||||
fusion_palette.setColor(QPalette::Disabled, QPalette::Button, Qt::GlobalColor::red);
|
||||
fusion_palette.setColor(QPalette::Disabled, QPalette::HighlightedText, clr_fg);
|
||||
fusion_palette.setColor(QPalette::Disabled, QPalette::Base, clr_altbg);
|
||||
fusion_palette.setColor(QPalette::Disabled, QPalette::Window, clr_altbg);
|
||||
fusion_palette.setColor(QPalette::Disabled, QPalette::Highlight, clr_selbg);
|
||||
|
||||
QToolTip::setPalette(fusion_palette);
|
||||
qApp->setPalette(fusion_palette);
|
||||
}
|
||||
}
|
||||
|
||||
void SkinFactory::setCurrentSkinName(const QString& skin_name) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user