| 1 |
/* === This file is part of Calamares Extensions - <http://github.com/calamares-extensions> === |
| 2 |
* |
| 3 |
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <[email protected]> |
| 4 |
* SPDX-License-Identifier: BSD-2-Clause |
| 5 |
*/ |
| 6 |
|
| 7 |
/* This is a simple slideshow for use during the *exec* phase of |
| 8 |
* installation, that displays a handful of slides. It uses |
| 9 |
* the *Presentation* QML components -- this allows, for instance, |
| 10 |
* notes to be added to slides, and for arrow navigation to be |
| 11 |
* used. But at its core it's just a bunch of images, repeating. |
| 12 |
* |
| 13 |
* For this kind of limited functionality, it may be better to |
| 14 |
* use the "plain images" slideshow format in Calamares, although |
| 15 |
* then you don't have any say in how things are animated. |
| 16 |
* |
| 17 |
* This slideshow is written for *slideshowAPI* version 1, so in |
| 18 |
* `branding.desc` set that appropriately. |
| 19 |
*/ |
| 20 |
|
| 21 |
|
| 22 |
import QtQuick 2.0 // Basic QML |
| 23 |
import calamares.slideshow 1.0 // Calamares slideshow: Presentation |
| 24 |
import io.calamares.ui 1.0 // Calamares internals: Branding |
| 25 |
|
| 26 |
/* *Presentation* comes from the pre-installed calamares.slideshow |
| 27 |
* that comes with Calamares itself. See `Presentation.qml` in the |
| 28 |
* Calamares repository for details and documentation. |
| 29 |
* |
| 30 |
* The important parts of presentation are: |
| 31 |
* - it has a property *activatedInCalamares* which is set to *true* |
| 32 |
* when the slideshow becomes visible, *false* afterwards. |
| 33 |
* - it expects one or more children with a property *isSlide* |
| 34 |
* set to *true*. |
| 35 |
* - it has a function *goToNextSlide()* to do just that (where |
| 36 |
* "slides" is the sequence of children that have property |
| 37 |
* *isSlide* set to *true*. |
| 38 |
* |
| 39 |
*/ |
| 40 |
Presentation |
| 41 |
{ |
| 42 |
id: presentation |
| 43 |
|
| 44 |
/* This timer ticks once per second (1000ms, set in *interval*) |
| 45 |
* and calls *goToNextSlide()* each time. Note that it needs |
| 46 |
* to know the *id* of the presentation, so keep *id* (above) |
| 47 |
* matched with the function call. |
| 48 |
* |
| 49 |
* The timer starts when the presentation is activated; you could |
| 50 |
* also set *running* to true, but that might cost extra resources. |
| 51 |
*/ |
| 52 |
Timer { |
| 53 |
interval: 1000 |
| 54 |
running: presentation.activatedInCalamares |
| 55 |
repeat: true |
| 56 |
onTriggered: presentation.goToNextSlide() |
| 57 |
} |
| 58 |
|
| 59 |
/* These functions are called when the presentation starts and |
| 60 |
* ends, respectively. They could be used to start the timer, |
| 61 |
* but that is done automatically through *activatedInCalamares*, |
| 62 |
* so there's nothing **to** do. |
| 63 |
* |
| 64 |
* Leaving these functions out is fine, although Calamares will |
| 65 |
* complain that they are missing, then. |
| 66 |
*/ |
| 67 |
function onActivate() { } |
| 68 |
function onLeave() { } |
| 69 |
|
| 70 |
|
| 71 |
/* A presentation is an Item: it has no visual appearance at all. |
| 72 |
* Give it a background, which fills the whole area of the presentation. |
| 73 |
* Setting *z* to a low value places this rectangle **behind** other |
| 74 |
* things in the presentation -- which is correct for a background. |
| 75 |
* |
| 76 |
* This uses the background set in the styles section of `branding.desc`. |
| 77 |
*/ |
| 78 |
Rectangle { |
| 79 |
id: mybackground |
| 80 |
anchors.fill: parent |
| 81 |
color: Branding.styleString(Branding.SidebarBackground) |
| 82 |
z: -1 |
| 83 |
} |
| 84 |
|
| 85 |
/* The *ImageSlide* is a component unique to this branding directory. |
| 86 |
* The QML file `ImageSlide.qml` can be stored alongside `show.qml` |
| 87 |
* and it will be loaded on-demand. See the documentation in that |
| 88 |
* file for details, but it comes down to this: for each *ImageSlide*, |
| 89 |
* set *src* to a suitable value (an image path in this directory) |
| 90 |
* and that will be displayed. |
| 91 |
*/ |
| 92 |
ImageSlide { |
| 93 |
src: "slide1.png" |
| 94 |
} |
| 95 |
|
| 96 |
ImageSlide { |
| 97 |
src: "slide2.png" |
| 98 |
} |
| 99 |
|
| 100 |
ImageSlide { |
| 101 |
src: "slide3.png" |
| 102 |
} |
| 103 |
} |