Commit a522e154 authored by Holger Kaelberer's avatar Holger Kaelberer
Browse files

main, regression, don't re-start() activity after leaving dialog

This was introduced by changes to stackView interaction for
balancebox.

In stackView transitions we now honour an alwaysStart property that
activities/dialogs can set to true to always enforce emission of the
start() signal when becoming visible. So far this was only triggered
if (!exitItem.isDialog).

This is needed for special cases in view transitions (like config
dialog to editor in balancebox) when the entering item always needs to
be start()ed.
parent fe0adbb5
......@@ -47,8 +47,6 @@ BalanceItem {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
//Component.onCompleted: console.log("XXX: " + width + "/" + height
// + " - " + font.pixelSize);
}
}
......@@ -40,6 +40,8 @@ ActivityBase {
property var testLevel
property bool inForeground: false // to avoid unneeded reconfigurations
//property bool alwaysStart: true // enforce start signal for editor-to-testing-transition
onWidthChanged: if (inForeground) {
Activity.reconfigureScene();
Activity.initLevel();
......@@ -51,11 +53,10 @@ ActivityBase {
}
onStart: {
console.log("XXX BalanceBox onStart");
inForeground = true;
focus = true;
}
onStop: {console.log("XXX BalanceBox onStop"); inForeground = false;}
onStop: inForeground = false;
Keys.onPressed: Activity.processKeyPress(event.key)
Keys.onReleased: Activity.processKeyRelease(event.key)
......@@ -69,7 +70,6 @@ ActivityBase {
signal stop
function startEditor() {
console.log("XXX: launching editor");
editorLoader.active = true;
if (activity.mode == "test")
displayDialogs([dialogActivityConfig, editorLoader.item]);
......@@ -78,9 +78,7 @@ ActivityBase {
}
function handleBackEvent() {
console.log("XXX Balancebox onEscape/back");
if (activity.mode == "test") {
console.log("XXX Balancebox onEscape/back");
startEditor();
return true;
} else
......@@ -141,10 +139,7 @@ ActivityBase {
visible: true
testBox: activity
onClose: {
console.log("XXX editor.onClose");
activity.home()
}
onClose: activity.home()
}
}
......@@ -314,15 +309,12 @@ ActivityBase {
xRotation = 90;
else if (xRotation < -90)
xRotation = -90;
//console.log("xRotation changed to " + xRotation);
}
onYRotationChanged: {
//console.log("yRotation changed to " + yRotation);
if (yRotation > 90)
yRotation = 90;
else if (yRotation < -90)
yRotation = -90;
//console.log("xRotation changed to " + xRotation);
}
TiltSensor {
......@@ -467,7 +459,7 @@ ActivityBase {
if (newLevels !== activity.levelSet) {
activity.levelSet = newLevels;
dataToSave = {"levels": activity.levelSet};
//activity.start(); done automatically during view switch
activity.start();
}
}
......
......@@ -62,7 +62,6 @@ Item {
sensor: true
onBeginContact: {
// /console.log("XXX hole begin contact with body cat" + body.target.objectName);
Activity.holeContacts.push(hole);
Activity.checkHoles(hole);
}
......
......@@ -32,27 +32,20 @@ Item {
id: editor
property string filename: Activity.userFile
property bool isDialog: true
property ActivityBase currentActivity
property var testBox
property bool isTesting: false
/**
* Emitted when the config dialog has been closed.
*/
// props needed for stackView integration:
signal close
/**
* Emitted when the config dialog has been started.
*/
signal start
signal stop
property bool isDialog: true
property bool alwaysStart: true // enforce start signal for configDialog-to-editor-transition
Keys.onEscapePressed: {
console.log("XXX editor onEscape");
if (!isTesting) {
if (Activity.levelChanged)
Activity.warnUnsavedChanges(home,
......@@ -64,15 +57,11 @@ Item {
}
onStart: {
console.log("XXX Editor onStart");
if (!isTesting)
Activity.initEditor(props);
else
stopTesting();
}
onStop: {console.log("XXX Editor onStop");}
Component.onCompleted: console.log("XXX editor complete " + filename);
QtObject {
id: props
......@@ -96,15 +85,14 @@ Item {
}
function startTesting() {
console.log("BalanceboxEditor: entering testing mode");
editor.isTesting = true;
testBox.mode = "test";
testBox.testLevel = Activity.modelToLevel();
testBox.start();
back(testBox);
}
function stopTesting() {
console.log("BalanceboxEditor: stopping testing mode");
editor.isTesting = false;
testBox.mode = "play";
testBox.testLevel = null;
......@@ -114,10 +102,6 @@ Item {
id: background
anchors.fill: parent
Component.onCompleted: {
console.log("XXX editor completed");
}
File {
id: file
......@@ -179,7 +163,6 @@ Item {
if (ballTool !== item) ballTool.selected = false;
if (contactTool !== item) contactTool.selected = false;
if (goalTool !== item) goalTool.selected = false;
console.log("XXX new current tool: " + item);
}
EditorTool {
......
......@@ -167,7 +167,6 @@ function modelToLevel()
value &= ~(0xff00); // always clear order-number bits
if (obj.value & CONTACT) {
value |= ((targetList.indexOf(parseInt(obj.contactValue)) + 1) << 8);
//console.log("XXX adjusting ordernum for value " + obj.contactValue + " to " + (targetList.indexOf(parseInt(obj.contactValue)) + 1));
}
map[row][col] = "0x" + dec2hex(value);
}
......@@ -176,7 +175,6 @@ function modelToLevel()
map: map,
targets: targetList
}
//console.log("XXX serialized level: " + JSON.stringify(level));
return level;
}
......@@ -303,7 +301,6 @@ function modifyMap(props, row, col)
if (oldValue !== newValue)
levelChanged = true;
//console.log("XXX changed=" + levelChanged + " old/new=" + dec2hex(oldValue) + "/"+ dec2hex(newValue));
props.mapModel.setProperty(modelIndex, "value", newValue);
}
......
......@@ -47,16 +47,13 @@ ActivityBase {
activityInfo: ActivityInfoTree.rootMenu
onBack: {
console.log("XXX onBack to " + to + " depth=" + pageView.depth);
pageView.pop(to);
console.log("XXX onBack to " + to + " depth=" + pageView.depth);
// Restore focus that has been taken by the loaded activity
if(pageView.currentItem == menuActivity)
focus = true;
}
onHome: {
console.log("XXX Menu onHome depth=" + pageView.depth);
if(pageView.depth === 1) {
Core.quit(main);
}
......@@ -71,7 +68,6 @@ ActivityBase {
onDisplayDialog: pageView.push(dialog)
onDisplayDialogs: {
console.log("XXX onForward to " + dialogs);
var toPush = new Array();
for (var i = 0; i < dialogs.length; i++) {
toPush.push({item: dialogs[i]});
......
......@@ -165,7 +165,7 @@ Item {
onDisplayDialogs: menu ? menu.displayDialogs(dialogs) : ""
Keys.forwardTo: activity.children
Keys.onEscapePressed: {console.log("XXX: Base onEscape"); home();}
Keys.onEscapePressed: home();
Keys.onPressed: {
if (event.modifiers === Qt.ControlModifier &&
event.key === Qt.Key_Q) {
......
......@@ -159,15 +159,13 @@ Window {
id: root
function getTransition(properties)
{
console.log("XXX getTransition: exitItem=" + properties.exitItem + " enterItem=" + properties.enterItem);
audioVoices.clearQueue()
if(!properties.exitItem.isDialog) {
if(!properties.enterItem.isDialog) {
playIntroVoice(properties.enterItem.activityInfo.name)
}
//properties.enterItem.start() // hkaelber // moved outside of if for configDialog -> Editor transition in balancebox
}
if (properties.enterItem.start)
if(!properties.exitItem.isDialog && // if coming from menu and
!properties.enterItem.isDialog) // going into an activity then
playIntroVoice(properties.enterItem.activityInfo.name); // play intro
if (!properties.exitItem.isDialog || // if coming from menu or
properties.enterItem.alwaysStart) // start signal enforced (for special case like transition from config-dialog to editor)
properties.enterItem.start();
if(properties.name === "pushTransition") {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment