Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pmaports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
postmarketOS
pmaports
Commits
a7740d85
Unverified
Commit
a7740d85
authored
6 years ago
by
Pierre Parent
Committed by
Oliver Smith
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Switch to official V1.0 + Patch
parent
0a5662e3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main/qtwebbrowser/0001-Patch-for-usability-on-postmarketOS.patch
+479
-0
479 additions, 0 deletions
...webbrowser/0001-Patch-for-usability-on-postmarketOS.patch
main/qtwebbrowser/APKBUILD
+10
-8
10 additions, 8 deletions
main/qtwebbrowser/APKBUILD
with
489 additions
and
8 deletions
main/qtwebbrowser/0001-Patch-for-usability-on-postmarketOS.patch
0 → 100644
+
479
−
0
View file @
a7740d85
From 14bdd49c5f21ff642d60b119c082c2d48a561b30 Mon Sep 17 00:00:00 2001
From: Pierre Parent <pierre.parent@pparent.fr>
Date: Sun, 23 Sep 2018 18:29:53 +0200
Subject: [PATCH 1/1] Patch for usability on postmarketOS
---
src/appengine.cpp | 37 +++++++++++++++++++++++++
src/appengine.h | 2 ++
src/main.cpp | 41 +++++++++++++++-------------
src/qml/BrowserWindow.qml | 15 +++++++++--
src/qml/NavigationBar.qml | 69 ++++++++++++++++++++++-------------------------
src/qml/PageView.qml | 42 +++++++++++++----------------
6 files changed, 125 insertions(+), 81 deletions(-)
diff --git a/src/appengine.cpp b/src/appengine.cpp
index f48325d..b32078a 100644
--- a/src/appengine.cpp
+++ b/src/appengine.cpp
@@ -33,6 +33,7 @@
#include <QtCore/QStandardPaths>
#include <QStringBuilder>
#include <QCoreApplication>
+#include <QTextStream>
AppEngine::AppEngine(QObject *parent)
: QObject(parent)
@@ -105,3 +106,39 @@
void AppEngine::saveSetting(const QString &name, const QString &value)
m_settings.setValue(name, value);
}
+
+bool AppEngine::writeFile(const QString& source, const QString& data)
+ {
+ if (source.isEmpty())
+ return false;
+
+ QFile file(source);
+ if (!file.open(QFile::WriteOnly | QFile::Truncate))
+ return false;
+
+ QTextStream out(&file);
+ out << data;
+ file.close();
+
+ return true;
+ }
+
+QString AppEngine::readFile(const QString& source)
+ {
+ if (source.isEmpty())
+ return "";
+
+ QFile file(source);
+ if(!file.open(QIODevice::ReadOnly)) {
+ return "";
+ }
+
+ QTextStream in(&file);
+
+ if (!in.atEnd()) {
+ QString line = in.readLine();
+ return line;
+ }
+ else
+ return "";
+ }
diff --git a/src/appengine.h b/src/appengine.h
index c5ad20e..c7a374e 100644
--- a/src/appengine.h
+++ b/src/appengine.h
@@ -83,6 +83,8 @@
public:
Q_INVOKABLE QString fallbackColor();
Q_INVOKABLE QString restoreSetting(const QString &name, const QString &defaultValue = QString());
Q_INVOKABLE void saveSetting(const QString &name, const QString &value);
+ Q_INVOKABLE bool writeFile(const QString& source, const QString& data);
+ Q_INVOKABLE QString readFile(const QString& source);
private:
QSettings m_settings;
diff --git a/src/main.cpp b/src/main.cpp
index 2181f15..e462b9b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -31,15 +31,17 @@
#include "navigationhistoryproxymodel.h"
#include "touchtracker.h"
-#if defined(DESKTOP_BUILD)
-#include "touchmockingapplication.h"
-#endif
-
#include <QGuiApplication>
#include <QQmlContext>
#include <QQmlEngine>
#include <QQuickView>
#include <QtWebEngine/qtwebengineglobal.h>
+#include <QtWebEngine>
+#include <csignal>
+#include <iostream>
+
+using namespace std;
+
static QObject *engine_factory(QQmlEngine *engine, QJSEngine *scriptEngine)
{
@@ -50,7 +52,15 @@
static QObject *engine_factory(QQmlEngine *engine, QJSEngine *scriptEngine)
}
int main(int argc, char **argv)
-{
+{
+ //Handle the signals
+ signal(SIGINT, SIG_IGN);
+ signal(SIGSEGV, SIG_IGN);
+ signal(SIGABRT, SIG_IGN);
+ signal(SIGIOT, SIG_IGN);
+ signal(SIGILL, SIG_IGN);
+ signal(SIGBUS, SIG_IGN);
+
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
//do not use any plugins installed on the device
@@ -71,24 +81,23 @@
int main(int argc, char **argv)
int qAppArgCount = qargv.size();
-#if defined(DESKTOP_BUILD)
- TouchMockingApplication app(qAppArgCount, qargv.data());
-#else
+
QGuiApplication app(qAppArgCount, qargv.data());
-#endif
+
+ QtWebEngine::initialize();
+
qmlRegisterType<NavigationHistoryProxyModel>("WebBrowser", 1, 0, "SearchProxyModel");
qmlRegisterType<TouchTracker>("WebBrowser", 1, 0, "TouchTracker");
qmlRegisterSingletonType<AppEngine>("WebBrowser", 1, 0, "AppEngine", engine_factory);
- QtWebEngine::initialize();
-
+
app.setOrganizationName("The Qt Company");
app.setOrganizationDomain("qt.io");
app.setApplicationName("qtwebbrowser");
QQuickView view;
- view.setTitle("Yet Another Browser");
+ view.setTitle("Qt WebBrowser");
view.setFlags(Qt::Window | Qt::WindowTitleHint);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setColor(Qt::black);
@@ -96,13 +105,7 @@
int main(int argc, char **argv)
QObject::connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
-#if defined(DESKTOP_BUILD)
- view.show();
- if (view.size().isEmpty())
- view.setGeometry(0, 0, 800, 600);
-#else
- view.showFullScreen();
-#endif
+ view.showMaximized();
app.exec();
}
diff --git a/src/qml/BrowserWindow.qml b/src/qml/BrowserWindow.qml
index 05ddcff..d1d0c73 100644
--- a/src/qml/BrowserWindow.qml
+++ b/src/qml/BrowserWindow.qml
@@ -189,7 +189,7 @@
Item {
return false
return true
}
-
+
anchors {
top: navigation.bottom
left: parent.left
@@ -205,9 +205,20 @@
Item {
return
navigation.webView = tab.webView
- var url = AppEngine.initialUrl
+ var url = AppEngine.readFile("/tmp/qt-WebBrowser-last-url.txt")
+
+ tabView.page_view_url=url;
navigation.load();
+
+ if ( url == "" )
+ {
+ homeScreen.messageBox.state = "disabled"
+ homeScreen.state = "enabled"
+ homeScreen.forceActiveFocus()
+ }
+
+
}
onCurrentIndexChanged: {
if (!tabView.get(tabView.currentIndex))
diff --git a/src/qml/NavigationBar.qml b/src/qml/NavigationBar.qml
index 742ca47..0ee6388 100644
--- a/src/qml/NavigationBar.qml
+++ b/src/qml/NavigationBar.qml
@@ -40,6 +40,7 @@
ToolBar {
property alias addressBar: urlBar
property Item webView: null
+ property bool moreButtons: false
onWebViewChanged: {
@@ -159,10 +160,7 @@
ToolBar {
}
Rectangle {
width: 1
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiSeparatorColor
}
UIButton {
@@ -175,19 +173,13 @@
ToolBar {
}
Rectangle {
width: 1
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiSeparatorColor
}
Rectangle {
Layout.fillWidth: true
implicitWidth: 10
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiColor
}
TextField {
@@ -286,10 +278,7 @@
ToolBar {
visible: !cancelButton.visible
Layout.fillWidth: true
implicitWidth: 10
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiColor
}
@@ -313,18 +302,18 @@
ToolBar {
}
Rectangle {
width: 1
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiSeparatorColor
}
- UIButton {
+
+ UIButton {
id: homeButton
source: "icons/Btn_Home.png"
+ visible:moreButtons
color: uiColor
highlightColor: buttonPressedColor
onClicked: {
+ moreButtons = false
if (homeScreen.state == "disabled" || homeScreen.state == "edit") {
homeScreen.messageBox.state = "disabled"
homeScreen.state = "enabled"
@@ -336,18 +325,17 @@
ToolBar {
}
Rectangle {
width: 1
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiSeparatorColor
}
UIButton {
id: pageViewButton
+ visible:moreButtons
source: "icons/Btn_Tabs.png"
color: uiColor
highlightColor: buttonPressedColor
- onClicked: {
+ onClicked: {
+ moreButtons = false
if (tabView.viewState == "list") {
tabView.viewState = "page"
} else {
@@ -371,23 +359,22 @@
ToolBar {
}
Rectangle {
width: 1
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiSeparatorColor
}
UIButton {
id: bookmarksButton
color: uiColor
highlightColor: buttonPressedColor
- enabled: urlBar.text != "" && !settingsView.privateBrowsingEnabled
+ enabled: true
+ visible:moreButtons
property bool bookmarked: false
source: bookmarked ? "icons/Btn_Bookmark_Checked.png" : "icons/Btn_Bookmarks.png"
onClicked: {
- if (!webView)
- return
+ moreButtons = false
var icon = webView.loading ? "" : webView.icon
+ icon=icon.toString().replace("image://favicon/", "");
+ bookmarked = true
var idx = homeScreen.contains(webView.url.toString())
if (idx !== -1) {
homeScreen.remove("", idx)
@@ -400,21 +387,29 @@
ToolBar {
}
Component.onCompleted: refresh()
}
+
Rectangle {
width: 1
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiSeparatorColor
}
+
UIButton {
id: settingsButton
source: "icons/Btn_Settings.png"
color: uiColor
highlightColor: buttonPressedColor
onClicked: {
+ if ( ! moreButtons )
+ {
+ moreButtons = true
+ return
+ }
+ else
+ {
settingsView.state = "enabled"
+ moreButtons = false
+ }
}
}
}
diff --git a/src/qml/PageView.qml b/src/qml/PageView.qml
index f7e0448..d31bc69 100644
--- a/src/qml/PageView.qml
+++ b/src/qml/PageView.qml
@@ -49,6 +49,7 @@
Rectangle {
property alias count: pathView.count
property string viewState: "page"
+ property string page_view_url: ""
onViewStateChanged: {
if (viewState == "page" || viewState == "fullscreen")
@@ -107,13 +108,19 @@
Rectangle {
WebEngineView {
id: webEngineView
-
+ url: parent.parent.page_view_url
+
+ profile: WebEngineProfile{
+ httpUserAgent: "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Safari/537.361"
+ persistentCookiesPolicy : WebEngineProfile.ForcePersistentCookies
+ persistentStoragePath : "~/.qtwebbrowser/"
+ }
+
anchors {
fill: parent
top: permBar.bottom
}
- profile: settingsView.privateBrowsingEnabled ? otrProfile : defaultProfile
enabled: root.interactive
function takeSnapshot() {
@@ -134,7 +141,11 @@
Rectangle {
}
// Trigger a refresh to check if the new url is bookmarked.
- onUrlChanged: navigation.refresh()
+ onUrlChanged:
+ {
+ AppEngine.writeFile("/tmp/qt-WebBrowser-last-url.txt",webEngineView.url)
+ navigation.refresh()
+ }
settings.autoLoadImages: settingsView.autoLoadImages
@@ -295,10 +306,7 @@
Rectangle {
anchors.fill: parent
Rectangle {
width: 5
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiColor
}
TextField {
@@ -324,18 +332,12 @@
Rectangle {
}
Rectangle {
width: 5
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiColor
}
Rectangle {
width: 1
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiSeparatorColor
}
UIButton {
@@ -346,10 +348,7 @@
Rectangle {
}
Rectangle {
width: 1
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiSeparatorColor
}
UIButton {
@@ -360,10 +359,7 @@
Rectangle {
}
Rectangle {
width: 1
- anchors {
- top: parent.top
- bottom: parent.bottom
- }
+ height: parent.height
color: uiSeparatorColor
}
UIButton {
--
2.11.0
This diff is collapsed.
Click to expand it.
main/qtwebbrowser/APKBUILD
+
10
−
8
View file @
a7740d85
# Contributor: Pierre Parent < m #at* pierre-parent.fr >
pkgname
=
qtwebbrowser
pkgver
=
1.1
_commit
=
a8c36890a9c9a885d6a8ba415fc9d1b47640518e
pkgrel
=
7
pkgver
=
1.0
#commit corresponding to v1.0
commit
=
023733af5523a5ad84359926224fa106001215f4
pkgrel
=
0
pkgdesc
=
"Qt web browser"
url
=
"http://doc.qt.io/QtWebBrowser/"
arch
=
"all"
...
...
@@ -10,17 +11,17 @@ license="GPLv3"
depends
=
"qt5-qtbase qt5-qtwebengine qt5-qtvirtualkeyboard mesa-dev"
makedepends
=
"qt5-qtbase-dev qt5-qtwebengine-dev busybox"
install
=
""
source
=
"https://github.com/
pparent76
/qt-apps-qtwebbrowser/archive/
$
_
commit
.tar.gz qtwebbrowser.svg startup-qtwebbrowser.sh qtwebbrowser.desktop"
builddir
=
"
$srcdir
/"
source
=
"https://github.com/
qtproject
/qt-apps-qtwebbrowser/archive/
$commit
.tar.gz qtwebbrowser.svg startup-qtwebbrowser.sh qtwebbrowser.desktop
0001-Patch-for-usability-on-postmarketOS.patch
"
builddir
=
"
$srcdir
/
qt-apps-qtwebbrowser-
$commit
/
"
build
()
{
cd
"
$builddir
/
qt-apps-qtwebbrowser-
$_commit
/
src/"
cd
"
$builddir
/src/"
/usr/lib/qt5/bin/qmake src.pro
make
}
package
()
{
cd
"
$builddir
/
qt-apps-qtwebbrowser-
$_commit
/
src/"
cd
"
$builddir
/src/"
mkdir
-p
$pkgdir
/usr/bin/
install
-D
-m644
qtwebbrowser
\
$pkgdir
/usr/bin/qtwebbrowser-bin
...
...
@@ -37,4 +38,5 @@ package() {
sha512sums
=
"5e14de5c4c8aec79f3ab25947e1f4091fdbf9a38a894229d1f636dbbb17480970e3c9d7dfdf7cc57e42246a55058025ee3e200145115cfea507f0611aaa3dd77 qtwebbrowser.svg
0b0edd36a128273f1c4d4287c50c2a6dec22699d651bcd22fba0b0ea25e58243149ff9b21c442a452f0f8b3a94f00667eb06e44d3443133d10157c654ab4ba79 startup-qtwebbrowser.sh
681a1275f7d09991cdffe9a0f86aa9af22103807d02fd24e806a46e79c8eacb4eea907ef1a677d5eacc379e0666934b346662c99e76026e3dc7820df162a9fe6 qtwebbrowser.desktop
62e66ca78327e48b7c8643ac7235788e0d428fd1b8298f182fd8052567b5d96b260c99b6a0493a4713ffb2911ceee1afcf4b49a5537d00d1ab614b80b210f6f9 a8c36890a9c9a885d6a8ba415fc9d1b47640518e.tar.gz"
6802f908973d29dc73f87df831cc4303dfc2eaf11a082341d1ff4618bbbcb712e858cab20bf67ed6cc2ef5eacfb44f80ec04d3765890b49ce510040d01986880 0001-Patch-for-usability-on-postmarketOS.patch
8f1ff6ef125fff2ae7794319e1ea6c6f1c068cf9aeb3b14516b9bc2326d6a69174970603effe7b35232b431eca24c3e11854c5363989d51e08ae4f597b425161
$commit
.tar.gz"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment