ability to live reload skin and add more info to feed status
This commit is contained in:
parent
c3911bd0bd
commit
01bc5a713b
8 changed files with 61 additions and 23 deletions
|
@ -97,6 +97,7 @@ QString StandardFeed::additionalTooltip() const {
|
|||
"Active message filters: %2\n"
|
||||
"Status: %3\n"
|
||||
"Source: %4\n"
|
||||
"HTTP/2: %6\n"
|
||||
"Item ID: %5\n")
|
||||
.arg(getAutoUpdateStatusDescription(),
|
||||
filters.size() > 0 ? QSL("%1 (%2)").arg(QString::number(filters.size()), fltrs.join(QSL(", ")))
|
||||
|
@ -104,7 +105,8 @@ QString StandardFeed::additionalTooltip() const {
|
|||
stat,
|
||||
m_sourceType == SourceType::Url ? QString("<a href=\"%1\">%1</a>").arg(source().left(100))
|
||||
: source().left(100),
|
||||
customId());
|
||||
customId(),
|
||||
getHttpDescription());
|
||||
|
||||
return base_tooltip + tr("Encoding: %1\n"
|
||||
"Type: %2\n"
|
||||
|
@ -468,6 +470,19 @@ bool StandardFeed::removeItself() {
|
|||
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 {
|
||||
return m_httpHeaders;
|
||||
}
|
||||
|
|
|
@ -134,6 +134,8 @@ class StandardFeed : public Feed {
|
|||
StandardServiceRoot* serviceRoot() const;
|
||||
bool removeItself();
|
||||
|
||||
QString getHttpDescription() const;
|
||||
|
||||
private:
|
||||
SourceType m_sourceType;
|
||||
Type m_type;
|
||||
|
|
|
@ -663,6 +663,7 @@ void FormMain::setupIcons() {
|
|||
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_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.
|
||||
m_ui->m_tabWidget->setupIcons();
|
||||
|
@ -794,6 +795,8 @@ void FormMain::createConnections() {
|
|||
m_ui->m_menuTools->removeAction(m_ui->m_actionCleanupWebCache);
|
||||
#endif
|
||||
|
||||
connect(m_ui->m_actionReloadSkin, &QAction::triggered, qApp, &Application::reloadCurrentSkin);
|
||||
|
||||
// Menu "Help" connections.
|
||||
connect(m_ui->m_actionAboutGuard, &QAction::triggered, this, [this]() {
|
||||
FormAbout(false, this).exec();
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
</property>
|
||||
<addaction name="m_actionSettings"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="m_actionReloadSkin"/>
|
||||
<addaction name="m_actionCleanupDatabase"/>
|
||||
<addaction name="m_actionCleanupWebCache"/>
|
||||
<addaction name="m_actionDownloadManager"/>
|
||||
|
@ -966,6 +967,11 @@
|
|||
<string>&Purge selected feeds</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionReloadSkin">
|
||||
<property name="text">
|
||||
<string>Reload &skin</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
@ -174,7 +174,8 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
|
|||
// and skin.
|
||||
m_icons->setupSearchPaths();
|
||||
m_icons->loadCurrentIconTheme();
|
||||
m_skins->loadCurrentSkin(usingLite());
|
||||
|
||||
reloadCurrentSkin(false);
|
||||
|
||||
if (m_toastNotifications != nullptr) {
|
||||
connect(m_toastNotifications,
|
||||
|
@ -1194,6 +1195,10 @@ void Application::onAdBlockFailure() {
|
|||
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() {
|
||||
m_firstRunEver = settings()->value(GROUP(General), SETTING(General::FirstRun)).toBool();
|
||||
m_firstRunCurrentVersion =
|
||||
|
|
|
@ -203,6 +203,8 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
|||
// Restarts the application.
|
||||
void restart();
|
||||
|
||||
void reloadCurrentSkin(bool replace_existing_qss = true);
|
||||
|
||||
// Processes incoming message from another RSS Guard instance.
|
||||
void parseCmdArgumentsFromOtherInstance(const QString& message);
|
||||
void parseCmdArgumentsFromMyInstance(const QStringList& raw_cli_args, QString& custom_ua);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
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)};
|
||||
bool skin_parsed;
|
||||
Skin skin_data;
|
||||
|
@ -34,7 +34,7 @@ void SkinFactory::loadCurrentSkin(bool lite) {
|
|||
skin_data = skinInfo(skin_name, lite, &skin_parsed);
|
||||
|
||||
if (skin_parsed) {
|
||||
loadSkinFromData(skin_data);
|
||||
loadSkinFromData(skin_data, replace_existing_qss);
|
||||
|
||||
// Set this 'Skin' object as active one.
|
||||
m_currentSkin = skin_data;
|
||||
|
@ -109,7 +109,7 @@ QPalette qt_fusionPalette(bool dark_appearance) {
|
|||
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
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
messages_layout
|
||||
.append(single_message_layout.arg(message.m_title,
|
||||
tr("Written by ") +
|
||||
(message.m_author.isEmpty() ? tr("unknown author") : message.m_author),
|
||||
messages_layout.append(single_message_layout.arg(message.m_title,
|
||||
tr("Written by ") + (message.m_author.isEmpty()
|
||||
? tr("unknown author")
|
||||
: message.m_author),
|
||||
message.m_url,
|
||||
msg_contents,
|
||||
msg_date,
|
||||
|
|
|
@ -90,7 +90,7 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
|
|||
virtual ~SkinFactory() = default;
|
||||
|
||||
// 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;
|
||||
|
||||
// Gets color for model from active skin.
|
||||
|
@ -122,7 +122,7 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
|
|||
|
||||
private:
|
||||
// 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,
|
||||
bool lite,
|
||||
|
|
Loading…
Add table
Reference in a new issue