Skip to content

Commit

Permalink
Merge pull request #61 from neochapay/5.3.3
Browse files Browse the repository at this point in the history
5.3.3
  • Loading branch information
locusf authored Apr 10, 2018
2 parents c2c387f + 3480e53 commit 0102218
Show file tree
Hide file tree
Showing 16 changed files with 698 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,51 @@ Page {
fillMode: Image.PreserveAspectCrop
}

ListModel {
id: animalsModel
ListElement { name: "Ant"; }
ListElement { name: "Flea"; }
ListElement { name: "Parrot"; }
ListElement { name: "Guinea pig"; }
ListElement { name: "Rat"; }
ListElement { name: "Butterfly"; }
ListElement { name: "Dog"; }
ListElement { name: "Cat"; }
ListElement { name: "Pony"; }
ListElement { name: "Koala"; }
ListElement { name: "Horse"; }
ListElement { name: "Tiger"; }
ListElement { name: "Giraffe"; }
ListElement { name: "Elephant"; }
ListElement { name: "Whale"; }
}

function hideButton(){
standartButton.visible = false
inlineButton.visible = false
simpleButton.visible = false
selectionButton.visible = false
}

function showButton(){
standartButton.visible = true
inlineButton.visible = true
simpleButton.visible = true
selectionButton.visible = true
}

Button {
id: standartButton
anchors{
top: parent.top
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Standart dialog")
text: qsTr("Standart query dialog")
onClicked: {
deleteDialog.inline = false
deleteDialog.visible = true
standartButton.visible = false
inlineButton.visible = false
deleteDialog.open()
hideButton();
}
}

Expand All @@ -72,15 +104,72 @@ Page {
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Inline dialog")
text: qsTr("Inline query dialog")
onClicked: {
deleteDialog.inline = true
deleteDialog.visible = true
standartButton.visible = false
inlineButton.visible = false
deleteDialog.open()
hideButton();
}
}

Button {
id: simpleButton
anchors{
top: inlineButton.bottom
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Simple dialog")
onClicked: {
hideButton();
simpleDialog.open();
}
}

Button {
id: selectionButton
anchors{
top: inlineButton.bottom
margins: 20
horizontalCenter: parent.horizontalCenter
}
text: qsTr("Selection dialog")
onClicked: {
hideButton();
selectionDialog.open();
}
}

Dialog{
id: simpleDialog
acceptText: qsTr("Ok")
headingText: qsTr("Simple dialog")
subLabelText: qsTr("Simple diaolg is open")

inline: false

icon: "image://theme/exclamation-triangle"

onAccepted: {
showButton();
simpleDialog.close();
}
}

SelectionDialog{
id: selectionDialog
visible: false

cancelText: qsTr("Cancel")
acceptText: qsTr("Ok")
headingText: qsTr("Select you favorite animal?")
subLabelText: qsTr("")

model: animalsModel

onSelectedIndexChanged: selectionDialog.close()
}

QueryDialog {
id: deleteDialog
visible: false
Expand All @@ -99,11 +188,11 @@ Page {
result.text = qsTr("User canceled")
}
onSelected: {
standartButton.visible = true
inlineButton.visible = true
visible = false
showButton();
deleteDialog.close()
}
}

Label {
id: result
anchors.centerIn: parent
Expand Down
1 change: 1 addition & 0 deletions examples/touch/content/LiveCoding.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Layouts 1.0

Page {
Expand Down
54 changes: 54 additions & 0 deletions examples/touch/content/TimePickerPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/****************************************************************************************
**
** Copyright (C) 2018 Chupligin Sergey <[email protected]>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/

import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0


Page {
id: root

headerTools: HeaderToolsLayout {
showBackButton: true;
title: qsTr("Time Picker")
}

Column {
spacing: Theme.itemSpacingLarge*2
width: parent.width
TimePicker{
width: parent.width-Theme.itemSpacingLarge*2
readOnly: false
}
}
}
8 changes: 6 additions & 2 deletions examples/touch/glacier-components.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ ApplicationWindow {
title: "DatePicker"
page: "content/DatePickerPage.qml"
}
ListElement {
title: "TimePicker"
page: "content/TimePickerPage.qml"
}
ListElement {
title: "Tabs"
page: "content/TabBarPage.qml"
Expand Down Expand Up @@ -118,8 +122,8 @@ ApplicationWindow {
page: "content/ButtonRowPage.qml"
}
ListElement {
title: "Query Dialog"
page: "content/QueryDialogPage.qml"
title: "Dialogs"
page: "content/DialogsPage.qml"
}
ListElement {
title: "Icons"
Expand Down
4 changes: 4 additions & 0 deletions examples/touch/touch.pro
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ qml.files += \
content/SelectRollerPage.qml \
content/IconPage.qml \
content/DatePickerPage.qml \
content/TimePickerPage.qml \
content/NotificationsPage.qml

qml.path = /usr/share/glacier-components/qml/content
Expand All @@ -44,3 +45,6 @@ INSTALLS += desktop target qml mainqml images

SOURCES += \
src/main.cpp

DISTFILES += \
content/TimePickerPage.qml
6 changes: 4 additions & 2 deletions src/controls/controls.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ QML_FILES += \
qml/Label.qml \
qml/Checkbox.qml\
qml/ButtonRow.qml \
qml/QueryDialog.qml \
qml/Header.qml \
qml/HeaderToolsLayout.qml \
qml/Slider.qml\
Expand All @@ -25,9 +24,12 @@ QML_FILES += \
qml/InverseMouseArea.qml \
qml/IconButton.qml \
qml/DatePicker.qml \
qml/TimePicker.qml \
qml/ScrollDecorator.qml \
qml/dialogs/QueryDialog.qml \
qml/TextField.qml
qml/TextField.qml \
qml/dialogs/SelectionDialog.qml \
qml/dialogs/Dialog.qml

OTHER_FILES += qmldir \
$$QML_FILES
Expand Down
68 changes: 68 additions & 0 deletions src/controls/qml/QueryDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import QtQuick 2.6

Item {
id: shell
anchors.fill: parent
signal accepted()
signal canceled()
property alias cancelText: cancel.text
property alias acceptText: accept.text
property alias headingText: heading.text
property alias subLabelText: subLabel.text


Rectangle {
anchors.fill: parent
opacity: 0.65
color: Theme.backgroundColor

}
Label {
width: parent.width*0.8
id: heading
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
font.weight: Theme.fontWeightLarge
wrapMode: Text.Wrap
}
Label {
id:subLabel
width: parent.width*0.8
wrapMode: Text.Wrap
font.weight: Theme.fontWeightMedium
horizontalAlignment: Text.AlignHCenter
anchors {
top:heading.bottom
topMargin: Theme.itemSpacingLarge
horizontalCenter: shell.horizontalCenter
}
}

Button {
id: cancel
width: parent.width / 2
height: Theme.itemHeightLarge
anchors {
left: parent.left
bottom: parent.bottom
}
onClicked: {
shell.canceled()
shell.destroy()
}
}
Button {
id: accept
width: parent.width / 2
height: Theme.itemHeightLarge
primary: true
anchors {
left: cancel.right
bottom: parent.bottom
}
onClicked: {
shell.accepted()
shell.destroy()
}
}
}
Loading

0 comments on commit 0102218

Please sign in to comment.