make readability use skins colors
This commit is contained in:
parent
03bd2e2baa
commit
7d62aa44fc
10 changed files with 29 additions and 8 deletions
|
@ -268,7 +268,7 @@ void WebBrowser::newWindowRequested(WebViewer* viewer) {
|
|||
|
||||
void WebBrowser::setReadabledHtml(const QString& better_html) {
|
||||
if (!better_html.isEmpty()) {
|
||||
m_webView->setHtml(better_html, m_webView->url());
|
||||
m_webView->setReadabledHtml(better_html, m_webView->url());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -556,6 +556,10 @@ void TextBrowserViewer::setHtml(const QString& html, const QUrl& base_url) {
|
|||
*/
|
||||
}
|
||||
|
||||
void TextBrowserViewer::setReadabledHtml(const QString& html, const QUrl& base_url) {
|
||||
setHtml(html, base_url);
|
||||
}
|
||||
|
||||
void TextBrowserViewer::setHtmlPrivate(const QString& html, const QUrl& base_url) {
|
||||
m_currentUrl = base_url;
|
||||
m_currentHtml = html;
|
||||
|
|
|
@ -51,6 +51,7 @@ class TextBrowserViewer : public QTextBrowser, public WebViewer {
|
|||
virtual void findText(const QString& text, bool backwards);
|
||||
virtual void setUrl(const QUrl& url);
|
||||
virtual void setHtml(const QString& html, const QUrl& base_url = {});
|
||||
virtual void setReadabledHtml(const QString& html, const QUrl& base_url = {});
|
||||
virtual QString html() const;
|
||||
virtual QUrl url() const;
|
||||
virtual void clear();
|
||||
|
|
|
@ -197,6 +197,12 @@ void WebEngineViewer::setHtml(const QString& html, const QUrl& base_url) {
|
|||
QWebEngineView::setHtml(html, base_url);
|
||||
}
|
||||
|
||||
void WebEngineViewer::setReadabledHtml(const QString& html, const QUrl& base_url) {
|
||||
auto better_html = qApp->skins()->prepareHtml(html, base_url);
|
||||
|
||||
setHtml(better_html.m_html, better_html.m_baseUrl);
|
||||
}
|
||||
|
||||
double WebEngineViewer::verticalScrollBarPosition() const {
|
||||
double position;
|
||||
QEventLoop loop;
|
||||
|
|
|
@ -29,6 +29,7 @@ class WebEngineViewer : public QWebEngineView, public WebViewer {
|
|||
virtual void findText(const QString& text, bool backwards);
|
||||
virtual void setUrl(const QUrl& url);
|
||||
virtual void setHtml(const QString& html, const QUrl& base_url = {});
|
||||
virtual void setReadabledHtml(const QString& html, const QUrl& base_url = {});
|
||||
virtual void clear();
|
||||
virtual double verticalScrollBarPosition() const;
|
||||
virtual void setVerticalScrollBarPosition(double pos);
|
||||
|
|
|
@ -38,6 +38,9 @@ class WebViewer {
|
|||
// Set static HTML into the viewer.
|
||||
virtual void setHtml(const QString& html, const QUrl& base_url = {}) = 0;
|
||||
|
||||
// Set HTML generated by "readability" into the viewer.
|
||||
virtual void setReadabledHtml(const QString& html, const QUrl& base_url = {}) = 0;
|
||||
|
||||
// Returns current static HTML loaded in the viewer.
|
||||
virtual QString html() const = 0;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
|
|||
m_settings = Settings::setupSettings(this);
|
||||
|
||||
#if defined(USE_WEBENGINE)
|
||||
if (!m_forcedNoWebEngine && qgetenv("QTWEBENGINE_CHROMIUM_FLAGS").isEmpty()) {
|
||||
if (!m_forcedNoWebEngine && qEnvironmentVariableIsEmpty("QTWEBENGINE_CHROMIUM_FLAGS")) {
|
||||
qputenv("QTWEBENGINE_CHROMIUM_FLAGS",
|
||||
settings()->value(GROUP(Browser), SETTING(Browser::WebEngineChromiumFlags)).toString().toLocal8Bit());
|
||||
}
|
||||
|
@ -292,8 +292,7 @@ void Application::loadDynamicShortcuts() {
|
|||
DynamicShortcuts::load(userActions());
|
||||
}
|
||||
|
||||
void Application::showPolls() const {
|
||||
/*
|
||||
void Application::offerPolls() const {
|
||||
if (isFirstRunCurrentVersion()) {
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
{QSL("%1 survey").arg(QSL(APP_NAME)),
|
||||
|
@ -301,10 +300,11 @@ void Application::showPolls() const {
|
|||
QSystemTrayIcon::MessageIcon::Warning},
|
||||
{false, true, false},
|
||||
{tr("Go to survey"), [] {
|
||||
qApp->web()->openUrlInExternalBrowser(QSL("https://forms.gle/FdzrwFGozCGViK8QA"));
|
||||
qApp->web()->openUrlInExternalBrowser(QSL("https://docs.google.com/forms/d/e/"
|
||||
"1FAIpQLScQ_r_EwM6qojPsIMQHGdnSktU-WGHgporN69mpU-"
|
||||
"Tvq8y7XQ/viewform?usp=sf_link"));
|
||||
}});
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void Application::offerChanges() const {
|
||||
|
@ -625,7 +625,7 @@ void Application::showTrayIcon() {
|
|||
trayIcon()->show();
|
||||
|
||||
offerChanges();
|
||||
showPolls();
|
||||
offerPolls();
|
||||
}
|
||||
else {
|
||||
m_feedReader->feedsModel()->notifyWithCounts();
|
||||
|
|
|
@ -89,7 +89,7 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
|||
void reactOnForeignNotifications();
|
||||
void hideOrShowMainForm();
|
||||
void loadDynamicShortcuts();
|
||||
void showPolls() const;
|
||||
void offerPolls() const;
|
||||
void offerChanges() const;
|
||||
|
||||
bool isAlreadyRunning();
|
||||
|
|
|
@ -224,6 +224,10 @@ QString SkinFactory::adBlockedPage(const QString& url, const QString& filter) {
|
|||
return currentSkin().m_layoutMarkupWrapper.arg(tr("This page was blocked by AdBlock"), adblocked);
|
||||
}
|
||||
|
||||
PreparedHtml SkinFactory::prepareHtml(const QString& inner_html, const QUrl& base_url) {
|
||||
return {currentSkin().m_layoutMarkupWrapper.arg(QString(), inner_html), base_url};
|
||||
}
|
||||
|
||||
PreparedHtml SkinFactory::generateHtmlOfArticles(const QList<Message>& messages, RootItem* root) const {
|
||||
Skin skin = currentSkin();
|
||||
QString messages_layout;
|
||||
|
|
|
@ -102,6 +102,8 @@ 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<Message>& messages, RootItem* root) const;
|
||||
|
||||
// Gets skin about a particular skin.
|
||||
|
|
Loading…
Add table
Reference in a new issue