Adding wip version for meego harmattan
[feedingit] / psa_harmattan / feedingit / 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 nextVisible: nextButton.visible
15     property alias prevVisible: prevButton.visible
16     property alias markAllVisible: markAllButton.visible
17     property alias zoomVisible: zoomButton.visible
18     property alias quitVisible: quitButton.visible
19     property alias addVisible: addButton.visible
20     property alias updateVisible: updateFeedButton.visible
21
22     property bool feedUpdating: false
23
24     signal menuClicked
25     signal backClicked
26     signal prevClicked
27     signal nextClicked
28     signal markAllClicked
29     signal zoomClicked
30     signal taskSwitcherClicked
31     signal addClicked
32     signal updateClicked
33     //signal rotateClicked
34
35     //BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
36     Rectangle {
37         anchors.fill: parent; color: "#343434";
38         border.color: "black"
39         gradient: Gradient {
40             GradientStop {
41                 position: 0.00;
42                 color: "#343434";
43             }
44             GradientStop {
45                 position: 1.00;
46                 color: "#ffffff";
47             }
48         }
49
50         Row {
51             anchors.fill: parent
52             Button {
53                 id: taskSwitcherButton
54                 /*anchors.left: parent.left;*/ anchors.leftMargin: 5; y: 3; width: 116; height: 60
55                 onClicked: toolbar.taskSwitcherClicked()
56                 imageSource: "images/wmTaskLauncherIcon.png"
57                 visible: false
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/loading2.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.rightMargin: 5; y: 3; width: 116; height: 60
132                 anchors.right: parent.right
133                 onClicked: toolbar.backClicked()
134                 imageSource: "images/wmBackIcon.png"
135                 visible: !quitButton.visible
136             }
137
138             Button {
139                 id: quitButton
140                 visible: false
141                 anchors.rightMargin: 5; y: 3; width: 116; height: 60
142                 anchors.right: parent.right
143                 onClicked: toolbar.backClicked()
144                 imageSource: "images/wmCloseIcon.png"
145             }
146         }
147     }
148 }