Changeset View
Changeset View
Standalone View
Standalone View
src/activities/menu/Menu.qml
Show First 20 Lines • Show All 473 Lines • ▼ Show 20 Line(s) | 456 | GridView { | |||
---|---|---|---|---|---|
474 | model: ActivityInfoTree.menuTree | 474 | model: ActivityInfoTree.menuTree | ||
475 | keyNavigationWraps: true | 475 | keyNavigationWraps: true | ||
476 | property int spacing: 10 | 476 | property int spacing: 10 | ||
477 | 477 | | |||
478 | delegate: Item { | 478 | delegate: Item { | ||
479 | id: delegateItem | 479 | id: delegateItem | ||
480 | width: activityCellWidth - activitiesGrid.spacing | 480 | width: activityCellWidth - activitiesGrid.spacing | ||
481 | height: activityCellHeight - activitiesGrid.spacing | 481 | height: activityCellHeight - activitiesGrid.spacing | ||
482 | enabled: clickMode === "play" || currentLevel != "" | 482 | enabled: clickMode === "play" || dialogChooseLevel.hasConfigOrDataset | ||
483 | Rectangle { | 483 | Rectangle { | ||
484 | id: activityBackground | 484 | id: activityBackground | ||
485 | width: parent.width | 485 | width: parent.width | ||
486 | height: parent.height | 486 | height: parent.height | ||
487 | anchors.horizontalCenter: parent.horizontalCenter | 487 | anchors.horizontalCenter: parent.horizontalCenter | ||
488 | color: "white" | 488 | color: "white" | ||
489 | opacity: 0.5 | 489 | opacity: 0.5 | ||
490 | } | 490 | } | ||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 568 | Image { | |||
577 | MouseArea { | 577 | MouseArea { | ||
578 | anchors.fill: parent | 578 | anchors.fill: parent | ||
579 | onClicked: favorite = !favorite | 579 | onClicked: favorite = !favorite | ||
580 | } | 580 | } | ||
581 | } | 581 | } | ||
582 | 582 | | |||
583 | DialogChooseLevel { | 583 | DialogChooseLevel { | ||
584 | id: dialogChooseLevel | 584 | id: dialogChooseLevel | ||
585 | displayDatasetAtStart: hasDataset | ||||
586 | currentActivity: ActivityInfoTree.menuTree[index] | ||||
585 | onClose: { | 587 | onClose: { | ||
586 | home() | 588 | home() | ||
587 | } | 589 | } | ||
588 | onSaveData: { | 590 | onSaveData: { | ||
589 | currentLevel = dialogChooseLevel.chosenLevel | 591 | currentLevel = dialogChooseLevel.chosenLevel | ||
590 | ApplicationSettings.setCurrentLevel(name, currentLevel) | 592 | ApplicationSettings.setCurrentLevel(name, currentLevel) | ||
591 | } | 593 | } | ||
592 | onStartActivity: { | 594 | onStartActivity: { | ||
593 | clickMode = "play" | 595 | clickMode = "play" | ||
596 | // immediately pop the Dialog to load the activity | ||||
597 | // if we don't do it immediately the page is busy | ||||
598 | // and it does not load the activity | ||||
599 | pageView.pop({immediate: true}) | ||||
594 | selectCurrentItem() | 600 | selectCurrentItem() | ||
595 | } | 601 | } | ||
596 | } | 602 | } | ||
597 | 603 | | |||
598 | function selectCurrentItem() { | 604 | function selectCurrentItem() { | ||
599 | if(pageView.busy || !delegateItem.enabled) | 605 | if(pageView.busy || !delegateItem.enabled) | ||
600 | return | 606 | return | ||
601 | 607 | | |||
602 | if(clickMode == "play") { | 608 | if(clickMode == "play") { | ||
603 | particles.burst(50) | 609 | particles.burst(50) | ||
604 | ActivityInfoTree.currentActivity = ActivityInfoTree.menuTree[index] | 610 | ActivityInfoTree.currentActivity = ActivityInfoTree.menuTree[index] | ||
605 | activityLoader.setSource("qrc:/gcompris/src/activities/" + ActivityInfoTree.currentActivity.name, | 611 | activityLoader.setSource("qrc:/gcompris/src/activities/" + ActivityInfoTree.currentActivity.name, | ||
606 | { | 612 | { | ||
607 | 'menu': activity, | 613 | 'menu': activity, | ||
608 | 'activityInfo': ActivityInfoTree.currentActivity, | 614 | 'activityInfo': ActivityInfoTree.currentActivity, | ||
609 | 'levelFolder': currentLevel | 615 | 'levelFolder': currentLevel | ||
610 | }) | 616 | }) | ||
611 | if (activityLoader.status == Loader.Ready) loadActivity() | 617 | if (activityLoader.status == Loader.Ready) loadActivity() | ||
612 | } | 618 | } | ||
613 | else { | 619 | else { | ||
614 | dialogChooseLevel.currentActivity = ActivityInfoTree.menuTree[index] | | |||
615 | displayDialog(dialogChooseLevel); | 620 | displayDialog(dialogChooseLevel); | ||
616 | } | 621 | } | ||
617 | } | 622 | } | ||
618 | } | 623 | } | ||
619 | highlight: Rectangle { | 624 | highlight: Rectangle { | ||
620 | width: activityCellWidth - activitiesGrid.spacing | 625 | width: activityCellWidth - activitiesGrid.spacing | ||
621 | height: activityCellHeight - activitiesGrid.spacing | 626 | height: activityCellHeight - activitiesGrid.spacing | ||
622 | color: "#AAFFFFFF" | 627 | color: "#AAFFFFFF" | ||
▲ Show 20 Lines • Show All 268 Lines • Show Last 20 Lines |