0.9 beta 3 - Added features to qml interface (dbus, edit mode...)
[feedingit] / src / qml / common / ToolBar.qml
1 import Qt 4.7
2
3 Item {
4     id: toolbar
5
6     property alias menuLabel: menuButton.text
7     property alias backLabel: backButton.text
8     property alias prevLabel: prevButton.text
9     property alias nextLabel: nextButton.text
10     property alias markAllLabel: markAllButton.text
11     property alias zoomLabel: zoomButton.text
12     property alias taskSwitcherLabel: taskSwitcherButton.text
13
14     property alias backVisible: backButton.visible
15     property alias nextVisible: nextButton.visible
16     property alias prevVisible: prevButton.visible
17     property alias markAllVisible: markAllButton.visible
18     property alias zoomVisible: zoomButton.visible
19     property alias quitVisible: quitButton.visible
20     property alias addVisible: addButton.visible
21     property alias updateVisible: updateFeedButton.visible
22
23     property bool feedUpdating: false
24
25     signal menuClicked
26     signal backClicked
27     signal prevClicked
28     signal nextClicked
29     signal markAllClicked
30     signal zoomClicked
31     signal taskSwitcherClicked
32     signal addClicked
33     signal updateClicked
34     //signal rotateClicked
35
36     //BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
37     Rectangle {
38         anchors.fill: parent; color: "#343434";
39         border.color: "black"
40         gradient: Gradient {
41             GradientStop {
42                 position: 0.00;
43                 color: "#343434";
44             }
45             GradientStop {
46                 position: 1.00;
47                 color: "#ffffff";
48             }
49         }
50
51         Row {
52             anchors.fill: parent
53             Button {
54                 id: taskSwitcherButton
55                 /*anchors.left: parent.left;*/ anchors.leftMargin: 5; y: 3; width: 116; height: 60
56                 onClicked: toolbar.taskSwitcherClicked()
57                 imageSource: "images/wmTaskLauncherIcon.png"
58             }
59
60             Button {
61                 id: menuButton
62                 /*anchors.left: taskSwitcherButton.right;*/ anchors.leftMargin: 5; y: 3; width: 60; height: 60
63                 onClicked: toolbar.menuClicked()
64                 imageSource: "images/wmEditIcon.png"
65             }
66
67             Button {
68                 id: addButton
69                 visible: true; /*anchors.left: menuButton.right;*/
70                 anchors.rightMargin: 5; y: 3; width: 60; height: 60
71                 onClicked: toolbar.addClicked()
72                 imageSource: "images/plus.png"
73
74             }
75
76             Button {
77                 id: updateFeedButton
78                 visible: false; /*anchors.left: menuButton.right;*/
79                 anchors.rightMargin: 5; y: 3; width: 60; height: 60
80                 onClicked: toolbar.updateClicked()
81                 //imageSource: (!feedUpdating) ? "images/rotate.png" : "images/loading.png"
82                 NumberAnimation on iconRotation {
83                     from: 0; to: 360; running: (visible == true) && (feedUpdating); loops: Animation.Infinite; duration: 900
84                 }
85                 state: "update"
86                 states : [State {name: "loading"; when: (feedUpdating);
87                         PropertyChanges {target: updateFeedButton; imageSource: "images/loading.png" }
88                     }, State { name: "update"; when: (!feedUpdating);
89                         PropertyChanges {target: updateFeedButton; iconRotation: 0}
90                         PropertyChanges {target: updateFeedButton; imageSource: "images/rotate.png"}
91                     }
92                 ]
93             }
94
95             Button {
96                 id: markAllButton
97                 visible: false
98                 /*anchors.left: updateFeedButton.right;*/ anchors.rightMargin: 5; y: 3; width: 60; height: 60
99                 onClicked: toolbar.markAllClicked()
100                 imageSource: "images/checkmark.png"
101             }
102
103             Button {
104                 id: prevButton
105                 visible: false
106                 /*anchors.left: menuButton.right;*/ anchors.rightMargin: 5; y: 3; width: 120; height: 60
107                 onClicked: toolbar.prevClicked()
108                 imageSource: "images/InputMethodShiftButtonNormal.png"
109                 imageRotation: -90;
110             }
111
112             Button {
113                 id: zoomButton
114                 visible: false
115                 /*anchors.right: backButton.left; */anchors.rightMargin: 5; y: 3; width: 80; height: 60
116                 onClicked: toolbar.zoomClicked()
117                 imageSource: "images/Zoom-In-icon.png"
118             }
119
120             Button {
121                 id: nextButton
122                 visible: false
123                 /*anchors.right: zoomButton.left;*/ anchors.rightMargin: 5; y: 3; width: 120; height: 60
124                 onClicked: toolbar.nextClicked()
125                 imageSource: "images/InputMethodShiftButtonNormal.png"
126                 imageRotation: 90
127             }
128
129             Button {
130                 id: backButton
131                 anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 116; height: 60
132                 onClicked: toolbar.backClicked()
133                 imageSource: "images/wmBackIcon.png"
134             }
135
136             Button {
137                 id: quitButton
138                 visible: false
139                 anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 116; height: 60
140                 onClicked: toolbar.backClicked()
141                 imageSource: "images/wmCloseIcon.png"
142             }
143         }
144     }
145 }