diff --git a/src/webengine/ui/AuthenticationDialog.qml b/src/webengine/ui/AuthenticationDialog.qml index 6a703b7df6d3fb00c7182bd25347d79b1edca637..a7eedd14dcebc76161fb0ef761fdc288d66f7469 100644 --- a/src/webengine/ui/AuthenticationDialog.qml +++ b/src/webengine/ui/AuthenticationDialog.qml @@ -44,8 +44,8 @@ import QtQuick.Layouts 1.0 import QtQuick.Window 2.2 Window { - signal accepted(string user, string password); - signal rejected; + signal accepted(string user, string password) + signal rejected property alias text: message.text title: qsTr("Authentication Required") @@ -75,7 +75,7 @@ Window { anchors.margins: 4 property int doubleMargins: anchors.margins * 2 Text { - id: message; + id: message color: palette.windowText } GridLayout { @@ -88,7 +88,10 @@ Window { id: userField focus: true Layout.fillWidth: true - onAccepted: acceptDialog() + onAccepted: { + if (userField.text && passwordField.text) + acceptDialog(); + } } Label { text: qsTr("Password:") @@ -98,7 +101,10 @@ Window { id: passwordField Layout.fillWidth: true echoMode: TextInput.Password - onAccepted: acceptDialog() + onAccepted: { + if (userField.text && passwordField.text) + acceptDialog(); + } } } Item { diff --git a/src/webengine/ui/ColorDialog.qml b/src/webengine/ui/ColorDialog.qml index 04af954b927e503f13f848b6ab96f3a705dce4a7..b74fd2cd7deaf8ff99b3b6418c29224fb414834b 100644 --- a/src/webengine/ui/ColorDialog.qml +++ b/src/webengine/ui/ColorDialog.qml @@ -45,6 +45,6 @@ ColorDialog { signal selectedColor(var color) onAccepted: { - selectedColor(colorDialog.currentColor) + selectedColor(colorDialog.currentColor); } } diff --git a/src/webengine/ui/FilePicker.qml b/src/webengine/ui/FilePicker.qml index 07c8a3638359b9288340c494207a73c5ead3d07d..e6af977bad47e5b13b11e74421791ddbd5dc608e 100644 --- a/src/webengine/ui/FilePicker.qml +++ b/src/webengine/ui/FilePicker.qml @@ -41,7 +41,7 @@ import QtQuick.Dialogs 1.1 FileDialog { - signal filesSelected(var fileList); + signal filesSelected(var fileList) onAccepted: { filesSelected(fileUrls); diff --git a/src/webengine/ui/Menu.qml b/src/webengine/ui/Menu.qml index 8e07b771c6ad4aa36b1918460d3aa5ca601ce2c2..36efa7680ff0ff43408341892fd4569ac2e004ab 100644 --- a/src/webengine/ui/Menu.qml +++ b/src/webengine/ui/Menu.qml @@ -45,7 +45,7 @@ Controls.Menu { signal done() // Use private API for now - onAboutToHide: doneTimer.start(); + onAboutToHide: doneTimer.start() // WORKAROUND On Mac the Menu may be destroyed before the MenuItem // is actually triggered (see qtbase commit 08cc9b9991ae9ab51) diff --git a/src/webengine/ui/MessageBubble.qml b/src/webengine/ui/MessageBubble.qml index c43e464746f9b4ef2c574bd721e5df369c52e5e5..056aac1fe412dfc2f55403a8f5980e9822df2643 100644 --- a/src/webengine/ui/MessageBubble.qml +++ b/src/webengine/ui/MessageBubble.qml @@ -46,8 +46,8 @@ Item { height: 1 property int maxWidth: 0 - property string mainText: ""; - property string subText: ""; + property string mainText: "" + property string subText: "" property int border: 1 @@ -111,40 +111,40 @@ Item { property int messageBoxBottom: height - border onPaint: { - var ctx = getContext("2d") + var ctx = getContext("2d"); - ctx.lineWidth = bubble.border - ctx.strokeStyle = "#555" - ctx.fillStyle = "#ffffe1" + ctx.lineWidth = bubble.border; + ctx.strokeStyle = "#555"; + ctx.fillStyle = "#ffffe1"; - ctx.beginPath() + ctx.beginPath(); - ctx.moveTo(messageBoxLeft + cornerRadius, messageBoxTop) + ctx.moveTo(messageBoxLeft + cornerRadius, messageBoxTop); // Arrow - ctx.lineTo(messageBoxLeft + bubble.arrowOffset, messageBoxTop) - ctx.lineTo(messageBoxLeft + bubble.arrowOffset, messageBoxTop - bubble.arrowHeight) - ctx.lineTo(messageBoxLeft + bubble.arrowOffset + bubble.arrowWidth, messageBoxTop) + ctx.lineTo(messageBoxLeft + bubble.arrowOffset, messageBoxTop); + ctx.lineTo(messageBoxLeft + bubble.arrowOffset, messageBoxTop - bubble.arrowHeight); + ctx.lineTo(messageBoxLeft + bubble.arrowOffset + bubble.arrowWidth, messageBoxTop); // Message Box - ctx.lineTo(messageBoxRight - cornerRadius, messageBoxTop) - ctx.quadraticCurveTo(messageBoxRight, messageBoxTop, messageBoxRight, messageBoxTop + cornerRadius) - ctx.lineTo(messageBoxRight, messageBoxBottom - cornerRadius) - ctx.quadraticCurveTo(messageBoxRight, messageBoxBottom, messageBoxRight - cornerRadius, messageBoxBottom) - ctx.lineTo(messageBoxLeft + cornerRadius, messageBoxBottom) - ctx.quadraticCurveTo(messageBoxLeft, messageBoxBottom, messageBoxLeft, messageBoxBottom - cornerRadius) - ctx.lineTo(messageBoxLeft, messageBoxTop + cornerRadius) - ctx.quadraticCurveTo(messageBoxLeft, messageBoxTop, messageBoxLeft + cornerRadius, messageBoxTop) - - ctx.closePath() - - ctx.fill() - ctx.stroke() + ctx.lineTo(messageBoxRight - cornerRadius, messageBoxTop); + ctx.quadraticCurveTo(messageBoxRight, messageBoxTop, messageBoxRight, messageBoxTop + cornerRadius); + ctx.lineTo(messageBoxRight, messageBoxBottom - cornerRadius); + ctx.quadraticCurveTo(messageBoxRight, messageBoxBottom, messageBoxRight - cornerRadius, messageBoxBottom); + ctx.lineTo(messageBoxLeft + cornerRadius, messageBoxBottom); + ctx.quadraticCurveTo(messageBoxLeft, messageBoxBottom, messageBoxLeft, messageBoxBottom - cornerRadius); + ctx.lineTo(messageBoxLeft, messageBoxTop + cornerRadius); + ctx.quadraticCurveTo(messageBoxLeft, messageBoxTop, messageBoxLeft + cornerRadius, messageBoxTop); + + ctx.closePath(); + + ctx.fill(); + ctx.stroke(); } onPainted: { - bubble.width = bubbleCanvas.width - bubble.height = bubbleCanvas.height + bubble.width = bubbleCanvas.width; + bubble.height = bubbleCanvas.height; } } } diff --git a/src/webengine/ui/PromptDialog.qml b/src/webengine/ui/PromptDialog.qml index d9fc61cf80c946b923e1f96b293548b77646ac63..c4dcd6b98ca4c2aa769d0f39780a7f007f8e1831 100644 --- a/src/webengine/ui/PromptDialog.qml +++ b/src/webengine/ui/PromptDialog.qml @@ -43,11 +43,11 @@ import QtQuick.Layouts 1.0 import QtQuick 2.5 ApplicationWindow { - signal input(string text); - signal accepted; - signal rejected; - property alias text: message.text; - property alias prompt: field.text; + signal input(string text) + signal accepted + signal rejected + property alias text: message.text + property alias prompt: field.text width: 350 height: 100 @@ -62,30 +62,30 @@ ApplicationWindow { } ColumnLayout { - anchors.fill: parent; - anchors.margins: 4; + anchors.fill: parent + anchors.margins: 4 Text { - id: message; - Layout.fillWidth: true; + id: message + Layout.fillWidth: true } TextField { - id:field; - Layout.fillWidth: true; + id:field + Layout.fillWidth: true } RowLayout { Layout.alignment: Qt.AlignRight - spacing: 8; + spacing: 8 Button { - text: "OK" + text: qsTr("OK") onClicked: { - input(field.text) + input(field.text); accepted(); close(); destroy(); } } Button { - text: "Cancel" + text: qsTr("Cancel") onClicked: { rejected(); close(); diff --git a/src/webengine/ui/qmldir b/src/webengine/ui/qmldir index 69ebe1bad76326e0091d88233aa1832508c27845..e23b972be79e6d739c524dc84f496d4bd656c2c4 100644 --- a/src/webengine/ui/qmldir +++ b/src/webengine/ui/qmldir @@ -1,4 +1,4 @@ -module QtWebEngine.UIDelegates +module QtWebEngine.Controls1Delegates AlertDialog 1.0 AlertDialog.qml ConfirmDialog 1.0 ConfirmDialog.qml FilePicker 1.0 FilePicker.qml diff --git a/src/webengine/ui/ui.pro b/src/webengine/ui/ui.pro index 60dab61d616add1d65f62c822977c66d1302b09f..bce03cc0cfbd2f868d9a1f0617cf7a0b8a7a4664 100644 --- a/src/webengine/ui/ui.pro +++ b/src/webengine/ui/ui.pro @@ -1,4 +1,4 @@ -TARGETPATH = QtWebEngine/UIDelegates +TARGETPATH = QtWebEngine/Controls1Delegates QML_FILES += \ # Authentication Dialog diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 4ca4ba98cbd4d515c48abbdbcda16ecb1e2ee825..6896b850d1dd486fe2ce2e6b6c90214f7d412619 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -145,7 +145,7 @@ UIDelegatesManager::~UIDelegatesManager() bool UIDelegatesManager::initializeImportDirs(QStringList &dirs, QQmlEngine *engine) { foreach (const QString &path, engine->importPathList()) { - QFileInfo fi(path % QLatin1String("/QtWebEngine/UIDelegates/")); + QFileInfo fi(path % QLatin1String("/QtWebEngine/Controls1Delegates/")); if (fi.exists()) { dirs << fi.absolutePath(); return true; @@ -571,10 +571,10 @@ UI2DelegatesManager::UI2DelegatesManager(QQuickWebEngineView *view) : UIDelegate bool UI2DelegatesManager::initializeImportDirs(QStringList &dirs, QQmlEngine *engine) { foreach (const QString &path, engine->importPathList()) { - QFileInfo fi1(path % QLatin1String("/QtWebEngine/Controls2Delegates/")); - QFileInfo fi2(path % QLatin1String("/QtWebEngine/UIDelegates/")); + QFileInfo fi1(path % QLatin1String("/QtWebEngine/Controls1Delegates/")); + QFileInfo fi2(path % QLatin1String("/QtWebEngine/Controls2Delegates/")); if (fi1.exists() && fi2.exists()) { - dirs << fi1.absolutePath() << fi2.absolutePath(); + dirs << fi2.absolutePath() << fi1.absolutePath(); return true; } } diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml similarity index 100% rename from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml rename to tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml similarity index 100% rename from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml rename to tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/FilePicker.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml similarity index 100% rename from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/FilePicker.qml rename to tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/PromptDialog.qml b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml similarity index 100% rename from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/PromptDialog.qml rename to tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml diff --git a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/qmldir b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir similarity index 100% rename from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/qmldir rename to tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir