@ -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"
/ / P r i v a t e A P I
property bool _faded : false
property int _userNum ;
property int _lastShownSlide : 0
Component.onCompleted: {
@ -85,7 +90,6 @@ Item {
}
root . slides = slides ;
root . _userNum = 0 ;
/ / M a k e f i r s t s l i d e v i s i b l e . . .
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 ; / / L o o p a t t h e e n d
}
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 ;
}
}
/ / d i r e c t l y t y p e i n t h e s l i d e n u m b e r : d e p e n d s o n r o o t h a v i n g f o c u s
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 / / K e e p f o c u s
@ -165,21 +142,12 @@ Item {
/ / p r e s e n t a t i o n - s p e c i f i c s i n g l e - k e y s h o r t c u t s ( w h i c h i n t e r f e r e w i t h n o r m a l t y p i n g )
Shortcut { sequence: " " ; enabled: root . keyShortcutsEnabled ; onActivated: goToNextSlide ( ) }
Shortcut { sequence: "c" ; enabled: root . keyShortcutsEnabled ; onActivated: root . _faded = ! root . _faded }
/ / s t a n d a r d s h o r t c u t s
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