diff --git a/FeedTheMonkey.pro b/FeedTheMonkey.pro index 15bd7f1..19007fd 100644 --- a/FeedTheMonkey.pro +++ b/FeedTheMonkey.pro @@ -1,7 +1,7 @@ TARGET = feedthemonkey TEMPLATE = app -QT += qml quick +QT += qml quick webenginewidgets CONFIG += c++11 SOURCES += \ diff --git a/ports/arch/PKGBUILD b/ports/arch/PKGBUILD index 0ef8649..25ff0b3 100644 --- a/ports/arch/PKGBUILD +++ b/ports/arch/PKGBUILD @@ -2,13 +2,13 @@ pkgname=feedthemonkey _name=FeedTheMonkey -pkgver=2.0.0 +pkgver=2.1.0 pkgrel=1 pkgdesc="Desktop client for the TinyTinyRSS reader" arch=('i686' 'x86_64') url="http://jabs.nu/feedthemonkey" license=('BSD') -depends=('qt5-declarative' 'qt5-quick1' 'qt5-quickcontrols' 'qt5-webkit') +depends=('qt5-declarative' 'qt5-quick1' 'qt5-quickcontrols' 'qt5-webengine') source=("https://github.com/jeena/${_name}/archive/v${pkgver}.tar.gz") md5sums=('SKIP') diff --git a/qml/Content.qml b/qml/Content.qml index 085902a..b431838 100644 --- a/qml/Content.qml +++ b/qml/Content.qml @@ -1,5 +1,4 @@ -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 +import QtWebEngine 1.0 import QtQuick 2.0 import QtQuick.Controls 1.3 import QtQuick.Layouts 1.1 @@ -7,7 +6,7 @@ import QtQuick.Controls.Styles 1.3 import QtQuick.Controls 1.3 import TTRSS 1.0 -ScrollView { +Item { id: content property Post post property ApplicationWindow app @@ -18,23 +17,19 @@ ScrollView { Layout.minimumWidth: 400 onTextFontSizeChanged: webView.setDefaults() - style: ScrollViewStyle { - transientScrollBars: true - } - function scrollDown(jump) { if(!jump) { - webView.experimental.evaluateJavaScript("window.scrollTo(0, document.body.scrollHeight - " + height + ");") + webView.runJavaScript("window.scrollTo(0, document.body.scrollHeight - " + height + ");") } else { - webView.experimental.evaluateJavaScript("window.scrollBy(0, " + jump + ");") + webView.runJavaScript("window.scrollBy(0, " + jump + ");") } } function scrollUp(jump) { if(!jump) { - webView.experimental.evaluateJavaScript("window.scrollTo(0, 0);") + webView.runJavaScript("window.scrollTo(0, 0);") } else { - webView.experimental.evaluateJavaScript("window.scrollBy(0, -" + jump + ");") + webView.runJavaScript("window.scrollBy(0, -" + jump + ");") } } @@ -44,41 +39,39 @@ ScrollView { Label { id: fontLabel } - WebView { + WebEngineView { id: webView + anchors.fill: parent url: "../html/content.html" - // Enable communication between QML and WebKit - experimental.preferences.navigatorQtObjectEnabled: true; - property Post post: content.post function setPost() { if(post) { - experimental.evaluateJavaScript("setArticle(" + post.jsonString + ")") + runJavaScript("setArticle(" + post.jsonString + ")") } else { - experimental.evaluateJavaScript("setArticle('logout')") + runJavaScript("setArticle('logout')") } } function setDefaults() { // font name needs to be enclosed in single quotes - experimental.evaluateJavaScript("document.body.style.fontFamily = \"'" + fontLabel.font.family + "'\";"); - experimental.evaluateJavaScript("document.body.style.fontSize = '" + content.textFontSize + "pt';"); + runJavaScript("document.body.style.fontFamily = \"'" + fontLabel.font.family + "'\";"); + runJavaScript("document.body.style.fontSize = '" + content.textFontSize + "pt';"); } onNavigationRequested: { - if (request.navigationType != WebView.LinkClickedNavigation) { - request.action = WebView.AcceptRequest; + if (request.navigationType != WebEngineView.LinkClickedNavigation) { + request.action = WebEngineView.AcceptRequest; } else { - request.action = WebView.IgnoreRequest; + request.action = WebEngineView.IgnoreRequest; Qt.openUrlExternally(request.url); } } onLoadingChanged: { - if(loadRequest.status === WebView.LoadSucceededStatus) { + if(!loading) { setPost() setDefaults() } diff --git a/qml/Sidebar.qml b/qml/Sidebar.qml index b2dcc80..56cf9ac 100644 --- a/qml/Sidebar.qml +++ b/qml/Sidebar.qml @@ -63,7 +63,7 @@ ScrollView { } item.content.post = server.posts[currentIndex] - content.flickableItem.contentY = 0 + //content.flickableItem.contentY = 0 previousPost = item.content.post } diff --git a/src/main.cpp b/src/main.cpp index c835418..87c9558 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "tinytinyrsslogin.h" #include "tinytinyrss.h" @@ -16,6 +17,8 @@ int main(int argc, char *argv[]) app.setOrganizationDomain("jeena.net"); app.setApplicationName("FeedTheMonkey"); + QtWebEngine::initialize(); + qmlRegisterType("TTRSS", 1, 0, "ServerLogin"); qmlRegisterType("TTRSS", 1, 0, "Server"); qmlRegisterType("TTRSS", 1, 0, "Post"); diff --git a/src/post.cpp b/src/post.cpp index 027c45c..e81c1f2 100644 --- a/src/post.cpp +++ b/src/post.cpp @@ -45,7 +45,6 @@ void Post::setRead(bool r) void Post::setDontChangeRead(bool r) { - qDebug() << "setDontChangeRead " << r << " " << mDontChangeRead; if(mDontChangeRead == r) return; mDontChangeRead = r;