diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2020-06-19 11:17:50 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-04 18:41:41 +0200 |
commit | 881339e9d9054c46f2621119246de7a13c83761a (patch) | |
tree | 77db7d7188c4ac61cab939c2ccd7a9610d4a01f4 /tests/manual/quick | |
parent | 4d67b9f639114ddec0521980495ba27921800e39 (diff) |
Replace FaviconManager with Chromium's Favicon Component
Task-number: QTBUG-51184
Change-Id: Ie050cb23f2c86841a66ec384bfbcdf0713cffa7c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/manual/quick')
-rw-r--r-- | tests/manual/quick/faviconbrowser/AddressBar.qml | 102 | ||||
-rw-r--r-- | tests/manual/quick/faviconbrowser/FaviconPanel.qml | 234 | ||||
-rw-r--r-- | tests/manual/quick/faviconbrowser/faviconbrowser.pro | 23 | ||||
-rw-r--r-- | tests/manual/quick/faviconbrowser/faviconbrowser.qrc | 17 | ||||
-rw-r--r-- | tests/manual/quick/faviconbrowser/main.cpp | 54 | ||||
-rw-r--r-- | tests/manual/quick/faviconbrowser/main.qml | 170 | ||||
-rw-r--r-- | tests/manual/quick/faviconbrowser/utils.h | 49 |
7 files changed, 0 insertions, 649 deletions
diff --git a/tests/manual/quick/faviconbrowser/AddressBar.qml b/tests/manual/quick/faviconbrowser/AddressBar.qml deleted file mode 100644 index c79b74f30..000000000 --- a/tests/manual/quick/faviconbrowser/AddressBar.qml +++ /dev/null @@ -1,102 +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 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 - -Rectangle { - id: root - - property int progress: 0 - property url iconUrl: "" - property url pageUrl: "" - - signal accepted(url addressUrl) - - clip: true - - onActiveFocusChanged: { - if (activeFocus) - addressField.forceActiveFocus(); - } - - Rectangle { - width: addressField.width / 100 * root.progress - height: root.height - - visible: root.progress < 100 - - color: "#b6dca6" - radius: root.radius - } - - TextField { - id: addressField - anchors.fill: parent - - Image { - anchors.verticalCenter: addressField.verticalCenter - x: 5; z: parent.z + 1 - width: 16; height: 16 - sourceSize: Qt.size(width, height) - source: root.iconUrl - visible: root.progress == 100 - } - - Text { - text: root.progress < 0 ? "" : root.progress + "%" - x: 5; z: parent.z + 1 - font.bold: true - anchors.verticalCenter: parent.verticalCenter - - visible: root.progress < 100 - } - - style: TextFieldStyle { - padding.left: 30 - - background: Rectangle { - color: "transparent" - border.color: "black" - border.width: 1 - radius: root.radius - } - } - - onActiveFocusChanged: { - if (activeFocus) - selectAll(); - else - deselect(); - } - - text: root.pageUrl - onAccepted: root.accepted(utils.fromUserInput(text)) - } -} diff --git a/tests/manual/quick/faviconbrowser/FaviconPanel.qml b/tests/manual/quick/faviconbrowser/FaviconPanel.qml deleted file mode 100644 index 857019d9a..000000000 --- a/tests/manual/quick/faviconbrowser/FaviconPanel.qml +++ /dev/null @@ -1,234 +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 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtQuick.Layouts 1.1 - -Item { - id: root - - property url iconUrl: "" - property int iconSize: 128 - property int iconMinimumSize: 8 - property int iconMaximumSize: 256 - - RowLayout { - anchors.fill: parent - spacing: 2 - - Rectangle { - Layout.fillWidth: true - Layout.fillHeight: true - - RowLayout { - anchors.fill: parent - spacing: 2 - - Rectangle { - Layout.fillHeight: true - Layout.preferredWidth: (parent.width - 2 * parent.spacing) / 3 - - border.color: "black" - border.width: 1 - clip: true - - Text { - z: parent.z + 1 - anchors.top: parent.top - anchors.topMargin: 5 - anchors.left: parent.left - anchors.leftMargin: 5 - font.bold: true - - text: "faviconImage" - } - - Image { - id: faviconImage - anchors.centerIn: parent - - width: root.iconSize - height: width - sourceSize: Qt.size(width, height) - - source: root.iconUrl - - onStatusChanged: { - if (status == Image.Ready) { - grabToImage(function(result) { - grabImage.source = result.url; - }); - } - - if (status == Image.Null) - grabImage.source = ""; - } - } - } - - Rectangle { - Layout.fillHeight: true - Layout.preferredWidth: (parent.width - 2 * parent.spacing) / 3 - - border.color: "black" - border.width: 1 - clip: true - - Text { - z: parent.z + 1 - anchors.top: parent.top - anchors.topMargin: 5 - anchors.left: parent.left - anchors.leftMargin: 5 - font.bold: true - - text: "grabImage" - } - - Image { - id: grabImage - anchors.centerIn: parent - - width: root.iconSize - height: width - - onStatusChanged: { - if (status == Image.Ready || status == Image.Null) - faviconCanvas.requestPaint(); - } - } - } - - Rectangle { - Layout.fillHeight: true - Layout.preferredWidth: (parent.width - 2 * parent.spacing) / 3 - - border.color: "black" - border.width: 1 - clip: true - - Text { - z: parent.z + 1 - anchors.top: parent.top - anchors.topMargin: 5 - anchors.left: parent.left - anchors.leftMargin: 5 - font.bold: true - - text: "faviconCanvas" - } - - Canvas { - id: faviconCanvas - anchors.centerIn: parent - - width: root.iconSize - height: width - - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - ctx.clearRect(0, 0, width, height); - - if (grabImage.source == "") - return; - - ctx.drawImage(grabImage, 0, 0, width, height); - - var imageData = ctx.getImageData(width/2, height/2, width/2, height/2); - var pixel = imageData.data; - - verbose.append("pixel(" + width/2 + ", " + height/2 + "): " + pixel[0] + ", " + pixel[1] + ", " + pixel[2]); - } - } - } - } - } - - Rectangle { - Layout.fillHeight: true - Layout.preferredWidth: 100 - - Slider { - id: faviconSizeSlider - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.bottom: faviconSizeSpin.top - - orientation: Qt.Vertical - minimumValue: root.iconMinimumSize - maximumValue: root.iconMaximumSize - stepSize: 1 - tickmarksEnabled: true - value: root.iconSize - - onValueChanged: { - if (pressed && value != root.iconSize) - root.iconSize = value; - } - } - - SpinBox { - id: faviconSizeSpin - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - - minimumValue: root.iconMinimumSize - maximumValue: root.iconMaximumSize - value: root.iconSize - - onEditingFinished: { - if (value != root.iconSize) - root.iconSize = value; - } - } - } - - TextArea { - id: verbose - - Layout.fillHeight: true - Layout.preferredWidth: 310 - - readOnly: true - tabChangesFocus: true - - font.family: "Monospace" - font.pointSize: 12 - - textFormat: TextEdit.RichText - frameVisible: false - - style: TextAreaStyle { - backgroundColor: "lightgray" - } - } - } -} diff --git a/tests/manual/quick/faviconbrowser/faviconbrowser.pro b/tests/manual/quick/faviconbrowser/faviconbrowser.pro deleted file mode 100644 index d997d6322..000000000 --- a/tests/manual/quick/faviconbrowser/faviconbrowser.pro +++ /dev/null @@ -1,23 +0,0 @@ -QT += qml quick webenginequick -qtHaveModule(widgets) { - QT += widgets # QApplication is required to get native styling with QtQuickControls -} - -TARGET = faviconbrowser -TEMPLATE = app - - -SOURCES = \ - main.cpp - -HEADERS = \ - utils.h - -OTHER_FILES += \ - main.qml \ - AddressBar.qml \ - FaviconPanel.qml - -RESOURCES += \ - faviconbrowser.qrc - diff --git a/tests/manual/quick/faviconbrowser/faviconbrowser.qrc b/tests/manual/quick/faviconbrowser/faviconbrowser.qrc deleted file mode 100644 index b641fa2fa..000000000 --- a/tests/manual/quick/faviconbrowser/faviconbrowser.qrc +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> - <qresource prefix="/"> - <file>main.qml</file> - <file>AddressBar.qml</file> - <file>FaviconPanel.qml</file> - </qresource> - <qresource prefix="test"> - <file alias="favicon-multi-gray.html">../../../auto/quick/qmltests2/data/favicon-multi-gray.html</file> - <file alias="favicon-candidates-gray.html">../../../auto/quick/qmltests2/data/favicon-candidates-gray.html</file> - <file alias="icons/grayicons.ico">../../../auto/quick/qmltests2/data/icons/grayicons.ico</file> - <file alias="icons/gray16.png">../../../auto/quick/qmltests2/data/icons/gray16.png</file> - <file alias="icons/gray32.png">../../../auto/quick/qmltests2/data/icons/gray32.png</file> - <file alias="icons/gray64.png">../../../auto/quick/qmltests2/data/icons/gray64.png</file> - <file alias="icons/gray128.png">../../../auto/quick/qmltests2/data/icons/gray128.png</file> - <file alias="icons/gray255.png">../../../auto/quick/qmltests2/data/icons/gray255.png</file> - </qresource> -</RCC> diff --git a/tests/manual/quick/faviconbrowser/main.cpp b/tests/manual/quick/faviconbrowser/main.cpp deleted file mode 100644 index d1faadfa0..000000000 --- a/tests/manual/quick/faviconbrowser/main.cpp +++ /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$ -** -****************************************************************************/ - -#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 <QtWebEngineQuick/qtwebengineglobal.h> - -int main(int argc, char **argv) -{ - Application app(argc, argv); - - QtWebEngine::initialize(); - - QQmlApplicationEngine appEngine; - Utils utils; - appEngine.rootContext()->setContextProperty("utils", &utils); - appEngine.load(QUrl("qrc:/main.qml")); - - return app.exec(); -} diff --git a/tests/manual/quick/faviconbrowser/main.qml b/tests/manual/quick/faviconbrowser/main.qml deleted file mode 100644 index c8e2bdbd5..000000000 --- a/tests/manual/quick/faviconbrowser/main.qml +++ /dev/null @@ -1,170 +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 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.1 -import QtWebEngine 1.3 -import Qt.labs.settings 1.0 - -ApplicationWindow { - width: 1300 - height: 900 - visible: true - - Item { - id: bookmarkUrls - - property url multiTest: Qt.resolvedUrl("qrc:/test/favicon-multi-gray.html") - property url candidatesTest: Qt.resolvedUrl("qrc:/test/favicon-candidates-gray.html") - property url aboutBlank: Qt.resolvedUrl("about:blank") - property url qtHome: Qt.resolvedUrl("http://www.qt.io/") - } - - Settings { - id: appSettings - - property alias autoLoadIconsForPage: autoLoadIconsForPage.checked - property alias touchIconsEnabled: touchIconsEnabled.checked - } - - SplitView { - anchors.fill: parent - orientation: Qt.Vertical - - FaviconPanel { - id: faviconPanel - - Layout.fillWidth: true - Layout.minimumHeight: 200 - - Layout.margins: 2 - - iconUrl: webEngineView && webEngineView.icon - } - - ColumnLayout { - Layout.fillWidth: true - Layout.fillHeight: true - Layout.topMargin: 2 - - AddressBar { - id: addressBar - - Layout.fillWidth: true - Layout.leftMargin: 5 - Layout.rightMargin: 5 - height: 25 - - color: "white" - radius: 4 - - progress: webEngineView && webEngineView.loadProgress - iconUrl: webEngineView && webEngineView.icon - pageUrl: webEngineView && webEngineView.url - - onAccepted: webEngineView.url = addressUrl - } - - Rectangle { - id: toolBar - - Layout.fillWidth: true - Layout.leftMargin: 5 - Layout.rightMargin: 5 - Layout.preferredHeight: 25 - - RowLayout { - anchors.verticalCenter: parent.verticalCenter - - Button { - text: "Multi-sized Favicon Test" - onClicked: webEngineView.url = bookmarkUrls.multiTest - enabled: webEngineView.url != bookmarkUrls.multiTest - } - - Button { - text: "Candidate Favicons Test" - onClicked: webEngineView.url = bookmarkUrls.candidatesTest - enabled: webEngineView.url != bookmarkUrls.candidatesTest - } - - Button { - text: "About Blank" - onClicked: webEngineView.url = bookmarkUrls.aboutBlank - enabled: webEngineView.url != bookmarkUrls.aboutBlank - } - - Button { - text: "Qt Home Page" - onClicked: webEngineView.url = bookmarkUrls.qtHome - enabled: webEngineView.url != bookmarkUrls.qtHome - } - } - - ToolButton { - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - - menu: Menu { - MenuItem { - id: autoLoadIconsForPage - text: "Icons On" - checkable: true - checked: WebEngine.settings.autoLoadIconsForPage - - onCheckedChanged: webEngineView.reload() - } - - MenuItem { - id: touchIconsEnabled - text: "Touch Icons On" - checkable: true - checked: WebEngine.settings.touchIconsEnabled - enabled: autoLoadIconsForPage.checked - - onCheckedChanged: webEngineView.reload() - } - } - } - } - - WebEngineView { - id: webEngineView - - Layout.fillWidth: true - Layout.fillHeight: true - - settings.autoLoadIconsForPage: appSettings.autoLoadIconsForPage - settings.touchIconsEnabled: appSettings.touchIconsEnabled - - Component.onCompleted: webEngineView.url = bookmarkUrls.multiTest - } - } - } -} diff --git a/tests/manual/quick/faviconbrowser/utils.h b/tests/manual/quick/faviconbrowser/utils.h deleted file mode 100644 index 9deef0b61..000000000 --- a/tests/manual/quick/faviconbrowser/utils.h +++ /dev/null @@ -1,49 +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); -}; - -inline QUrl Utils::fromUserInput(const QString& userInput) -{ - QFileInfo fileInfo(userInput); - if (fileInfo.exists()) - return QUrl::fromLocalFile(fileInfo.absoluteFilePath()); - return QUrl::fromUserInput(userInput); -} - -#endif // UTILS_H |