Changeset View
Changeset View
Standalone View
Standalone View
src/activities/money/MoneyCore.qml
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 49 | QtObject { | |||
---|---|---|---|---|---|
51 | property Item main: activity.main | 51 | property Item main: activity.main | ||
52 | property alias background: background | 52 | property alias background: background | ||
53 | property GCSfx audioEffects: activity.audioEffects | 53 | property GCSfx audioEffects: activity.audioEffects | ||
54 | property alias answerModel: answerArea.pocketModel | 54 | property alias answerModel: answerArea.pocketModel | ||
55 | property alias pocketModel: pocketArea.pocketModel | 55 | property alias pocketModel: pocketArea.pocketModel | ||
56 | property alias store: store | 56 | property alias store: store | ||
57 | property alias instructions: instructions | 57 | property alias instructions: instructions | ||
58 | property alias tux: tux | 58 | property alias tux: tux | ||
59 | property var levels: activity.datasetLoader.item.data | ||||
59 | property alias tuxMoney: tuxMoney | 60 | property alias tuxMoney: tuxMoney | ||
60 | property alias bar: bar | 61 | property alias bar: bar | ||
61 | property alias bonus: bonus | 62 | property alias bonus: bonus | ||
62 | property int itemIndex | 63 | property int itemIndex | ||
64 | property int pocketRows | ||||
65 | property var verticalOrientation: background.height > background.width - bar.height | ||||
jjazeix: bool? | |||||
63 | property var selectedArea | 66 | property var selectedArea | ||
64 | property alias pocket: pocketArea.answer | 67 | property alias pocket: pocketArea.answer | ||
65 | property alias answer: answerArea.answer | 68 | property alias answer: answerArea.answer | ||
66 | } | 69 | } | ||
67 | 70 | | |||
68 | onStart: { Activity.start(items, dataset) } | 71 | onStart: { Activity.start(items, dataset) } | ||
69 | onStop: { Activity.stop() } | 72 | onStop: { Activity.stop() } | ||
70 | 73 | | |||
71 | Column { | 74 | Column { | ||
72 | id: columnLayout | 75 | id: columnLayout | ||
73 | spacing: 10 | 76 | spacing: 10 | ||
74 | x: parent.width * 0.05 | 77 | x: parent.width * 0.05 | ||
75 | y: parent.height * 0.05 | 78 | y: parent.height * 0.05 | ||
76 | width: parent.width * 0.9 | 79 | width: parent.width * 0.9 | ||
77 | 80 | | |||
78 | property int nbColumns: 5 | 81 | property int nbColumns: 5 | ||
79 | property int nbLines: 2 | 82 | property int nbLines: (items.verticalOrientation) ? items.pocketRows + 1 : items.pocketRows | ||
80 | property int itemWidth: | 83 | property int itemWidth: | ||
81 | Math.min(width / nbColumns - 10 - 10 / nbColumns, | 84 | Math.min(width / nbColumns - 10 - 10 / nbColumns, | ||
82 | parent.height * 0.4 / nbLines - 10 - 10 / nbLines) | 85 | parent.height * 0.4 / nbLines - 10 - 10 / nbLines) | ||
83 | property int itemHeight: itemWidth * 0.59 | 86 | property int itemHeight: itemWidth * 0.59 | ||
84 | 87 | | |||
85 | // === The Answer Area === | 88 | // === The Answer Area === | ||
86 | MoneyArea { | 89 | MoneyArea { | ||
87 | id: answerArea | 90 | id: answerArea | ||
88 | onTransaction: Activity.unpay(index) | 91 | onTransaction: Activity.unpay(index) | ||
89 | } | 92 | } | ||
90 | 93 | | |||
91 | // === The Store Area === | 94 | // === The Store Area === | ||
92 | property int nbStoreColumns: activity.dataset === "BACK_WITHOUT_CENTS" || | 95 | property int nbStoreColumns: activity.dataset === "BACK_WITHOUT_CENTS" || | ||
93 | activity.dataset === "BACK_WITH_CENTS" ? store.model.length + 1 : store.model.length | 96 | activity.dataset === "BACK_WITH_CENTS" ? store.model.length + 1 : store.model.length | ||
94 | //tempSpace is a workaround to replace instructionsArea.realHeight that is freezing with Qt-5.9.1 | 97 | //tempSpace is a workaround to replace instructionsArea.realHeight that is freezing with Qt-5.9.1 | ||
95 | property int tempSpace: bar.level === 1 ? 140 + columnLayout.spacing : 0 | 98 | property int tempSpace: bar.level === 1 ? 140 + columnLayout.spacing : 0 | ||
96 | property int itemStoreWidth: | 99 | property int itemStoreWidth: | ||
97 | Math.min((columnLayout.width - storeAreaFlow.spacing * nbStoreColumns) / nbStoreColumns, | 100 | Math.min((columnLayout.width - storeAreaFlow.spacing * nbStoreColumns) / nbStoreColumns, | ||
98 | (parent.height - answerArea.height - | 101 | (parent.height - answerArea.height - | ||
99 | pocketArea.height - bar.height) * 0.8) - tempSpace | 102 | pocketArea.height - bar.height) * 0.8) - tempSpace | ||
100 | property int itemStoreHeight: itemStoreWidth | 103 | property int itemStoreHeight: itemStoreWidth | ||
101 | 104 | | |||
102 | Rectangle { | 105 | Rectangle { | ||
103 | id: storeArea | 106 | id: storeArea | ||
104 | height: (columnLayout.itemStoreHeight + 10) | 107 | height: columnLayout.itemStoreHeight + 10 | ||
105 | width: columnLayout.width | 108 | width: columnLayout.width | ||
106 | color: "#55333333" | 109 | color: "#55333333" | ||
107 | border.color: "black" | 110 | border.color: "black" | ||
108 | border.width: 2 | 111 | border.width: 2 | ||
109 | radius: 5 | 112 | radius: 5 | ||
110 | | ||||
111 | Flow { | 113 | Flow { | ||
112 | id: storeAreaFlow | 114 | id: storeAreaFlow | ||
113 | anchors.topMargin: 4 | 115 | anchors.topMargin: 4 | ||
114 | anchors.bottomMargin: 4 | 116 | anchors.bottomMargin: 4 | ||
115 | anchors.leftMargin: 20 | 117 | anchors.leftMargin: 20 | ||
116 | anchors.rightMargin: 20 | 118 | anchors.rightMargin: 20 | ||
117 | anchors.fill: parent | 119 | anchors.fill: parent | ||
118 | spacing: 40 | 120 | spacing: 40 | ||
Show All 11 Lines | 130 | Image { | |||
130 | visible: activity.dataset === "BACK_WITHOUT_CENTS" || | 132 | visible: activity.dataset === "BACK_WITHOUT_CENTS" || | ||
131 | activity.dataset === "BACK_WITH_CENTS" | 133 | activity.dataset === "BACK_WITH_CENTS" | ||
132 | source: Activity.url + "/tux.svg" | 134 | source: Activity.url + "/tux.svg" | ||
133 | sourceSize.height: columnLayout.itemStoreHeight | 135 | sourceSize.height: columnLayout.itemStoreHeight | ||
134 | sourceSize.width: columnLayout.itemStoreHeight | 136 | sourceSize.width: columnLayout.itemStoreHeight | ||
135 | Repeater { | 137 | Repeater { | ||
136 | id: tuxMoney | 138 | id: tuxMoney | ||
137 | Image { | 139 | Image { | ||
138 | source: Activity.url + modelData.img | 140 | source: modelData.img | ||
139 | sourceSize.height: columnLayout.itemStoreHeight * 0.4 | 141 | sourceSize.height: columnLayout.itemStoreHeight * 0.3 | ||
140 | x: tux.x + index * 20 | 142 | x: tux.x + index * 50 | ||
141 | y: tux.y + tux.height / 2 + index * 20 | 143 | y: tux.y + tux.height / 2 + index * 20 | ||
142 | } | 144 | } | ||
143 | } | 145 | } | ||
144 | } | 146 | } | ||
145 | 147 | | |||
146 | Repeater { | 148 | Repeater { | ||
147 | id: store | 149 | id: store | ||
148 | Image { | 150 | Image { | ||
149 | source: Activity.url + modelData.img | 151 | source: modelData.img | ||
150 | sourceSize.height: columnLayout.itemStoreHeight | 152 | sourceSize.height: columnLayout.itemStoreHeight | ||
151 | sourceSize.width: columnLayout.itemStoreHeight | 153 | sourceSize.width: columnLayout.itemStoreHeight | ||
152 | GCText { | 154 | GCText { | ||
153 | text: modelData.price | 155 | text: modelData.price | ||
154 | fontSize: 16 | 156 | fontSize: 16 | ||
155 | font.weight: Font.DemiBold | 157 | font.weight: Font.DemiBold | ||
156 | style: Text.Outline | 158 | style: Text.Outline | ||
157 | styleColor: "black" | 159 | styleColor: "black" | ||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |
bool?