mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
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.
This commit is contained in:
parent
c116dba2e8
commit
3d89828fe1
1 changed files with 10 additions and 42 deletions
|
@ -2,6 +2,11 @@
|
|||
*
|
||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
* - added looping, keys-instead-of-shortcut
|
||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||
* - 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
|
||||
|
|
Loading…
Add table
Reference in a new issue