port slideshow to Qt 6
This commit is contained in:
parent
627465a734
commit
ed540673d9
@ -14,8 +14,13 @@ include(CalamaresAddTranslations)
|
||||
add_subdirectory(libcalamares)
|
||||
add_subdirectory(libcalamaresui)
|
||||
|
||||
# all things qml
|
||||
add_subdirectory(qml/calamares)
|
||||
if(WITH_QT6)
|
||||
# all things qml
|
||||
add_subdirectory(qml/calamares-qt5)
|
||||
else()
|
||||
# all things qml
|
||||
add_subdirectory(qml/calamares)
|
||||
endif()
|
||||
|
||||
# application
|
||||
add_subdirectory(calamares)
|
||||
|
42
src/qml/calamares-qt5/CMakeLists.txt
Normal file
42
src/qml/calamares-qt5/CMakeLists.txt
Normal file
@ -0,0 +1,42 @@
|
||||
# === This file is part of Calamares - <https://calamares.io> ===
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
|
||||
# Install "slideshows" and other QML-sources for Calamares.
|
||||
#
|
||||
# In practice, in the central source repositoy, this means
|
||||
# just-install-the-slideshow-example. For alternative slideshows,
|
||||
# see the approach in the calamares-extensions repository.
|
||||
|
||||
# Iterate over all the subdirectories which have a qmldir file, copy them over to the build dir,
|
||||
# and install them into share/calamares/qml/calamares
|
||||
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
|
||||
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
|
||||
if(
|
||||
IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}"
|
||||
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/qmldir"
|
||||
)
|
||||
set(QML_DIR share/calamares/qml)
|
||||
set(QML_MODULE_DESTINATION ${QML_DIR}/calamares/${SUBDIRECTORY})
|
||||
|
||||
# We glob all the files inside the subdirectory, and we make sure they are
|
||||
# synced with the bindir structure and installed.
|
||||
file(GLOB QML_MODULE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*")
|
||||
foreach(QML_MODULE_FILE ${QML_MODULE_FILES})
|
||||
if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE})
|
||||
configure_file(${SUBDIRECTORY}/${QML_MODULE_FILE} ${SUBDIRECTORY}/${QML_MODULE_FILE} COPYONLY)
|
||||
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE}
|
||||
DESTINATION ${QML_MODULE_DESTINATION}
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message("-- ${BoldYellow}Configured QML module: ${BoldRed}calamares.${SUBDIRECTORY}${ColorReset}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message("")
|
15
src/qml/calamares-qt5/slideshow/BackButton.qml
Normal file
15
src/qml/calamares-qt5/slideshow/BackButton.qml
Normal file
@ -0,0 +1,15 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
*
|
||||
*/
|
||||
|
||||
NavButton {
|
||||
id: backButton
|
||||
anchors.left: parent.left
|
||||
visible: parent.currentSlide > 0
|
||||
isForward: false
|
||||
}
|
14
src/qml/calamares-qt5/slideshow/ForwardButton.qml
Normal file
14
src/qml/calamares-qt5/slideshow/ForwardButton.qml
Normal file
@ -0,0 +1,14 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
*
|
||||
*/
|
||||
|
||||
NavButton {
|
||||
id: forwardButton
|
||||
anchors.right: parent.right
|
||||
visible: parent.currentSlide + 1 < parent.slides.length;
|
||||
}
|
59
src/qml/calamares-qt5/slideshow/NavButton.qml
Normal file
59
src/qml/calamares-qt5/slideshow/NavButton.qml
Normal file
@ -0,0 +1,59 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
*
|
||||
*/
|
||||
|
||||
/* This is a navigation (arrow) button that fades in on hover, and
|
||||
* which calls forward / backward navigation on the presentation it
|
||||
* is in. It should be a child item of the presentation (not of a
|
||||
* single slide). Use the ForwardButton or BackButton for a pre-
|
||||
* configured instance that interacts with the presentation.
|
||||
*/
|
||||
|
||||
import QtQuick 2.5;
|
||||
|
||||
Image {
|
||||
id: fade
|
||||
|
||||
property bool isForward : true
|
||||
|
||||
width: 100
|
||||
height: 100
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
opacity: 0.3
|
||||
|
||||
OpacityAnimator {
|
||||
id: fadeIn
|
||||
target: fade
|
||||
from: fade.opacity
|
||||
to: 1.0
|
||||
duration: 500
|
||||
running: false
|
||||
}
|
||||
|
||||
OpacityAnimator {
|
||||
id: fadeOut
|
||||
target: fade
|
||||
from: fade.opacity
|
||||
to: 0.3
|
||||
duration: 250
|
||||
running: false
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onEntered: { fadeOut.running = false; fadeIn.running = true }
|
||||
onExited: { fadeIn.running = false ; fadeOut.running = true }
|
||||
onClicked: {
|
||||
if (isForward)
|
||||
fade.parent.goToNextSlide()
|
||||
else
|
||||
fade.parent.goToPreviousSlide()
|
||||
}
|
||||
}
|
||||
}
|
243
src/qml/calamares-qt5/slideshow/Presentation.qml
Normal file
243
src/qml/calamares-qt5/slideshow/Presentation.qml
Normal file
@ -0,0 +1,243 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-FileCopyrightText: 2016 The Qt Company Ltd.
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*
|
||||
* 2017, Adriaan de Groot <groot@kde.org>
|
||||
* - added looping, keys-instead-of-shortcut
|
||||
* 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)
|
||||
* - remove quit key
|
||||
* 2019, Adriaan de Groot <groot@kde.org>
|
||||
* - Support "V2" loading
|
||||
* - Disable shortcuts until the content is visible in Calamares
|
||||
* 2020, Adriaan de Groot <groot@kde.org>
|
||||
* - Updated to SPDX headers
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QML Presentation System.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Window 2.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property variant slides: []
|
||||
property int currentSlide: 0
|
||||
|
||||
property bool loopSlides: true
|
||||
|
||||
property bool showNotes: false;
|
||||
property bool allowDelay: true;
|
||||
property alias mouseNavigation: mouseArea.enabled
|
||||
property bool arrowNavigation: true
|
||||
property bool keyShortcutsEnabled: true
|
||||
|
||||
property color titleColor: textColor;
|
||||
property color textColor: "black"
|
||||
property string fontFamily: "Helvetica"
|
||||
property string codeFontFamily: "Courier New"
|
||||
|
||||
// This is set by the C++ part of Calamares when the slideshow
|
||||
// becomes visible. You can connect it to a timer, or whatever
|
||||
// else needs to start only when the slideshow becomes visible.
|
||||
//
|
||||
// It is used in this example also to keep the keyboard shortcuts
|
||||
// enabled only while the slideshow is active.
|
||||
property bool activatedInCalamares: false
|
||||
|
||||
// Private API
|
||||
property int _lastShownSlide: 0
|
||||
|
||||
Component.onCompleted: {
|
||||
var slideCount = 0;
|
||||
var slides = [];
|
||||
for (var i=0; i<root.children.length; ++i) {
|
||||
var r = root.children[i];
|
||||
if (r.isSlide) {
|
||||
slides.push(r);
|
||||
}
|
||||
}
|
||||
|
||||
root.slides = slides;
|
||||
|
||||
// Make first slide visible...
|
||||
if (root.slides.length > 0)
|
||||
root.slides[root.currentSlide].visible = true;
|
||||
}
|
||||
|
||||
function switchSlides(from, to, forward) {
|
||||
from.visible = false
|
||||
to.visible = true
|
||||
return true
|
||||
}
|
||||
|
||||
onCurrentSlideChanged: {
|
||||
switchSlides(root.slides[_lastShownSlide], root.slides[currentSlide], currentSlide > _lastShownSlide)
|
||||
_lastShownSlide = currentSlide
|
||||
// Always keep focus on the slideshow
|
||||
root.focus = true
|
||||
}
|
||||
|
||||
function goToNextSlide() {
|
||||
if (root.slides[currentSlide].delayPoints) {
|
||||
if (root.slides[currentSlide]._advance())
|
||||
return;
|
||||
}
|
||||
if (currentSlide + 1 < root.slides.length)
|
||||
++currentSlide;
|
||||
else if (loopSlides)
|
||||
currentSlide = 0; // Loop at the end
|
||||
}
|
||||
|
||||
function goToPreviousSlide() {
|
||||
if (currentSlide - 1 >= 0)
|
||||
--currentSlide;
|
||||
else if (loopSlides)
|
||||
currentSlide = root.slides.length - 1
|
||||
}
|
||||
|
||||
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.activatedInCalamares && root .arrowNavigation; onActivated: goToNextSlide() }
|
||||
Shortcut { sequence: StandardKey.MoveToPreviousLine; enabled: root.activatedInCalamares && root.arrowNavigation; onActivated: goToPreviousSlide() }
|
||||
Shortcut { sequence: StandardKey.MoveToNextChar; enabled: root.activatedInCalamares && root.arrowNavigation; onActivated: goToNextSlide() }
|
||||
Shortcut { sequence: StandardKey.MoveToPreviousChar; enabled: root.activatedInCalamares && root.arrowNavigation; onActivated: goToPreviousSlide() }
|
||||
|
||||
// presentation-specific single-key shortcuts (which interfere with normal typing)
|
||||
Shortcut { sequence: " "; enabled: root.activatedInCalamares && root.keyShortcutsEnabled; onActivated: goToNextSlide() }
|
||||
|
||||
// standard shortcuts
|
||||
Shortcut { sequence: StandardKey.MoveToNextPage; enabled: root.activatedInCalamares; onActivated: goToNextSlide() }
|
||||
Shortcut { sequence: StandardKey.MoveToPreviousPage; enabled: root.activatedInCalamares; onActivated: goToPreviousSlide() }
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
onClicked: {
|
||||
if (mouse.button == Qt.RightButton)
|
||||
goToPreviousSlide()
|
||||
else
|
||||
goToNextSlide()
|
||||
}
|
||||
onPressAndHold: goToPreviousSlide(); //A back mechanism for touch only devices
|
||||
}
|
||||
|
||||
Window {
|
||||
id: notesWindow;
|
||||
width: 400
|
||||
height: 300
|
||||
|
||||
title: "QML Presentation: Notes"
|
||||
visible: root.showNotes
|
||||
|
||||
Flickable {
|
||||
anchors.fill: parent
|
||||
contentWidth: parent.width
|
||||
contentHeight: textContainer.height
|
||||
|
||||
Item {
|
||||
id: textContainer
|
||||
width: parent.width
|
||||
height: notesText.height + 2 * notesText.padding
|
||||
|
||||
Text {
|
||||
id: notesText
|
||||
|
||||
property real padding: 16;
|
||||
|
||||
x: padding
|
||||
y: padding
|
||||
width: parent.width - 2 * padding
|
||||
|
||||
|
||||
font.pixelSize: 16
|
||||
wrapMode: Text.WordWrap
|
||||
|
||||
property string notes: root.slides[root.currentSlide].notes;
|
||||
|
||||
onNotesChanged: {
|
||||
var result = "";
|
||||
|
||||
var lines = notes.split("\n");
|
||||
var beginNewLine = false
|
||||
for (var i=0; i<lines.length; ++i) {
|
||||
var line = lines[i].trim();
|
||||
if (line.length == 0) {
|
||||
beginNewLine = true;
|
||||
} else {
|
||||
if (beginNewLine && result.length) {
|
||||
result += "\n\n"
|
||||
beginNewLine = false
|
||||
}
|
||||
if (result.length > 0)
|
||||
result += " ";
|
||||
result += line;
|
||||
}
|
||||
}
|
||||
|
||||
if (result.length == 0) {
|
||||
font.italic = true;
|
||||
text = "no notes.."
|
||||
} else {
|
||||
font.italic = false;
|
||||
text = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
206
src/qml/calamares-qt5/slideshow/Slide.qml
Normal file
206
src/qml/calamares-qt5/slideshow/Slide.qml
Normal file
@ -0,0 +1,206 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the QML Presentation System.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
import QtQuick 2.5
|
||||
|
||||
Item {
|
||||
/*
|
||||
Slides can only be instantiated as a direct child of a Presentation {} as they rely on
|
||||
several properties there.
|
||||
*/
|
||||
|
||||
id: slide
|
||||
|
||||
property bool isSlide: true;
|
||||
|
||||
property bool delayPoints: false;
|
||||
property int _pointCounter: 0;
|
||||
function _advance() {
|
||||
if (!parent.allowDelay)
|
||||
return false;
|
||||
|
||||
_pointCounter = _pointCounter + 1;
|
||||
if (_pointCounter < content.length)
|
||||
return true;
|
||||
_pointCounter = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
property string title;
|
||||
property variant content: []
|
||||
property string centeredText
|
||||
property string writeInText;
|
||||
property string notes;
|
||||
|
||||
property real fontSize: parent.height * 0.05
|
||||
property real fontScale: 1
|
||||
|
||||
property real baseFontSize: fontSize * fontScale
|
||||
property real titleFontSize: fontSize * 1.2 * fontScale
|
||||
property real bulletSpacing: 1
|
||||
|
||||
property real contentWidth: width
|
||||
|
||||
// Define the slide to be the "content area"
|
||||
x: parent.width * 0.05
|
||||
y: parent.height * 0.2
|
||||
width: parent.width * 0.9
|
||||
height: parent.height * 0.7
|
||||
|
||||
property real masterWidth: parent.width
|
||||
property real masterHeight: parent.height
|
||||
|
||||
property color titleColor: parent.titleColor;
|
||||
property color textColor: parent.textColor;
|
||||
property string fontFamily: parent.fontFamily;
|
||||
property int textFormat: Text.PlainText
|
||||
|
||||
visible: false
|
||||
|
||||
Text {
|
||||
id: titleText
|
||||
font.pixelSize: titleFontSize
|
||||
text: title;
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.top
|
||||
anchors.bottomMargin: parent.fontSize * 1.5
|
||||
font.bold: true;
|
||||
font.family: slide.fontFamily
|
||||
color: slide.titleColor
|
||||
horizontalAlignment: Text.Center
|
||||
z: 1
|
||||
}
|
||||
|
||||
Text {
|
||||
id: centeredId
|
||||
width: parent.width
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: - parent.y / 3
|
||||
text: centeredText
|
||||
horizontalAlignment: Text.Center
|
||||
font.pixelSize: baseFontSize
|
||||
font.family: slide.fontFamily
|
||||
color: slide.textColor
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
Text {
|
||||
id: writeInTextId
|
||||
property int length;
|
||||
font.family: slide.fontFamily
|
||||
font.pixelSize: baseFontSize
|
||||
color: slide.textColor
|
||||
|
||||
anchors.fill: parent;
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
text: slide.writeInText.substring(0, length);
|
||||
|
||||
NumberAnimation on length {
|
||||
from: 0;
|
||||
to: slide.writeInText.length;
|
||||
duration: slide.writeInText.length * 30;
|
||||
running: slide.visible && parent.visible && slide.writeInText.length > 0
|
||||
}
|
||||
|
||||
visible: slide.writeInText != undefined;
|
||||
}
|
||||
|
||||
|
||||
Column {
|
||||
id: contentId
|
||||
anchors.fill: parent
|
||||
|
||||
Repeater {
|
||||
model: content.length
|
||||
|
||||
Row {
|
||||
id: row
|
||||
|
||||
function decideIndentLevel(s) { return s.charAt(0) == " " ? 1 + decideIndentLevel(s.substring(1)) : 0 }
|
||||
property int indentLevel: decideIndentLevel(content[index])
|
||||
property int nextIndentLevel: index < content.length - 1 ? decideIndentLevel(content[index+1]) : 0
|
||||
property real indentFactor: (10 - row.indentLevel * 2) / 10;
|
||||
|
||||
height: text.height + (nextIndentLevel == 0 ? 1 : 0.3) * slide.baseFontSize * slide.bulletSpacing
|
||||
x: slide.baseFontSize * indentLevel
|
||||
visible: (!slide.parent.allowDelay || !delayPoints) || index <= _pointCounter
|
||||
|
||||
Rectangle {
|
||||
id: dot
|
||||
anchors.baseline: text.baseline
|
||||
anchors.baselineOffset: -text.font.pixelSize / 2
|
||||
width: text.font.pixelSize / 3
|
||||
height: text.font.pixelSize / 3
|
||||
color: slide.textColor
|
||||
radius: width / 2
|
||||
opacity: text.text.length == 0 ? 0 : 1
|
||||
}
|
||||
|
||||
Item {
|
||||
id: space
|
||||
width: dot.width * 1.5
|
||||
height: 1
|
||||
}
|
||||
|
||||
Text {
|
||||
id: text
|
||||
width: slide.contentWidth - parent.x - dot.width - space.width
|
||||
font.pixelSize: baseFontSize * row.indentFactor
|
||||
text: content[index]
|
||||
textFormat: slide.textFormat
|
||||
wrapMode: Text.WordWrap
|
||||
color: slide.textColor
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
font.family: slide.fontFamily
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
29
src/qml/calamares-qt5/slideshow/SlideCounter.qml
Normal file
29
src/qml/calamares-qt5/slideshow/SlideCounter.qml
Normal file
@ -0,0 +1,29 @@
|
||||
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
*
|
||||
*/
|
||||
|
||||
/* This control just shows a (non-translated) count of the slides
|
||||
* in the slideshow in the format "n / total".
|
||||
*/
|
||||
|
||||
import QtQuick 2.5;
|
||||
|
||||
Rectangle {
|
||||
id: slideCounter
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
width: 100
|
||||
height: 50
|
||||
|
||||
Text {
|
||||
id: slideCounterText
|
||||
anchors.centerIn: parent
|
||||
//: slide counter, %1 of %2 (numeric)
|
||||
text: qsTr("%L1 / %L2").arg(parent.parent.currentSlide + 1).arg(parent.parent.slides.length)
|
||||
}
|
||||
}
|
10
src/qml/calamares-qt5/slideshow/qmldir
Normal file
10
src/qml/calamares-qt5/slideshow/qmldir
Normal file
@ -0,0 +1,10 @@
|
||||
module calamares.slideshow
|
||||
|
||||
Presentation 1.0 Presentation.qml
|
||||
Slide 1.0 Slide.qml
|
||||
|
||||
NavButton 1.0 NavButton.qml
|
||||
ForwardButton 1.0 ForwardButton.qml
|
||||
BackButton 1.0 BackButton.qml
|
||||
|
||||
SlideCounter 1.0 SlideCounter.qml
|
2
src/qml/calamares-qt5/slideshow/qmldir.license
Normal file
2
src/qml/calamares-qt5/slideshow/qmldir.license
Normal file
@ -0,0 +1,2 @@
|
||||
SPDX-FileCopyrightText: no
|
||||
SPDX-License-Identifier: CC0-1.0
|
@ -196,8 +196,6 @@ Item {
|
||||
Text {
|
||||
id: notesText
|
||||
|
||||
property real padding: 16;
|
||||
|
||||
x: padding
|
||||
y: padding
|
||||
width: parent.width - 2 * padding
|
||||
|
Loading…
Reference in New Issue
Block a user