Skip to content

Commit

Permalink
enable for skins to define forced QSS to be loaded even when skin col…
Browse files Browse the repository at this point in the history
…ors are not enabled
  • Loading branch information
martinrotter committed Feb 14, 2025
1 parent 7e0b2ab commit ad3069f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 29 deletions.
1 change: 1 addition & 0 deletions resources/rssguard.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<file>skins/nudus-dark/html_style.css</file>
<file>skins/nudus-dark/metadata.xml</file>
<file>skins/nudus-dark/qt_style.qss</file>
<file>skins/nudus-dark/qt_style_forced.qss</file>
<file>skins/nudus-dark/lite_html_style.css</file>

<file>skins/nudus-light/html_style.css</file>
Expand Down
28 changes: 0 additions & 28 deletions resources/skins/nudus-dark/qt_style.qss
Original file line number Diff line number Diff line change
@@ -1,28 +0,0 @@
QListWidget,
QScrollArea {
border: 1px solid palette(light);
}


QPlainTextEdit:focus {
border: 1px solid palette(highlight);
}

QToolTip {
background-color: palette(window);
border: 1px solid palette(highlight);
border-radius: 2px;
}

QProgressBar {
background-color: palette(highlight);
color: palette(window);
}

QSplitter::handle {
background: palette(light);
}

QStatusBar::item {
border: none;
}
17 changes: 16 additions & 1 deletion src/librssguard/miscellaneous/skinfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,21 @@ void SkinFactory::loadSkinFromData(const Skin& skin) {
#endif
}

QString qss_to_set = skin.m_rawForcedData;

if (m_useSkinColors && !skin.m_rawData.isEmpty()) {
if (qApp->styleSheet().simplified().isEmpty()) {
qApp->setStyleSheet(skin.m_rawData);
qss_to_set += QSL("\r\n") + skin.m_rawData;
}
else {
qCriticalNN << LOGSEC_GUI
<< "Skipped setting of application style and skin because there is already some style set.";
}
}

qss_to_set = qApp->styleSheet() + QSL("\r\n") + qss_to_set;

qApp->setStyleSheet(qss_to_set);
}

void SkinFactory::setCurrentSkinName(const QString& skin_name) {
Expand Down Expand Up @@ -486,6 +492,15 @@ Skin SkinFactory::skinInfo(const QString& skin_name, bool lite, bool* ok) const
skin.m_enclosureMarkup =
loadSkinFile(skin_folder_no_sep, lite, QSL("html_enclosure_every.html"), real_base_skin_folder);
skin.m_rawData = loadSkinFile(skin_folder_no_sep, lite, QSL("qt_style.qss"), real_base_skin_folder);

try {
skin.m_rawForcedData =
loadSkinFile(skin_folder_no_sep, lite, QSL("qt_style_forced.qss"), real_base_skin_folder);
}
catch (...) {
qWarningNN << "Skin" << QUOTE_W_SPACE(skin_name) << "does not support forced QSS.";
}

skin.m_adblocked = loadSkinFile(skin_folder_no_sep, lite, QSL("html_adblocked.html"), real_base_skin_folder);
skin.m_skinFolder = skin_folder_no_sep;

Expand Down
1 change: 1 addition & 0 deletions src/librssguard/miscellaneous/skinfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct RSSGUARD_DLLSPEC Skin {
QString m_version;
QString m_description;
QString m_rawData;
QString m_rawForcedData;
QString m_adblocked;
QString m_layoutMarkupWrapper;
QString m_enclosureImageMarkup;
Expand Down

0 comments on commit ad3069f

Please sign in to comment.