Skip to content

Commit

Permalink
elimu-ai#62, adding images, and removing text from quit dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
diegowald committed Jun 24, 2017
1 parent 3774044 commit 29a48dd
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 11 deletions.
3 changes: 3 additions & 0 deletions VoltAir/VoltAir.pro
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,6 @@ RESOURCES += \
resources/voltair.qrc

cache()

DISTFILES += \
qml/ui/VoltairImage.qml
Binary file added VoltAir/assets/images/UI/exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added VoltAir/assets/images/UI/no.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added VoltAir/assets/images/UI/yes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions VoltAir/qml/Ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,13 @@ UiInternal {
height: 0.6 * parent.height
anchors.centerIn: parent

questionText: TR.value("quit.question")
cancelText: TR.value("no")
confirmText: TR.value("yes")
//questionText: TR.value("quit.question")
questionIcon: Util.getPathToImage("UI/exit.png")
cancelSelectedIconSource: Util.getPathToImage("UI/no.png")
cancelUnselectedIconSource: Util.getPathToImage("UI/no.png")

confirmSelectedIconSource: Util.getPathToImage("UI/yes.png")
confirmUnselectedIconSource: Util.getPathToImage("UI/yes.png")

onHideCompleted: {
if (root.state == "PAUSE_MENU") {
Expand Down
32 changes: 24 additions & 8 deletions VoltAir/qml/ui/ConfirmDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,26 @@ UiComponent {
/**
* @brief Question to ask the user to confirm whether they want to perform the action or not.
*/
property string questionText
//property string questionText//
property string questionIcon

/**
* @brief type:string Text that indicates to the user that the action should not be performed.
*/
property alias cancelText: cancelButton.buttonText
//property alias cancelText: cancelButton.buttonText//
//property string cancelText//

property alias cancelUnselectedIconSource: cancelButton.unselectedIconSource
property alias cancelSelectedIconSource: cancelButton.selectedIconSource

/**
* @brief type:string Text that indicates to the user that the action should be performed.
*/
property alias confirmText: confirmButton.buttonText
//property alias confirmText: confirmButton.buttonText
//property string confirmText

property alias confirmUnselectedIconSource: confirmButton.unselectedIconSource
property alias confirmSelectedIconSource: confirmButton.selectedIconSource

/**
* @brief Emitted when the cancel button is activated.
Expand Down Expand Up @@ -91,8 +102,9 @@ UiComponent {
id: frame
anchors.fill: parent

VoltAirText {
id: question

VoltairImage {
id: questionImage

anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
Expand All @@ -101,10 +113,10 @@ UiComponent {
width: 0.8 * parent.width
height: 0.3 * parent.height

textElement.text: questionText
sourceImage: questionIcon
}

MenuButton {
MenuIcon {
id: cancelButton

anchors.left: parent.left
Expand All @@ -124,7 +136,7 @@ UiComponent {
}
}

MenuButton {
MenuIcon {
id: confirmButton

anchors.right: parent.right
Expand All @@ -137,10 +149,14 @@ UiComponent {

focusLeft: cancelButton

unselectedIconSource: Util.getPathToImage("UI/back.png")
selectedIconSource: Util.getPathToImage("UI/back_h.png")

onReleased: {
root.confirmed()
}
}

}

onEscaped: {
Expand Down
54 changes: 54 additions & 0 deletions VoltAir/qml/ui/VoltairImage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import QtGraphicalEffects 1.0
import QtQuick 2.0
import VoltAir 1.0

/**
* @ingroup QQuickItem
* @brief Container for Image with default style settings and a drop shadow.
*/

Item {
id: root

property string sourceImage

/**
* @brief type:Text Reference to the internal @c Text element that is used by this VoltAirText.
*/
//property alias textElement: text
/**
* @brief type:DropShadow Reference to the internal @c DropShadow element that is used by this VoltAirText.
*/
property alias dropShadow: dropShadow

FontLoader {
id: voltAirFont
source: Util.getPathToFont("AndikaLowerCase-Regular_5dp.ttf")
}

Image {
id: image
source: sourceImage

anchors.fill: parent

verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter

fillMode: Image.PreserveAspectFit
}

DropShadow {
id: dropShadow

anchors.fill: image
source: image

horizontalOffset: 1
verticalOffset: 2
radius: 6.0
spread: 0.6
samples: 16
color: "white"
}
}

0 comments on commit 29a48dd

Please sign in to comment.