Skip to content

Commit

Permalink
Make gesture allowance declarative
Browse files Browse the repository at this point in the history
  • Loading branch information
pvuorela committed Jun 8, 2016
1 parent 5ae2c3d commit 7617b68
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 26 deletions.
5 changes: 1 addition & 4 deletions qml/LayoutWindow.qml
Expand Up @@ -124,10 +124,7 @@ Rectangle {
Transition {
from: "*"
to: "*"
SequentialAnimation {
PropertyAnimation { target: layoutWindow; properties: "y"; duration: 200; easing.type: Easing.InOutCubic }
ScriptAction { script: window.updateGesturesAllowed(); }
}
PropertyAnimation { target: layoutWindow; properties: "y"; duration: 200; easing.type: Easing.InOutCubic }
}
]
}
21 changes: 7 additions & 14 deletions qml/Main.qml
Expand Up @@ -29,6 +29,13 @@ Item {

property string windowTitle: util.currentWindowTitle();

Binding {
target: util
property: "allowGestures"
value: !vkb.active && !menu.showing && urlWindow.state != "visible" && aboutDialog.state != "visible"
&& layoutWindow.state != "visible"
}

Item {
id: page

Expand Down Expand Up @@ -278,9 +285,6 @@ Item {
MenuFingerterm {
id: menu
anchors.fill: parent
onShowingChanged: {
window.updateGesturesAllowed();
}
}

TextRender {
Expand Down Expand Up @@ -401,7 +405,6 @@ Item {
vkb.active = true;
lineView.setPosition(vkb.active);
setTextRenderAttributes();
updateGesturesAllowed();
}

function sleepVKB()
Expand All @@ -411,7 +414,6 @@ Item {
vkb.active = false;
lineView.setPosition(vkb.active);
setTextRenderAttributes();
updateGesturesAllowed();
}

function setTextRenderAttributes()
Expand Down Expand Up @@ -479,15 +481,6 @@ Item {
window.color = "#ffffff"
}

function updateGesturesAllowed()
{
if(vkb.active || menu.showing || urlWindow.state=="visible" ||
aboutDialog.state=="visible" || layoutWindow.state=="visible")
util.allowGestures = false;
else
util.allowGestures = true;
}

function setOrientationLockMode(stringMode)
{
util.setSettingsValue("ui/orientationLockMode", stringMode);
Expand Down
5 changes: 1 addition & 4 deletions qml/NotifyWin.qml
Expand Up @@ -86,10 +86,7 @@ Rectangle {
Transition {
from: "*"
to: "*"
SequentialAnimation {
PropertyAnimation { target: notifyWin; properties: "y"; duration: 200; easing.type: Easing.InOutCubic }
ScriptAction { script: window.updateGesturesAllowed(); }
}
PropertyAnimation { target: notifyWin; properties: "y"; duration: 200; easing.type: Easing.InOutCubic }
}
]
}
5 changes: 1 addition & 4 deletions qml/UrlWindow.qml
Expand Up @@ -125,10 +125,7 @@ Rectangle {
Transition {
from: "*"
to: "*"
SequentialAnimation {
PropertyAnimation { target: urlWindow; properties: "y"; duration: 200; easing.type: Easing.InOutCubic }
ScriptAction { script: window.updateGesturesAllowed(); }
}
PropertyAnimation { target: urlWindow; properties: "y"; duration: 200; easing.type: Easing.InOutCubic }
}
]
}

0 comments on commit 7617b68

Please sign in to comment.