Warning, /system/ubiquity-slideshow-neon/ubiquity-slideshow/slides/UbiquitySlide.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     Copyright 2019 Harald Sitter <sitter@kde.org>
0003 
0004     This program is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU General Public License as
0006     published by the Free Software Foundation; either version 3 of
0007     the License or any later version accepted by the membership of
0008     KDE e.V. (or its successor approved by the membership of KDE
0009     e.V.), which shall act as a proxy defined in Section 14 of
0010     version 3 of the license.
0011 
0012     This program is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015     GNU General Public License for more details.
0016 
0017     You should have received a copy of the GNU General Public License
0018     along with this program.  If not, see <https://www.gnu.org/licenses/>.
0019 */
0020 
0021 import QtQuick 2.0
0022 import QtQuick.Controls 2.5
0023 import QtQuick.XmlListModel 2.0
0024 
0025 import calamares.slideshow 1.0
0026 import org.kde.kirigami 2.4 as Kirigami
0027 import org.kde.neon.calamares.slideshow.context 1.0
0028 
0029 Slide {
0030     id: slide
0031     anchors.fill: parent
0032 
0033     property string name
0034     property string textColor
0035 
0036     // Extract the actual string out of the html. This requires all html
0037     // pages to have a standard div/h2 nexting and is somewhat abusing
0038     // the fact that xhtml and html are just about the same.
0039     XmlListModel {
0040         id: xmlModel
0041         query: "/div"
0042         source: slide.name + ".html"
0043 
0044         XmlRole { name: "title"; query: "h2/string()" }
0045         XmlRole { name: "image"; query: "img/@src/string()" }
0046 
0047         onCountChanged:{
0048             var item = get(0)
0049             background.source = item.image
0050             header.text = i18n(item.title)
0051         }
0052     }
0053 
0054     Image {
0055         id: background
0056         anchors.fill: parent
0057         // Cropping would be nicer IMO. but it severely messes with my size
0058         // calculation
0059         fillMode: Image.PreserveAspectFit
0060         smooth: true
0061         clip: true
0062     }
0063 
0064     Item {
0065         id: headerContainer
0066         x: (background.width - background.paintedWidth) / 2.0
0067         y: (background.height - background.paintedHeight) / 2.0
0068         width: background.paintedWidth
0069         height: background.paintedHeight
0070 
0071         Kirigami.Heading  {
0072             id: header
0073 
0074             anchors.left: headerContainer.left
0075             anchors.top: headerContainer.top
0076             anchors.right: headerContainer.right
0077             anchors.margins: Kirigami.Units.largeSpacing
0078 
0079             wrapMode: Text.Wrap
0080             level: 1
0081             color: textColor
0082         }
0083     }
0084 }