diff options
Diffstat (limited to 'tests/quicktestbrowser')
-rw-r--r-- | tests/quicktestbrowser/ApplicationRoot.qml | 68 | ||||
-rw-r--r-- | tests/quicktestbrowser/BrowserDialog.qml | 44 | ||||
-rw-r--r-- | tests/quicktestbrowser/BrowserWindow.qml | 532 | ||||
-rw-r--r-- | tests/quicktestbrowser/ButtonWithMenu.qml | 58 | ||||
-rw-r--r-- | tests/quicktestbrowser/DownloadView.qml | 153 | ||||
-rw-r--r-- | tests/quicktestbrowser/FeaturePermissionBar.qml | 92 | ||||
-rw-r--r-- | tests/quicktestbrowser/FullScreenNotification.qml | 87 | ||||
-rw-r--r-- | tests/quicktestbrowser/ZoomController.qml | 90 | ||||
-rw-r--r-- | tests/quicktestbrowser/main.cpp | 96 | ||||
-rw-r--r-- | tests/quicktestbrowser/quicktestbrowser.pro | 26 | ||||
-rw-r--r-- | tests/quicktestbrowser/resources.qrc | 19 | ||||
-rw-r--r-- | tests/quicktestbrowser/utils.h | 54 |
12 files changed, 0 insertions, 1319 deletions
diff --git a/tests/quicktestbrowser/ApplicationRoot.qml b/tests/quicktestbrowser/ApplicationRoot.qml deleted file mode 100644 index a2e83e1e6..000000000 --- a/tests/quicktestbrowser/ApplicationRoot.qml +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtWebEngine 1.1 - -QtObject { - id: root - - property bool thirdPartyCookiesEnabled: true - - property QtObject testProfile: WebEngineProfile { - storageName: "Test" - } - - property QtObject otrProfile: WebEngineProfile { - offTheRecord: true - } - - property Component browserWindowComponent: BrowserWindow { - applicationRoot: root - onClosing: destroy() - } - property Component browserDialogComponent: BrowserDialog { - onClosing: destroy() - } - function createWindow(profile) { - var newWindow = browserWindowComponent.createObject(root) - newWindow.currentWebView.profile = profile - profile.downloadRequested.connect(newWindow.onDownloadRequested) - profile.presentNotification.connect(newWindow.onPresentNotification) - return newWindow - } - function createDialog(profile) { - var newDialog = browserDialogComponent.createObject(root) - newDialog.currentWebView.profile = profile - return newDialog - } - function load(url) { - var browserWindow = createWindow(testProfile) - browserWindow.currentWebView.url = url - } -} diff --git a/tests/quicktestbrowser/BrowserDialog.qml b/tests/quicktestbrowser/BrowserDialog.qml deleted file mode 100644 index 9f286125e..000000000 --- a/tests/quicktestbrowser/BrowserDialog.qml +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Window 2.2 -import QtWebEngine 1.1 - -Window { - property alias currentWebView: webView - flags: Qt.Dialog - width: 800 - height: 600 - visible: true - onClosing: destroy() - WebEngineView { - id: webView - anchors.fill: parent - } -} diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml deleted file mode 100644 index 6c3c160ac..000000000 --- a/tests/quicktestbrowser/BrowserWindow.qml +++ /dev/null @@ -1,532 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtWebEngine 1.2 - -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 -import QtQuick.Layouts 1.0 -import QtQuick.Window 2.1 -import QtQuick.Controls.Private 1.0 -import Qt.labs.settings 1.0 -import QtQuick.Dialogs 1.2 - -ApplicationWindow { - id: browserWindow - property QtObject applicationRoot - property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item.webView : null - property int previousVisibility: Window.Windowed - - property bool isFullScreen: visibility == Window.FullScreen - onIsFullScreenChanged: { - // This is for the case where the system forces us to leave fullscreen. - if (currentWebView && !isFullScreen) { - currentWebView.state = "" - if (currentWebView.isFullScreen) { - currentWebView.fullScreenCancelled() - fullScreenNotification.hide() - } - } - } - - height: 600 - width: 800 - visible: true - title: currentWebView && currentWebView.title - - Settings { - id : appSettings - property alias autoLoadImages: loadImages.checked; - property alias javaScriptEnabled: javaScriptEnabled.checked; - property alias errorPageEnabled: errorPageEnabled.checked; - property alias pluginsEnabled: pluginsEnabled.checked; - property alias thirdPartyCookiesEnabled: thirdPartyCookiesEnabled.checked; - } - - // Make sure the Qt.WindowFullscreenButtonHint is set on OS X. - Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint - - // Create a styleItem to determine the platform. - // When using style "mac", ToolButtons are not supposed to accept focus. - StyleItem { id: styleItem } - property bool platformIsMac: styleItem.style == "mac" - - Action { - shortcut: "Ctrl+D" - onTriggered: { - downloadView.visible = !downloadView.visible - } - } - - Action { - id: focus - shortcut: "Ctrl+L" - onTriggered: { - addressBar.forceActiveFocus(); - addressBar.selectAll(); - } - } - Action { - shortcut: "Ctrl+R" - onTriggered: { - if (currentWebView) - currentWebView.reload() - } - } - Action { - shortcut: "Ctrl+T" - onTriggered: { - tabs.createEmptyTab(currentWebView.profile) - tabs.currentIndex = tabs.count - 1 - addressBar.forceActiveFocus(); - addressBar.selectAll(); - } - } - Action { - shortcut: "Ctrl+W" - onTriggered: { - if (tabs.count == 1) - browserWindow.close() - else - tabs.removeTab(tabs.currentIndex) - } - } - - Action { - shortcut: "Escape" - onTriggered: { - if (browserWindow.isFullScreen) - browserWindow.visibility = browserWindow.previousVisibility - } - } - Action { - shortcut: "Ctrl+0" - onTriggered: zoomController.reset() - } - Action { - shortcut: "Ctrl+-" - onTriggered: zoomController.zoomOut() - } - Action { - shortcut: "Ctrl+=" - onTriggered: zoomController.zoomIn() - } - - Menu { - id: backHistoryMenu - - Instantiator { - model: currentWebView && currentWebView.navigationHistory.backItems - MenuItem { - text: model.title - onTriggered: currentWebView.goBackOrForward(model.offset) - } - - onObjectAdded: backHistoryMenu.insertItem(index, object) - onObjectRemoved: backHistoryMenu.removeItem(object) - } - } - - Menu { - id: forwardHistoryMenu - - Instantiator { - model: currentWebView && currentWebView.navigationHistory.forwardItems - MenuItem { - text: model.title - onTriggered: currentWebView.goBackOrForward(model.offset) - } - - onObjectAdded: forwardHistoryMenu.insertItem(index, object) - onObjectRemoved: forwardHistoryMenu.removeItem(object) - } - } - - toolBar: ToolBar { - id: navigationBar - RowLayout { - anchors.fill: parent; - ButtonWithMenu { - id: backButton - iconSource: "icons/go-previous.png" - enabled: currentWebView && currentWebView.canGoBack - activeFocusOnTab: !browserWindow.platformIsMac - onClicked: currentWebView.goBack() - longPressMenu: backHistoryMenu - } - ButtonWithMenu { - id: forwardButton - iconSource: "icons/go-next.png" - enabled: currentWebView && currentWebView.canGoForward - activeFocusOnTab: !browserWindow.platformIsMac - onClicked: currentWebView.goForward() - longPressMenu: forwardHistoryMenu - } - ToolButton { - id: reloadButton - iconSource: currentWebView && currentWebView.loading ? "icons/process-stop.png" : "icons/view-refresh.png" - onClicked: currentWebView && currentWebView.loading ? currentWebView.stop() : currentWebView.reload() - activeFocusOnTab: !browserWindow.platformIsMac - } - TextField { - id: addressBar - Image { - anchors.verticalCenter: addressBar.verticalCenter; - x: 5 - z: 2 - id: faviconImage - width: 16; height: 16 - source: currentWebView && currentWebView.icon - } - style: TextFieldStyle { - padding { - left: 26; - } - } - focus: true - Layout.fillWidth: true - text: currentWebView && currentWebView.url - onAccepted: currentWebView.url = utils.fromUserInput(text) - } - ToolButton { - id: settingsMenuButton - menu: Menu { - MenuItem { - id: loadImages - text: "Autoload images" - checkable: true - checked: true - } - MenuItem { - id: javaScriptEnabled - text: "JavaScript On" - checkable: true - checked: true - } - MenuItem { - id: errorPageEnabled - text: "ErrorPage On" - checkable: true - checked: true - } - MenuItem { - id: pluginsEnabled - text: "Plugins On" - checkable: true - checked: true - } - MenuItem { - id: thirdPartyCookiesEnabled - text: "Third party cookies enabled" - checkable: true - checked: true - onToggled: applicationRoot.thirdPartyCookiesEnabled = checked - } - MenuItem { - id: offTheRecordEnabled - text: "Off The Record" - checkable: true - checked: currentWebView.profile.offTheRecord - onToggled: currentWebView.profile = checked ? otrProfile : testProfile; - } - MenuItem { - id: httpDiskCacheEnabled - text: "HTTP Disk Cache" - checkable: !currentWebView.profile.offTheRecord - checked: (currentWebView.profile.httpCacheType == WebEngineProfile.DiskHttpCache) - onToggled: currentWebView.profile.httpCacheType = checked ? WebEngineProfile.DiskHttpCache : WebEngineProfile.MemoryHttpCache; - } - } - } - } - ProgressBar { - id: progressBar - height: 3 - anchors { - left: parent.left - top: parent.bottom - right: parent.right - leftMargin: -parent.leftMargin - rightMargin: -parent.rightMargin - } - style: ProgressBarStyle { - background: Item {} - } - z: -2; - minimumValue: 0 - maximumValue: 100 - value: (currentWebView && currentWebView.loadProgress < 100) ? currentWebView.loadProgress : 0 - } - } - - TabView { - id: tabs - function createEmptyTab(profile) { - var tab = addTab("", tabComponent) - // We must do this first to make sure that tab.active gets set so that tab.item gets instantiated immediately. - tab.active = true - tab.title = Qt.binding(function() { return tab.item.title }) - tab.item.webView.profile = profile - return tab - } - - anchors.fill: parent - Component.onCompleted: createEmptyTab(testProfile) - - Component { - id: tabComponent - Item { - property alias webView: webEngineView - property alias title: webEngineView.title - Action { - shortcut: "Ctrl+F" - onTriggered: { - findBar.visible = !findBar.visible - if (findBar.visible) { - findTextField.forceActiveFocus() - } - } - } - FeaturePermissionBar { - id: permBar - view: webEngineView - anchors { - left: parent.left - right: parent.right - top: parent.top - } - z: 3 - } - - WebEngineView { - id: webEngineView - - anchors { - fill: parent - top: permBar.bottom - } - - focus: true - - states: [ - State { - name: "FullScreen" - PropertyChanges { - target: tabs - frameVisible: false - tabsVisible: false - } - PropertyChanges { - target: navigationBar - visible: false - } - } - ] - settings.autoLoadImages: appSettings.autoLoadImages - settings.javascriptEnabled: appSettings.javaScriptEnabled - settings.errorPageEnabled: appSettings.errorPageEnabled - settings.pluginsEnabled: appSettings.pluginsEnabled - - onCertificateError: { - if (!acceptedCertificates.shouldAutoAccept(error)){ - error.defer() - sslDialog.enqueue(error) - } else{ - error.ignoreCertificateError() - } - } - - onNewViewRequested: { - if (!request.userInitiated) - print("Warning: Blocked a popup window.") - else if (request.destination == WebEngineView.NewViewInTab) { - var tab = tabs.createEmptyTab(currentWebView.profile) - tabs.currentIndex = tabs.count - 1 - request.openIn(tab.item.webView) - } else if (request.destination == WebEngineView.NewViewInBackgroundTab) { - var tab = tabs.createEmptyTab(currentWebView.profile) - request.openIn(tab.item.webView) - } else if (request.destination == WebEngineView.NewViewInDialog) { - var dialog = applicationRoot.createDialog(currentWebView.profile) - request.openIn(dialog.currentWebView) - } else { - var window = applicationRoot.createWindow(currentWebView.profile) - request.openIn(window.currentWebView) - } - } - - onFullScreenRequested: { - if (request.toggleOn) { - webEngineView.state = "FullScreen" - browserWindow.previousVisibility = browserWindow.visibility - browserWindow.showFullScreen() - fullScreenNotification.show() - } else { - webEngineView.state = "" - browserWindow.visibility = browserWindow.previousVisibility - fullScreenNotification.hide() - } - request.accept() - } - - onFeaturePermissionRequested: { - permBar.securityOrigin = securityOrigin; - permBar.requestedFeature = feature; - permBar.visible = true; - } - } - - Rectangle { - id: findBar - anchors.top: webEngineView.top - anchors.right: webEngineView.right - width: 240 - height: 35 - border.color: "lightgray" - border.width: 1 - radius: 5 - visible: false - color: browserWindow.color - - RowLayout { - anchors.centerIn: findBar - TextField { - id: findTextField - onAccepted: { - webEngineView.findText(text) - } - } - ToolButton { - id: findBackwardButton - iconSource: "icons/go-previous.png" - onClicked: webEngineView.findText(findTextField.text, WebEngineView.FindBackward) - } - ToolButton { - id: findForwardButton - iconSource: "icons/go-next.png" - onClicked: webEngineView.findText(findTextField.text) - } - ToolButton { - id: findCancelButton - iconSource: "icons/process-stop.png" - onClicked: findBar.visible = false - } - } - } - } - } - } - - QtObject{ - id:acceptedCertificates - - property var acceptedUrls : [] - - function shouldAutoAccept(certificateError){ - var domain = utils.domainFromString(certificateError.url) - return acceptedUrls.indexOf(domain) >= 0 - } - } - - MessageDialog { - id: sslDialog - - property var certErrors: [] - icon: StandardIcon.Warning - standardButtons: StandardButton.No | StandardButton.Yes - title: "Server's certificate not trusted" - text: "Do you wish to continue?" - detailedText: "If you wish so, you may continue with an unverified certificate. " + - "Accepting an unverified certificate means " + - "you may not be connected with the host you tried to connect to.\n" + - "Do you wish to override the security check and continue?" - onYes: { - var cert = certErrors.shift() - var domain = utils.domainFromString(cert.url) - acceptedCertificates.acceptedUrls.push(domain) - cert.ignoreCertificateError() - presentError() - } - onNo: reject() - onRejected: reject() - - function reject(){ - certErrors.shift().rejectCertificate() - presentError() - } - function enqueue(error){ - certErrors.push(error) - presentError() - } - function presentError(){ - visible = certErrors.length > 0 - } - } - - FullScreenNotification { - id: fullScreenNotification - } - - DownloadView { - id: downloadView - visible: false - anchors.fill: parent - } - - function onDownloadRequested(download) { - downloadView.visible = true - downloadView.append(download) - download.accept() - } - - MessageDialog { - id: notificationDialog - width: 200 - standardButtons: StandardButton.Ok - } - - function onPresentNotification(notification) { - notificationDialog.title = notification.title - notificationDialog.text = notification.origin.toString() + '\n' + notification.message - notificationDialog.open() - } - - ZoomController { - id: zoomController - y: parent.mapFromItem(currentWebView, 0 , 0).y - 4 - anchors.right: parent.right - width: (parent.width > 800) ? parent.width * 0.25 : 220 - anchors.rightMargin: (parent.width > 400) ? 100 : 0 - } - Binding { - target: currentWebView - property: "zoomFactor" - value: zoomController.zoomFactor - } -} diff --git a/tests/quicktestbrowser/ButtonWithMenu.qml b/tests/quicktestbrowser/ButtonWithMenu.qml deleted file mode 100644 index b8d4f743c..000000000 --- a/tests/quicktestbrowser/ButtonWithMenu.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Controls 1.2 - -// The QtQuick controls guys are slackers, so we need to make our own stuff - -ToolButton { - id: root - property Menu longPressMenu - function showMenu() { - longPressMenu.__popup(Qt.rect(0, root.height, 0, 0), 0) - } - - Binding { - target: longPressMenu - property: "__visualItem" - value: root - } - - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: { - if (mouse.button == Qt.RightButton) - showMenu() - else - root.clicked() - } - onPressAndHold: showMenu() - } -} diff --git a/tests/quicktestbrowser/DownloadView.qml b/tests/quicktestbrowser/DownloadView.qml deleted file mode 100644 index eb945eccc..000000000 --- a/tests/quicktestbrowser/DownloadView.qml +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 -import QtWebEngine 1.0 -import QtQuick.Layouts 1.0 - -Rectangle { - id: downloadView - color: "lightgray" - - ListModel { - id: downloadModel - property var downloads: [] - } - - function append(download) { - downloadModel.append(download) - downloadModel.downloads.push(download) - } - - Component { - id: downloadItemDelegate - - Rectangle { - width: listView.width - height: childrenRect.height - anchors.margins: 10 - radius: 3 - color: "transparent" - border.color: "black" - Rectangle { - id: progressBar - - property real progress: downloadModel.downloads[index] - ? downloadModel.downloads[index].receivedBytes / downloadModel.downloads[index].totalBytes : 0 - - radius: 3 - color: width == listView.width ? "green" : "#2b74c7" - width: listView.width * progress - height: cancelButton.height - - Behavior on width { - SmoothedAnimation { duration: 100 } - } - } - Rectangle { - anchors { - left: parent.left - right: parent.right - leftMargin: 20 - } - Label { - id: label - text: path - anchors { - verticalCenter: cancelButton.verticalCenter - left: parent.left - right: cancelButton.left - } - } - Button { - id: cancelButton - anchors.right: parent.right - iconSource: "icons/process-stop.png" - onClicked: { - var download = downloadModel.downloads[index] - - download.cancel() - - downloadModel.downloads = downloadModel.downloads.filter(function (el) { - return el.id !== download.id; - }); - downloadModel.remove(index) - } - } - } - } - - } - ListView { - id: listView - anchors { - topMargin: 10 - top: parent.top - bottom: parent.bottom - horizontalCenter: parent.horizontalCenter - } - width: parent.width - 20 - spacing: 5 - - model: downloadModel - delegate: downloadItemDelegate - - Text { - visible: !listView.count - horizontalAlignment: Text.AlignHCenter - height: 30 - anchors { - top: parent.top - left: parent.left - right: parent.right - } - font.pixelSize: 20 - text: "No active downloads." - } - - Rectangle { - color: "gray" - anchors { - bottom: parent.bottom - left: parent.left - right: parent.right - } - height: 30 - Button { - id: okButton - text: "OK" - anchors.centerIn: parent - onClicked: { - downloadView.visible = false - } - } - } - } -} diff --git a/tests/quicktestbrowser/FeaturePermissionBar.qml b/tests/quicktestbrowser/FeaturePermissionBar.qml deleted file mode 100644 index 500d13206..000000000 --- a/tests/quicktestbrowser/FeaturePermissionBar.qml +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.1 -import QtQuick.Controls 1.0 -import QtWebEngine 1.1 -import QtQuick.Layouts 1.0 - -Rectangle { - property var requestedFeature; - property url securityOrigin; - property WebEngineView view; - - id: permissionBar - visible: false - height: acceptButton.height + 4 - - - function textForFeature(feature) { - switch (feature) { - case WebEngineView.Geolocation: return 'Allow %1 to access your location information?' - case WebEngineView.MediaAudioCapture: return 'Allow %1 to access your microphone?' - case WebEngineView.MediaVideoCapture: return 'Allow %1 to access your webcam?' - case WebEngineView.MediaAudioVideoCapture: return 'Allow %1 to access your microphone and webcam?' - case WebEngineView.DesktopVideoCapture: return 'Allow %1 to capture video of your desktop?' - case WebEngineView.DesktopAudioVideoCapture: return 'Allow %1 to capture audio and video of your desktop?' - case WebEngineView.Notifications: return 'Allow %1 to show notification on your desktop?' - default: break - } - return 'Grant permission for %1 to unknown or unsupported feature [' + feature + ']?' - } - - onRequestedFeatureChanged: { - message.text = textForFeature(requestedFeature).arg(securityOrigin); - } - - RowLayout { - anchors { - fill: permissionBar - leftMargin: 5 - rightMargin: 5 - } - Label { - id: message - Layout.fillWidth: true - } - - Button { - id: acceptButton - text: "Accept" - Layout.alignment: Qt.AlignRight - onClicked: { - view.grantFeaturePermission(securityOrigin, requestedFeature, true); - permissionBar.visible = false; - } - } - - Button { - text: "Deny" - Layout.alignment: Qt.AlignRight - onClicked: { - view.grantFeaturePermission(securityOrigin, requestedFeature, false); - permissionBar.visible = false - } - } - } -} diff --git a/tests/quicktestbrowser/FullScreenNotification.qml b/tests/quicktestbrowser/FullScreenNotification.qml deleted file mode 100644 index 90f27cca6..000000000 --- a/tests/quicktestbrowser/FullScreenNotification.qml +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 - -Rectangle { - id: fullScreenNotification - width: 500 - height: 40 - color: "white" - radius: 7 - - visible: false - opacity: 0 - - function show() { - visible = true - opacity = 1 - reset.start() - } - - function hide() { - reset.stop() - opacity = 0 - } - - Behavior on opacity { - NumberAnimation { - duration: 750 - onStopped: { - if (opacity == 0) - visible = false - } - } - } - - Timer { - id: reset - interval: 5000 - onTriggered: hide() - } - - anchors.horizontalCenter: parent.horizontalCenter - y: 125 - - Text { - id: message - width: parent.width - - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - - wrapMode: Text.WordWrap - elide: Text.ElideNone - clip: true - - text: qsTr("You are now in fullscreen mode. Press ESC to quit!") - } -} diff --git a/tests/quicktestbrowser/ZoomController.qml b/tests/quicktestbrowser/ZoomController.qml deleted file mode 100644 index 122ae8815..000000000 --- a/tests/quicktestbrowser/ZoomController.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.1 - -Rectangle { - property alias zoomFactor: slider.value ; - function zoomIn() { - visible = true - visibilityTimer.restart() - zoomFactor = zoomFactor + 0.25; - } - function zoomOut() { - visible = true - visibilityTimer.restart() - zoomFactor = zoomFactor - 0.25; - } - function reset() { zoomFactor = 1.0 } - - width: 220 - height: 30 - color: palette.window - visible: false - radius: 4 - - SystemPalette { - id: palette - } - Timer { - id: visibilityTimer - interval: 3000 - repeat: false - onTriggered: zoomController.visible = false - } - - RowLayout { - anchors.margins: 4 - anchors.fill: parent - ToolButton { - id: plusButton - text: '+' - onClicked: zoomIn() - } - ToolButton { - text: '\u2014' - id: minusButton - onClicked: zoomOut() - } - Slider { - id: slider - maximumValue: 5.0 - minimumValue: 0.25 - Layout.fillWidth: true; - stepSize: 0.05 - value: 1 - onValueChanged: visibilityTimer.restart() - } - Button { - text: "Reset" - onClicked: reset() - } - } -} diff --git a/tests/quicktestbrowser/main.cpp b/tests/quicktestbrowser/main.cpp deleted file mode 100644 index b886564f3..000000000 --- a/tests/quicktestbrowser/main.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "utils.h" - -#ifndef QT_NO_WIDGETS -#include <QtWidgets/QApplication> -typedef QApplication Application; -#else -#include <QtGui/QGuiApplication> -typedef QGuiApplication Application; -#endif -#include <QtQml/QQmlApplicationEngine> -#include <QtQml/QQmlContext> -#include <QtQml/QQmlComponent> -#include <QtWebEngine/qtwebengineglobal.h> -#include <QtWebEngine/QQuickWebEngineProfile> -#include <QtWebEngineCore/qwebenginecookiestore.h> - -static QUrl startupUrl() -{ - QUrl ret; - QStringList args(qApp->arguments()); - args.takeFirst(); - for (const QString &arg : qAsConst(args)) { - if (arg.startsWith(QLatin1Char('-'))) - continue; - ret = Utils::fromUserInput(arg); - if (ret.isValid()) - return ret; - } - return QUrl(QStringLiteral("http://qt.io/")); -} - -int main(int argc, char **argv) -{ - Application app(argc, argv); - - // Enable dev tools by default for the test browser - if (qgetenv("QTWEBENGINE_REMOTE_DEBUGGING").isNull()) - qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "1337"); - QtWebEngine::initialize(); - - QQmlApplicationEngine appEngine; - Utils utils; - appEngine.rootContext()->setContextProperty("utils", &utils); - appEngine.load(QUrl("qrc:/ApplicationRoot.qml")); - - QObject *rootObject = appEngine.rootObjects().first(); - - QQuickWebEngineProfile *profile = new QQuickWebEngineProfile(rootObject); - - const QMetaObject *rootMeta = rootObject->metaObject(); - int index = rootMeta->indexOfProperty("thirdPartyCookiesEnabled"); - Q_ASSERT(index != -1); - QMetaProperty thirdPartyCookiesProperty = rootMeta->property(index); - profile->cookieStore()->setCookieFilter( - [rootObject,&thirdPartyCookiesProperty](const QWebEngineCookieStore::FilterRequest &request) - { - return !request.thirdParty || thirdPartyCookiesProperty.read(rootObject).toBool(); - }); - - index = rootMeta->indexOfProperty("testProfile"); - Q_ASSERT(index != -1); - QMetaProperty profileProperty = rootMeta->property(index); - profileProperty.write(rootObject, QVariant::fromValue(profile)); - - QMetaObject::invokeMethod(rootObject, "load", Q_ARG(QVariant, startupUrl())); - - return app.exec(); -} diff --git a/tests/quicktestbrowser/quicktestbrowser.pro b/tests/quicktestbrowser/quicktestbrowser.pro deleted file mode 100644 index 8c6b8a111..000000000 --- a/tests/quicktestbrowser/quicktestbrowser.pro +++ /dev/null @@ -1,26 +0,0 @@ -requires(qtConfig(accessibility)) - -TEMPLATE = app -TARGET = quicktestbrowser - -macx: CONFIG -= app_bundle - -HEADERS = utils.h -SOURCES = main.cpp - -OTHER_FILES += ApplicationRoot.qml \ - BrowserDialog.qml \ - BrowserWindow.qml \ - ButtonWithMenu.qml \ - ContextMenuExtras.qml \ - DownloadView.qml \ - FeaturePermissionBar.qml \ - FullScreenNotification.qml - -RESOURCES += resources.qrc - -QT += qml quick webengine - -qtHaveModule(widgets) { - QT += widgets # QApplication is required to get native styling with QtQuickControls -} diff --git a/tests/quicktestbrowser/resources.qrc b/tests/quicktestbrowser/resources.qrc deleted file mode 100644 index 63ff051de..000000000 --- a/tests/quicktestbrowser/resources.qrc +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> - <qresource prefix="/"> - <file>ApplicationRoot.qml</file> - <file>BrowserDialog.qml</file> - <file>BrowserWindow.qml</file> - <file>FeaturePermissionBar.qml</file> - <file>FullScreenNotification.qml</file> - <file>ButtonWithMenu.qml</file> - <file>DownloadView.qml</file> - <file>ZoomController.qml</file> - </qresource> - <qresource prefix="icons"> - <!-- To the risk of this breaking more often, do not duplicate the resources since this application won't be deployed --> - <file alias="go-next.png">../../examples/webengine/quicknanobrowser/icons/3rdparty/go-next.png</file> - <file alias="go-previous.png">../../examples/webengine/quicknanobrowser/icons/3rdparty/go-previous.png</file> - <file alias="process-stop.png">../../examples/webengine/quicknanobrowser/icons/3rdparty/process-stop.png</file> - <file alias="view-refresh.png">../../examples/webengine/quicknanobrowser/icons/3rdparty/view-refresh.png</file> - </qresource> -</RCC> diff --git a/tests/quicktestbrowser/utils.h b/tests/quicktestbrowser/utils.h deleted file mode 100644 index d4f3dba0e..000000000 --- a/tests/quicktestbrowser/utils.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://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 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef UTILS_H -#define UTILS_H - -#include <QtCore/QFileInfo> -#include <QtCore/QUrl> - -class Utils : public QObject { - Q_OBJECT -public: - Q_INVOKABLE static QUrl fromUserInput(const QString& userInput); - Q_INVOKABLE static QString domainFromString(const QString& urlString); -}; - -inline QUrl Utils::fromUserInput(const QString& userInput) -{ - QFileInfo fileInfo(userInput); - if (fileInfo.exists()) - return QUrl::fromLocalFile(fileInfo.absoluteFilePath()); - return QUrl::fromUserInput(userInput); -} - -inline QString Utils::domainFromString(const QString& urlString) -{ - return QUrl::fromUserInput(urlString).host(); -} - -#endif // UTILS_H |