summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrgad Shaneh <orgads@gmail.com>2011-07-25 21:33:42 +0300
committerOrgad Shaneh <orgads@gmail.com>2011-07-25 21:42:48 +0300
commitd1b7c162be27a3aa7e969fc08bad5ad5cc46f39d (patch)
treefcb38011741b3966ae0951f5eea199d61de7bf50
parentb5ae07fe33de14cc1b792a92a91d07a58743cf2b (diff)
Go to next slide on Return, go to previous slide on Backspace or right-clickquick1
-rw-r--r--src/Presentation.qml21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/Presentation.qml b/src/Presentation.qml
index 9648e4a..50743ec 100644
--- a/src/Presentation.qml
+++ b/src/Presentation.qml
@@ -102,9 +102,11 @@ Item {
function goToUserSlide() {
--userNum;
- if (root.faded || userNum < 0 || userNum >= root.slides.length)
+ if (root.faded || userNum >= root.slides.length)
return
- if (root.currentSlide != userNum) {
+ if (userNum < 0)
+ goToNextSlide()
+ else if (root.currentSlide != userNum) {
var from = slides[currentSlide]
var to = slides[userNum]
if (switchSlides(from, to)) {
@@ -118,15 +120,18 @@ Item {
Keys.onSpacePressed: goToNextSlide()
Keys.onRightPressed: goToNextSlide()
+ Keys.onDownPressed: goToNextSlide()
Keys.onLeftPressed: goToPreviousSlide()
+ Keys.onUpPressed: goToPreviousSlide()
Keys.onEscapePressed: Qt.quit()
Keys.onPressed: {
if (event.key >= Qt.Key_0 && event.key <= Qt.Key_9)
userNum = 10 * userNum + (event.key - Qt.Key_0)
- else
- {
+ else {
if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter)
goToUserSlide();
+ else if (event.key == Qt.Key_Backspace)
+ goToPreviousSlide();
else if (event.key == Qt.Key_C)
root.faded = !root.faded;
userNum = 0;
@@ -144,6 +149,12 @@ Item {
MouseArea {
id: mouseArea
anchors.fill: parent
- onClicked: goToNextSlide()
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button == Qt.RightButton)
+ goToPreviousSlide()
+ else
+ goToNextSlide()
+ }
}
}