OSDN Git Service

added test script and translated
[alterlinux/LFBS.git] / calamares-qmls / qml / calamares / slideshow / NavButton.qml
1 /* === This file is part of Calamares - <https://calamares.io> ===
2  *
3  *   SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
4  *   SPDX-License-Identifier: GPL-3.0-or-later
5  *
6  *   Calamares is Free Software: see the License-Identifier above.
7  *
8  */
9
10 /* This is a navigation (arrow) button that fades in on hover, and
11  * which calls forward / backward navigation on the presentation it
12  * is in. It should be a child item of the presentation (not of a
13  * single slide). Use the ForwardButton or BackButton for a pre-
14  * configured instance that interacts with the presentation.
15  */
16
17 import QtQuick 2.5;
18
19 Image {
20     id: fade
21
22     property bool isForward : true
23
24     width: 100
25     height: 100
26     anchors.verticalCenter: parent.verticalCenter
27     opacity: 0.3
28
29     OpacityAnimator {
30         id: fadeIn
31         target: fade
32         from: fade.opacity
33         to: 1.0
34         duration: 500
35         running: false
36     }
37
38     OpacityAnimator {
39         id: fadeOut
40         target: fade
41         from: fade.opacity
42         to: 0.3
43         duration: 250
44         running: false
45     }
46
47     MouseArea {
48         anchors.fill: parent
49         hoverEnabled: true
50         onEntered: { fadeOut.running = false; fadeIn.running = true }
51         onExited: { fadeIn.running = false ; fadeOut.running = true }
52         onClicked: {
53             if (isForward)
54                 fade.parent.goToNextSlide()
55             else
56                 fade.parent.goToPreviousSlide()
57         }
58     }
59 }