summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2016-07-06 13:55:31 +0200
committerMichal Klocek <michal.klocek@qt.io>2016-10-04 11:50:43 +0000
commit33348994de656361942456834ac0c719ff5d87b8 (patch)
treebe9dd0c863d7a87575183d7484f5fad9cc830e4c
parent7f763e5fd0ba5481040d08f97034fec0dac61236 (diff)
Clean up qt quick controls 1 dialogs
Based on code review for qqc2 integration, apply cleanup changes to qqc1. Change-Id: I9752ce944385a529a1d999a5419638868e18d799 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--src/webengine/ui/AuthenticationDialog.qml16
-rw-r--r--src/webengine/ui/ColorDialog.qml2
-rw-r--r--src/webengine/ui/FilePicker.qml2
-rw-r--r--src/webengine/ui/Menu.qml2
-rw-r--r--src/webengine/ui/MessageBubble.qml52
-rw-r--r--src/webengine/ui/PromptDialog.qml30
-rw-r--r--src/webengine/ui/qmldir2
-rw-r--r--src/webengine/ui/ui.pro2
-rw-r--r--src/webengine/ui_delegates_manager.cpp8
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/AlertDialog.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/ConfirmDialog.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/FilePicker.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/FilePicker.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/PromptDialog.qml (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/PromptDialog.qml)0
-rw-r--r--tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir (renamed from tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/qmldir)0
14 files changed, 61 insertions, 55 deletions
diff --git a/src/webengine/ui/AuthenticationDialog.qml b/src/webengine/ui/AuthenticationDialog.qml
index 6a703b7df..a7eedd14d 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 04af954b9..b74fd2cd7 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 07c8a3638..e6af977ba 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 8e07b771c..36efa7680 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 c43e46474..056aac1fe 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 d9fc61cf8..c4dcd6b98 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 69ebe1bad..e23b972be 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 60dab61d6..bce03cc0c 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 4ca4ba98c..6896b850d 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
index 4ba3be4b9..4ba3be4b9 100644
--- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/AlertDialog.qml
+++ b/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
index 9933fc2f7..9933fc2f7 100644
--- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/ConfirmDialog.qml
+++ b/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
index 5d78807df..5d78807df 100644
--- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/FilePicker.qml
+++ b/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
index 7c5b16eab..7c5b16eab 100644
--- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/PromptDialog.qml
+++ b/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
index cf8ac0512..cf8ac0512 100644
--- a/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/UIDelegates/qmldir
+++ b/tests/auto/quick/qmltests/mock-delegates/QtWebEngine/Controls1Delegates/qmldir