1
by Robert Steckroth
Initial commit of the Stock Ticker app to Launchpad |
1 |
/* Copyright 2013 Robert Edward Steckroth II <RobertSteckroth@gmail.com> Bust0ut, Surgemcgee
|
2 |
||
3 |
* This program is free software; you can redistribute it and/or modify
|
|
4 |
* it under the terms of the GNU Lesser General Public License as published by
|
|
5 |
* the Free Software Foundation; version 3.
|
|
6 |
*
|
|
7 |
* This program is distributed in the hope that it will be useful,
|
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
* GNU Lesser General Public License for more details.
|
|
11 |
*
|
|
12 |
* You should have received a copy of the GNU Lesser General Public License
|
|
13 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
14 |
*/
|
|
15 |
||
16 |
import QtQuick 2.0 |
|
17 |
import Ubuntu.Components 0.1 |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
18 |
import Ubuntu.Components.ListItems 0.1 as ListItem |
1
by Robert Steckroth
Initial commit of the Stock Ticker app to Launchpad |
19 |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
20 |
ListItem.Empty { |
1
by Robert Steckroth
Initial commit of the Stock Ticker app to Launchpad |
21 |
id: addMainRect
|
22 |
width: parent.width |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
23 |
height: children[0].height+10 |
24 |
// color: (typeof allStocksList.get(index) !== "undefined" && allStocksList.get(index).isCurrent) ? index % 2 === 0 ? "#8ba3cb" : "#a3b5d4" : (index % 2) ? "#d5c18b" : "#decea4"
|
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
25 |
Item { |
26 |
id: addStockComponent
|
|
27 |
width: parent.width |
|
28 |
height: childrenRect.height |
|
29 |
Column { |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
30 |
width: parent.width |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
31 |
Row { |
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
32 |
width: parent.width |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
33 |
Item { |
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
34 |
//color: "yellow"
|
35 |
width: Math.floor(parent.width * .39) |
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
36 |
height: childrenRect.height |
37 |
Text { |
|
34
by Robert Steckroth
Added stock add test. Added tab switch test. Added open toolbar test |
38 |
objectName: "companyNameText" |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
39 |
text: i18n.tr(cmpy_name.substr(0, 13)) |
40 |
font.bold: true |
|
41 |
font.pixelSize: FontUtils.sizeToPixels("medium") |
|
52
by Robert Steckroth
More work to management design. |
42 |
color: isCurrent ? "#1A0F04" : "#8D4F11" |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
43 |
}
|
44 |
}
|
|
45 |
Item { |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
46 |
// color: "blue"
|
47 |
width: Math.floor(parent.width * .20) |
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
48 |
height: childrenRect.height |
49 |
Text { |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
50 |
anchors.right: parent.right |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
51 |
text: i18n.tr(getPrice(price, close, open)) |
52 |
font.bold: true |
|
53 |
font.pixelSize: FontUtils.sizeToPixels("medium") |
|
54 |
color: "#202020" |
|
55 |
}
|
|
56 |
}
|
|
57 |
Item { |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
58 |
// color: "orange"
|
59 |
width: Math.floor(parent.width * .20) |
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
60 |
height: childrenRect.height |
61 |
Text { |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
62 |
anchors.right: parent.right |
63 |
text: i18n.tr(getChangedAmount(close, getPrice(price, close, open), priceFormat)+(priceFormat === "%" ? "%" : " ")) // PriceFormat is a global and is altererd with |
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
64 |
font.pixelSize: FontUtils.sizeToPixels("medium") |
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
65 |
color: { |
66 |
if ( getChangedAmount(close, getPrice(price, close, open), 'goNegative') < 0 ) "#631308" |
|
67 |
else if ( getChangedAmount(close, getPrice(price, close, open), 'goNegative') > 0 ) "#0D5006" |
|
68 |
else "black" |
|
69 |
}
|
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
70 |
}
|
71 |
MouseArea { |
|
72 |
anchors.fill: parent |
|
73 |
onClicked: { |
|
52
by Robert Steckroth
More work to management design. |
74 |
currentStocksList.setProperty(index, "priceFormat", priceFormat === "%" ? "$" : "%") |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
75 |
}
|
76 |
}
|
|
77 |
}
|
|
78 |
Item { |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
79 |
// color: "purple"
|
51
by Robert Steckroth
Added sub tabs tests. Switched to a more coherent management design. |
80 |
objectName: "removeButton" |
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
81 |
width: Math.floor(parent.width * .21) |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
82 |
height: childrenRect.height |
83 |
Text { |
|
51
by Robert Steckroth
Added sub tabs tests. Switched to a more coherent management design. |
84 |
objectName: "removeButtonText" |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
85 |
id: addRemoveButton
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
86 |
anchors.horizontalCenter: parent.horizontalCenter |
52
by Robert Steckroth
More work to management design. |
87 |
text: i18n.tr("Remove") |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
88 |
font.pixelSize: FontUtils.sizeToPixels("medium") |
52
by Robert Steckroth
More work to management design. |
89 |
color: "Blue" |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
90 |
}
|
91 |
MouseArea { |
|
92 |
anchors.fill: parent |
|
93 |
onClicked: { |
|
24
by Robert Steckroth
Added Ubuntu SDK listItems to main view. Fixed some todo's |
94 |
log("Removed Stock") |
51
by Robert Steckroth
Added sub tabs tests. Switched to a more coherent management design. |
95 |
currentStocksList.remove(index) |
96 |
current_index = index == currentPage.mainViewCurrent.currentIndex && (currentPage.mainViewCurrent.currentIndex-1 || currentPage.mainViewCurrent.currentIndex+1) |
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
97 |
currentPage.mainViewCurrent.currentIndex = current_index |
98 |
currentPage.mainViewCurrent.positionViewAtIndex(current_index, currentStocksList) |
|
52
by Robert Steckroth
More work to management design. |
99 |
sortModel(currentStocksList) |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
100 |
}
|
1
by Robert Steckroth
Initial commit of the Stock Ticker app to Launchpad |
101 |
}
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
102 |
}
|
103 |
}
|
|
104 |
Row { |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
105 |
width: parent.width |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
106 |
Item { |
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
107 |
// color: "lightblue"
|
108 |
width: Math.round(parent.width * .22) |
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
109 |
height: childrenRect.height |
52
by Robert Steckroth
More work to management design. |
110 |
Text { |
111 |
text: i18n.tr("("+tick+")") |
|
1
by Robert Steckroth
Initial commit of the Stock Ticker app to Launchpad |
112 |
font.bold: false |
113 |
font.letterSpacing: -1 |
|
2
by Robert Steckroth
Removed scale font mechinism from project. |
114 |
font.pixelSize: FontUtils.sizeToPixels("medium") |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
115 |
color: "#202020" |
52
by Robert Steckroth
More work to management design. |
116 |
}
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
117 |
}
|
118 |
Item { |
|
25
by Robert Steckroth
Fix to graph date printing. Update to design. |
119 |
// color: "red"
|
120 |
width: Math.round(parent.width * .33) |
|
121 |
height: childrenRect.height |
|
122 |
Text { |
|
123 |
text: i18n.tr("open: "+open) |
|
124 |
font.bold: false |
|
125 |
//font.letterSpacing: -1
|
|
126 |
font.pixelSize: FontUtils.sizeToPixels("medium") |
|
127 |
color: "#202020" |
|
128 |
}
|
|
129 |
}
|
|
130 |
Item { |
|
131 |
// color: "pink"
|
|
132 |
width: Math.round(parent.width * .45) |
|
133 |
height: childrenRect.height |
|
134 |
Text { |
|
135 |
anchors.horizontalCenter: parent.horizontalCenter |
|
136 |
text: i18n.tr("prev close: "+close) |
|
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
137 |
font.bold: false |
1
by Robert Steckroth
Initial commit of the Stock Ticker app to Launchpad |
138 |
//font.letterSpacing: -1
|
2
by Robert Steckroth
Removed scale font mechinism from project. |
139 |
font.pixelSize: FontUtils.sizeToPixels("medium") |
21
by Robert Steckroth
smarter model float rounding. Management page is formated. |
140 |
color: "#202020" |
141 |
}
|
|
142 |
}
|
|
143 |
}
|
|
144 |
}
|
|
145 |
}
|
|
1
by Robert Steckroth
Initial commit of the Stock Ticker app to Launchpad |
146 |
}
|
147 |
||
148 |
||
149 |
||
150 |
||
151 |