~popey/stock-ticker-mobile-app/fix-1288885

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* Copyght 2013 Robert Edward Steckroth II <RobertSteckroth@gmail.com> Bust0ut, Surgemcgee

* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem

Item {
    id: sortRect
    height: units.gu(2)
    width: parent.width
    Row {
        width: parent.width
        height: parent.height
        Item {
            width: Math.floor(parent.width * .48)
            height: parent.height
            UbuntuShape {
                id: sortNameIcon
                color: "#E0E0E0"
                smooth: true
                gradientColor: "#DCDCDC"
                width: units.gu(6)
                height: parent.height
                x: 30
                Label {
                    anchors.centerIn: parent
                    text: i18n.tr("Title")
                    fontSize: "small"
                    color: "#3A3A3A"
                }
                MouseArea {
                    property string acsdesLocal: acsdes
                    anchors.fill: parent
                    onClicked: {
                        animateOpacityName.start()
                        sortModel(currentStocksList, "Name", acsdesLocal) // acsdesLocal is ascending or descending
                        acsdesLocal === "up" ? acsdesLocal = "down" : acsdesLocal = "up" // We can't use boolean in our loaclStorage (It is hard to evaluate a successfull call).
                    }
                }
            }
            NumberAnimation { id: animateOpacityName; target: sortNameIcon; properties: "opacity"; from: 0.29; to: 1.0; duration: 100 }
        }
        Item {
            width: Math.floor(parent.width * .26)-dummyTextWidth/2 // Subtract the percent sign width we get in Stock_component_main
            height: parent.height
            UbuntuShape {
                id: sortPriceIcon
                color: "#E0E0E0"
                gradientColor: "#DCDCDC"
                smooth: true
                width: units.gu(6)
                height: parent.height
                Label {
                    anchors.centerIn: parent
                    text: i18n.tr("Trading")
                    fontSize: "small"
                    color: "#3A3A3A"
                }
                MouseArea {
                    property string acsdesLocal: acsdes
                    anchors.fill: parent
                    onClicked: {
                        animateOpacityPrice.start()
                        sortModel(currentStocksList, "Price", acsdesLocal) // acsdesLocal is ascending or descending
                        acsdesLocal === "up" ? acsdesLocal = "down" : acsdesLocal = "up" // We can't use boolean in our loaclStorage (It is hard to evaluate a successfull call).
                    }
                }
            }
            NumberAnimation { id: animateOpacityPrice; target: sortPriceIcon; properties: "opacity"; from: 0.29; to: 1.0; duration: 100 }
        }
        Item {
            width: Math.floor(parent.width * .26)
            height: sortRect.height
            UbuntuShape {
                id: sortChangedIcon
                smooth: true
                color: "#E0E0E0"
                gradientColor: "#DCDCDC"
                width: units.gu(6)
                height: sortRect.height
                anchors.right: parent.right
                Label {
                    anchors.centerIn: parent
                    text: i18n.tr("Change")
                    fontSize: "small"
                    color: "#3A3A3A"
                }
                MouseArea {
                    property string acsdesLocal: acsdes
                    anchors.fill: parent
                    onClicked: {
                        animateOpacityChanged.start()
                        sortModel(currentStocksList, "Changed", acsdesLocal) // acsdesLocal is ascending or descending
                        acsdesLocal === "up" ? acsdesLocal = "down" : acsdesLocal = "up" // We can't use boolean in our loaclStorage (It is hard to evaluate a successfull call).
                    }
                }
            }
            NumberAnimation { id: animateOpacityChanged; target: sortChangedIcon; properties: "opacity"; from: 0.29; to: 1.0; duration: 100 }
        }
    }
}