Changeset View
Changeset View
Standalone View
Standalone View
src/activities/money/MoneyCore.qml
Show All 14 Lines | |||||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | 17 | * GNU General Public License for more details. | ||
18 | * | 18 | * | ||
19 | * You should have received a copy of the GNU General Public License | 19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. | 20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. | ||
21 | */ | 21 | */ | ||
22 | import QtQuick 2.6 | 22 | import QtQuick 2.6 | ||
23 | import GCompris 1.0 | ||||
23 | 24 | | |||
24 | import "../../core" | 25 | import "../../core" | ||
25 | import "money.js" as Activity | 26 | import "money.js" as Activity | ||
26 | 27 | | |||
27 | ActivityBase { | 28 | ActivityBase { | ||
28 | id: activity | 29 | id: activity | ||
29 | 30 | | |||
30 | onStart: focus = true | 31 | onStart: focus = true | ||
31 | onStop: {} | 32 | onStop: {} | ||
32 | 33 | | |||
33 | property var dataset | 34 | property var dataset | ||
34 | 35 | | |||
35 | pageComponent: Image { | 36 | pageComponent: Image { | ||
36 | id: background | 37 | id: background | ||
37 | anchors.fill: parent | 38 | anchors.fill: parent | ||
38 | source: Activity.url + "/background.svg" | 39 | source: Activity.url + "/background.svg" | ||
39 | sourceSize.width: parent.width | 40 | sourceSize.width: parent.width | ||
40 | signal start | 41 | signal start | ||
41 | signal stop | 42 | signal stop | ||
42 | 43 | | |||
43 | Component.onCompleted: { | 44 | Component.onCompleted: { | ||
45 | dialogActivityConfig.initialize() | ||||
44 | activity.start.connect(start) | 46 | activity.start.connect(start) | ||
45 | activity.stop.connect(stop) | 47 | activity.stop.connect(stop) | ||
46 | } | 48 | } | ||
47 | 49 | | |||
48 | // Add here the QML items you need to access in javascript | 50 | // Add here the QML items you need to access in javascript | ||
49 | QtObject { | 51 | QtObject { | ||
50 | id: items | 52 | id: items | ||
51 | property Item main: activity.main | 53 | property Item main: activity.main | ||
52 | property alias background: background | 54 | property alias background: background | ||
53 | property GCSfx audioEffects: activity.audioEffects | 55 | property GCSfx audioEffects: activity.audioEffects | ||
54 | property alias answerModel: answerArea.pocketModel | 56 | property alias answerModel: answerArea.pocketModel | ||
55 | property alias pocketModel: pocketArea.pocketModel | 57 | property alias pocketModel: pocketArea.pocketModel | ||
56 | property alias store: store | 58 | property alias store: store | ||
57 | property alias instructions: instructions | 59 | property alias instructions: instructions | ||
58 | property alias tux: tux | 60 | property alias tux: tux | ||
59 | property var levels: activity.datasetLoader.item.data | 61 | property var levels: activity.datasetLoader.item.data | ||
60 | property alias tuxMoney: tuxMoney | 62 | property alias tuxMoney: tuxMoney | ||
61 | property alias bar: bar | 63 | property alias bar: bar | ||
62 | property alias bonus: bonus | 64 | property alias bonus: bonus | ||
63 | property int itemIndex | 65 | property int itemIndex | ||
64 | property int pocketRows | 66 | property int pocketRows | ||
65 | property var verticalOrientation: background.height > background.width - bar.height | 67 | property var verticalOrientation: background.height > background.width - bar.height | ||
jjazeix: bool? | |||||
66 | property var selectedArea | 68 | property var selectedArea | ||
67 | property alias pocket: pocketArea.answer | 69 | property alias pocket: pocketArea.answer | ||
68 | property alias answer: answerArea.answer | 70 | property alias answer: answerArea.answer | ||
69 | } | 71 | } | ||
70 | 72 | | |||
71 | onStart: { Activity.start(items, dataset) } | 73 | onStart: { Activity.start(items, dataset) } | ||
72 | onStop: { Activity.stop() } | 74 | onStop: { Activity.stop() } | ||
73 | 75 | | |||
▲ Show 20 Lines • Show All 169 Lines • ▼ Show 20 Line(s) | 244 | if(items.itemIndex > 0) | |||
243 | items.itemIndex-- | 245 | items.itemIndex-- | ||
244 | } | 246 | } | ||
245 | } | 247 | } | ||
246 | 248 | | |||
247 | if(items.selectedArea.count !== 0 && items.itemIndex !== -1) | 249 | if(items.selectedArea.count !== 0 && items.itemIndex !== -1) | ||
248 | items.selectedArea.itemAt(items.itemIndex).selected = true | 250 | items.selectedArea.itemAt(items.itemIndex).selected = true | ||
249 | } | 251 | } | ||
250 | 252 | | |||
253 | DialogChooseLevel { | ||||
254 | id: dialogActivityConfig | ||||
255 | currentActivity: activity.activityInfo | ||||
256 | | ||||
257 | onSaveData: { | ||||
258 | levelFolder = dialogActivityConfig.chosenLevel | ||||
259 | currentActivity.currentLevel = dialogActivityConfig.chosenLevel | ||||
260 | ApplicationSettings.setCurrentLevel(currentActivity.name, dialogActivityConfig.chosenLevel) | ||||
261 | home() | ||||
262 | } | ||||
263 | onClose: { | ||||
264 | home() | ||||
265 | } | ||||
266 | onStartActivity: { | ||||
267 | background.start() | ||||
268 | } | ||||
269 | } | ||||
270 | | ||||
251 | DialogHelp { | 271 | DialogHelp { | ||
252 | id: dialogHelp | 272 | id: dialogHelp | ||
253 | onClose: home() | 273 | onClose: home() | ||
254 | } | 274 | } | ||
255 | 275 | | |||
256 | Bar { | 276 | Bar { | ||
257 | id: bar | 277 | id: bar | ||
258 | content: BarEnumContent { value: help | home | level } | 278 | content: BarEnumContent { value: help | home | level | activityConfig } | ||
259 | onHelpClicked: { | 279 | onHelpClicked: { | ||
260 | displayDialog(dialogHelp) | 280 | displayDialog(dialogHelp) | ||
261 | } | 281 | } | ||
282 | onActivityConfigClicked: { | ||||
283 | displayDialog(dialogActivityConfig) | ||||
284 | } | ||||
262 | onPreviousLevelClicked: Activity.previousLevel() | 285 | onPreviousLevelClicked: Activity.previousLevel() | ||
263 | onNextLevelClicked: Activity.nextLevel() | 286 | onNextLevelClicked: Activity.nextLevel() | ||
264 | onHomeClicked: activity.home() | 287 | onHomeClicked: activity.home() | ||
265 | } | 288 | } | ||
266 | 289 | | |||
267 | Bonus { | 290 | Bonus { | ||
268 | id: bonus | 291 | id: bonus | ||
269 | Component.onCompleted: win.connect(Activity.nextLevel) | 292 | Component.onCompleted: win.connect(Activity.nextLevel) | ||
270 | } | 293 | } | ||
271 | } | 294 | } | ||
272 | 295 | | |||
273 | } | 296 | } |
bool?