From 3d89828fe15ae358711610d7e041b7577b0074eb Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 8 Mar 2018 12:03:35 +0100 Subject: [PATCH] QML: drop potentially confusing shortcuts Removed these features that make sense in a presentation slideshow (e.g. during a talk) but that are potentially confusing during a passive slideshow like Calamares has: - Using 'c' blanks the slideshow. - Entering a slide number + enter changes slides. --- src/qml/calamares/slideshow/Presentation.qml | 52 ++++---------------- 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/src/qml/calamares/slideshow/Presentation.qml b/src/qml/calamares/slideshow/Presentation.qml index b53b9fc55..da5048035 100644 --- a/src/qml/calamares/slideshow/Presentation.qml +++ b/src/qml/calamares/slideshow/Presentation.qml @@ -2,6 +2,11 @@ * * Copyright 2017, Adriaan de Groot * - added looping, keys-instead-of-shortcut + * Copyright 2018, Adriaan de Groot + * - make looping a property, drop the 'c' fade-key + * - drop navigation through entering a slide number + * (this and the 'c' key make sense in a *presentation* + * slideshow, not in a passive slideshow like Calamares) * * SPDX-License-Identifier: LGPL-2.1 * License-Filename: LICENSES/LGPLv2.1-Presentation @@ -57,6 +62,8 @@ Item { property variant slides: [] property int currentSlide: 0 + + property bool loopSlides: true property bool showNotes: false; property bool allowDelay: true; @@ -70,8 +77,6 @@ Item { property string codeFontFamily: "Courier New" // Private API - property bool _faded: false - property int _userNum; property int _lastShownSlide: 0 Component.onCompleted: { @@ -85,7 +90,6 @@ Item { } root.slides = slides; - root._userNum = 0; // Make first slide visible... if (root.slides.length > 0) @@ -106,48 +110,21 @@ Item { } function goToNextSlide() { - root._userNum = 0 - if (_faded) - return if (root.slides[currentSlide].delayPoints) { if (root.slides[currentSlide]._advance()) return; } if (currentSlide + 1 < root.slides.length) ++currentSlide; - else + else if (loopSlides) currentSlide = 0; // Loop at the end } function goToPreviousSlide() { - root._userNum = 0 - if (root._faded) - return if (currentSlide - 1 >= 0) --currentSlide; - } - - function goToUserSlide() { - --_userNum; - if (root._faded || _userNum >= root.slides.length) - return - if (_userNum < 0) - goToNextSlide() - else { - currentSlide = _userNum; - root.focus = true; - } - } - - // directly type in the slide number: depends on root having focus - Keys.onPressed: { - if (event.key >= Qt.Key_0 && event.key <= Qt.Key_9) - _userNum = 10 * _userNum + (event.key - Qt.Key_0) - else { - if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) - goToUserSlide(); - _userNum = 0; - } + else if (loopSlides) + currentSlide = root.slides.length - 1 } focus: true // Keep focus @@ -165,21 +142,12 @@ Item { // presentation-specific single-key shortcuts (which interfere with normal typing) Shortcut { sequence: " "; enabled: root.keyShortcutsEnabled; onActivated: goToNextSlide() } - Shortcut { sequence: "c"; enabled: root.keyShortcutsEnabled; onActivated: root._faded = !root._faded } // standard shortcuts Shortcut { sequence: StandardKey.MoveToNextPage; onActivated: goToNextSlide() } Shortcut { sequence: StandardKey.MoveToPreviousPage; onActivated: goToPreviousSlide() } Shortcut { sequence: StandardKey.Quit; onActivated: Qt.quit() } - Rectangle { - z: 1000 - color: "black" - anchors.fill: parent - opacity: root._faded ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 250 } } - } - MouseArea { id: mouseArea anchors.fill: parent