touch: Prevent multiple page pushes at the same time

This commit is contained in:
Thomas Perl 2014-02-04 22:56:59 +01:00
parent 7165800c73
commit 7f620cb505
3 changed files with 20 additions and 4 deletions

View file

@ -39,13 +39,16 @@ MouseArea {
}
onPressedChanged: {
if (pgst.loadPageInProgress) {
return;
}
if (pressed) {
dragging.stacking.stopAllAnimations();
} else {
if (hasPull && parent.x < -parent.width / 4 + 10) {
pulled();
parent.x = -parent.width / 4;
//dragging.stacking.fadeInAgain();
} else if (parent.x > parent.width / 3) {
dragging.stacking.startFadeOut();
} else {

View file

@ -45,17 +45,26 @@ Item {
children[index-1].opacity = x / width;
}
property bool loadPageInProgress: false
function loadPage(filename, properties) {
if (pgst.loadPageInProgress) {
console.log('ignoring loadPage request while load in progress');
return;
}
var component = Qt.createComponent(filename);
if (component.status != Component.Ready) {
console.log('Error loading ' + filename + ':' +
component.errorString());
}
if (properties === undefined) {
component.createObject(pgst);
} else {
component.createObject(pgst, properties);
properties = {};
}
pgst.loadPageInProgress = true;
component.createObject(pgst, properties);
}
PBusyIndicator {

View file

@ -31,6 +31,10 @@ Item {
to: 0
duration: 500
easing.type: Easing.OutCubic
onStopped: {
pgst.loadPageInProgress = false;
}
}
PropertyAnimation {