diff options
author | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-01-07 15:21:11 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-01-14 10:12:49 +0000 |
commit | 5b999a1817e7829c87977b5d99f75a179ec36fda (patch) | |
tree | eca5bf6c8777755ea6828d0c45d0caad1cd094db /src | |
parent | 2e18b419a7084b1e39bf8749855768a1002e34de (diff) |
Use qml extension plugin
Placing c++ code to plugins we can use the same codebase
for qtwebbrowser in b2qtlauncher
Change-Id: I7a8c29e2dfb98e2645dccfc5fcb145f6cbd60102
Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/app/app.pro | 53 | ||||
-rw-r--r-- | src/app/browserwindow.cpp (renamed from src/browserwindow.cpp) | 5 | ||||
-rw-r--r-- | src/app/browserwindow.h (renamed from src/browserwindow.h) | 0 | ||||
-rw-r--r-- | src/app/engine.cpp (renamed from src/engine.cpp) | 0 | ||||
-rw-r--r-- | src/app/engine.h (renamed from src/engine.h) | 2 | ||||
-rw-r--r-- | src/app/main.cpp (renamed from src/main.cpp) | 14 | ||||
-rw-r--r-- | src/app/navigationhistoryproxymodel.cpp (renamed from src/navigationhistoryproxymodel.cpp) | 0 | ||||
-rw-r--r-- | src/app/navigationhistoryproxymodel.h (renamed from src/navigationhistoryproxymodel.h) | 0 | ||||
-rw-r--r-- | src/app/qml/BrowserWindow.qml (renamed from src/qml/BrowserWindow.qml) | 20 | ||||
-rw-r--r-- | src/app/qml/FeaturePermissionBar.qml (renamed from src/qml/FeaturePermissionBar.qml) | 0 | ||||
-rw-r--r-- | src/app/qml/HomeScreen.qml (renamed from src/qml/HomeScreen.qml) | 13 | ||||
-rw-r--r-- | src/app/qml/MockTouchPoint.qml (renamed from src/qml/MockTouchPoint.qml) | 2 | ||||
-rw-r--r-- | src/app/qml/NavigationBar.qml (renamed from src/qml/NavigationBar.qml) | 57 | ||||
-rw-r--r-- | src/app/qml/PageView.qml (renamed from src/qml/PageView.qml) | 14 | ||||
-rw-r--r-- | src/app/qml/SettingsView.qml (renamed from src/qml/SettingsView.qml) | 5 | ||||
-rw-r--r-- | src/app/qml/Utils.js | 60 | ||||
-rw-r--r-- | src/app/qml/assets/UIButton.qml (renamed from src/qml/assets/UIButton.qml) | 0 | ||||
-rw-r--r-- | src/app/qml/assets/UIToolBar.qml (renamed from src/qml/assets/UIToolBar.qml) | 0 | ||||
-rw-r--r-- | src/app/qml/assets/icons/AppLogoColor.png (renamed from src/qml/assets/icons/AppLogoColor.png) | bin | 6113 -> 6113 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/AppLogoGrey.png (renamed from src/qml/assets/icons/AppLogoGrey.png) | bin | 5539 -> 5539 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Add.png (renamed from src/qml/assets/icons/Btn_Add.png) | bin | 1169 -> 1169 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Back.png (renamed from src/qml/assets/icons/Btn_Back.png) | bin | 1184 -> 1184 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Bookmark_Checked.png (renamed from src/qml/assets/icons/Btn_Bookmark_Checked.png) | bin | 1696 -> 1696 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Bookmark_Indicator.png (renamed from src/qml/assets/icons/Btn_Bookmark_Indicator.png) | bin | 1972 -> 1972 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Bookmarks.png (renamed from src/qml/assets/icons/Btn_Bookmarks.png) | bin | 1792 -> 1792 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Clear.png (renamed from src/qml/assets/icons/Btn_Clear.png) | bin | 1467 -> 1467 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Delete.png (renamed from src/qml/assets/icons/Btn_Delete.png) | bin | 2793 -> 2793 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Forward.png (renamed from src/qml/assets/icons/Btn_Forward.png) | bin | 1178 -> 1178 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Home.png (renamed from src/qml/assets/icons/Btn_Home.png) | bin | 1461 -> 1461 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Reload.png (renamed from src/qml/assets/icons/Btn_Reload.png) | bin | 1614 -> 1614 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Search.png (renamed from src/qml/assets/icons/Btn_Search.png) | bin | 1691 -> 1691 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Settings.png (renamed from src/qml/assets/icons/Btn_Settings.png) | bin | 1149 -> 1149 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Tabs.png (renamed from src/qml/assets/icons/Btn_Tabs.png) | bin | 1235 -> 1235 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Btn_Up.png (renamed from src/qml/assets/icons/Btn_Up.png) | bin | 1223 -> 1223 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/Error_Icon.png (renamed from src/qml/assets/icons/Error_Icon.png) | bin | 4371 -> 4371 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/LightWebBrowser_Icons.svg (renamed from src/qml/assets/icons/LightWebBrowser_Icons.svg) | 0 | ||||
-rw-r--r-- | src/app/qml/assets/icons/about_blank.png (renamed from src/qml/assets/icons/about_blank.png) | bin | 6022 -> 6022 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/qt.png (renamed from src/qml/assets/icons/qt.png) | bin | 7345 -> 7345 bytes | |||
-rw-r--r-- | src/app/qml/assets/icons/touchpoint.png (renamed from src/qml/assets/icons/touchpoint.png) | bin | 1331 -> 1331 bytes | |||
-rw-r--r-- | src/app/resources.qrc | 34 | ||||
-rw-r--r-- | src/app/touchmockingapplication.cpp (renamed from src/touchmockingapplication.cpp) | 0 | ||||
-rw-r--r-- | src/app/touchmockingapplication.h (renamed from src/touchmockingapplication.h) | 0 | ||||
-rw-r--r-- | src/app/touchtracker.cpp (renamed from src/touchtracker.cpp) | 37 | ||||
-rw-r--r-- | src/app/touchtracker.h | 97 | ||||
-rw-r--r-- | src/imports/imports.pro | 17 | ||||
-rw-r--r-- | src/imports/plugin.cpp | 81 | ||||
-rw-r--r-- | src/imports/qmldir | 4 | ||||
-rw-r--r-- | src/qml/Utils.js | 24 | ||||
-rw-r--r-- | src/resources.qrc | 34 | ||||
-rw-r--r-- | src/src.pro | 49 | ||||
-rw-r--r-- | src/touchtracker.h | 60 |
51 files changed, 478 insertions, 204 deletions
diff --git a/src/app/app.pro b/src/app/app.pro new file mode 100644 index 0000000..7b9b8a2 --- /dev/null +++ b/src/app/app.pro @@ -0,0 +1,53 @@ +TARGET = qtwebbrowser + +DESTDIR = ../ +CONFIG += c++11 +CONFIG -= app_bundle + +SOURCES = main.cpp \ + browserwindow.cpp \ + engine.cpp + +HEADERS = browserwindow.h \ + engine.h + +OTHER_FILES = \ + qml/assets/UIButton.qml \ + qml/assets/UIToolBar.qml \ + qml/ApplicationRoot.qml \ + qml/BrowserWindow.qml \ + qml/FeaturePermissionBar.qml \ + qml/MockTouchPoint.qml \ + qml/PageView.qml \ + qml/NavigationBar.qml \ + qml/HomeScreen.qml \ + qml/SettingsView.qml \ + +QT += qml quick webengine + +RESOURCES += resources.qrc + +!cross_compile { + DEFINES += HOST_BUILD + SOURCES += touchmockingapplication.cpp \ + navigationhistoryproxymodel.cpp \ + touchtracker.cpp + + HEADERS += touchmockingapplication.h \ + navigationhistoryproxymodel.h \ + touchtracker.h + + QT_PRIVATE += quick-private gui-private core-private +} +else { + DESTPATH = /data/user/qt/qtwebbrowser + + content.files = qml/* + content.path = $$DESTPATH + target.path = $$DESTPATH + + INSTALLS += target content +} + + + diff --git a/src/browserwindow.cpp b/src/app/browserwindow.cpp index 410dc44..41d8d2a 100644 --- a/src/browserwindow.cpp +++ b/src/app/browserwindow.cpp @@ -36,7 +36,6 @@ ****************************************************************************/ #include "browserwindow.h" -#include "engine.h" #include <QList> #include <QQmlContext> @@ -46,6 +45,8 @@ #include <QUrl> #include <QVariant> +#include "engine.h" + void BrowserWindow::ensureProfileInstance() { if (m_lazyProfileInstance) @@ -78,7 +79,7 @@ BrowserWindow::BrowserWindow(QWindow *) setResizeMode(QQuickView::SizeRootObjectToView); setColor(Qt::black); - engine()->rootContext()->setContextProperty("engine", new Engine(this)); + engine()->rootContext()->setContextProperty("WebEngine", new Engine(this)); setSource(QUrl("qrc:///qml/BrowserWindow.qml")); } diff --git a/src/browserwindow.h b/src/app/browserwindow.h index 1d055bf..1d055bf 100644 --- a/src/browserwindow.h +++ b/src/app/browserwindow.h diff --git a/src/engine.cpp b/src/app/engine.cpp index 3c8d0d0..3c8d0d0 100644 --- a/src/engine.cpp +++ b/src/app/engine.cpp diff --git a/src/engine.h b/src/app/engine.h index 5d59990..af60dad 100644 --- a/src/engine.h +++ b/src/app/engine.h @@ -84,7 +84,7 @@ class Engine : public QObject { QString m_initialUrl; public: - Engine(QObject *parent); + Engine(QObject *parent = 0); QObject *rootWindow() { return parent(); diff --git a/src/main.cpp b/src/app/main.cpp index aafa4df..f4fbf5d 100644 --- a/src/main.cpp +++ b/src/app/main.cpp @@ -41,11 +41,13 @@ #include <QQuickView> #include <QtWebEngine/qtwebengineglobal.h> -#include "navigationhistoryproxymodel.h" +#include "browserwindow.h" + +#if defined(HOST_BUILD) #include "touchmockingapplication.h" -#include "engine.h" +#include "navigationhistoryproxymodel.h" #include "touchtracker.h" - +#endif int main(int argc, char **argv) { qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); @@ -65,6 +67,9 @@ int main(int argc, char **argv) int qAppArgCount = qargv.size(); #if defined(HOST_BUILD) TouchMockingApplication app(qAppArgCount, qargv.data()); + + qmlRegisterType<TouchTracker>("WebBrowser", 1, 0, "TouchTracker"); + qmlRegisterType<NavigationHistoryProxyModel>("WebBrowser", 1, 0, "SearchProxyModel"); #else QGuiApplication app(qAppArgCount, qargv.data()); #endif @@ -74,9 +79,6 @@ int main(int argc, char **argv) app.setOrganizationDomain("qt.io"); app.setApplicationName("qtwebbrowser"); - qmlRegisterType<TouchTracker>("io.qt.browser", 1, 0, "TouchTracker"); - qmlRegisterType<NavigationHistoryProxyModel>("io.qt.browser", 1, 0, "SearchProxyModel"); - BrowserWindow window; QObject::connect(window.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit())); diff --git a/src/navigationhistoryproxymodel.cpp b/src/app/navigationhistoryproxymodel.cpp index d574ae5..d574ae5 100644 --- a/src/navigationhistoryproxymodel.cpp +++ b/src/app/navigationhistoryproxymodel.cpp diff --git a/src/navigationhistoryproxymodel.h b/src/app/navigationhistoryproxymodel.h index c2e3886..c2e3886 100644 --- a/src/navigationhistoryproxymodel.h +++ b/src/app/navigationhistoryproxymodel.h diff --git a/src/qml/BrowserWindow.qml b/src/app/qml/BrowserWindow.qml index 8b112cd..6f6f07c 100644 --- a/src/qml/BrowserWindow.qml +++ b/src/app/qml/BrowserWindow.qml @@ -44,10 +44,10 @@ import QtQuick.Layouts 1.0 import QtQuick.Window 2.1 import QtQuick.Controls.Private 1.0 import QtQuick.Dialogs 1.2 -import QtQuick.Enterprise.VirtualKeyboard 1.2 +import QtQuick.Enterprise.VirtualKeyboard 2.0 import "assets" -import io.qt.browser 1.0 +import WebBrowser 1.0 import "Utils.js" as Utils Item { @@ -134,7 +134,7 @@ Item { UIToolBar { id: tabEditToolBar - source: "qrc:///newtab" + source: "icons/Btn_Add.png" indicator: tabView.count anchors { @@ -215,7 +215,7 @@ Item { return navigation.webView = tab.webView - navigation.load(engine.initialUrl); + navigation.load(WebEngine.initialUrl); } onCurrentIndexChanged: { if (!tabView.get(tabView.currentIndex)) @@ -230,7 +230,7 @@ Item { property var acceptedUrls : [] function shouldAutoAccept(certificateError){ - var domain = engine.domainFromString(certificateError.url) + var domain = WebEngine.domainFromString(certificateError.url) return acceptedUrls.indexOf(domain) >= 0 } } @@ -251,7 +251,7 @@ Item { "Do you wish to override the security check and continue?" onYes: { var cert = certErrors.shift() - var domain = engine.domainFromString(cert.url) + var domain = WebEngine.domainFromString(cert.url) acceptedCertificates.acceptedUrls.push(domain) cert.ignoreCertificateError() presentError() @@ -398,10 +398,10 @@ Item { onClicked: { var string = urlDropDown.searchString var constructedUrl = "" - if (engine.isUrl(string)) { - constructedUrl = engine.fromUserInput(string) + if (WebEngine.isUrl(string)) { + constructedUrl = WebEngine.fromUserInput(string) } else { - constructedUrl = engine.fromUserInput(googleSearchQuery + string) + constructedUrl = WebEngine.fromUserInput(googleSearchQuery + string) } navigation.webView.url = constructedUrl navigation.webView.forceActiveFocus() @@ -416,7 +416,7 @@ Item { color: "transparent" Image { anchors.centerIn: parent - source: "qrc:///search" + source: "assets/icons/Btn_Search.png" } } Text { diff --git a/src/qml/FeaturePermissionBar.qml b/src/app/qml/FeaturePermissionBar.qml index 8595724..8595724 100644 --- a/src/qml/FeaturePermissionBar.qml +++ b/src/app/qml/FeaturePermissionBar.qml diff --git a/src/qml/HomeScreen.qml b/src/app/qml/HomeScreen.qml index 2e6d919..2510025 100644 --- a/src/qml/HomeScreen.qml +++ b/src/app/qml/HomeScreen.qml @@ -36,6 +36,7 @@ ****************************************************************************/ import QtQuick 2.5 +import WebBrowser 1.0 import "assets" Rectangle { @@ -67,7 +68,7 @@ Rectangle { homeScreen.forceActiveFocus() return } - var icon = url.indexOf("qt.io") != -1 ? "qrc:///qt" : iconUrl + var icon = url.indexOf("qt.io") != -1 ? "assets/icons/qt.png" : iconUrl var element = { "title": title, "url": url, "iconUrl": icon, "fallbackColor": fallbackColor } listModel.append(element) set(listModel.count - 1) @@ -124,11 +125,11 @@ Rectangle { ListModel { id: listModel - property string defaultBookmarks: "[{\"fallbackColor\":\"#46a2da\",\"iconUrl\":\"qrc:///qt\",\"title\":\"Qt - Home\",\"url\":\"http://www.qt.io/\"},{\"fallbackColor\":\"#18394c\",\"iconUrl\":\"http://www.topgear.com/sites/all/themes/custom/tg/apple-touch-icon-144x144.png\",\"title\":\"Top Gear\",\"url\":\"http://www.topgear.com/\"},{\"fallbackColor\":\"#46a2da\",\"iconUrl\":\"https://duckduckgo.com/assets/icons/meta/DDG-iOS-icon_152x152.png\",\"title\":\"DuckDuckGo\",\"url\":\"https://duckduckgo.com/\"},{\"fallbackColor\":\"#ff8c0a\",\"iconUrl\":\"http://www.blogsmithmedia.com/www.engadget.com/media/favicon-160x160.png\",\"title\":\"Engadget | Technology News, Advice and Features\",\"url\":\"http://www.engadget.com/\"},{\"fallbackColor\":\"#ff8c0a\",\"iconUrl\":\"https://www.openstreetmap.org/assets/favicon-194x194-32cdac24b02b88e09f0639bb92c760b2.png\",\"title\":\"OpenStreetMap\",\"url\":\"https://www.openstreetmap.org/\"},{\"fallbackColor\":\"#5caa15\",\"iconUrl\":\"http://www.redditstatic.com/icon.png\",\"title\":\"reddit: the front page of the internet\",\"url\":\"http://www.reddit.com/\"}]" + property string defaultBookmarks: "[{\"fallbackColor\":\"#46a2da\",\"iconUrl\":\"assets/icons/qt.png\",\"title\":\"Qt - Home\",\"url\":\"http://www.qt.io/\"},{\"fallbackColor\":\"#18394c\",\"iconUrl\":\"http://www.topgear.com/sites/all/themes/custom/tg/apple-touch-icon-144x144.png\",\"title\":\"Top Gear\",\"url\":\"http://www.topgear.com/\"},{\"fallbackColor\":\"#46a2da\",\"iconUrl\":\"https://duckduckgo.com/assets/icons/meta/DDG-iOS-icon_152x152.png\",\"title\":\"DuckDuckGo\",\"url\":\"https://duckduckgo.com/\"},{\"fallbackColor\":\"#ff8c0a\",\"iconUrl\":\"http://www.blogsmithmedia.com/www.engadget.com/media/favicon-160x160.png\",\"title\":\"Engadget | Technology News, Advice and Features\",\"url\":\"http://www.engadget.com/\"},{\"fallbackColor\":\"#ff8c0a\",\"iconUrl\":\"https://www.openstreetmap.org/assets/favicon-194x194-32cdac24b02b88e09f0639bb92c760b2.png\",\"title\":\"OpenStreetMap\",\"url\":\"https://www.openstreetmap.org/\"},{\"fallbackColor\":\"#5caa15\",\"iconUrl\":\"http://www.redditstatic.com/icon.png\",\"title\":\"reddit: the front page of the internet\",\"url\":\"http://www.reddit.com/\"}]" Component.onCompleted: { listModel.clear() - var string = engine.restoreSetting("bookmarks", defaultBookmarks) + var string = WebEngine.restoreSetting("bookmarks", defaultBookmarks) if (!string) return var list = JSON.parse(string) @@ -142,7 +143,7 @@ Rectangle { for (var i = 0; i < listModel.count; ++i) { list[i] = listModel.get(i) } - engine.saveSetting("bookmarks", JSON.stringify(list)) + WebEngine.saveSetting("bookmarks", JSON.stringify(list)) } } @@ -381,7 +382,7 @@ Rectangle { top: parent.top left: parent.left } - source: "qrc:///delete" + source: "assets/icons/Btn_Delete.png" MouseArea { id: deleteButton anchors.fill: parent @@ -470,7 +471,7 @@ Rectangle { } Image { id: errorIcon - source: "qrc:///error" + source: "assets/icons/Error_Icon.png" anchors { horizontalCenter: parent.horizontalCenter top: parent.top diff --git a/src/qml/MockTouchPoint.qml b/src/app/qml/MockTouchPoint.qml index 6ca4d7e..f7fa1b1 100644 --- a/src/qml/MockTouchPoint.qml +++ b/src/app/qml/MockTouchPoint.qml @@ -44,7 +44,7 @@ Item { property int pointId: 0 Image { - source: "qrc:///touchpoint" + source: "assets/icons/touchpoint.png" x: -(width / 2) y: -(height / 2) height: parent.height diff --git a/src/qml/NavigationBar.qml b/src/app/qml/NavigationBar.qml index 6fe9247..140ec91 100644 --- a/src/qml/NavigationBar.qml +++ b/src/app/qml/NavigationBar.qml @@ -1,7 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtBrowser project. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPLv2 included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.2 +import WebBrowser 1.0 import "assets" @@ -120,7 +157,7 @@ ToolBar { UIButton { id: backButton - source: "qrc:///back" + source: "icons/Btn_Back.png" color: uiColor highlightColor: buttonPressedColor onClicked: webView.goBack() @@ -136,7 +173,7 @@ ToolBar { } UIButton { id: forwardButton - source: "qrc:///forward" + source: "icons/Btn_Forward.png" color: uiColor highlightColor: buttonPressedColor onClicked: webView.goForward() @@ -187,7 +224,7 @@ ToolBar { name: "load" PropertyChanges { target: reloadButton - source: webView && webView.loading ? "qrc:///stop" : "qrc:///refresh" + source: webView && webView.loading ? "icons/Btn_Clear.png" : "icons/Btn_Reload.png" height: 54 } }, @@ -195,7 +232,7 @@ ToolBar { name: "edit" PropertyChanges { target: reloadButton - source: "qrc:///stop" + source: "icons/Btn_Clear.png" height: 45 visible: urlBar.text != "" } @@ -240,7 +277,7 @@ ToolBar { } } onAccepted: { - webView.url = engine.fromUserInput(text) + webView.url = WebEngine.fromUserInput(text) homeScreen.state = "disabled" tabView.viewState = "page" } @@ -290,7 +327,7 @@ ToolBar { } UIButton { id: homeButton - source: "qrc:///home" + source: "icons/Btn_Home.png" color: uiColor highlightColor: buttonPressedColor onClicked: { @@ -313,7 +350,7 @@ ToolBar { } UIButton { id: pageViewButton - source: "qrc:///tabs" + source: "icons/Btn_Tabs.png" color: uiColor highlightColor: buttonPressedColor onClicked: { @@ -352,7 +389,7 @@ ToolBar { highlightColor: buttonPressedColor enabled: urlBar.text != "" && !settingsView.privateBrowsingEnabled property bool bookmarked: false - source: bookmarked ? "qrc:///star_checked" : "qrc:///star" + source: bookmarked ? "icons/Btn_Bookmark_Checked.png" : "icons/Btn_Bookmarks.png" onClicked: { if (!webView) return @@ -363,7 +400,7 @@ ToolBar { return } var count = homeScreen.count - homeScreen.add(webView.title, webView.url, icon, engine.fallbackColor()) + homeScreen.add(webView.title, webView.url, icon, WebEngine.fallbackColor()) if (count < homeScreen.count) bookmarked = true } @@ -379,7 +416,7 @@ ToolBar { } UIButton { id: settingsButton - source: "qrc:///settings" + source: "icons/Btn_Settings.png" color: uiColor highlightColor: buttonPressedColor onClicked: { diff --git a/src/qml/PageView.qml b/src/app/qml/PageView.qml index d9bcaab..87381ce 100644 --- a/src/qml/PageView.qml +++ b/src/app/qml/PageView.qml @@ -42,7 +42,7 @@ import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.2 import QtGraphicalEffects 1.0 -import io.qt.browser 1.0 +import WebBrowser 1.0 import "assets" Rectangle { @@ -267,7 +267,7 @@ Rectangle { id: placeholder y: placeholder.height - navigation.y anchors.horizontalCenter: parent.horizontalCenter - source: "qrc:///icon" + source: "assets/icons/AppLogoColor.png" } Text { id: label @@ -348,7 +348,7 @@ Rectangle { } UIButton { id: findBackwardButton - iconSource: "qrc:///back" + iconSource: "assets/icons/Btn_Back.png" implicitHeight: parent.height onClicked: webEngineView.findText(findTextField.text, WebEngineView.FindBackward) } @@ -362,7 +362,7 @@ Rectangle { } UIButton { id: findForwardButton - iconSource: "qrc:///forward" + iconSource: "assets/icons/Btn_Forward.png" implicitHeight: parent.height onClicked: webEngineView.findText(findTextField.text) } @@ -376,7 +376,7 @@ Rectangle { } UIButton { id: findCancelButton - iconSource: "qrc:///stop" + iconSource: "assets/icons/Btn_Clear.png" implicitHeight: parent.height onClicked: findBar.visible = false } @@ -564,7 +564,7 @@ Rectangle { Image { source: { if (!item.image.snapshot) - return "qrc:///about" + return "assets/icons/about_blank.png" return item.image.snapshot.url } anchors.fill: parent @@ -591,7 +591,7 @@ Rectangle { top: parent.top left: parent.left } - source: "qrc:///delete" + source: "assets/icons/Btn_Delete.png" MouseArea { id: closeButton anchors.fill: parent diff --git a/src/qml/SettingsView.qml b/src/app/qml/SettingsView.qml index 2f04224..8ae6f64 100644 --- a/src/qml/SettingsView.qml +++ b/src/app/qml/SettingsView.qml @@ -41,6 +41,7 @@ import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import Qt.labs.settings 1.0 +import WebBrowser 1.0 Rectangle { id: root @@ -66,7 +67,7 @@ Rectangle { // Do not persist private browsing mode if (setting.name === "Private Browsing") continue - engine.saveSetting(setting.name, setting.active) + WebEngine.saveSetting(setting.name, setting.active) } } @@ -169,7 +170,7 @@ Rectangle { Component.onCompleted: { for (var i = 0; i < appSettings.length; ++i) { var setting = appSettings[i] - var active = JSON.parse(engine.restoreSetting(setting.name, setting.active)) + var active = JSON.parse(WebEngine.restoreSetting(setting.name, setting.active)) if (setting.active !== active) { setting.active = active setting.notify(active) diff --git a/src/app/qml/Utils.js b/src/app/qml/Utils.js new file mode 100644 index 0000000..88e2bbe --- /dev/null +++ b/src/app/qml/Utils.js @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtBrowser project. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPLv2 included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +. pragma library + +function quote(str, delimiter) { + // discuss at: http://phpjs.org/functions/preg_quote/ + // original by: booeyOH + // improved by: Ates Goral (http://magnetiq.com) + // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) + // improved by: Brett Zamir (http://brett-zamir.me) + // bugfixed by: Onno Marsman + // example 1: preg_quote("$40"); + // returns 1: '\\$40' + // example 2: preg_quote("*RRRING* Hello?"); + // returns 2: '\\*RRRING\\* Hello\\?' + // example 3: preg_quote("\\.+*?[^]$(){}=!<>|:"); + // returns 3: '\\\\\\.\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:' + + return String(str) + .replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\' + (delimiter || '') + '-]', 'g'), '\\$&'); +} + +function highlight( text, search ) +{ + return text.replace( new RegExp( "(" + quote( search ) + ")" , 'gi' ), "<b>$1</b>" ); +} diff --git a/src/qml/assets/UIButton.qml b/src/app/qml/assets/UIButton.qml index cc9351f..cc9351f 100644 --- a/src/qml/assets/UIButton.qml +++ b/src/app/qml/assets/UIButton.qml diff --git a/src/qml/assets/UIToolBar.qml b/src/app/qml/assets/UIToolBar.qml index 39a0974..39a0974 100644 --- a/src/qml/assets/UIToolBar.qml +++ b/src/app/qml/assets/UIToolBar.qml diff --git a/src/qml/assets/icons/AppLogoColor.png b/src/app/qml/assets/icons/AppLogoColor.png Binary files differindex 2a49717..2a49717 100644 --- a/src/qml/assets/icons/AppLogoColor.png +++ b/src/app/qml/assets/icons/AppLogoColor.png diff --git a/src/qml/assets/icons/AppLogoGrey.png b/src/app/qml/assets/icons/AppLogoGrey.png Binary files differindex b2baae5..b2baae5 100644 --- a/src/qml/assets/icons/AppLogoGrey.png +++ b/src/app/qml/assets/icons/AppLogoGrey.png diff --git a/src/qml/assets/icons/Btn_Add.png b/src/app/qml/assets/icons/Btn_Add.png Binary files differindex 3c45c42..3c45c42 100644 --- a/src/qml/assets/icons/Btn_Add.png +++ b/src/app/qml/assets/icons/Btn_Add.png diff --git a/src/qml/assets/icons/Btn_Back.png b/src/app/qml/assets/icons/Btn_Back.png Binary files differindex 562c9f6..562c9f6 100644 --- a/src/qml/assets/icons/Btn_Back.png +++ b/src/app/qml/assets/icons/Btn_Back.png diff --git a/src/qml/assets/icons/Btn_Bookmark_Checked.png b/src/app/qml/assets/icons/Btn_Bookmark_Checked.png Binary files differindex a6dbe6a..a6dbe6a 100644 --- a/src/qml/assets/icons/Btn_Bookmark_Checked.png +++ b/src/app/qml/assets/icons/Btn_Bookmark_Checked.png diff --git a/src/qml/assets/icons/Btn_Bookmark_Indicator.png b/src/app/qml/assets/icons/Btn_Bookmark_Indicator.png Binary files differindex a8b8b6b..a8b8b6b 100644 --- a/src/qml/assets/icons/Btn_Bookmark_Indicator.png +++ b/src/app/qml/assets/icons/Btn_Bookmark_Indicator.png diff --git a/src/qml/assets/icons/Btn_Bookmarks.png b/src/app/qml/assets/icons/Btn_Bookmarks.png Binary files differindex fc286cc..fc286cc 100644 --- a/src/qml/assets/icons/Btn_Bookmarks.png +++ b/src/app/qml/assets/icons/Btn_Bookmarks.png diff --git a/src/qml/assets/icons/Btn_Clear.png b/src/app/qml/assets/icons/Btn_Clear.png Binary files differindex 1c9870a..1c9870a 100644 --- a/src/qml/assets/icons/Btn_Clear.png +++ b/src/app/qml/assets/icons/Btn_Clear.png diff --git a/src/qml/assets/icons/Btn_Delete.png b/src/app/qml/assets/icons/Btn_Delete.png Binary files differindex 2010838..2010838 100644 --- a/src/qml/assets/icons/Btn_Delete.png +++ b/src/app/qml/assets/icons/Btn_Delete.png diff --git a/src/qml/assets/icons/Btn_Forward.png b/src/app/qml/assets/icons/Btn_Forward.png Binary files differindex e4c96f8..e4c96f8 100644 --- a/src/qml/assets/icons/Btn_Forward.png +++ b/src/app/qml/assets/icons/Btn_Forward.png diff --git a/src/qml/assets/icons/Btn_Home.png b/src/app/qml/assets/icons/Btn_Home.png Binary files differindex 7358a59..7358a59 100644 --- a/src/qml/assets/icons/Btn_Home.png +++ b/src/app/qml/assets/icons/Btn_Home.png diff --git a/src/qml/assets/icons/Btn_Reload.png b/src/app/qml/assets/icons/Btn_Reload.png Binary files differindex cff41cd..cff41cd 100644 --- a/src/qml/assets/icons/Btn_Reload.png +++ b/src/app/qml/assets/icons/Btn_Reload.png diff --git a/src/qml/assets/icons/Btn_Search.png b/src/app/qml/assets/icons/Btn_Search.png Binary files differindex a6ef383..a6ef383 100644 --- a/src/qml/assets/icons/Btn_Search.png +++ b/src/app/qml/assets/icons/Btn_Search.png diff --git a/src/qml/assets/icons/Btn_Settings.png b/src/app/qml/assets/icons/Btn_Settings.png Binary files differindex 33d7400..33d7400 100644 --- a/src/qml/assets/icons/Btn_Settings.png +++ b/src/app/qml/assets/icons/Btn_Settings.png diff --git a/src/qml/assets/icons/Btn_Tabs.png b/src/app/qml/assets/icons/Btn_Tabs.png Binary files differindex c007408..c007408 100644 --- a/src/qml/assets/icons/Btn_Tabs.png +++ b/src/app/qml/assets/icons/Btn_Tabs.png diff --git a/src/qml/assets/icons/Btn_Up.png b/src/app/qml/assets/icons/Btn_Up.png Binary files differindex f70a78d..f70a78d 100644 --- a/src/qml/assets/icons/Btn_Up.png +++ b/src/app/qml/assets/icons/Btn_Up.png diff --git a/src/qml/assets/icons/Error_Icon.png b/src/app/qml/assets/icons/Error_Icon.png Binary files differindex cf40696..cf40696 100644 --- a/src/qml/assets/icons/Error_Icon.png +++ b/src/app/qml/assets/icons/Error_Icon.png diff --git a/src/qml/assets/icons/LightWebBrowser_Icons.svg b/src/app/qml/assets/icons/LightWebBrowser_Icons.svg index fce4b40..fce4b40 100644 --- a/src/qml/assets/icons/LightWebBrowser_Icons.svg +++ b/src/app/qml/assets/icons/LightWebBrowser_Icons.svg diff --git a/src/qml/assets/icons/about_blank.png b/src/app/qml/assets/icons/about_blank.png Binary files differindex 6901b0b..6901b0b 100644 --- a/src/qml/assets/icons/about_blank.png +++ b/src/app/qml/assets/icons/about_blank.png diff --git a/src/qml/assets/icons/qt.png b/src/app/qml/assets/icons/qt.png Binary files differindex 6a22d2e..6a22d2e 100644 --- a/src/qml/assets/icons/qt.png +++ b/src/app/qml/assets/icons/qt.png diff --git a/src/qml/assets/icons/touchpoint.png b/src/app/qml/assets/icons/touchpoint.png Binary files differindex 7649ee9..7649ee9 100644 --- a/src/qml/assets/icons/touchpoint.png +++ b/src/app/qml/assets/icons/touchpoint.png diff --git a/src/app/resources.qrc b/src/app/resources.qrc new file mode 100644 index 0000000..93b48eb --- /dev/null +++ b/src/app/resources.qrc @@ -0,0 +1,34 @@ +<RCC> + <qresource prefix="/"> + <file>qml/BrowserWindow.qml</file> + <file>qml/FeaturePermissionBar.qml</file> + <file>qml/MockTouchPoint.qml</file> + <file>qml/PageView.qml</file> + <file>qml/NavigationBar.qml</file> + <file>qml/HomeScreen.qml</file> + <file>qml/SettingsView.qml</file> + <file>qml/assets/UIButton.qml</file> + <file>qml/assets/UIToolBar.qml</file> + <file>qml/Utils.js</file> + <file>qml/assets/icons/Btn_Home.png</file> + <file>qml/assets/icons/Btn_Tabs.png</file> + <file>qml/assets/icons/Btn_Forward.png</file> + <file>qml/assets/icons/Btn_Back.png</file> + <file>qml/assets/icons/Btn_Reload.png</file> + <file>qml/assets/icons/Btn_Clear.png</file> + <file>qml/assets/icons/touchpoint.png</file> + <file>qml/assets/icons/Btn_Delete.png</file> + <file>qml/assets/icons/Btn_Bookmarks.png</file> + <file>qml/assets/icons/Btn_Bookmark_Checked.png</file> + <file>qml/assets/icons/Btn_Bookmark_Indicator.png</file> + <file>qml/assets/icons/Btn_Settings.png</file> + <file>qml/assets/icons/about_blank.png</file> + <file>qml/assets/icons/Btn_Add.png</file> + <file>qml/assets/icons/Btn_Up.png</file> + <file>qml/assets/icons/Btn_Search.png</file> + <file>qml/assets/icons/Error_Icon.png</file> + <file>qml/assets/icons/qt.png</file> + <file>qml/assets/icons/AppLogoColor.png</file> + <file>qml/assets/icons/AppLogoGrey.png</file> + </qresource> +</RCC> diff --git a/src/touchmockingapplication.cpp b/src/app/touchmockingapplication.cpp index 4819b01..4819b01 100644 --- a/src/touchmockingapplication.cpp +++ b/src/app/touchmockingapplication.cpp diff --git a/src/touchmockingapplication.h b/src/app/touchmockingapplication.h index 6350436..6350436 100644 --- a/src/touchmockingapplication.h +++ b/src/app/touchmockingapplication.h diff --git a/src/touchtracker.cpp b/src/app/touchtracker.cpp index aa4d8a1..16b57c1 100644 --- a/src/touchtracker.cpp +++ b/src/app/touchtracker.cpp @@ -1,3 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtBrowser project. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPLv2 included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "touchtracker.h" #include <QDateTime> diff --git a/src/app/touchtracker.h b/src/app/touchtracker.h new file mode 100644 index 0000000..3aaecd2 --- /dev/null +++ b/src/app/touchtracker.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtBrowser project. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPLv2 included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TOUCHTRACKER_H +#define TOUCHTRACKER_H + +#include <QObject> +#include <QQuickItem> + +class TouchTracker : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(qreal touchX READ touchX NOTIFY touchChanged) + Q_PROPERTY(qreal touchY READ touchY NOTIFY touchChanged) + Q_PROPERTY(int xVelocity READ xVelocity NOTIFY velocityChanged) + Q_PROPERTY(int yVelocity READ yVelocity NOTIFY velocityChanged) + Q_PROPERTY(bool blockEvents READ blockEvents WRITE setBlockEvents NOTIFY blockEventsChanged) + Q_PROPERTY(QQuickItem* target READ target WRITE setTarget NOTIFY targetChanged) + + struct PositionInfo + { + QPointF pos; + qint64 ts; + qreal x() const { return pos.x(); } + qreal y() const { return pos.y(); } + }; + +public: + TouchTracker(QQuickItem *parent = 0); + + qreal touchX() const; + qreal touchY() const; + int xVelocity() const; + int yVelocity() const; + QQuickItem* target() const; + bool blockEvents() const; + void setBlockEvents(bool shouldBlock); + void setTarget(QQuickItem * target); + +signals: + void touchChanged(); + void blockEventsChanged(); + void targetChanged(); + void touchBegin(); + void touchEnd(); + void velocityChanged(); + void scrollDirectionChanged(); + +protected: + bool eventFilter(QObject *obj, QEvent *event); + void touchEvent(QTouchEvent *event) override; + +private: + bool m_blockEvents; + int m_diff; + int m_previousY; + PositionInfo m_startPoint; + PositionInfo m_currentPoint; + QQuickItem *m_target; + QQuickItem *m_delegate; +}; + +#endif // TOUCHTRACKER_H diff --git a/src/imports/imports.pro b/src/imports/imports.pro new file mode 100644 index 0000000..22f5ec1 --- /dev/null +++ b/src/imports/imports.pro @@ -0,0 +1,17 @@ +CXX_MODULE = qml +TARGET = webbrowser +TARGETPATH = WebBrowser +QT += qml quick +CONFIG += qt + +SOURCES += \ + plugin.cpp + +load(qml_plugin) + +target.path += /data/user/qt/qmlplugins/WebBrowser +INSTALLS += target + + + + diff --git a/src/imports/plugin.cpp b/src/imports/plugin.cpp new file mode 100644 index 0000000..ebd59c1 --- /dev/null +++ b/src/imports/plugin.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtBrowser project. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPLv2 included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QQmlExtensionPlugin> +#include "../app/touchtracker.h" +#include "../app/navigationhistoryproxymodel.h" + +#include <qqml.h> +#include "../app/engine.cpp" +#include <QQmlEngine> +#include <QQmlContext> +#include <QtQml/qqmlextensionplugin.h> +#include <qqml.h> + +QT_BEGIN_NAMESPACE + +static QObject *engine_factory(QQmlEngine *engine, QJSEngine *scriptEngine) +{ + Q_UNUSED(engine); + Q_UNUSED(scriptEngine); + Engine *eng = new Engine(); + return eng; +} + +class WebBrowser : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0") +public: + virtual void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("WebBrowser")); + qmlRegisterType<TouchTracker>(uri, 1, 0, "TouchTracker"); + qmlRegisterType<NavigationHistoryProxyModel>(uri, 1, 0, "SearchProxyModel"); + qmlRegisterSingletonType<Engine>(uri, 1, 0, "WebEngine", engine_factory); + } + + virtual void initializeEngine(QQmlEngine *engine, const char *uri) + { + Q_UNUSED(uri); + } +}; + +QT_END_NAMESPACE + +#include "plugin.moc" + diff --git a/src/imports/qmldir b/src/imports/qmldir new file mode 100644 index 0000000..89b8c78 --- /dev/null +++ b/src/imports/qmldir @@ -0,0 +1,4 @@ +module WebBrowser +plugin webbrowser +class WebBrowser + diff --git a/src/qml/Utils.js b/src/qml/Utils.js deleted file mode 100644 index d08c3db..0000000 --- a/src/qml/Utils.js +++ /dev/null @@ -1,24 +0,0 @@ -. pragma library - -function quote(str, delimiter) { - // discuss at: http://phpjs.org/functions/preg_quote/ - // original by: booeyOH - // improved by: Ates Goral (http://magnetiq.com) - // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) - // improved by: Brett Zamir (http://brett-zamir.me) - // bugfixed by: Onno Marsman - // example 1: preg_quote("$40"); - // returns 1: '\\$40' - // example 2: preg_quote("*RRRING* Hello?"); - // returns 2: '\\*RRRING\\* Hello\\?' - // example 3: preg_quote("\\.+*?[^]$(){}=!<>|:"); - // returns 3: '\\\\\\.\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:' - - return String(str) - .replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\' + (delimiter || '') + '-]', 'g'), '\\$&'); -} - -function highlight( text, search ) -{ - return text.replace( new RegExp( "(" + quote( search ) + ")" , 'gi' ), "<b>$1</b>" ); -} diff --git a/src/resources.qrc b/src/resources.qrc deleted file mode 100644 index bc8d3a6..0000000 --- a/src/resources.qrc +++ /dev/null @@ -1,34 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>qml/BrowserWindow.qml</file> - <file>qml/FeaturePermissionBar.qml</file> - <file>qml/MockTouchPoint.qml</file> - <file>qml/PageView.qml</file> - <file>qml/NavigationBar.qml</file> - <file>qml/HomeScreen.qml</file> - <file>qml/SettingsView.qml</file> - <file>qml/assets/UIButton.qml</file> - <file>qml/assets/UIToolBar.qml</file> - <file>qml/Utils.js</file> - <file alias="home">qml/assets/icons/Btn_Home.png</file> - <file alias="tabs">qml/assets/icons/Btn_Tabs.png</file> - <file alias="forward">qml/assets/icons/Btn_Forward.png</file> - <file alias="back">qml/assets/icons/Btn_Back.png</file> - <file alias="refresh">qml/assets/icons/Btn_Reload.png</file> - <file alias="stop">qml/assets/icons/Btn_Clear.png</file> - <file alias="touchpoint">qml/assets/icons/touchpoint.png</file> - <file alias="delete">qml/assets/icons/Btn_Delete.png</file> - <file alias="star">qml/assets/icons/Btn_Bookmarks.png</file> - <file alias="star_checked">qml/assets/icons/Btn_Bookmark_Checked.png</file> - <file alias="star_indicator">qml/assets/icons/Btn_Bookmark_Indicator.png</file> - <file alias="settings">qml/assets/icons/Btn_Settings.png</file> - <file alias="about">qml/assets/icons/about_blank.png</file> - <file alias="newtab">qml/assets/icons/Btn_Add.png</file> - <file alias="up">qml/assets/icons/Btn_Up.png</file> - <file alias="search">qml/assets/icons/Btn_Search.png</file> - <file alias="error">qml/assets/icons/Error_Icon.png</file> - <file alias="qt">qml/assets/icons/qt.png</file> - <file alias="icon">qml/assets/icons/AppLogoColor.png</file> - <file alias="icon_grey">qml/assets/icons/AppLogoGrey.png</file> - </qresource> -</RCC> diff --git a/src/src.pro b/src/src.pro index e30748a..b5ae676 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,41 +1,8 @@ -TARGET = qtwebbrowser - -DESTDIR = ../ -CONFIG += c++11 -CONFIG -= app_bundle - -SOURCES = main.cpp \ - touchmockingapplication.cpp \ - browserwindow.cpp \ - touchtracker.cpp \ - engine.cpp \ - navigationhistoryproxymodel.cpp - -HEADERS = \ - touchmockingapplication.h \ - browserwindow.h \ - touchtracker.h \ - engine.h \ - navigationhistoryproxymodel.h - -OTHER_FILES = \ - qml/assets/UIButton.qml \ - qml/assets/UIToolBar.qml \ - qml/ApplicationRoot.qml \ - qml/BrowserWindow.qml \ - qml/FeaturePermissionBar.qml \ - qml/MockTouchPoint.qml \ - qml/PageView.qml \ - qml/NavigationBar.qml \ - qml/HomeScreen.qml \ - qml/SettingsView.qml \ - -QT += qml quick webengine -QT_PRIVATE += quick-private gui-private core-private - -RESOURCES += resources.qrc - -!cross_compile: DEFINES += HOST_BUILD - -target.path = /data/user/qt/qtwebbrowser -INSTALLS += target +TEMPLATE = subdirs +SUBDIRS += \ + app + +cross_compile { + SUBDIRS += \ + imports +} diff --git a/src/touchtracker.h b/src/touchtracker.h deleted file mode 100644 index 8392e12..0000000 --- a/src/touchtracker.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef TOUCHTRACKER_H -#define TOUCHTRACKER_H - -#include <QObject> -#include <QQuickItem> - -class TouchTracker : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(qreal touchX READ touchX NOTIFY touchChanged) - Q_PROPERTY(qreal touchY READ touchY NOTIFY touchChanged) - Q_PROPERTY(int xVelocity READ xVelocity NOTIFY velocityChanged) - Q_PROPERTY(int yVelocity READ yVelocity NOTIFY velocityChanged) - Q_PROPERTY(bool blockEvents READ blockEvents WRITE setBlockEvents NOTIFY blockEventsChanged) - Q_PROPERTY(QQuickItem* target READ target WRITE setTarget NOTIFY targetChanged) - - struct PositionInfo - { - QPointF pos; - qint64 ts; - qreal x() const { return pos.x(); } - qreal y() const { return pos.y(); } - }; - -public: - TouchTracker(QQuickItem *parent = 0); - - qreal touchX() const; - qreal touchY() const; - int xVelocity() const; - int yVelocity() const; - QQuickItem* target() const; - bool blockEvents() const; - void setBlockEvents(bool shouldBlock); - void setTarget(QQuickItem * target); - -signals: - void touchChanged(); - void blockEventsChanged(); - void targetChanged(); - void touchBegin(); - void touchEnd(); - void velocityChanged(); - void scrollDirectionChanged(); - -protected: - bool eventFilter(QObject *obj, QEvent *event); - void touchEvent(QTouchEvent *event) override; - -private: - bool m_blockEvents; - int m_diff; - int m_previousY; - PositionInfo m_startPoint; - PositionInfo m_currentPoint; - QQuickItem *m_target; - QQuickItem *m_delegate; -}; - -#endif // TOUCHTRACKER_H |