lang sync
This commit is contained in:
parent
085d5be953
commit
86fa39fc56
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -93,3 +93,14 @@ QString FilterUtils::runExecutableGetOutput(const QString& executable, const QSt
|
||||
return ex.message();
|
||||
}
|
||||
}
|
||||
|
||||
void FilterUtils::runExecutable(const QString& executable,
|
||||
const QStringList& arguments,
|
||||
const QString& working_directory) const {
|
||||
try {
|
||||
IOFactory::startProcessDetached(executable, arguments, working_directory);
|
||||
}
|
||||
catch (const ApplicationException& ex) {
|
||||
// return ex.message();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <QObject>
|
||||
|
||||
class FilterUtils : public QObject {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FilterUtils(QObject* parent = nullptr);
|
||||
@ -23,6 +23,9 @@ class FilterUtils : public QObject {
|
||||
// Parses string into date/time object.
|
||||
Q_INVOKABLE QDateTime parseDateTime(const QString& dat) const;
|
||||
Q_INVOKABLE QString runExecutableGetOutput(const QString& executable, const QStringList& arguments = {}) const;
|
||||
Q_INVOKABLE void runExecutable(const QString& executable,
|
||||
const QStringList& arguments = {},
|
||||
const QString& working_directory = {}) const;
|
||||
};
|
||||
|
||||
#endif // FILTERUTILS_H
|
||||
|
@ -293,6 +293,9 @@ void TextBrowserViewer::loadMessages(const QList<Message>& messages, RootItem* r
|
||||
|
||||
auto html_messages = prepareHtmlForMessage(messages, root);
|
||||
|
||||
// TODO: Make this switchable? To allow for more formatted output even in notwebengine.
|
||||
// auto html_messages = qApp->skins()->generateHtmlOfArticles(messages, root);
|
||||
|
||||
setHtml(html_messages.m_html, html_messages.m_baseUrl);
|
||||
emit loadingFinished(true);
|
||||
}
|
||||
@ -449,15 +452,23 @@ void TextBrowserViewer::downloadLink() {
|
||||
void TextBrowserViewer::onAnchorClicked(const QUrl& url) {
|
||||
if (!url.isEmpty()) {
|
||||
const QUrl resolved_url = (m_currentUrl.isValid() && url.isRelative()) ? m_currentUrl.resolved(url) : url;
|
||||
const bool ctrl_pressed = (QGuiApplication::keyboardModifiers() & Qt::KeyboardModifier::ControlModifier) ==
|
||||
Qt::KeyboardModifier::ControlModifier;
|
||||
|
||||
bool open_externally_now =
|
||||
qApp->settings()->value(GROUP(Browser), SETTING(Browser::OpenLinksInExternalBrowserRightAway)).toBool();
|
||||
|
||||
if (open_externally_now) {
|
||||
qApp->web()->openUrlInExternalBrowser(resolved_url.toString());
|
||||
if (ctrl_pressed) {
|
||||
// Open in new tab.
|
||||
qApp->mainForm()->tabWidget()->addLinkedBrowser(resolved_url);
|
||||
}
|
||||
else {
|
||||
setUrl(resolved_url);
|
||||
bool open_externally_now =
|
||||
qApp->settings()->value(GROUP(Browser), SETTING(Browser::OpenLinksInExternalBrowserRightAway)).toBool();
|
||||
|
||||
if (open_externally_now) {
|
||||
qApp->web()->openUrlInExternalBrowser(resolved_url.toString());
|
||||
}
|
||||
else {
|
||||
setUrl(resolved_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,11 +34,6 @@ class TextBrowserDocument : public QTextDocument {
|
||||
QPointer<TextBrowserViewer> m_viewer;
|
||||
};
|
||||
|
||||
struct PreparedHtml {
|
||||
QString m_html;
|
||||
QUrl m_baseUrl;
|
||||
};
|
||||
|
||||
class TextBrowserViewer : public QTextBrowser, public WebViewer {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(WebViewer)
|
||||
|
@ -57,8 +57,8 @@ void WebEngineViewer::loadMessages(const QList<Message>& messages, RootItem* roo
|
||||
auto html_messages = qApp->skins()->generateHtmlOfArticles(messages, root);
|
||||
|
||||
m_root = root;
|
||||
m_messageContents = html_messages.first;
|
||||
m_messageBaseUrl = html_messages.second;
|
||||
m_messageContents = html_messages.m_html;
|
||||
m_messageBaseUrl = html_messages.m_baseUrl;
|
||||
|
||||
bool previously_enabled = isEnabled();
|
||||
|
||||
|
@ -10,6 +10,11 @@
|
||||
class WebBrowser;
|
||||
class RootItem;
|
||||
|
||||
struct PreparedHtml {
|
||||
QString m_html;
|
||||
QUrl m_baseUrl;
|
||||
};
|
||||
|
||||
// Interface for web/article viewers.
|
||||
class WebViewer {
|
||||
public:
|
||||
|
@ -154,7 +154,7 @@ QString SkinFactory::adBlockedPage(const QString& url, const QString& filter) {
|
||||
return currentSkin().m_layoutMarkupWrapper.arg(tr("This page was blocked by AdBlock"), adblocked);
|
||||
}
|
||||
|
||||
QPair<QString, QUrl> SkinFactory::generateHtmlOfArticles(const QList<Message>& messages, RootItem* root) const {
|
||||
PreparedHtml SkinFactory::generateHtmlOfArticles(const QList<Message>& messages, RootItem* root) const {
|
||||
Skin skin = currentSkin();
|
||||
QString messages_layout;
|
||||
QString single_message_layout = skin.m_layoutMarkup;
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include "core/message.h"
|
||||
|
||||
#include "gui/webviewers/webviewer.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QHash>
|
||||
@ -95,7 +97,7 @@ class RSSGUARD_DLLSPEC SkinFactory : public QObject {
|
||||
|
||||
QString adBlockedPage(const QString& url, const QString& filter);
|
||||
|
||||
QPair<QString, QUrl> generateHtmlOfArticles(const QList<Message>& messages, RootItem* root) const;
|
||||
PreparedHtml generateHtmlOfArticles(const QList<Message>& messages, RootItem* root) const;
|
||||
|
||||
// Gets skin about a particular skin.
|
||||
Skin skinInfo(const QString& skin_name, bool* ok = nullptr) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user