diff --git a/localization/rssguard_en.ts b/localization/rssguard_en.ts
index b06529653..2fee15762 100644
--- a/localization/rssguard_en.ts
+++ b/localization/rssguard_en.ts
@@ -160,7 +160,7 @@ Error: %1
Application
-
+
Application is already running.
Application is already running
@@ -185,22 +185,22 @@ Error: %1
Settings restoration was not initiated. Make sure that output directory is writable.
-
+
Cannot add feed
Cannot add feed
-
+
Feed cannot be added because there is no active account which can add feeds.
-
+
Packages %1 were updated.
-
+
Unread articles fetched
@@ -210,7 +210,7 @@ Error: %1
-
+
AdBlock needs to be configured
@@ -228,17 +228,17 @@ version by clicking this popup notification.
-
+
AdBlock is not configured properly. Go to "Settings" -> "Node.js" and check if your Node.js is properly configured.
-
+
Already running
-
+
Packages %1 were NOT updated because of error: %2.
@@ -5732,37 +5732,37 @@ List of supported readers:
-
+
interesting stuff
-
+
interesting stuff (highlighted)
-
+
errored items
-
+
errored items (highlighted)
-
+
items with new articles
-
+
items with new articles (highlighted)
-
+
OK-ish color
@@ -7457,20 +7457,25 @@ Also, relaunch "Settings" dialog after you install Node.js.
-
+
Written by
Written by
-
+
unknown author
-
+
Newspaper view
Newspaper view
+
+
+ file %1 not found
+
+
SqliteDriver
@@ -8041,12 +8046,12 @@ Unread news: %2
-
+
Enable external resources
-
+
Download
diff --git a/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp b/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp
index b7db93bd1..cb3f78538 100644
--- a/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp
+++ b/src/librssguard/gui/webviewers/qtextbrowser/textbrowserviewer.cpp
@@ -25,14 +25,14 @@ TextBrowserViewer::TextBrowserViewer(QWidget* parent)
m_placeholderImage(qApp->icons()->miscPixmap(QSL("image-placeholder"))),
m_placeholderImageError(qApp->icons()->miscPixmap(QSL("image-placeholder-error"))),
m_downloader(new Downloader(this)), m_document(new TextBrowserDocument(this)) {
- setAutoFillBackground(true);
+ setAutoFillBackground(false);
setFrameShape(QFrame::Shape::NoFrame);
setFrameShadow(QFrame::Shadow::Plain);
setTabChangesFocus(true);
setOpenLinks(false);
setWordWrapMode(QTextOption::WrapMode::WordWrap);
- viewport()->setAutoFillBackground(true);
+ viewport()->setAutoFillBackground(false);
setResourcesEnabled(qApp->settings()->value(GROUP(Messages), SETTING(Messages::ShowResourcesInArticles)).toBool());
setDocument(m_document.data());
@@ -298,24 +298,14 @@ void TextBrowserViewer::loadMessages(const QList& messages, RootItem* r
emit loadingStarted();
m_root = root;
- auto html_messages = prepareHtmlForMessage(messages, root);
+ auto html_messages = qApp->skins()->generateHtmlOfArticles(messages, root);
- // TODO: Make this switchable? To allow for more formatted output even in notwebengine.
- // auto html_messages = qApp->skins()->generateHtmlOfArticles(messages, root);
+ if (html_messages.m_html.isEmpty()) {
+ html_messages = prepareHtmlForMessage(messages, root);
+ }
setHtml(html_messages.m_html, html_messages.m_baseUrl);
- /*
- auto* feed = root != nullptr
- ? root->getParentServiceRoot()
- ->getItemFromSubTree([messages](const RootItem* it) {
- return it->kind() == RootItem::Kind::Feed && it->customId() == messages.at(0).m_feedId;
- })
- ->toFeed()
- : nullptr;
- bool is_rtl_feed = feed != nullptr && feed->isRtl();
- */
-
QTextOption op;
op.setTextDirection(messages.at(0).m_isRtl ? Qt::LayoutDirection::RightToLeft : Qt::LayoutDirection::LeftToRight);
document()->setDefaultTextOption(op);
diff --git a/src/librssguard/miscellaneous/application.cpp b/src/librssguard/miscellaneous/application.cpp
index 7fd0a61d8..90568d7c6 100644
--- a/src/librssguard/miscellaneous/application.cpp
+++ b/src/librssguard/miscellaneous/application.cpp
@@ -148,7 +148,7 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
// and skin.
m_icons->setupSearchPaths();
m_icons->loadCurrentIconTheme();
- m_skins->loadCurrentSkin();
+ m_skins->loadCurrentSkin(usingNoWebEngine());
if (m_toastNotifications != nullptr) {
connect(m_toastNotifications,
@@ -788,6 +788,14 @@ WebViewer* Application::createWebView() {
#endif
}
+bool Application::usingNoWebEngine() const {
+#if !defined(USE_WEBENGINE)
+ return true;
+#else
+ return forcedNoWebEngine();
+#endif
+}
+
void Application::onCommitData(QSessionManager& manager) {
qDebugNN << LOGSEC_CORE << "OS asked application to commit its data.";
diff --git a/src/librssguard/miscellaneous/application.h b/src/librssguard/miscellaneous/application.h
index 8c9922b9d..6713176f8 100644
--- a/src/librssguard/miscellaneous/application.h
+++ b/src/librssguard/miscellaneous/application.h
@@ -184,6 +184,8 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
WebViewer* createWebView();
+ bool usingNoWebEngine() const;
+
#if defined(USE_WEBENGINE)
bool forcedNoWebEngine() const;
#endif
diff --git a/src/librssguard/miscellaneous/skinfactory.cpp b/src/librssguard/miscellaneous/skinfactory.cpp
index 65cc0aa16..69637581d 100644
--- a/src/librssguard/miscellaneous/skinfactory.cpp
+++ b/src/librssguard/miscellaneous/skinfactory.cpp
@@ -21,7 +21,7 @@
SkinFactory::SkinFactory(QObject* parent) : QObject(parent), m_styleIsFrozen(false), m_useSkinColors(false) {}
-void SkinFactory::loadCurrentSkin() {
+void SkinFactory::loadCurrentSkin(bool lite) {
QList skin_names_to_try = {selectedSkinName(), QSL(APP_SKIN_DEFAULT)};
bool skin_parsed;
Skin skin_data;
@@ -29,14 +29,14 @@ void SkinFactory::loadCurrentSkin() {
while (!skin_names_to_try.isEmpty()) {
skin_name = skin_names_to_try.takeFirst();
- skin_data = skinInfo(skin_name, &skin_parsed);
+ skin_data = skinInfo(skin_name, lite, &skin_parsed);
if (skin_parsed) {
loadSkinFromData(skin_data);
// Set this 'Skin' object as active one.
m_currentSkin = skin_data;
- qDebugNN << LOGSEC_GUI << "Skin" << QUOTE_W_SPACE(skin_name) << "loaded.";
+ qDebugNN << LOGSEC_GUI << "Skin" << QUOTE_W_SPACE(skin_name) << "loaded. Lite:" << QUOTE_W_SPACE_DOT(lite);
return;
}
else {
@@ -242,9 +242,6 @@ PreparedHtml SkinFactory::generateHtmlOfArticles(const QList& messages,
})
->toFeed()
: nullptr;
- /*
- bool is_rtl_feed = feed != nullptr && feed->isRtl();
- */
for (const Message& message : messages) {
QString enclosures;
@@ -314,7 +311,7 @@ PreparedHtml SkinFactory::generateHtmlOfArticles(const QList& messages,
return {msg_contents, base_url};
}
-Skin SkinFactory::skinInfo(const QString& skin_name, bool* ok) const {
+Skin SkinFactory::skinInfo(const QString& skin_name, bool lite, bool* ok) const {
Skin skin;
const QStringList skins_root_folders = {APP_SKIN_PATH, customSkinBaseFolder()};
@@ -461,10 +458,11 @@ Skin SkinFactory::skinInfo(const QString& skin_name, bool* ok) const {
// be safely loaded.
//
// %style% placeholder is used in main wrapper HTML file to be replaced with custom skin-wide CSS.
- skin.m_layoutMarkupWrapper = loadSkinFile(skin_folder_no_sep, QSL("html_wrapper.html"), real_base_skin_folder);
+ skin.m_layoutMarkupWrapper =
+ loadSkinFile(skin_folder_no_sep, lite, QSL("html_wrapper.html"), real_base_skin_folder);
try {
- auto custom_css = loadSkinFile(skin_folder_no_sep, QSL("html_style.css"), real_base_skin_folder);
+ auto custom_css = loadSkinFile(skin_folder_no_sep, lite, QSL("html_style.css"), real_base_skin_folder);
skin.m_layoutMarkupWrapper = skin.m_layoutMarkupWrapper.replace(QSL(SKIN_STYLE_PLACEHOLDER), custom_css);
}
@@ -473,12 +471,13 @@ Skin SkinFactory::skinInfo(const QString& skin_name, bool* ok) const {
}
skin.m_enclosureImageMarkup =
- loadSkinFile(skin_folder_no_sep, QSL("html_enclosure_image.html"), real_base_skin_folder);
- skin.m_layoutMarkup = loadSkinFile(skin_folder_no_sep, QSL("html_single_message.html"), real_base_skin_folder);
+ loadSkinFile(skin_folder_no_sep, lite, QSL("html_enclosure_image.html"), real_base_skin_folder);
+ skin.m_layoutMarkup =
+ loadSkinFile(skin_folder_no_sep, lite, QSL("html_single_message.html"), real_base_skin_folder);
skin.m_enclosureMarkup =
- loadSkinFile(skin_folder_no_sep, QSL("html_enclosure_every.html"), real_base_skin_folder);
- skin.m_rawData = loadSkinFile(skin_folder_no_sep, QSL("qt_style.qss"), real_base_skin_folder);
- skin.m_adblocked = loadSkinFile(skin_folder_no_sep, QSL("html_adblocked.html"), real_base_skin_folder);
+ 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);
+ skin.m_adblocked = loadSkinFile(skin_folder_no_sep, lite, QSL("html_adblocked.html"), real_base_skin_folder);
skin.m_skinFolder = skin_folder_no_sep;
if (ok != nullptr) {
@@ -498,22 +497,33 @@ Skin SkinFactory::skinInfo(const QString& skin_name, bool* ok) const {
}
QString SkinFactory::loadSkinFile(const QString& skin_folder,
+ bool lite,
const QString& file_name,
const QString& base_folder) const {
- QString local_file = QDir::toNativeSeparators(skin_folder + QDir::separator() + file_name);
- QString base_file = QDir::toNativeSeparators(base_folder + QDir::separator() + file_name);
- QString data;
+ QStringList prefixes = {QString()};
- if (QFile::exists(local_file)) {
- qDebugNN << LOGSEC_GUI << "Local file" << QUOTE_W_SPACE(local_file) << "exists, using it for the skin.";
- data = QString::fromUtf8(IOFactory::readFile(local_file));
- return data.replace(QSL(USER_DATA_PLACEHOLDER), skin_folder);
+ if (lite) {
+ prefixes.prepend(QSL("lite_"));
}
- else {
- qDebugNN << LOGSEC_GUI << "Trying to load base file" << QUOTE_W_SPACE(base_file) << "for the skin.";
- data = QString::fromUtf8(IOFactory::readFile(base_file));
- return data.replace(QSL(USER_DATA_PLACEHOLDER), base_folder);
+
+ for (const QString& prefix : prefixes) {
+ QString local_file = QDir::toNativeSeparators(skin_folder + QDir::separator() + prefix + file_name);
+ QString base_file = QDir::toNativeSeparators(base_folder + QDir::separator() + prefix + file_name);
+ QString data;
+
+ if (QFile::exists(local_file)) {
+ qDebugNN << LOGSEC_GUI << "Local file" << QUOTE_W_SPACE(local_file) << "exists, using it for the skin.";
+ data = QString::fromUtf8(IOFactory::readFile(local_file));
+ return data.replace(QSL(USER_DATA_PLACEHOLDER), skin_folder);
+ }
+ else if (QFile::exists(base_file)) {
+ qDebugNN << LOGSEC_GUI << "Base file" << QUOTE_W_SPACE(base_file) << "exists, using it for the skin.";
+ data = QString::fromUtf8(IOFactory::readFile(base_file));
+ return data.replace(QSL(USER_DATA_PLACEHOLDER), base_folder);
+ }
}
+
+ throw ApplicationException(tr("file %1 not found").arg(file_name));
}
QString SkinFactory::currentStyle() const {
@@ -534,7 +544,7 @@ QList SkinFactory::installedSkins() const {
.entryList(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot | QDir::Filter::Readable));
for (const QString& base_directory : skin_directories) {
- const Skin skin_info = skinInfo(base_directory, &skin_load_ok);
+ const Skin skin_info = skinInfo(base_directory, false, &skin_load_ok);
if (skin_load_ok) {
skins.append(skin_info);
diff --git a/src/librssguard/miscellaneous/skinfactory.h b/src/librssguard/miscellaneous/skinfactory.h
index ff20091fb..7eaec0b69 100644
--- a/src/librssguard/miscellaneous/skinfactory.h
+++ b/src/librssguard/miscellaneous/skinfactory.h
@@ -88,7 +88,7 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
virtual ~SkinFactory() = default;
// Loads skin name from settings and sets it as active.
- void loadCurrentSkin();
+ void loadCurrentSkin(bool lite);
Skin currentSkin() const;
// Gets color for model from active skin.
@@ -103,11 +103,10 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
QString adBlockedPage(const QString& url, const QString& filter);
PreparedHtml prepareHtml(const QString& inner_html, const QUrl& base_url);
-
PreparedHtml generateHtmlOfArticles(const QList& messages, RootItem* root) const;
// Gets skin about a particular skin.
- Skin skinInfo(const QString& skin_name, bool* ok = nullptr) const;
+ Skin skinInfo(const QString& skin_name, bool lite, bool* ok = nullptr) const;
// Returns list of installed skins.
QList installedSkins() const;
@@ -123,7 +122,10 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
// Loads the skin from given skin_data.
void loadSkinFromData(const Skin& skin);
- QString loadSkinFile(const QString& skin_folder, const QString& file_name, const QString& base_folder) const;
+ QString loadSkinFile(const QString& skin_folder,
+ bool lite,
+ const QString& file_name,
+ const QString& base_folder) const;
// Holds name of the current skin.
Skin m_currentSkin;