/*
-@version: 0.1
+@version: 0.2
@author: Sudheer K. <scifi1947 at gmail.com>
@license: GNU General Public License
*/
property bool updatePending: false
property bool displayIcons: true
property bool displayNavigation: false
+ property string targetContentType: "News"
property int componentHeight: toolbar.height
signal reloadButtonClicked
signal downButtonClicked
signal upButtonClicked
signal newsButtonClicked
+ signal stocksButtonClicked
BorderImage { source: "images/toolbar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
source: "images/reload.png"
width: 32; height: 32
anchors.centerIn: parent
+ smooth: true
NumberAnimation on rotation {
from: 0; to: 360; running: toolbar.updatePending == true; loops: Animation.Infinite; duration: 900
height: parent.height
anchors.right: parent.horizontalCenter; anchors.horizontalCenterOffset: -60;
color: "#00000000"
- visible: (toolbar.displayIcons && toolbar.displayNavigation)
+ visible: toolbar.displayNavigation
Image {
id: downButton
height: parent.height
anchors.left: parent.horizontalCenter; anchors.horizontalCenterOffset: 60;
color: "#00000000"
- visible: (toolbar.displayIcons && toolbar.displayNavigation)
+ visible: toolbar.displayNavigation
Image {
id: upButton
}
}
-
-
- Rectangle {
- id: newsButtonArea
+ Loader {
+ id: contentIconLoader
width: 60
height: parent.height
anchors.right: parent.right
- color: "#00000000"
visible: toolbar.displayIcons
+ sourceComponent: targetContentType == "News"? newsButtonComponent:stocksButtonComponent
+ }
- Image {
- id: newsButton
- source: "images/news.png"
- width: 32; height: 32
- anchors.centerIn: parent
- }
- MouseArea{
- id: newsButtonMouseArea
- anchors.fill: parent
- onClicked: toolbar.newsButtonClicked()
- }
+ Component {
+ id: newsButtonComponent
- states: State {
- name: "pressed"; when: newsButtonMouseArea.pressed
- PropertyChanges { target: newsButtonArea; color: "#9a9a9a"}
+ Rectangle {
+ id: newsButtonArea
+ anchors.fill: parent
+ color: "#00000000"
+
+ Image {
+ id: newsButton
+ source: "images/tab_news.png"
+ width: 32; height: 32
+ anchors.centerIn: parent
+ }
+
+ MouseArea{
+ id: newsButtonMouseArea
+ anchors.fill: parent
+ onClicked: toolbar.newsButtonClicked()
+ }
+
+ states: State {
+ name: "pressed"; when: newsButtonMouseArea.pressed
+ PropertyChanges { target: newsButtonArea; color: "#9a9a9a"}
+ }
}
}
+ Component{
+ id: stocksButtonComponent
+ Rectangle {
+ id: stocksButtonArea
+ anchors.fill: parent
+ color: "#00000000"
+
+ Image {
+ id: stocksButton
+ source: "images/tab_stocks.png"
+ width: 32; height: 32
+ anchors.centerIn: parent
+ }
+
+ MouseArea{
+ id: stocksButtonMouseArea
+ anchors.fill: parent
+ onClicked: toolbar.stocksButtonClicked()
+ }
+
+ states: State {
+ name: "pressed"; when: stocksButtonMouseArea.pressed
+ PropertyChanges { target: stocksButtonArea; color: "#9a9a9a"}
+ }
+ }
+ }
}