ability to live reload skin and add more info to feed status

This commit is contained in:
Martin Rotter 2025-04-09 15:05:00 +02:00
parent c3911bd0bd
commit 01bc5a713b
8 changed files with 61 additions and 23 deletions

View file

@ -97,6 +97,7 @@ QString StandardFeed::additionalTooltip() const {
"Active message filters: %2\n" "Active message filters: %2\n"
"Status: %3\n" "Status: %3\n"
"Source: %4\n" "Source: %4\n"
"HTTP/2: %6\n"
"Item ID: %5\n") "Item ID: %5\n")
.arg(getAutoUpdateStatusDescription(), .arg(getAutoUpdateStatusDescription(),
filters.size() > 0 ? QSL("%1 (%2)").arg(QString::number(filters.size()), fltrs.join(QSL(", "))) filters.size() > 0 ? QSL("%1 (%2)").arg(QString::number(filters.size()), fltrs.join(QSL(", ")))
@ -104,7 +105,8 @@ QString StandardFeed::additionalTooltip() const {
stat, stat,
m_sourceType == SourceType::Url ? QString("<a href=\"%1\">%1</a>").arg(source().left(100)) m_sourceType == SourceType::Url ? QString("<a href=\"%1\">%1</a>").arg(source().left(100))
: source().left(100), : source().left(100),
customId()); customId(),
getHttpDescription());
return base_tooltip + tr("Encoding: %1\n" return base_tooltip + tr("Encoding: %1\n"
"Type: %2\n" "Type: %2\n"
@ -468,6 +470,19 @@ bool StandardFeed::removeItself() {
return DatabaseQueries::deleteFeed(database, this, getParentServiceRoot()->accountId()); return DatabaseQueries::deleteFeed(database, this, getParentServiceRoot()->accountId());
} }
QString StandardFeed::getHttpDescription() const {
switch (m_http2Status) {
case NetworkFactory::Http2Status::DontSet:
return tr("uses application setting");
case NetworkFactory::Http2Status::Enabled:
return tr("enabled");
case NetworkFactory::Http2Status::Disabled:
return tr("disabled");
}
}
QVariantHash StandardFeed::httpHeaders() const { QVariantHash StandardFeed::httpHeaders() const {
return m_httpHeaders; return m_httpHeaders;
} }

View file

@ -134,6 +134,8 @@ class StandardFeed : public Feed {
StandardServiceRoot* serviceRoot() const; StandardServiceRoot* serviceRoot() const;
bool removeItself(); bool removeItself();
QString getHttpDescription() const;
private: private:
SourceType m_sourceType; SourceType m_sourceType;
Type m_type; Type m_type;

View file

@ -663,6 +663,7 @@ void FormMain::setupIcons() {
m_ui->m_actionBrowserScrollUp->setIcon(icon_theme_factory->fromTheme(QSL("arrow-up"))); m_ui->m_actionBrowserScrollUp->setIcon(icon_theme_factory->fromTheme(QSL("arrow-up")));
m_ui->m_actionBrowserScrollDown->setIcon(icon_theme_factory->fromTheme(QSL("arrow-down"))); m_ui->m_actionBrowserScrollDown->setIcon(icon_theme_factory->fromTheme(QSL("arrow-down")));
m_ui->m_actionCleanupWebCache->setIcon(icon_theme_factory->fromTheme(QSL("edit-clear"))); m_ui->m_actionCleanupWebCache->setIcon(icon_theme_factory->fromTheme(QSL("edit-clear")));
m_ui->m_actionReloadSkin->setIcon(icon_theme_factory->fromTheme(QSL("view-refresh")));
// Setup icons on TabWidget too. // Setup icons on TabWidget too.
m_ui->m_tabWidget->setupIcons(); m_ui->m_tabWidget->setupIcons();
@ -794,6 +795,8 @@ void FormMain::createConnections() {
m_ui->m_menuTools->removeAction(m_ui->m_actionCleanupWebCache); m_ui->m_menuTools->removeAction(m_ui->m_actionCleanupWebCache);
#endif #endif
connect(m_ui->m_actionReloadSkin, &QAction::triggered, qApp, &Application::reloadCurrentSkin);
// Menu "Help" connections. // Menu "Help" connections.
connect(m_ui->m_actionAboutGuard, &QAction::triggered, this, [this]() { connect(m_ui->m_actionAboutGuard, &QAction::triggered, this, [this]() {
FormAbout(false, this).exec(); FormAbout(false, this).exec();

View file

@ -96,6 +96,7 @@
</property> </property>
<addaction name="m_actionSettings"/> <addaction name="m_actionSettings"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="m_actionReloadSkin"/>
<addaction name="m_actionCleanupDatabase"/> <addaction name="m_actionCleanupDatabase"/>
<addaction name="m_actionCleanupWebCache"/> <addaction name="m_actionCleanupWebCache"/>
<addaction name="m_actionDownloadManager"/> <addaction name="m_actionDownloadManager"/>
@ -966,6 +967,11 @@
<string>&amp;Purge selected feeds</string> <string>&amp;Purge selected feeds</string>
</property> </property>
</action> </action>
<action name="m_actionReloadSkin">
<property name="text">
<string>Reload &amp;skin</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View file

@ -174,7 +174,8 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
// and skin. // and skin.
m_icons->setupSearchPaths(); m_icons->setupSearchPaths();
m_icons->loadCurrentIconTheme(); m_icons->loadCurrentIconTheme();
m_skins->loadCurrentSkin(usingLite());
reloadCurrentSkin(false);
if (m_toastNotifications != nullptr) { if (m_toastNotifications != nullptr) {
connect(m_toastNotifications, connect(m_toastNotifications,
@ -1194,6 +1195,10 @@ void Application::onAdBlockFailure() {
qApp->settings()->setValue(GROUP(AdBlock), AdBlock::AdBlockEnabled, false); qApp->settings()->setValue(GROUP(AdBlock), AdBlock::AdBlockEnabled, false);
} }
void Application::reloadCurrentSkin(bool replace_existing_qss) {
m_skins->loadCurrentSkin(usingLite(), replace_existing_qss);
}
void Application::determineFirstRuns() { void Application::determineFirstRuns() {
m_firstRunEver = settings()->value(GROUP(General), SETTING(General::FirstRun)).toBool(); m_firstRunEver = settings()->value(GROUP(General), SETTING(General::FirstRun)).toBool();
m_firstRunCurrentVersion = m_firstRunCurrentVersion =

View file

@ -203,6 +203,8 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
// Restarts the application. // Restarts the application.
void restart(); void restart();
void reloadCurrentSkin(bool replace_existing_qss = true);
// Processes incoming message from another RSS Guard instance. // Processes incoming message from another RSS Guard instance.
void parseCmdArgumentsFromOtherInstance(const QString& message); void parseCmdArgumentsFromOtherInstance(const QString& message);
void parseCmdArgumentsFromMyInstance(const QStringList& raw_cli_args, QString& custom_ua); void parseCmdArgumentsFromMyInstance(const QStringList& raw_cli_args, QString& custom_ua);

View file

@ -23,7 +23,7 @@
SkinFactory::SkinFactory(QObject* parent) : QObject(parent), m_styleIsFrozen(false), m_useSkinColors(false) {} SkinFactory::SkinFactory(QObject* parent) : QObject(parent), m_styleIsFrozen(false), m_useSkinColors(false) {}
void SkinFactory::loadCurrentSkin(bool lite) { void SkinFactory::loadCurrentSkin(bool lite, bool replace_existing_qss) {
QList<QString> skin_names_to_try = {selectedSkinName(), QSL(APP_SKIN_DEFAULT)}; QList<QString> skin_names_to_try = {selectedSkinName(), QSL(APP_SKIN_DEFAULT)};
bool skin_parsed; bool skin_parsed;
Skin skin_data; Skin skin_data;
@ -34,7 +34,7 @@ void SkinFactory::loadCurrentSkin(bool lite) {
skin_data = skinInfo(skin_name, lite, &skin_parsed); skin_data = skinInfo(skin_name, lite, &skin_parsed);
if (skin_parsed) { if (skin_parsed) {
loadSkinFromData(skin_data); loadSkinFromData(skin_data, replace_existing_qss);
// Set this 'Skin' object as active one. // Set this 'Skin' object as active one.
m_currentSkin = skin_data; m_currentSkin = skin_data;
@ -109,7 +109,7 @@ QPalette qt_fusionPalette(bool dark_appearance) {
return fusion_palette; return fusion_palette;
} }
void SkinFactory::loadSkinFromData(const Skin& skin) { void SkinFactory::loadSkinFromData(const Skin& skin, bool replace_existing_qss) {
#if QT_VERSION >= 0x060500 // Qt >= 6.5.0 #if QT_VERSION >= 0x060500 // Qt >= 6.5.0
auto system_color_scheme = qApp->styleHints()->colorScheme(); auto system_color_scheme = qApp->styleHints()->colorScheme();
@ -207,7 +207,12 @@ void SkinFactory::loadSkinFromData(const Skin& skin) {
} }
} }
if (replace_existing_qss) {
qss_to_set = qss_to_set;
}
else {
qss_to_set = qApp->styleSheet() + QSL("\r\n") + qss_to_set; qss_to_set = qApp->styleSheet() + QSL("\r\n") + qss_to_set;
}
qApp->setStyleSheet(qss_to_set); qApp->setStyleSheet(qss_to_set);
} }
@ -292,10 +297,10 @@ PreparedHtml SkinFactory::generateHtmlOfArticles(const QList<Message>& messages,
msg_contents = qApp->web()->limitSizeOfHtmlImages(msg_contents, desired_width, forced_img_height); msg_contents = qApp->web()->limitSizeOfHtmlImages(msg_contents, desired_width, forced_img_height);
} }
messages_layout messages_layout.append(single_message_layout.arg(message.m_title,
.append(single_message_layout.arg(message.m_title, tr("Written by ") + (message.m_author.isEmpty()
tr("Written by ") + ? tr("unknown author")
(message.m_author.isEmpty() ? tr("unknown author") : message.m_author), : message.m_author),
message.m_url, message.m_url,
msg_contents, msg_contents,
msg_date, msg_date,

View file

@ -90,7 +90,7 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
virtual ~SkinFactory() = default; virtual ~SkinFactory() = default;
// Loads skin name from settings and sets it as active. // Loads skin name from settings and sets it as active.
void loadCurrentSkin(bool lite); void loadCurrentSkin(bool lite, bool replace_existing_qss);
Skin currentSkin() const; Skin currentSkin() const;
// Gets color for model from active skin. // Gets color for model from active skin.
@ -122,7 +122,7 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
private: private:
// Loads the skin from given skin_data. // Loads the skin from given skin_data.
void loadSkinFromData(const Skin& skin); void loadSkinFromData(const Skin& skin, bool replace_existing_qss);
QString loadSkinFile(const QString& skin_folder, QString loadSkinFile(const QString& skin_folder,
bool lite, bool lite,