Upgrade from Webkit to WebEngine
This commit is contained in:
parent
81bac3ec8d
commit
c6c41c799f
6 changed files with 23 additions and 28 deletions
|
@ -1,7 +1,7 @@
|
|||
TARGET = feedthemonkey
|
||||
|
||||
TEMPLATE = app
|
||||
QT += qml quick
|
||||
QT += qml quick webenginewidgets
|
||||
CONFIG += c++11
|
||||
|
||||
SOURCES += \
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ ScrollView {
|
|||
}
|
||||
|
||||
item.content.post = server.posts[currentIndex]
|
||||
content.flickableItem.contentY = 0
|
||||
//content.flickableItem.contentY = 0
|
||||
|
||||
previousPost = item.content.post
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QMetaType>
|
||||
#include <QtQml>
|
||||
#include <QIcon>
|
||||
#include <QtWebEngine/qtwebengineglobal.h>
|
||||
|
||||
#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<TinyTinyRSSLogin>("TTRSS", 1, 0, "ServerLogin");
|
||||
qmlRegisterType<TinyTinyRSS>("TTRSS", 1, 0, "Server");
|
||||
qmlRegisterType<Post>("TTRSS", 1, 0, "Post");
|
||||
|
|
|
@ -45,7 +45,6 @@ void Post::setRead(bool r)
|
|||
|
||||
void Post::setDontChangeRead(bool r)
|
||||
{
|
||||
qDebug() << "setDontChangeRead " << r << " " << mDontChangeRead;
|
||||
if(mDontChangeRead == r) return;
|
||||
|
||||
mDontChangeRead = r;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue