| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/gui/webviewers/webengine/webengineviewer.cpp`/ |
| 2 | |
| 3 | #include "gui/webviewers/webengine/webengineviewer.h"cxx . . $ `<file>/src/librssguard/gui/webviewers/webengine/webengineviewer.h`/ |
| 4 | |
| 5 | #include "definitions/definitions.h"cxx . . $ `<file>/src/librssguard/definitions/definitions.h`/ |
| 6 | #include "gui/dialogs/formmain.h"cxx . . $ `<file>/src/librssguard/gui/dialogs/formmain.h`/ |
| 7 | #include "gui/webbrowser.h"cxx . . $ `<file>/src/librssguard/gui/webbrowser.h`/ |
| 8 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 9 | #include "miscellaneous/externaltool.h"cxx . . $ `<file>/src/librssguard/miscellaneous/externaltool.h`/ |
| 10 | #include "miscellaneous/settings.h"cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/ |
| 11 | #include "miscellaneous/skinfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/skinfactory.h`/ |
| 12 | #include "network-web/adblock/adblockicon.h"cxx . . $ `<file>/src/librssguard/network-web/adblock/adblockicon.h`/ |
| 13 | #include "network-web/adblock/adblockmanager.h"cxx . . $ `<file>/src/librssguard/network-web/adblock/adblockmanager.h`/ |
| 14 | #include "network-web/webengine/webenginepage.h"cxx . . $ `<file>/src/librssguard/network-web/webengine/webenginepage.h`/ |
| 15 | #include "network-web/webfactory.h"cxx . . $ `<file>/src/librssguard/network-web/webfactory.h`/ |
| 16 | |
| 17 | #include <QFileIconProvider> |
| 18 | #include <QGraphicsView> |
| 19 | #include <QTimer> |
| 20 | #include <QToolTip> |
| 21 | #include <QWheelEvent> |
| 22 | |
| 23 | #if QT_VERSION_MAJORcxx . . $ `<external>/9758848313111604122/qconfig.h:67:9`! == 6 |
| 24 | #include <QWebEngineContextMenuRequest> |
| 25 | #else |
| 26 | #include <QWebEngineContextMenuData> |
| 27 | #endif |
| 28 | |
| 29 | #include <QWebEngineProfile> |
| 30 | #include <QWebEngineSettings> |
| 31 | |
| 32 | WebEngineViewercxx . . $ WebEngineViewer#::WebEngineViewercxx . . $ WebEngineViewer#WebEngineViewer(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) : QWebEngineViewcxx . . $ QWebEngineView#QWebEngineView(108f35f7aa7f3cf9).(parent), m_browsercxx . . $ WebEngineViewer#m_browser.(nullptr), m_rootcxx . . $ WebEngineViewer#m_root.(nullptr) { |
| 33 | WebEnginePagecxx . . $ WebEnginePage#* page = new WebEnginePagecxx . . $ WebEnginePage#(this); |
| 34 | |
| 35 | setPagecxx . . $ QWebEngineView#setPage(c518603ea2f6765d).(page); |
| 36 | |
| 37 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(page, &WebEnginePagecxx . . $ WebEnginePage#::fullScreenRequestedcxx . . $ QWebEnginePage#fullScreenRequested(6369523533de137b)., this, &WebEngineViewercxx . . $ WebEngineViewer#::onFullScreenRequestedcxx . . $ WebEngineViewer#onFullScreenRequested(6369523533de137b).); |
| 38 | } |
| 39 | |
| 40 | bool WebEngineViewercxx . . $ WebEngineViewer#::eventcxx . . $ WebEngineViewer#event(f123fa2ce489f0bd).(QEventcxx . . $ QEvent#* event) { |
| 41 | if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::ChildAddedcxx . . $ QEvent#ChildAdded.) { |
| 42 | QChildEventcxx . . $ QChildEvent#* child_ev = static_cast<QChildEventcxx . . $ QChildEvent#*>(event); |
| 43 | QWidgetcxx . . $ QWidget#* w = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<QWidgetcxx . . $ QWidget#*>(child_ev->childcxx . . $ QChildEvent#child(2dbb680a34285c44).()); |
| 44 | |
| 45 | if (w != nullptr && m_browsercxx . . $ WebEngineViewer#m_browser. != nullptr) { |
| 46 | w->installEventFiltercxx . . $ QObject#installEventFilter(749de1b6ae65bddd).(m_browsercxx . . $ WebEngineViewer#m_browser.); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | return QWebEngineViewcxx . . $ QWebEngineView#::eventcxx . . $ QWebEngineView#event(f123fa2ce489f0bd).(event); |
| 51 | } |
| 52 | |
| 53 | void WebEngineViewercxx . . $ WebEngineViewer#::onFullScreenRequestedcxx . . $ WebEngineViewer#onFullScreenRequested(6369523533de137b).(QWebEngineFullScreenRequestcxx . . $ QWebEngineFullScreenRequest# request) { |
| 54 | request.acceptcxx . . $ QWebEngineFullScreenRequest#accept(49f6e7a06ebc5aa8).(); |
| 55 | } |
| 56 | |
| 57 | WebEnginePagecxx . . $ WebEnginePage#* WebEngineViewercxx . . $ WebEngineViewer#::pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).() const { |
| 58 | return qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<WebEnginePagecxx . . $ WebEnginePage#*>(QWebEngineViewcxx . . $ QWebEngineView#::pagecxx . . $ QWebEngineView#page(f6067852cd2f1633).()); |
| 59 | } |
| 60 | |
| 61 | void WebEngineViewercxx . . $ WebEngineViewer#::loadMessagescxx . . $ WebEngineViewer#loadMessages(49f6da13449e8c82).(const QListcxx . . $ QList#<Messagecxx . . $ Message#>& messages, RootItemcxx . . $ RootItem#* root) { |
| 62 | auto html_messages = htmlForMessagescxx . . $ WebEngineViewer#htmlForMessages(6b71c5483f38f48).(messages, root); |
| 63 | |
| 64 | m_rootcxx . . $ WebEngineViewer#m_root. = root; |
| 65 | m_messageContentscxx . . $ WebEngineViewer#m_messageContents. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). html_messages.m_htmlcxx . . $ PreparedHtml#m_html.; |
| 66 | m_messageBaseUrlcxx . . $ WebEngineViewer#m_messageBaseUrl. =cxx . . $ QUrl#`operator=`(5236b30dc3aa36dd). html_messages.m_baseUrlcxx . . $ PreparedHtml#m_baseUrl.; |
| 67 | |
| 68 | bool previously_enabled = isEnabledcxx . . $ QWidget#isEnabled(50ce9a9e25b4a850).(); |
| 69 | |
| 70 | setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 71 | setHtmlcxx . . $ WebEngineViewer#setHtml(9b3514a5b076b66b).(m_messageContentscxx . . $ WebEngineViewer#m_messageContents., m_messageBaseUrlcxx . . $ WebEngineViewer#m_messageBaseUrl.); |
| 72 | setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(previously_enabled); |
| 73 | |
| 74 | pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).()->runJavaScriptcxx . . $ QWebEnginePage#runJavaScript(78cf515ccadc8b80).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("window.scrollTo(0, 0);")); |
| 75 | } |
| 76 | |
| 77 | PreparedHtmlcxx . . $ PreparedHtml# WebEngineViewercxx . . $ WebEngineViewer#::htmlForMessagescxx . . $ WebEngineViewer#htmlForMessages(6b71c5483f38f48).(const QListcxx . . $ QList#<Messagecxx . . $ Message#>& messages, RootItemcxx . . $ RootItem#* root) const { |
| 78 | return qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->skinscxx . . $ Application#skins(260b20d67347ae96).()->generateHtmlOfArticlescxx . . $ SkinFactory#generateHtmlOfArticles(e95722fdaa1a1d02).(messages, root, widthcxx . . $ QWidget#width(455f465bc33b4cdf).() * ACCEPTABLE_IMAGE_PERCENTUAL_WIDTHcxx . . $ `src/librssguard/gui/webviewers/webviewer.h:28:9`!); |
| 79 | } |
| 80 | |
| 81 | void WebEngineViewercxx . . $ WebEngineViewer#::clearcxx . . $ WebEngineViewer#clear(49f6e7a06ebc5aa8).() { |
| 82 | bool previously_enabled = isEnabledcxx . . $ QWidget#isEnabled(50ce9a9e25b4a850).(); |
| 83 | |
| 84 | setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false); |
| 85 | setHtmlcxx . . $ WebEngineViewer#setHtml(9b3514a5b076b66b).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("<!DOCTYPE html><html><body</body></html>"), QUrlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(INTERNAL_URL_BLANKcxx . . $ `src/librssguard/definitions/definitions.h:206:9`!))); |
| 86 | setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(previously_enabled); |
| 87 | } |
| 88 | |
| 89 | void WebEngineViewercxx . . $ WebEngineViewer#::contextMenuEventcxx . . $ WebEngineViewer#contextMenuEvent(ebb2569a74e11126).(QContextMenuEventcxx . . $ QContextMenuEvent#* event) { |
| 90 | event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 91 | |
| 92 | #if QT_VERSION_MAJORcxx . . $ `<external>/9758848313111604122/qconfig.h:67:9`! == 6 |
| 93 | QMenucxx . . $ QMenu#* menu = createStandardContextMenucxx . . $ QWebEngineView#createStandardContextMenu(fe0a096c13a48705).(); |
| 94 | #else |
| 95 | QMenu* menu = page()->createStandardContextMenu(); |
| 96 | #endif |
| 97 | |
| 98 | menu->removeActioncxx . . $ QWidget#removeAction(92b1e80c0a7f1406).(pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).()->actioncxx . . $ QWebEnginePage#action(dfc8626a631b7a9b).(QWebEnginePagecxx . . $ QWebEnginePage#::WebActioncxx . . $ QWebEnginePage#WebAction#::OpenLinkInNewWindowcxx . . $ QWebEnginePage#OpenLinkInNewWindow.)); |
| 99 | |
| 100 | menu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->webcxx . . $ Application#web(ad68e16c93841931).()->adBlockcxx . . $ WebFactory#adBlock(dd9ae43777736cac).()->adBlockIconcxx . . $ AdBlockManager#adBlockIcon(c28c2e98a16e03de).()); |
| 101 | menu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->webcxx . . $ Application#web(ad68e16c93841931).()->engineSettingsActioncxx . . $ WebFactory#engineSettingsAction(a590eff9f1ec9a95).()); |
| 102 | |
| 103 | const QPointcxx . . $ QPoint# pos = event->globalPoscxx . . $ QContextMenuEvent#globalPos(6de9f7a200ca710c).(); |
| 104 | QPointcxx . . $ QPoint# pcxx . . $ QPoint#QPoint(c0d38f4800714fae).(pos.xcxx . . $ QPoint#x(ea6fe5115c70a13f).(), pos.ycxx . . $ QPoint#y(ea6fe5115c70a13f).() + 1); |
| 105 | |
| 106 | processContextMenucxx . . $ WebViewer#processContextMenu(50faf3e001f68251).(menu, event); |
| 107 | |
| 108 | menu->popupcxx . . $ QMenu#popup(371d674a5bfc952e).(p); |
| 109 | } |
| 110 | |
| 111 | QWebEngineViewcxx . . $ QWebEngineView#* WebEngineViewercxx . . $ WebEngineViewer#::createWindowcxx . . $ WebEngineViewer#createWindow(77eb51dbbe81432f).(QWebEnginePagecxx . . $ QWebEnginePage#::WebWindowTypecxx . . $ QWebEnginePage#WebWindowType# type) { |
| 112 | auto* viewer = new WebEngineViewercxx . . $ WebEngineViewer#WebEngineViewer(108f35f7aa7f3cf9).(this); |
| 113 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! newWindowRequestedcxx . . $ WebEngineViewer#newWindowRequested(759227a73ba7c3f4).(viewer); |
| 114 | |
| 115 | return viewer; |
| 116 | } |
| 117 | |
| 118 | void WebEngineViewercxx . . $ WebEngineViewer#::openUrlWithExternalToolcxx . . $ WebEngineViewer#openUrlWithExternalTool(dcbd01e059f189e1).(ExternalToolcxx . . $ ExternalTool# tool, const QStringcxx . . $ QString#& target_url) { |
| 119 | tool.runcxx . . $ ExternalTool#run(e1defb592416720d).(target_url); |
| 120 | } |
| 121 | |
| 122 | void WebEngineViewercxx . . $ WebEngineViewer#::bindToBrowsercxx . . $ WebEngineViewer#bindToBrowser(ffbf97f3859aff07).(WebBrowsercxx . . $ WebBrowser#* browser) { |
| 123 | m_browsercxx . . $ WebEngineViewer#m_browser. = browser; |
| 124 | |
| 125 | browser->m_actionBackcxx . . $ WebBrowser#m_actionBack. = pageActioncxx . . $ QWebEngineView#pageAction(dfc8626a631b7a9b).(QWebEnginePagecxx . . $ QWebEnginePage#::WebActioncxx . . $ QWebEnginePage#WebAction#::Backcxx . . $ QWebEnginePage#Back.); |
| 126 | browser->m_actionForwardcxx . . $ WebBrowser#m_actionForward. = pageActioncxx . . $ QWebEngineView#pageAction(dfc8626a631b7a9b).(QWebEnginePagecxx . . $ QWebEnginePage#::WebActioncxx . . $ QWebEnginePage#WebAction#::Forwardcxx . . $ QWebEnginePage#Forward.); |
| 127 | browser->m_actionReloadcxx . . $ WebBrowser#m_actionReload. = pageActioncxx . . $ QWebEngineView#pageAction(dfc8626a631b7a9b).(QWebEnginePagecxx . . $ QWebEnginePage#::WebActioncxx . . $ QWebEnginePage#WebAction#::Reloadcxx . . $ QWebEnginePage#Reload.); |
| 128 | browser->m_actionStopcxx . . $ WebBrowser#m_actionStop. = pageActioncxx . . $ QWebEngineView#pageAction(dfc8626a631b7a9b).(QWebEnginePagecxx . . $ QWebEnginePage#::WebActioncxx . . $ QWebEnginePage#WebAction#::Stopcxx . . $ QWebEnginePage#Stop.); |
| 129 | |
| 130 | // NOTE: Just forward QtWebEngine signals, it's all there. |
| 131 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, &QWebEngineViewcxx . . $ QWebEngineView#::loadStartedcxx . . $ QWebEngineView#loadStarted(49f6e7a06ebc5aa8)., this, &WebEngineViewercxx . . $ WebEngineViewer#::loadingStartedcxx . . $ WebEngineViewer#loadingStarted(49f6e7a06ebc5aa8).); |
| 132 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, &QWebEngineViewcxx . . $ QWebEngineView#::loadProgresscxx . . $ QWebEngineView#loadProgress(d4f767463ce0a6b3)., this, &WebEngineViewercxx . . $ WebEngineViewer#::loadingProgresscxx . . $ WebEngineViewer#loadingProgress(d4f767463ce0a6b3).); |
| 133 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, &QWebEngineViewcxx . . $ QWebEngineView#::loadFinishedcxx . . $ QWebEngineView#loadFinished(b45ddcbc8423892c)., this, &WebEngineViewercxx . . $ WebEngineViewer#::loadingFinishedcxx . . $ WebEngineViewer#loadingFinished(b45ddcbc8423892c).); |
| 134 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, &QWebEngineViewcxx . . $ QWebEngineView#::titleChangedcxx . . $ QWebEngineView#titleChanged(3520e46b33348bf6)., this, &WebEngineViewercxx . . $ WebEngineViewer#::pageTitleChangedcxx . . $ WebEngineViewer#pageTitleChanged(3520e46b33348bf6).); |
| 135 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, &QWebEngineViewcxx . . $ QWebEngineView#::iconChangedcxx . . $ QWebEngineView#iconChanged(71dcdac178620ed6)., this, &WebEngineViewercxx . . $ WebEngineViewer#::pageIconChangedcxx . . $ WebEngineViewer#pageIconChanged(71dcdac178620ed6).); |
| 136 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(this, &QWebEngineViewcxx . . $ QWebEngineView#::urlChangedcxx . . $ QWebEngineView#urlChanged(37355d2f77053a23)., this, &WebEngineViewercxx . . $ WebEngineViewer#::pageUrlChangedcxx . . $ WebEngineViewer#pageUrlChanged(37355d2f77053a23).); |
| 137 | |
| 138 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).(), &QWebEnginePagecxx . . $ QWebEnginePage#::windowCloseRequestedcxx . . $ QWebEnginePage#windowCloseRequested(49f6e7a06ebc5aa8)., this, &WebEngineViewercxx . . $ WebEngineViewer#::closeWindowRequestedcxx . . $ WebEngineViewer#closeWindowRequested(49f6e7a06ebc5aa8).); |
| 139 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).(), &QWebEnginePagecxx . . $ QWebEnginePage#::linkHoveredcxx . . $ QWebEnginePage#linkHovered(3520e46b33348bf6)., this, &WebEngineViewercxx . . $ WebEngineViewer#::linkMouseHighlightedcxx . . $ WebEngineViewer#linkMouseHighlighted(37355d2f77053a23).); |
| 140 | } |
| 141 | |
| 142 | void WebEngineViewercxx . . $ WebEngineViewer#::findTextcxx . . $ WebEngineViewer#findText(37c160c81b6367f7).(const QStringcxx . . $ QString#& text, bool backwards) { |
| 143 | if (backwards) { |
| 144 | QWebEngineViewcxx . . $ QWebEngineView#::findTextcxx . . $ QWebEngineView#findText(94fc18bbfff58c18).(text, QWebEnginePagecxx . . $ QFlags#QFlags(93d577a3e9528307).::FindFlagcxx . . $ QWebEnginePage#FindFlag#::FindBackwardcxx . . $ QWebEnginePage#FindBackward.); |
| 145 | } |
| 146 | else { |
| 147 | QWebEngineViewcxx . . $ QWebEngineView#::findTextcxx . . $ QWebEngineView#findText(94fc18bbfff58c18).(text); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | void WebEngineViewercxx . . $ WebEngineViewer#::setUrlcxx . . $ WebEngineViewer#setUrl(37355d2f77053a23).(const QUrlcxx . . $ QUrl#& url) { |
| 152 | QWebEngineViewcxx . . $ QWebEngineView#::setUrlcxx . . $ QWebEngineView#setUrl(37355d2f77053a23).(url); |
| 153 | } |
| 154 | |
| 155 | void WebEngineViewercxx . . $ WebEngineViewer#::setHtmlcxx . . $ WebEngineViewer#setHtml(9b3514a5b076b66b).(const QStringcxx . . $ QString#& html, const QUrlcxx . . $ QUrl#& base_url) { |
| 156 | QWebEngineViewcxx . . $ QWebEngineView#::setHtmlcxx . . $ QWebEngineView#setHtml(9b3514a5b076b66b).(html, base_url); |
| 157 | |
| 158 | // IOFactory::writeFile("a.html", html.toUtf8()); |
| 159 | } |
| 160 | |
| 161 | void WebEngineViewercxx . . $ WebEngineViewer#::setReadabledHtmlcxx . . $ WebEngineViewer#setReadabledHtml(9b3514a5b076b66b).(const QStringcxx . . $ QString#& html, const QUrlcxx . . $ QUrl#& base_url) { |
| 162 | auto better_html = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->skinscxx . . $ Application#skins(260b20d67347ae96).()->prepareHtmlcxx . . $ SkinFactory#prepareHtml(58000ba8dd36147c).(html, base_url); |
| 163 | |
| 164 | setHtmlcxx . . $ WebEngineViewer#setHtml(9b3514a5b076b66b).(better_html.m_htmlcxx . . $ PreparedHtml#m_html., better_html.m_baseUrlcxx . . $ PreparedHtml#m_baseUrl.); |
| 165 | } |
| 166 | |
| 167 | double WebEngineViewercxx . . $ WebEngineViewer#::verticalScrollBarPositioncxx . . $ WebEngineViewer#verticalScrollBarPosition(21b6c25e127938e2).() const { |
| 168 | double position; |
| 169 | QEventLoopcxx . . $ QEventLoop# loopcxx . . $ QEventLoop#QEventLoop(749de1b6ae65bddd).; |
| 170 | |
| 171 | pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).()->runJavaScriptcxx . . $ QWebEnginePage#runJavaScript(34a16e02a9832945).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("window.pageYOffset;"), [cxx . . $ std/function#function(bdc3712e480e4d04).&position, &loop](const QVariantcxx . . $ QVariant#& val) { |
| 172 | position = val.toDoublecxx . . $ QVariant#toDouble(1bd8e57dd4a29c14).(); |
| 173 | loop.exitcxx . . $ QEventLoop#exit(d4f767463ce0a6b3).(); |
| 174 | }); |
| 175 | loop.execcxx . . $ QEventLoop#exec(f981dedee5b32481).(); |
| 176 | |
| 177 | return position; |
| 178 | } |
| 179 | |
| 180 | void WebEngineViewercxx . . $ WebEngineViewer#::setVerticalScrollBarPositioncxx . . $ WebEngineViewer#setVerticalScrollBarPosition(ba8836b59fb42830).(double pos) { |
| 181 | pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).()->runJavaScriptcxx . . $ QWebEnginePage#runJavaScript(78cf515ccadc8b80).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("window.scrollTo(0, %1);").argcxx . . $ QString#arg(4bc30c57834ce0f4).(pos)); |
| 182 | } |
| 183 | |
| 184 | void WebEngineViewercxx . . $ WebEngineViewer#::applyFontcxx . . $ WebEngineViewer#applyFont(d0a4bd0c8524b912).(const QFontcxx . . $ QFont#& fon) { |
| 185 | auto pixel_size = QFontMetricscxx . . $ QFontMetrics#QFontMetrics(d0a4bd0c8524b912).(fon).ascentcxx . . $ QFontMetrics#ascent(455f465bc33b4cdf).(); |
| 186 | |
| 187 | pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).()->profilecxx . . $ QWebEnginePage#profile(294eeb6492764e8c).()->settingscxx . . $ QWebEngineProfile#settings(18c7951e61ec77a6).()->setFontFamilycxx . . $ QWebEngineSettings#setFontFamily(7a5d45baa244c688).(QWebEngineSettingscxx . . $ QWebEngineSettings#::FontFamilycxx . . $ QWebEngineSettings#FontFamily#::StandardFontcxx . . $ QWebEngineSettings#StandardFont., fon.familycxx . . $ QFont#family(6ef7b6c27b00b43d).()); |
| 188 | pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).()->profilecxx . . $ QWebEnginePage#profile(294eeb6492764e8c).()->settingscxx . . $ QWebEngineProfile#settings(18c7951e61ec77a6).()->setFontFamilycxx . . $ QWebEngineSettings#setFontFamily(7a5d45baa244c688).(QWebEngineSettingscxx . . $ QWebEngineSettings#::FontFamilycxx . . $ QWebEngineSettings#FontFamily#::SerifFontcxx . . $ QWebEngineSettings#SerifFont., fon.familycxx . . $ QFont#family(6ef7b6c27b00b43d).()); |
| 189 | pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).()->profilecxx . . $ QWebEnginePage#profile(294eeb6492764e8c).()->settingscxx . . $ QWebEngineProfile#settings(18c7951e61ec77a6).()->setFontFamilycxx . . $ QWebEngineSettings#setFontFamily(7a5d45baa244c688).(QWebEngineSettingscxx . . $ QWebEngineSettings#::FontFamilycxx . . $ QWebEngineSettings#FontFamily#::SansSerifFontcxx . . $ QWebEngineSettings#SansSerifFont., fon.familycxx . . $ QFont#family(6ef7b6c27b00b43d).()); |
| 190 | pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).()->profilecxx . . $ QWebEnginePage#profile(294eeb6492764e8c).()->settingscxx . . $ QWebEngineProfile#settings(18c7951e61ec77a6).()->setFontSizecxx . . $ QWebEngineSettings#setFontSize(6ad4e0e61510c249).(QWebEngineSettingscxx . . $ QWebEngineSettings#::DefaultFontSizecxx . . $ QWebEngineSettings#DefaultFontSize., pixel_size); |
| 191 | } |
| 192 | |
| 193 | qrealcxx . . $ qreal# WebEngineViewercxx . . $ WebEngineViewer#::zoomFactorcxx . . $ WebEngineViewer#zoomFactor(21b6c25e127938e2).() const { |
| 194 | return QWebEngineViewcxx . . $ QWebEngineView#::zoomFactorcxx . . $ QWebEngineView#zoomFactor(21b6c25e127938e2).(); |
| 195 | } |
| 196 | |
| 197 | void WebEngineViewercxx . . $ WebEngineViewer#::setZoomFactorcxx . . $ WebEngineViewer#setZoomFactor(ba8836b59fb42830).(qrealcxx . . $ qreal# zoom_factor) { |
| 198 | QWebEngineViewcxx . . $ QWebEngineView#::setZoomFactorcxx . . $ QWebEngineView#setZoomFactor(ba8836b59fb42830).(zoom_factor); |
| 199 | } |
| 200 | |
| 201 | QStringcxx . . $ QString# WebEngineViewercxx . . $ WebEngineViewer#::htmlcxx . . $ WebEngineViewer#html(6ef7b6c27b00b43d).() const { |
| 202 | QEventLoopcxx . . $ QEventLoop# loopcxx . . $ QEventLoop#QEventLoop(749de1b6ae65bddd).; |
| 203 | QStringcxx . . $ QString# htmllcxx . . $ QString#QString(ced63f7c635d850d).; |
| 204 | |
| 205 | pagecxx . . $ WebEngineViewer#page(7cad7df830b309ab).()->toHtmlcxx . . $ QWebEnginePage#toHtml(56bff8ec12a4105).([cxx . . $ std/function#function(bdc3712e480e4d04).&](const QStringcxx . . $ QString#& htm) { |
| 206 | htmll =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). htm; |
| 207 | loop.exitcxx . . $ QEventLoop#exit(d4f767463ce0a6b3).(); |
| 208 | }); |
| 209 | |
| 210 | loop.execcxx . . $ QEventLoop#exec(f981dedee5b32481).(); |
| 211 | |
| 212 | return htmllcxx . . $ QString#QString(28715ad661ad3cec).; |
| 213 | } |
| 214 | |
| 215 | QUrlcxx . . $ QUrl# WebEngineViewercxx . . $ WebEngineViewer#::urlcxx . . $ WebEngineViewer#url(36d9834fe7321282).() const { |
| 216 | return QWebEngineViewcxx . . $ QWebEngineView#::urlcxx . . $ QWebEngineView#url(36d9834fe7321282).(); |
| 217 | } |
| 218 | |
| 219 | QByteArraycxx . . $ QByteArray# WebEngineViewercxx . . $ WebEngineViewer#::getJsEnabledHtmlcxx . . $ WebEngineViewer#getJsEnabledHtml(1d3fb15cad771d33).(const QStringcxx . . $ QString#& url, bool worker_thread) { |
| 220 | WebEnginePagecxx . . $ WebEnginePage#* page = new WebEnginePagecxx . . $ WebEnginePage#(); |
| 221 | WebEngineViewercxx . . $ WebEngineViewer#* viewer = nullptr; |
| 222 | |
| 223 | if (worker_thread) { |
| 224 | QMetaObjectcxx . . $ QMetaObject#::invokeMethodcxx . . $ QMetaObject#invokeMethod(bb73ac13b4485c8).( |
| 225 | qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!, |
| 226 | [&] { |
| 227 | // NOTE: Must be created on main thread. |
| 228 | viewer = new WebEngineViewercxx . . $ WebEngineViewer#WebEngineViewer(108f35f7aa7f3cf9).(); |
| 229 | }, |
| 230 | Qtcxx . . $ Qt/::ConnectionTypecxx . . $ Qt/ConnectionType#::BlockingQueuedConnectioncxx . . $ Qt/BlockingQueuedConnection.); |
| 231 | |
| 232 | viewer->moveToThreadcxx . . $ QObject#moveToThread(d30c93cb79097f61).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->threadcxx . . $ QObject#thread(e822fcf2e88733f4).()); |
| 233 | page->moveToThreadcxx . . $ QObject#moveToThread(d30c93cb79097f61).(qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->threadcxx . . $ QObject#thread(e822fcf2e88733f4).()); |
| 234 | } |
| 235 | else { |
| 236 | viewer = new WebEngineViewercxx . . $ WebEngineViewer#WebEngineViewer(108f35f7aa7f3cf9).(); |
| 237 | } |
| 238 | |
| 239 | viewer->setPagecxx . . $ QWebEngineView#setPage(c518603ea2f6765d).(page); |
| 240 | viewer->setAttributecxx . . $ QWidget#setAttribute(52fc7bf162518f7f).(Qtcxx . . $ Qt/::WidgetAttributecxx . . $ Qt/WidgetAttribute#::WA_DontShowOnScreencxx . . $ Qt/WA_DontShowOnScreen., true); |
| 241 | viewer->setAttributecxx . . $ QWidget#setAttribute(52fc7bf162518f7f).(Qtcxx . . $ Qt/::WidgetAttributecxx . . $ Qt/WidgetAttribute#::WA_DeleteOnClosecxx . . $ Qt/WA_DeleteOnClose., true); |
| 242 | |
| 243 | QStringcxx . . $ QString# htmlcxx . . $ QString#QString(ced63f7c635d850d).; |
| 244 | |
| 245 | if (worker_thread) { |
| 246 | QMetaObjectcxx . . $ QMetaObject#::invokeMethodcxx . . $ QMetaObject#invokeMethod(8b0e30ae6de741c4).(viewer, "show", Qtcxx . . $ Qt/::ConnectionTypecxx . . $ Qt/ConnectionType#::BlockingQueuedConnectioncxx . . $ Qt/BlockingQueuedConnection.); |
| 247 | QMetaObjectcxx . . $ QMetaObject#::invokeMethodcxx . . $ QMetaObject#invokeMethod(50dab19f05caf2fd).(page, |
| 248 | "pageHtml", |
| 249 | Qtcxx . . $ Qt/::ConnectionTypecxx . . $ Qt/ConnectionType#::BlockingQueuedConnectioncxx . . $ Qt/BlockingQueuedConnection., |
| 250 | Q_RETURN_ARGcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:64:9`!(QString, html), |
| 251 | Q_ARGcxx . . $ `<external>/4766508314589701758/qobjectdefs.h:63:9`!(QString, url)); |
| 252 | } |
| 253 | else { |
| 254 | viewer->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).(); |
| 255 | html =cxx . . $ QString#`operator=`(4f35bf974e7f8568). page->pageHtmlcxx . . $ WebEnginePage#pageHtml(fd988a2ab94d906b).(url); |
| 256 | } |
| 257 | |
| 258 | page->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 259 | viewer->closecxx . . $ QWidget#close(c9857a73d68e59ba).(); |
| 260 | |
| 261 | // IOFactory::writeFile("a.html", html.toUtf8()); |
| 262 | |
| 263 | return html.toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).(); |
| 264 | } |
| 265 | |
| 266 | ContextMenuDatacxx . . $ ContextMenuData# WebEngineViewercxx . . $ WebEngineViewer#::provideContextMenuDatacxx . . $ WebEngineViewer#provideContextMenuData(f150d2abff9f3aa2).(QContextMenuEventcxx . . $ QContextMenuEvent#* event) const { |
| 267 | #if QT_VERSION_MAJORcxx . . $ `<external>/9758848313111604122/qconfig.h:67:9`! == 6 |
| 268 | auto* menu_pointer = lastContextMenuRequestcxx . . $ QWebEngineView#lastContextMenuRequest(6def20a0cf97cb0d).(); |
| 269 | QWebEngineContextMenuRequestcxx . . $ QWebEngineContextMenuRequest#& menu_data = *menu_pointer; |
| 270 | #else |
| 271 | QWebEngineContextMenuData menu_data = page()->contextMenuData(); |
| 272 | #endif |
| 273 | |
| 274 | ContextMenuDatacxx . . $ ContextMenuData# c; |
| 275 | |
| 276 | if (menu_data.mediaUrlcxx . . $ QWebEngineContextMenuRequest#mediaUrl(36d9834fe7321282).().isValidcxx . . $ QUrl#isValid(50ce9a9e25b4a850).()) { |
| 277 | c.m_mediaUrlcxx . . $ ContextMenuData#m_mediaUrl. =cxx . . $ QUrl#`operator=`(590d023fc9cd4b2d). menu_data.linkUrlcxx . . $ QWebEngineContextMenuRequest#linkUrl(36d9834fe7321282).(); |
| 278 | } |
| 279 | |
| 280 | if (menu_data.linkUrlcxx . . $ QWebEngineContextMenuRequest#linkUrl(36d9834fe7321282).().isValidcxx . . $ QUrl#isValid(50ce9a9e25b4a850).()) { |
| 281 | c.m_linkUrlcxx . . $ ContextMenuData#m_linkUrl. =cxx . . $ QUrl#`operator=`(590d023fc9cd4b2d). menu_data.linkUrlcxx . . $ QWebEngineContextMenuRequest#linkUrl(36d9834fe7321282).(); |
| 282 | } |
| 283 | |
| 284 | return c; |
| 285 | } |