0.9.3-1 release
[ubi] / qml / ubi / components / Mask.qml
1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
2 import "../UIConstants.js" as Const
3
4 Item {
5     id: root
6
7     state: "idle"
8
9     signal clicked()
10
11     onStateChanged: {
12         if(root.state=="busy") {
13             busy.running = true;
14         } else {
15             busy.running = false;
16         }
17
18         if(root.state=="idle") {
19             systemBar.state = "active";
20         } else {
21             systemBar.state = "inactive";
22         }
23     }
24
25     Rectangle {
26         id: mask
27         anchors.fill: root
28         color: "black"
29         opacity: 0
30
31         Text {
32             id: label
33             color: Const.DEFAULT_FOREGROUND_COLOR
34             anchors.centerIn: parent
35             font.pixelSize: Const.DEFAULT_FONT_PIXEL_SIZE
36         }
37
38         BusyIndicator {
39             id: busy
40             anchors.centerIn: parent
41             running: true
42             visible: root.state=="busy"
43         }
44
45         MouseArea {
46             id: maskMouseArea
47             anchors.fill: parent
48             enabled: root.state=="defocused"
49             onClicked: {
50                 root.clicked();
51             }
52         }
53     }
54
55     states: [
56         State {
57             name: "defocused"
58             PropertyChanges { target: mask; opacity: 0.6 }
59         },
60         State {
61             name: "idle"
62             PropertyChanges { target: mask; opacity: 0 }
63             PropertyChanges { target: label; text: "" }
64         },
65         State {
66             name: "busy"
67             PropertyChanges { target: mask; opacity: 0.6 }
68             PropertyChanges { target: label; text: "" }
69         },
70         State {
71             name: "dialog"
72             PropertyChanges { target: mask; opacity: 0.6 }
73             PropertyChanges { target: label; text: "" }
74         }
75
76     ]
77
78     transitions: Transition {
79         NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
80     }
81 }