Commit 799a9b30 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Improve webengine support

parent 4552c3f7
......@@ -44,7 +44,7 @@ if (QTWEBENGINE_EXPERIMENTAL_OPTION)
articleviewer-ng/webengine/articleviewerwebengine.cpp
articleviewer-ng/webengine/articleviewerwebenginepage.cpp
articleviewer-ng/webengine/articlehtmlwebenginewriter.cpp
#articleviewer-ng/webengine/articleviewerwebenginewidgetng.cpp
articleviewer-ng/webengine/articleviewerwebenginewidgetng.cpp
)
set(akregator_articleviewer_ng_webengine_libs Qt5::WebEngine Qt5::WebEngineWidgets)
endif()
......@@ -76,7 +76,7 @@ set(akregatorprivate_frame_webkit_SRCS
)
if (QTWEBENGINE_EXPERIMENTAL_OPTION)
set(akregatorprivate_frame_webengine_SRCS
#frame/webengine/webengineframe.cpp
frame/webengine/webengineframe.cpp
frame/webengine/webengineviewer.cpp
)
endif()
......
......@@ -17,7 +17,6 @@
#include "articleviewerwebenginewidgetng.h"
#include "articleviewerng.h"
#include <MessageViewer/FindBarWebView>
#include <KActionCollection>
......@@ -29,6 +28,8 @@
#include <kpimtextedit/slidecontainer.h>
#include <MessageViewer/FindBarWebEngineView>
using namespace Akregator;
ArticleViewerWebEngineWidgetNg::ArticleViewerWebEngineWidgetNg(ArticleViewerWebEngine *customViewer, KActionCollection *ac, QWidget *parent)
......@@ -56,20 +57,20 @@ void ArticleViewerWebEngineWidgetNg::initializeLayout(KActionCollection *ac)
layout->addWidget(mTextToSpeechWidget);
if (!mArticleViewerNg) {
mArticleViewerNg = new ArticleViewerNg(ac, this);
mArticleViewerNg = new ArticleViewerWebEngine(ac, this);
}
mArticleViewerNg->setObjectName(QStringLiteral("articleviewerng"));
layout->addWidget(mArticleViewerNg);
mSliderContainer = new KPIMTextEdit::SlideContainer(this);
mSliderContainer->setObjectName(QStringLiteral("slidercontainer"));
mFindBarWebView = new MessageViewer::FindBarWebView(mArticleViewerNg, this);
mFindBarWebView = new MessageViewer::FindBarWebEngineView(mArticleViewerNg, this);
mFindBarWebView->setObjectName(QStringLiteral("findbarwebview"));
connect(mFindBarWebView, &MessageViewer::FindBarBase::hideFindBar, mSliderContainer, &KPIMTextEdit::SlideContainer::slideOut);
mSliderContainer->setContent(mFindBarWebView);
layout->addWidget(mSliderContainer);
connect(articleViewerNg(), &ArticleViewerNg::textToSpeech, this, &ArticleViewerWebEngineWidgetNg::slotSpeakText);
connect(articleViewerNg(), &ArticleViewerNg::findTextInHtml, this, &ArticleViewerWebEngineWidgetNg::slotFind);
connect(articleViewerNg(), &ArticleViewerWebEngine::textToSpeech, this, &ArticleViewerWebEngineWidgetNg::slotSpeakText);
connect(articleViewerNg(), &ArticleViewerWebEngine::findTextInHtml, this, &ArticleViewerWebEngineWidgetNg::slotFind);
}
ArticleViewerWebEngineWidgetNg::~ArticleViewerWebEngineWidgetNg()
......
......@@ -24,7 +24,7 @@
class KActionCollection;
namespace MessageViewer
{
class FindBarWebView;
class FindBarWebEngineView;
}
namespace KPIMTextEdit
......@@ -51,7 +51,7 @@ public Q_SLOTS:
private:
void initializeActions(KActionCollection *ac);
void initializeLayout(KActionCollection *ac);
MessageViewer::FindBarWebView *mFindBarWebView;
MessageViewer::FindBarWebEngineView *mFindBarWebView;
ArticleViewerWebEngine *mArticleViewerNg;
KPIMTextEdit::TextToSpeechWidget *mTextToSpeechWidget;
KPIMTextEdit::SlideContainer *mSliderContainer;
......
......@@ -32,12 +32,12 @@ WebEngineFrame::WebEngineFrame(KActionCollection *ac, QWidget *parent)
Akregator::ArticleViewerWebEngine *viewer = new Akregator::ArticleViewerWebEngine(ac, this);
mArticleViewerWidgetNg = new Akregator::ArticleViewerWebEngineWidgetNg(viewer, ac, this);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerNg::titleChanged, this, &WebEngineFrame::slotTitleChanged);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerNg::loadProgress, this, &WebEngineFrame::slotProgressChanged);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerNg::signalOpenUrlRequest, this, &WebEngineFrame::signalOpenUrlRequest);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerNg::loadStarted, this, &WebEngineFrame::slotLoadStarted);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerNg::loadFinished, this, &WebEngineFrame::slotLoadFinished);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerNg::showStatusBarMessage, this, &WebEngineFrame::showStatusBarMessage);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::titleChanged, this, &WebEngineFrame::slotTitleChanged);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::loadProgress, this, &WebEngineFrame::slotProgressChanged);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::signalOpenUrlRequest, this, &WebEngineFrame::signalOpenUrlRequest);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::loadStarted, this, &WebEngineFrame::slotLoadStarted);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::loadFinished, this, &WebEngineFrame::slotLoadFinished);
connect(mArticleViewerWidgetNg->articleViewerNg(), &ArticleViewerWebEngine::showStatusBarMessage, this, &WebEngineFrame::showStatusBarMessage);
layout->addWidget(mArticleViewerWidgetNg);
}
......@@ -99,14 +99,14 @@ void WebEngineFrame::loadConfig(const KConfigGroup &config, const QString &prefi
req.setArgs(args);
openUrl(req);
mArticleViewerWidgetNg->articleViewerNg()->setZoomFactor(zf);
mArticleViewerWidgetNg->articleViewerNg()->settings()->setAttribute(QWebSettings::ZoomTextOnly, onlyZoomFont);
//FIXME mArticleViewerWidgetNg->articleViewerNg()->settings()->setAttribute(QWebEngineSettings::ZoomTextOnly, onlyZoomFont);
}
void WebEngineFrame::saveConfig(KConfigGroup &config, const QString &prefix)
{
config.writeEntry(QStringLiteral("url").prepend(prefix), url().url());
config.writeEntry(QStringLiteral("zoom").prepend(prefix), mArticleViewerWidgetNg->articleViewerNg()->zoomFactor());
config.writeEntry(QStringLiteral("onlyZoomFont").prepend(prefix), mArticleViewerWidgetNg->articleViewerNg()->settings()->testAttribute(QWebSettings::ZoomTextOnly));
//FIXME config.writeEntry(QStringLiteral("onlyZoomFont").prepend(prefix), mArticleViewerWidgetNg->articleViewerNg()->settings()->testAttribute(QWebSettings::ZoomTextOnly));
}
void WebEngineFrame::slotCopyInFrame(int frameId)
......@@ -167,12 +167,12 @@ void WebEngineFrame::slotZoomTextOnlyInFrame(int frameId, bool textOnlyInFrame)
void WebEngineFrame::slotHistoryForward()
{
mArticleViewerWidgetNg->articleViewerNg()->pageAction(QWebPage::Forward)->trigger();
mArticleViewerWidgetNg->articleViewerNg()->pageAction(QWebEnginePage::Forward)->trigger();
}
void WebEngineFrame::slotHistoryBack()
{
mArticleViewerWidgetNg->articleViewerNg()->pageAction(QWebPage::Back)->trigger();
mArticleViewerWidgetNg->articleViewerNg()->pageAction(QWebEnginePage::Back)->trigger();
}
void WebEngineFrame::slotReload()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment