diff --git a/src/activities/railroad/Railroad.qml b/src/activities/railroad/Railroad.qml --- a/src/activities/railroad/Railroad.qml +++ b/src/activities/railroad/Railroad.qml @@ -20,7 +20,6 @@ * along with this program; if not, see . */ import QtQuick 2.1 -import QtQuick.Controls 2.0 import GCompris 1.0 import "../../core" import "railroad.js" as Activity @@ -79,7 +78,7 @@ top: parent.top horizontalCenter: parent.horizontalCenter } - text: "<<== Swipe here ==>>" + text: qsTr("<<== Swipe here ==>>") fontSize: smallSize font.weight: Font.DemiBold color: "black" @@ -384,15 +383,31 @@ Bar { id: bar - content: BarEnumContent { value: help | home | level | reload} + content: BarEnumContent { value: help | home | level | hint } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() - onReloadClicked: { - Activity.reset() + onHintClicked: { + if (!introMessage.visible && items.mouseEnabled) { + if(Activity.memoryMode == false) { + timer.stop() + animateFlow.stop(); + displayRow.x = 2; + listModel.clear(); + Activity.isReset = false; + for (var index = 0; index < Activity.backupListModel.length; index++) { + Activity.items.listModel.append({"id" : Activity.backupListModel[index]}); + (Activity.items.displayList.itemAt(Activity.items.listModel.count - 1)).source = Activity.resourceURL + "loco" + (Activity.backupListModel[index]) + ".svg"; + } + Activity.memoryMode = true; + Activity.items.railCollection.visible = true + } else { + Activity.reset(); + } + } } } diff --git a/src/activities/railroad/railroad.js b/src/activities/railroad/railroad.js --- a/src/activities/railroad/railroad.js +++ b/src/activities/railroad/railroad.js @@ -93,6 +93,7 @@ currentLevel = 0 } items.score.currentSubLevel = 1; + isReset = false; initLevel(); } @@ -101,19 +102,20 @@ currentLevel = numberOfLevel - 1 } items.score.currentSubLevel = 1; + isReset = false; initLevel(); } function reset() { if(!isReset) { - // If reset was not pressed twice - backupListModel = []; + // If reset was not pressed twice + backupListModel = []; for (var index = 0; index < items.listModel.count; index++) { backupListModel.push(items.listModel.get(index).id); } + isReset = true; + initLevel(); } - isReset = true; - initLevel(); } function advanceSubLevel() { @@ -130,14 +132,14 @@ function isAnswer() { /* Checks if the top level setup equals the solutions */ if(items.listModel.count === solutionArray.length) { - var flag = true; + var isSolution = true; for (var index = 0; index < items.listModel.count; index++) { if(items.listModel.get(index).id != solutionArray[index]) { - flag = false; + isSolution = false; break; } } - if(flag == true) { + if(isSolution == true) { items.mouseEnabled = false; // Disables the touch items.bonus.good("flower"); } @@ -169,6 +171,6 @@ return count; } else if(xVal <= x && x < (xVal + itemWidth + items.displayRow.spacing)) { return index + 1; - } + } } }