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

[dialogs] Update QueryDialog and QueryDialog Example

parent d46caed4
......@@ -42,14 +42,55 @@ Page {
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 {
id: deleteDialog
visible: false
cancelText: qsTr("Cancel")
acceptText: qsTr("Delete")
headingText: qsTr("Are you sure you want to delete this?")
subLabelText: qsTr("Do you want to continue?")
icon: "image://theme/trash"
image: "/usr/share/glacier-components/images/example.jpg"
onAccepted: {
result.text = qsTr("User accepted")
......@@ -57,6 +98,11 @@ Page {
onCanceled: {
result.text = qsTr("User canceled")
}
onSelected: {
standartButton.visible = true
inlineButton.visible = true
visible = false
}
}
Label {
id: result
......
......@@ -24,7 +24,8 @@ QML_FILES += \
qml/GlacierRollerItem.qml \
qml/InverseMouseArea.qml \
qml/IconButton.qml \
qml/DatePicker.qml
qml/DatePicker.qml \
qml/dialogs/QueryDialog.qml
OTHER_FILES += qmldir \
$$QML_FILES
......@@ -59,7 +60,11 @@ qmlfiles.files = $$_PRO_FILE_PWD_/qml/*.qml
qmlfiles.files += $$_PRO_FILE_PWD_/qml/qmldir
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.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
INSTALLS += target qmlfiles images
INSTALLS += target qmlfiles images dialogs
......@@ -6,25 +6,19 @@ Item {
anchors.fill: parent
signal accepted()
signal canceled()
signal selected()
property alias cancelText: cancel.text
property alias acceptText: accept.text
property alias headingText: heading.text
property alias subLabelText: subLabel.text
property string icon: ""
property string image: ""
Image{
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: shell.image
visible: shell.image != ""
}
property bool inline: true
Rectangle {
id: shadow
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
color: Theme.backgroundColor
anchors.bottom: cancel.top
......@@ -40,7 +34,7 @@ Item {
topMargin: Theme.itemSpacingHuge
horizontalCenter: shell.horizontalCenter
}
visible: shell.icon != ""
visible: shell.icon != "" && !inline
fillMode: Image.PreserveAspectCrop
}
......@@ -48,11 +42,11 @@ Item {
id: heading
width: parent.width*0.95
anchors{
centerIn: (shell.image != "" && shell.icon == "") ? shadow : parent
centerIn: inline ? shadow : parent
}
horizontalAlignment: Text.AlignHCenter
font.weight: Theme.fontWeightLarge
font.pixelSize: (shell.image != "" && shell.icon == "") ? Theme.fontSizeTiny : Theme.fontSizeSmall
font.pixelSize: inline ? Theme.fontSizeTiny : Theme.fontSizeSmall
wrapMode: Text.Wrap
}
......@@ -61,11 +55,11 @@ Item {
width: parent.width*0.95
wrapMode: Text.Wrap
font.weight: Theme.fontWeightMedium
font.pixelSize: (shell.image != "" && shell.icon == "") ? Theme.fontSizeTiny : Theme.fontSizeSmall
font.pixelSize: inline ? Theme.fontSizeTiny : Theme.fontSizeSmall
horizontalAlignment: Text.AlignHCenter
anchors {
top:heading.bottom
topMargin: (shell.image != "" && shell.icon == "") ? Theme.itemSpacingSmall : Theme.itemSpacingLarge
topMargin: inline ? Theme.itemSpacingSmall : Theme.itemSpacingLarge
horizontalCenter: shell.horizontalCenter
}
}
......@@ -80,7 +74,7 @@ Item {
}
onClicked: {
shell.canceled()
shell.destroy()
shell.selected()
}
}
Button {
......@@ -94,7 +88,7 @@ Item {
}
onClicked: {
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
SUBDIRS += controls
SUBDIRS += styles
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