Commit 632cfe08 authored by Chupligin Sergey's avatar Chupligin Sergey

[dialogs] Update QueryDialog and QueryDialog Example

parent d46caed4
...@@ -42,14 +42,55 @@ Page { ...@@ -42,14 +42,55 @@ Page {
headerTools: HeaderToolsLayout { showBackButton: true; title: qsTr("Query dialog example") } headerTools: HeaderToolsLayout { showBackButton: true; title: qsTr("Query dialog example") }
Image {
id: bgImage
source: "/usr/share/glacier-components/images/example.jpg"
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
}
Button {
id: standartButton
anchors{
top: parent.top
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Standart dialog")
onClicked: {
deleteDialog.inline = false
deleteDialog.visible = true
standartButton.visible = false
inlineButton.visible = false
}
}
Button {
id: inlineButton
anchors{
top: standartButton.bottom
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Inline dialog")
onClicked: {
deleteDialog.inline = true
deleteDialog.visible = true
standartButton.visible = false
inlineButton.visible = false
}
}
QueryDialog { QueryDialog {
id: deleteDialog
visible: false
cancelText: qsTr("Cancel") cancelText: qsTr("Cancel")
acceptText: qsTr("Delete") acceptText: qsTr("Delete")
headingText: qsTr("Are you sure you want to delete this?") headingText: qsTr("Are you sure you want to delete this?")
subLabelText: qsTr("Do you want to continue?") subLabelText: qsTr("Do you want to continue?")
icon: "image://theme/trash" icon: "image://theme/trash"
image: "/usr/share/glacier-components/images/example.jpg"
onAccepted: { onAccepted: {
result.text = qsTr("User accepted") result.text = qsTr("User accepted")
...@@ -57,6 +98,11 @@ Page { ...@@ -57,6 +98,11 @@ Page {
onCanceled: { onCanceled: {
result.text = qsTr("User canceled") result.text = qsTr("User canceled")
} }
onSelected: {
standartButton.visible = true
inlineButton.visible = true
visible = false
}
} }
Label { Label {
id: result id: result
......
...@@ -24,7 +24,8 @@ QML_FILES += \ ...@@ -24,7 +24,8 @@ QML_FILES += \
qml/GlacierRollerItem.qml \ qml/GlacierRollerItem.qml \
qml/InverseMouseArea.qml \ qml/InverseMouseArea.qml \
qml/IconButton.qml \ qml/IconButton.qml \
qml/DatePicker.qml qml/DatePicker.qml \
qml/dialogs/QueryDialog.qml
OTHER_FILES += qmldir \ OTHER_FILES += qmldir \
$$QML_FILES $$QML_FILES
...@@ -59,7 +60,11 @@ qmlfiles.files = $$_PRO_FILE_PWD_/qml/*.qml ...@@ -59,7 +60,11 @@ qmlfiles.files = $$_PRO_FILE_PWD_/qml/*.qml
qmlfiles.files += $$_PRO_FILE_PWD_/qml/qmldir qmlfiles.files += $$_PRO_FILE_PWD_/qml/qmldir
qmlfiles.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH qmlfiles.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
dialogs.files = $$_PRO_FILE_PWD_/qml/dialogs/*.qml
dialogs.files += $$_PRO_FILE_PWD_/qml/dialogs/qmldir
dialogs.path = $$[QT_INSTALL_QML]/Nemo/Dialogs
images.files = $$_PRO_FILE_PWD_/images images.files = $$_PRO_FILE_PWD_/images
images.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH images.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
INSTALLS += target qmlfiles images INSTALLS += target qmlfiles images dialogs
...@@ -6,25 +6,19 @@ Item { ...@@ -6,25 +6,19 @@ Item {
anchors.fill: parent anchors.fill: parent
signal accepted() signal accepted()
signal canceled() signal canceled()
signal selected()
property alias cancelText: cancel.text property alias cancelText: cancel.text
property alias acceptText: accept.text property alias acceptText: accept.text
property alias headingText: heading.text property alias headingText: heading.text
property alias subLabelText: subLabel.text property alias subLabelText: subLabel.text
property string icon: "" property string icon: ""
property string image: "" property bool inline: true
Image{
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: shell.image
visible: shell.image != ""
}
Rectangle { Rectangle {
id: shadow id: shadow
width: parent.width width: parent.width
height: (shell.image != "" && shell.icon == "") ? (parent.height-cancel.height)/3 : parent.height-cancel.height height: inline ? (parent.height-cancel.height)/3 : parent.height-cancel.height
opacity: 0.65 opacity: 0.65
color: Theme.backgroundColor color: Theme.backgroundColor
anchors.bottom: cancel.top anchors.bottom: cancel.top
...@@ -40,7 +34,7 @@ Item { ...@@ -40,7 +34,7 @@ Item {
topMargin: Theme.itemSpacingHuge topMargin: Theme.itemSpacingHuge
horizontalCenter: shell.horizontalCenter horizontalCenter: shell.horizontalCenter
} }
visible: shell.icon != "" visible: shell.icon != "" && !inline
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
} }
...@@ -48,11 +42,11 @@ Item { ...@@ -48,11 +42,11 @@ Item {
id: heading id: heading
width: parent.width*0.95 width: parent.width*0.95
anchors{ anchors{
centerIn: (shell.image != "" && shell.icon == "") ? shadow : parent centerIn: inline ? shadow : parent
} }
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
font.weight: Theme.fontWeightLarge font.weight: Theme.fontWeightLarge
font.pixelSize: (shell.image != "" && shell.icon == "") ? Theme.fontSizeTiny : Theme.fontSizeSmall font.pixelSize: inline ? Theme.fontSizeTiny : Theme.fontSizeSmall
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
...@@ -61,11 +55,11 @@ Item { ...@@ -61,11 +55,11 @@ Item {
width: parent.width*0.95 width: parent.width*0.95
wrapMode: Text.Wrap wrapMode: Text.Wrap
font.weight: Theme.fontWeightMedium font.weight: Theme.fontWeightMedium
font.pixelSize: (shell.image != "" && shell.icon == "") ? Theme.fontSizeTiny : Theme.fontSizeSmall font.pixelSize: inline ? Theme.fontSizeTiny : Theme.fontSizeSmall
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
anchors { anchors {
top:heading.bottom top:heading.bottom
topMargin: (shell.image != "" && shell.icon == "") ? Theme.itemSpacingSmall : Theme.itemSpacingLarge topMargin: inline ? Theme.itemSpacingSmall : Theme.itemSpacingLarge
horizontalCenter: shell.horizontalCenter horizontalCenter: shell.horizontalCenter
} }
} }
...@@ -80,7 +74,7 @@ Item { ...@@ -80,7 +74,7 @@ Item {
} }
onClicked: { onClicked: {
shell.canceled() shell.canceled()
shell.destroy() shell.selected()
} }
} }
Button { Button {
...@@ -94,7 +88,7 @@ Item { ...@@ -94,7 +88,7 @@ Item {
} }
onClicked: { onClicked: {
shell.accepted() shell.accepted()
shell.destroy() shell.selected()
} }
} }
} }
TEMPLATE = lib
TARGET = nemouxdialogs
PLUGIN_IMPORT_PATH = Nemo/Dialogs
qmlfiles.files = qmldir
qmlfiles.files += *.qml
qmlfiles.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
DISTFILES += \
qmldir \
QueryDialog.qml
INSTALLS += qmlfiles
...@@ -3,4 +3,3 @@ TEMPLATE = subdirs ...@@ -3,4 +3,3 @@ TEMPLATE = subdirs
SUBDIRS += controls SUBDIRS += controls
SUBDIRS += styles SUBDIRS += styles
SUBDIRS += models SUBDIRS += models
SUBDIRS += dialogs
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment