Warning, /education/gcompris/src/activities/learn_decimals/Learn_decimals.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - learn_decimals.qml 0002 * 0003 * SPDX-FileCopyrightText: 2021 Mariam Fahmy <mariamfahmy66@gmail.com> 0004 * 0005 * Authors: 0006 * Mariam Fahmy <mariamfahmy66@gmail.com> 0007 * Timothée Giet <animtim@gmail.com> 0008 * 0009 * SPDX-License-Identifier: GPL-3.0-or-later 0010 */ 0011 import QtQuick 2.12 0012 import GCompris 1.0 0013 import "../../core" 0014 import "learn_decimals.js" as Activity 0015 import "qrc:/gcompris/src/core/core.js" as Core 0016 0017 0018 ActivityBase { 0019 id: activity 0020 0021 onStart: focus = true 0022 onStop: {} 0023 0024 property bool isSubtractionMode: false 0025 property bool isAdditionMode: false 0026 property bool isQuantityMode: false 0027 0028 pageComponent: Image { 0029 id: background 0030 source: "qrc:/gcompris/src/activities/braille_fun/resource/hillside.svg" 0031 sourceSize.width: width 0032 sourceSize.height: height 0033 fillMode: Image.PreserveAspectCrop 0034 0035 property bool horizontalLayout: background.width >= background.height 0036 property bool scoreAtBottom: bar.width * 9 < background.width 0037 0038 signal start 0039 signal stop 0040 0041 Component.onCompleted: { 0042 dialogActivityConfig.initialize() 0043 activity.start.connect(start) 0044 activity.stop.connect(stop) 0045 } 0046 0047 // Needed to get keyboard focus on Tutorial 0048 Keys.forwardTo: tutorialSection 0049 0050 // Add here the QML items you need to access in javascript 0051 QtObject { 0052 id: items 0053 property Item main: activity.main 0054 property bool isSubtractionMode: activity.isSubtractionMode 0055 property bool isAdditionMode: activity.isAdditionMode 0056 property bool isQuantityMode: activity.isQuantityMode 0057 property alias background: background 0058 property GCSfx audioEffects: activity.audioEffects 0059 property int currentLevel: activity.currentLevel 0060 property alias bonus: bonus 0061 property alias score: score 0062 property alias numpad: numpad 0063 readonly property var levels: activity.datasetLoader.data 0064 property alias draggedItems: draggedItems 0065 property alias droppedItems: droppedItems 0066 property alias largestNumberRepresentation: largestNumberRepresentation 0067 property alias tutorialImage: tutorialImage 0068 property alias scrollBar: bottomRectangle.scrollBar 0069 property alias errorRectangle: errorRectangle 0070 property string largestNumber 0071 property string smallestNumber 0072 property bool helper: false 0073 property bool typeResult: false 0074 property double unit: activity.isQuantityMode ? 1 : 0.1 0075 property bool buttonsBlocked: false 0076 } 0077 0078 onStart: { 0079 Activity.start(items) 0080 } 0081 onStop: { 0082 timer.stop() 0083 Activity.stop() 0084 } 0085 0086 // Tutorial section starts 0087 Image { 0088 id: tutorialImage 0089 source: "qrc:/gcompris/src/activities/guesscount/resource/backgroundW01.svg" 0090 anchors.fill: parent 0091 visible: true 0092 z: 5 0093 Tutorial { 0094 id: tutorialSection 0095 useImage: false 0096 tutorialDetails: isSubtractionMode ? Activity.subtractionInstructions : 0097 isAdditionMode ? Activity.additionInstructions : 0098 isQuantityMode ? Activity.quantityInstructions : 0099 Activity.tutorialInstructions 0100 onSkipPressed: { 0101 Activity.initLevel() 0102 tutorialImage.visible = false 0103 } 0104 } 0105 } 0106 // Tutorial section ends 0107 0108 Rectangle { 0109 id: decimalNumber 0110 width: background.width * 0.6 0111 height: parent.height / 12 0112 radius: 10 0113 color: "#373737" 0114 anchors.horizontalCenter: background.horizontalCenter 0115 anchors.top: background.top 0116 anchors.topMargin: 5 * ApplicationInfo.ratio 0117 0118 property string decimalQuestion: qsTr("Display the number: %1") 0119 property string additionQuestion: qsTr("Display the result of: %1 + %2") 0120 property string subtractionQuestion: qsTr("Display the result of: %1 - %2") 0121 property string quantityQuestion: qsTr("Represent the quantity: %1") 0122 0123 GCText { 0124 anchors.centerIn: parent 0125 width: parent.width - 10 * ApplicationInfo.ratio 0126 height: parent.height 0127 text: isSubtractionMode ? decimalNumber.subtractionQuestion.arg(items.largestNumber).arg(items.smallestNumber) : 0128 isAdditionMode ? decimalNumber.additionQuestion.arg(items.largestNumber).arg(items.smallestNumber) : 0129 isQuantityMode ? decimalNumber.quantityQuestion.arg(items.largestNumber) : 0130 decimalNumber.decimalQuestion.arg(items.largestNumber) 0131 fontSizeMode: Text.Fit 0132 wrapMode: Text.WordWrap 0133 horizontalAlignment: Text.AlignHCenter 0134 verticalAlignment: Text.AlignVCenter 0135 font.weight: Font.DemiBold 0136 color: "white" 0137 } 0138 } 0139 0140 ListModel { 0141 id: droppedItems 0142 } 0143 0144 Item { 0145 id: layoutArea 0146 anchors.top: decimalNumber.bottom 0147 anchors.topMargin: 5 * ApplicationInfo.ratio 0148 anchors.bottom: okButton.top 0149 anchors.bottomMargin: background.scoreAtBottom ? bar.height * 0.5 : anchors.topMargin 0150 anchors.horizontalCenter: background.horizontalCenter 0151 width: background.horizontalLayout ? background.width * 0.7 : background.width * 0.95 0152 } 0153 0154 Rectangle { 0155 id: topRectangle 0156 visible: !isSubtractionMode && !tutorialImage.visible 0157 anchors.top: layoutArea.top 0158 color: "#F2F2F2" 0159 border.color: "#373737" 0160 border.width: 2 0161 radius: 10 0162 z: 10 0163 0164 states: [ 0165 State { 0166 when: background.horizontalLayout 0167 PropertyChanges { 0168 target: topRectangle 0169 width: layoutArea.width 0170 // 7/11 of layoutArea 0171 height: layoutArea.height * 0.636 0172 } 0173 AnchorChanges { 0174 target: topRectangle 0175 anchors.right: undefined 0176 anchors.horizontalCenter: layoutArea.horizontalCenter 0177 } 0178 }, 0179 State { 0180 when: !background.horizontalLayout && !items.typeResult 0181 PropertyChanges { 0182 target: topRectangle 0183 width: layoutArea.width * 0.636 0184 height: layoutArea.height 0185 anchors.rightMargin: 10 * ApplicationInfo.ratio 0186 } 0187 AnchorChanges { 0188 target: topRectangle 0189 anchors.right: background.right 0190 anchors.horizontalCenter: undefined 0191 } 0192 }, 0193 State { 0194 when: !background.horizontalLayout && items.typeResult 0195 PropertyChanges { 0196 target: topRectangle 0197 width: layoutArea.width * 0.636 0198 height: layoutArea.height 0199 } 0200 AnchorChanges { 0201 target: topRectangle 0202 anchors.right: undefined 0203 anchors.horizontalCenter: background.horizontalCenter 0204 } 0205 } 0206 ] 0207 0208 DropArea { 0209 id: dropArea 0210 anchors.fill: parent 0211 0212 readonly property int maxDroppedItems: 6 0213 onDropped: { 0214 if(droppedItems.count === dropArea.maxDroppedItems) return; 0215 droppedItems.append( {"selectedSquareNumbers": bottomRectangle.currentStep + 1 } ); 0216 timer.restart() 0217 } 0218 } 0219 0220 Timer { 0221 id: timer 0222 interval: 1000 0223 onTriggered: { 0224 if(droppedItems.count == 1) return; 0225 Activity.organizeDroppedBars(); 0226 } 0227 } 0228 0229 SingleBar { 0230 id: answerZone 0231 anchors.centerIn: topRectangle 0232 selectedModel: droppedItems 0233 isAnswerRepresentation: true 0234 isUnselectedBar: false 0235 states: [ 0236 State { 0237 when: background.horizontalLayout 0238 PropertyChanges { 0239 target: answerZone 0240 cellSize: Math.min(topRectangle.height / 7, topRectangle.width / 11) 0241 cellHeight: cellSize * 1.125 0242 cellWidth: cellSize 0243 width: cellSize * 10 0244 height: cellSize * 6.875 0245 anchors.verticalCenterOffset: cellSize * 0.125 0246 anchors.horizontalCenterOffset: 0 0247 flow: GridView.FlowTopToBottom 0248 } 0249 }, 0250 State { 0251 when: !background.horizontalLayout 0252 PropertyChanges { 0253 target: answerZone 0254 cellSize: Math.min(topRectangle.width / 7, topRectangle.height / 11) 0255 cellHeight: cellSize 0256 cellWidth: cellSize * 1.125 0257 width: cellSize * 6.875 0258 height: cellSize * 10 0259 anchors.verticalCenterOffset: 0 0260 anchors.horizontalCenterOffset: cellSize * 0.125 0261 flow: GridView.FlowLeftToRight 0262 } 0263 } 0264 ] 0265 } 0266 } 0267 0268 ListModel { 0269 id: draggedItems 0270 } 0271 0272 Rectangle { 0273 id: bottomRectangle 0274 visible: !isSubtractionMode && !items.typeResult 0275 color: "#F2F2F2" 0276 border.color: "#373737" 0277 border.width: 2 0278 radius: 10 0279 0280 property alias scrollBar: scrollBar 0281 0282 states: [ 0283 State { 0284 when: background.horizontalLayout 0285 PropertyChanges { 0286 target: bottomRectangle 0287 width: layoutArea.width 0288 // 3/11 of layoutArea 0289 height: layoutArea.height * 0.273 0290 anchors.rightMargin: 0 0291 // 0.5/11 of layoutArea 0292 anchors.topMargin: layoutArea.height * 0.045 0293 } 0294 AnchorChanges { 0295 target: bottomRectangle 0296 anchors.top: topRectangle.bottom 0297 anchors.horizontalCenter: background.horizontalCenter 0298 anchors.right: undefined 0299 } 0300 PropertyChanges { 0301 target: unselectedBar 0302 anchors.verticalCenterOffset: -unselectedBar.height * 0.5 0303 anchors.horizontalCenterOffset: 0 0304 } 0305 PropertyChanges { 0306 target: selectedBar 0307 anchors.verticalCenterOffset: -selectedBar.height * 0.5 0308 anchors.horizontalCenterOffset: 0 0309 } 0310 PropertyChanges { 0311 target: scrollBar 0312 width: unselectedBar.width 0313 height: bottomRectangle.height * 0.5 0314 x: unselectedBar.x 0315 y: unselectedBar.y + unselectedBar.height 0316 } 0317 PropertyChanges { 0318 target: arrow 0319 rotation: 0 0320 x: 0 0321 } 0322 AnchorChanges { 0323 target: arrow 0324 anchors.top: parent.top 0325 anchors.right: undefined 0326 } 0327 AnchorChanges { 0328 target: hintArea 0329 anchors.top: arrow.bottom 0330 anchors.horizontalCenter: arrow.horizontalCenter 0331 anchors.right: undefined 0332 anchors.verticalCenter: undefined 0333 } 0334 }, 0335 State { 0336 when: !background.horizontalLayout 0337 PropertyChanges { 0338 target: bottomRectangle 0339 width: layoutArea.width * 0.273 0340 height: layoutArea.height 0341 anchors.rightMargin: layoutArea.width * 0.045 0342 anchors.topMargin: 0 0343 } 0344 AnchorChanges { 0345 target: bottomRectangle 0346 anchors.top: layoutArea.top 0347 anchors.horizontalCenter: undefined 0348 anchors.right: topRectangle.left 0349 } 0350 PropertyChanges { 0351 target: unselectedBar 0352 anchors.verticalCenterOffset: 0 0353 anchors.horizontalCenterOffset: unselectedBar.width * 0.5 0354 } 0355 PropertyChanges { 0356 target: selectedBar 0357 anchors.verticalCenterOffset: 0 0358 anchors.horizontalCenterOffset: selectedBar.width * 0.5 0359 } 0360 PropertyChanges { 0361 target: scrollBar 0362 width: bottomRectangle.width * 0.5 0363 height: unselectedBar.height 0364 x: unselectedBar.x - width 0365 y: unselectedBar.y 0366 } 0367 PropertyChanges { 0368 target: arrow 0369 rotation: 90 0370 y: 0 0371 } 0372 AnchorChanges { 0373 target: arrow 0374 anchors.top: undefined 0375 anchors.right: parent.right 0376 } 0377 AnchorChanges { 0378 target: hintArea 0379 anchors.top: undefined 0380 anchors.horizontalCenter: undefined 0381 anchors.right: arrow.left 0382 anchors.verticalCenter: arrow.verticalCenter 0383 } 0384 } 0385 ] 0386 0387 property int currentStep: scrollBar.currentStep 0388 0389 SingleBar { 0390 id: unselectedBar 0391 opacity: 0.5 0392 cellSize: background.horizontalLayout ? Math.min(bottomRectangle.height / 3, bottomRectangle.width / 11) : Math.min(bottomRectangle.width / 3, bottomRectangle.height / 11) 0393 width: background.horizontalLayout ? cellSize * 10 : cellSize 0394 height: background.horizontalLayout ? cellSize : cellSize * 10 0395 anchors.centerIn: bottomRectangle 0396 0397 selectedModel: draggedItems 0398 isAnswerRepresentation: false 0399 isUnselectedBar: true 0400 } 0401 0402 SingleBar { 0403 id: selectedBar 0404 cellSize: unselectedBar.cellSize 0405 width: unselectedBar.width 0406 height: unselectedBar.height 0407 anchors.centerIn: bottomRectangle 0408 0409 selectedModel: draggedItems 0410 isAnswerRepresentation: false 0411 isUnselectedBar: false 0412 0413 Drag.active: dragArea.drag.active 0414 0415 states: [ 0416 State { 0417 when: dragArea.drag.active 0418 ParentChange { 0419 target: selectedBar 0420 parent: topRectangle 0421 } 0422 } 0423 ] 0424 } 0425 0426 MouseArea { 0427 id: dragArea 0428 width: selectedBar.width 0429 height: selectedBar.height 0430 anchors.fill: selectedBar 0431 anchors.centerIn: parent 0432 drag.target: selectedBar 0433 enabled: !items.buttonsBlocked 0434 0435 onReleased: { 0436 selectedBar.Drag.drop() 0437 bottomRectangle.resetArrowPosition() 0438 } 0439 } 0440 0441 Item { 0442 id: scrollBar 0443 0444 property double horizontalBarLimit: scrollBar.width - arrow.width / 2 0445 property double verticalBarLimit: scrollBar.height - arrow.width / 2 0446 property double arrowOrigin: unselectedBar.cellSize * 0.5 0447 property alias arrowX: arrow.x 0448 property alias arrowY: arrow.y 0449 property int currentStep: 0 0450 0451 Image { 0452 id: arrow 0453 source: "qrc:/gcompris/src/activities/learn_decimals/resource/arrow.svg" 0454 sourceSize.width: width 0455 width: unselectedBar.cellSize 0456 height: width 0457 0458 MouseArea { 0459 id: arrowMouseArea 0460 width: parent.width * 2 0461 height: parent.height * 1.5 0462 enabled: !items.buttonsBlocked 0463 anchors.centerIn: parent 0464 anchors.verticalCenterOffset: parent.height * 0.25 0465 drag.target: arrow 0466 onPositionChanged: { 0467 if(background.horizontalLayout) { 0468 //range of the horizontal scrolling 0469 if(arrow.x < scrollBar.arrowOrigin) { 0470 arrow.x = scrollBar.arrowOrigin 0471 } 0472 else if(arrow.x > scrollBar.horizontalBarLimit) { 0473 arrow.x = scrollBar.horizontalBarLimit 0474 } 0475 0476 scrollBar.currentStep = Math.round((arrow.x - scrollBar.arrowOrigin) / unselectedBar.cellSize) ; 0477 arrow.x = (scrollBar.currentStep + 0.5) * unselectedBar.cellSize 0478 } 0479 else { 0480 // range of the vertical scrolling 0481 if(arrow.y < scrollBar.arrowOrigin) { 0482 arrow.y = scrollBar.arrowOrigin 0483 } 0484 else if(arrow.y > scrollBar.verticalBarLimit) { 0485 arrow.y = scrollBar.verticalBarLimit 0486 } 0487 0488 scrollBar.currentStep = Math.round((arrow.y - scrollBar.arrowOrigin) / unselectedBar.cellSize); 0489 arrow.y = (scrollBar.currentStep + 0.5) * unselectedBar.cellSize 0490 } 0491 0492 Activity.changeSingleBarVisibility(scrollBar.currentStep + 1) 0493 } 0494 } 0495 } 0496 Rectangle { 0497 id: hintArea 0498 visible: items.helper 0499 width: unselectedBar.cellSize * 1.1 0500 height: width 0501 color: "#FFFFFF" 0502 radius: 5 * ApplicationInfo.ratio 0503 border.color: "#808080" 0504 border.width: 2 0505 GCText { 0506 id: text 0507 fontSize: regularSize 0508 text: activity.isQuantityMode ? scrollBar.currentStep + 1 : 0509 Activity.toDecimalLocaleNumber((scrollBar.currentStep + 1) * items.unit) 0510 font.bold: true 0511 color: "#373737" 0512 fontSizeMode: Text.Fit 0513 verticalAlignment: Text.AlignVCenter 0514 horizontalAlignment: Text.AlignHCenter 0515 anchors.centerIn: parent 0516 width: parent.width - 4 0517 height: width 0518 } 0519 } 0520 0521 onWidthChanged: { 0522 if(items.draggedItems.count != 0) { 0523 bottomRectangle.resetArrowPosition() 0524 } 0525 } 0526 onHeightChanged: { 0527 if(items.draggedItems.count != 0) { 0528 bottomRectangle.resetArrowPosition() 0529 } 0530 } 0531 } 0532 0533 function resetArrowPosition() { 0534 if(background.horizontalLayout) { 0535 scrollBar.arrowX = scrollBar.arrowOrigin 0536 } 0537 else { 0538 scrollBar.arrowY = scrollBar.arrowOrigin 0539 } 0540 Activity.changeSingleBarVisibility(1) 0541 scrollBar.currentStep = 0 0542 } 0543 } 0544 0545 ListModel { 0546 id: largestNumberRepresentation 0547 } 0548 0549 Rectangle { 0550 id: mainRectangle 0551 visible: isSubtractionMode 0552 width: topRectangle.width 0553 height: background.scoreAtBottom ? layoutArea.height - okButton.height : layoutArea.height 0554 anchors.top: layoutArea.top 0555 anchors.horizontalCenter: background.horizontalCenter 0556 color: "#F2F2F2" 0557 border.color: "#373737" 0558 border.width: 2 0559 radius: 10 0560 0561 MultipleBars { 0562 id: multipleBars 0563 } 0564 } 0565 0566 Rectangle { 0567 id: answerBackground 0568 visible: items.typeResult 0569 height: okButton.height 0570 color: "#f2f2f2" 0571 border.color: "#373737" 0572 border.width: 2 0573 radius: 10 0574 0575 property string userEntry 0576 property string resultText: qsTr("Enter the result: %1") 0577 0578 GCText { 0579 id: userEntryText 0580 anchors.centerIn: parent 0581 width: parent.width - 10 * ApplicationInfo.ratio 0582 height: parent.height 0583 horizontalAlignment: Text.AlignHCenter 0584 verticalAlignment: Text.AlignVCenter 0585 fontSize: smallSize 0586 fontSizeMode: Text.Fit 0587 wrapMode: Text.WordWrap 0588 color: "#373737" 0589 text: answerBackground.resultText.arg(answerBackground.userEntry) 0590 } 0591 } 0592 0593 NumPad { 0594 id: numpad 0595 displayDecimalButton: true 0596 onAnswerChanged: { 0597 answerBackground.userEntry = answer 0598 } 0599 maxDigit: 3 0600 opacity: items.typeResult ? 1 : 0 0601 columnWidth: 60 * ApplicationInfo.ratio 0602 enableInput: !items.buttonsBlocked 0603 } 0604 0605 Keys.enabled: !items.buttonsBlocked 0606 Keys.onPressed: { 0607 if(items.buttonsBlocked) 0608 return 0609 if(event.key === Qt.Key_Enter || event.key === Qt.Key_Return) { 0610 if(items.typeResult) { 0611 Activity.verifyNumberTyping(answerBackground.userEntry) 0612 } 0613 else { 0614 Activity.verifyNumberRepresentation() 0615 } 0616 } 0617 else { 0618 numpad.updateAnswer(event.key, true); 0619 } 0620 } 0621 0622 states: [ 0623 State { 0624 when: background.scoreAtBottom 0625 AnchorChanges { 0626 target: answerBackground 0627 anchors.left: undefined 0628 anchors.horizontalCenter: parent.horizontalCenter 0629 anchors.top: mainRectangle.bottom 0630 anchors.verticalCenter: undefined 0631 } 0632 PropertyChanges { 0633 target: answerBackground 0634 width: mainRectangle.width 0635 anchors.topMargin: 5 * ApplicationInfo.ratio 0636 } 0637 AnchorChanges { 0638 target: okButton 0639 anchors.horizontalCenter: undefined 0640 anchors.verticalCenter: bar.verticalCenter 0641 anchors.bottom: undefined 0642 anchors.right: background.right 0643 anchors.left: undefined 0644 } 0645 PropertyChanges { 0646 target: okButton 0647 anchors.bottomMargin: 0 0648 anchors.rightMargin: okButton.width * 0.5 0649 anchors.verticalCenterOffset: -10 0650 } 0651 }, 0652 State { 0653 when: !background.scoreAtBottom 0654 AnchorChanges { 0655 target: answerBackground 0656 anchors.left: topRectangle.left 0657 anchors.horizontalCenter: undefined 0658 anchors.top: undefined 0659 anchors.verticalCenter: okButton.verticalCenter 0660 } 0661 PropertyChanges { 0662 target: answerBackground 0663 width: mainRectangle.width - okButton.width * 1.2 0664 anchors.topMargin: 0 0665 } 0666 AnchorChanges { 0667 target: okButton 0668 anchors.horizontalCenter: undefined 0669 anchors.verticalCenter: undefined 0670 anchors.bottom: bar.top 0671 anchors.right: mainRectangle.right 0672 anchors.left: undefined 0673 } 0674 PropertyChanges { 0675 target: okButton 0676 anchors.bottomMargin: okButton.height * 0.5 0677 anchors.rightMargin: 0 0678 anchors.verticalCenterOffset: 0 0679 } 0680 } 0681 ] 0682 0683 Image { 0684 id: hint 0685 source:"qrc:/gcompris/src/core/resource/bar_hint.svg" 0686 visible: !isSubtractionMode && !items.typeResult 0687 sourceSize.width: okButton.width 0688 fillMode: Image.PreserveAspectFit 0689 anchors.right: okButton.left 0690 anchors.rightMargin: okButton.width * 0.3 0691 anchors.verticalCenter: okButton.verticalCenter 0692 0693 MouseArea { 0694 id: hintMouseArea 0695 anchors.fill: parent 0696 enabled: !items.buttonsBlocked 0697 hoverEnabled: true 0698 onClicked: items.helper = !items.helper 0699 } 0700 0701 states: State { 0702 when: hintMouseArea.containsMouse 0703 PropertyChanges { 0704 target: hint 0705 scale: 1.1 0706 } 0707 } 0708 } 0709 0710 ErrorRectangle { 0711 id: errorRectangle 0712 z: 10 0713 function releaseControls() { items.buttonsBlocked = false; } 0714 0715 states: [ 0716 State { 0717 when: !isSubtractionMode && !items.typeResult 0718 PropertyChanges { 0719 target: errorRectangle 0720 anchors.fill: topRectangle 0721 radius: topRectangle.radius 0722 imageSize: 60 * ApplicationInfo.ratio 0723 } 0724 }, 0725 State { 0726 when: isSubtractionMode && !items.typeResult 0727 PropertyChanges { 0728 target: errorRectangle 0729 anchors.fill: mainRectangle 0730 radius: mainRectangle.radius 0731 imageSize: 60 * ApplicationInfo.ratio 0732 } 0733 }, 0734 State { 0735 when: items.typeResult 0736 PropertyChanges { 0737 target: errorRectangle 0738 anchors.fill: answerBackground 0739 radius: answerBackground.radius 0740 imageSize: height * 0.5 0741 } 0742 } 0743 ] 0744 } 0745 0746 DialogChooseLevel { 0747 id: dialogActivityConfig 0748 currentActivity: activity.activityInfo 0749 0750 onSaveData: { 0751 levelFolder = dialogActivityConfig.chosenLevels 0752 currentActivity.currentLevels = dialogActivityConfig.chosenLevels 0753 ApplicationSettings.setCurrentLevels(currentActivity.name, dialogActivityConfig.chosenLevels) 0754 } 0755 onClose: home() 0756 onStartActivity: { 0757 background.stop() 0758 background.start() 0759 } 0760 } 0761 0762 0763 DialogHelp { 0764 id: dialogHelp 0765 onClose: home() 0766 } 0767 0768 Bar { 0769 id: bar 0770 level: items.currentLevel + 1 0771 0772 content: tutorialImage.visible ? tutorialBar : withConfig 0773 property BarEnumContent tutorialBar: BarEnumContent { value: help | home } 0774 property BarEnumContent withConfig: BarEnumContent { value: help | home | level | activityConfig } 0775 0776 onHelpClicked: { 0777 displayDialog(dialogHelp) 0778 } 0779 onActivityConfigClicked: { 0780 displayDialog(dialogActivityConfig) 0781 } 0782 onPreviousLevelClicked: Activity.previousLevel() 0783 onNextLevelClicked: Activity.nextLevel() 0784 onHomeClicked: home() 0785 } 0786 0787 BarButton { 0788 id: okButton 0789 source: "qrc:/gcompris/src/core/resource/bar_ok.svg" 0790 width: 60 * ApplicationInfo.ratio 0791 sourceSize.width: width 0792 onClicked: items.typeResult? Activity.verifyNumberTyping(answerBackground.userEntry) : Activity.verifyNumberRepresentation() 0793 mouseArea.enabled: !items.buttonsBlocked 0794 } 0795 0796 Bonus { 0797 id: bonus 0798 Component.onCompleted: win.connect(Activity.nextLevel) 0799 } 0800 0801 Score { 0802 id: score 0803 visible: !tutorialImage.visible && !isAdditionMode && !isSubtractionMode 0804 height: okButton.height * 0.9 0805 anchors.top: undefined 0806 anchors.bottom: undefined 0807 anchors.right: hint.visible ? hint.left : okButton.left 0808 anchors.verticalCenter: okButton.verticalCenter 0809 onStop: Activity.nextSubLevel() 0810 } 0811 } 0812 }