mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
Presentation: re-implement looping, keyboard-nav
This commit is contained in:
parent
6f00dd761b
commit
2a4d8faa3b
1 changed files with 14 additions and 0 deletions
|
@ -1,4 +1,7 @@
|
|||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
* - added looping, keys-instead-of-shortcut
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1
|
||||
* License-Filename: LICENSES/LGPLv2.1-Presentation
|
||||
|
@ -98,6 +101,8 @@ Item {
|
|||
onCurrentSlideChanged: {
|
||||
switchSlides(root.slides[_lastShownSlide], root.slides[currentSlide], currentSlide > _lastShownSlide)
|
||||
_lastShownSlide = currentSlide
|
||||
// Always keep focus on the slideshow
|
||||
root.focus = true
|
||||
}
|
||||
|
||||
function goToNextSlide() {
|
||||
|
@ -110,6 +115,8 @@ Item {
|
|||
}
|
||||
if (currentSlide + 1 < root.slides.length)
|
||||
++currentSlide;
|
||||
else
|
||||
currentSlide = 0; // Loop at the end
|
||||
}
|
||||
|
||||
function goToPreviousSlide() {
|
||||
|
@ -143,6 +150,13 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
focus: true // Keep focus
|
||||
|
||||
// Navigation through key events, too
|
||||
Keys.onSpacePressed: goToNextSlide()
|
||||
Keys.onRightPressed: goToNextSlide()
|
||||
Keys.onLeftPressed: goToPreviousSlide()
|
||||
|
||||
// navigate with arrow keys
|
||||
Shortcut { sequence: StandardKey.MoveToNextLine; enabled: root.arrowNavigation; onActivated: goToNextSlide() }
|
||||
Shortcut { sequence: StandardKey.MoveToPreviousLine; enabled: root.arrowNavigation; onActivated: goToPreviousSlide() }
|
||||
|
|
Loading…
Add table
Reference in a new issue