Warning, /plasma/plasma-welcome/src/qml/pages/Welcome.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com>
0003  *  SPDX-FileCopyrightText: 2022 Nate Graham <nate@kde.org>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Controls as QQC2
0010 import QtQuick.Layouts
0011 import org.kde.kirigami as Kirigami
0012 import org.kde.plasma.welcome
0013 
0014 GenericPage {
0015     id: root
0016 
0017     heading: i18nc("@title", "Welcome")
0018     description: Controller.customIntroText.length > 0
0019             ? xi18nc("@info:usagetip %1 is custom text supplied by the distro", "%1<nl/><nl/>This operating system is running Plasma, a free and open-source desktop environment created by KDE, an international software community of volunteers. It is designed to be simple by default for a smooth experience, but powerful when needed to help you really get things done. We hope you love it!", Controller.customIntroText)
0020             : xi18nc("@info:usagetip %1 is the name of the user's distro", "Welcome to the %1 operating system running KDE Plasma!<nl/><nl/>Plasma is a free and open-source desktop environment created by KDE, an international software community of volunteers. It is designed to be simple by default for a smooth experience, but powerful when needed to help you really get things done. We hope you love it!", Controller.distroName())
0021 
0022     topContent: [
0023         ColumnLayout {
0024             spacing: Kirigami.Units.smallSpacing
0025 
0026             Kirigami.UrlButton {
0027                 id: plasmaLink
0028                 Layout.topMargin: Kirigami.Units.largeSpacing
0029                 text: i18nc("@action:button", "Learn more about the KDE community")
0030                 url: "https://community.kde.org/Welcome_to_KDE?source=plasma-welcome"
0031             }
0032             Kirigami.UrlButton {
0033                 Layout.topMargin: Kirigami.Units.largeSpacing
0034                 text: i18nc("@action:button %1 is the name of the user's distro", "Learn more about %1", Controller.distroName())
0035                 url: Controller.distroUrl()
0036                 visible: Controller.distroUrl().length > 0
0037             }
0038         }
0039     ]
0040 
0041     ColumnLayout {
0042         anchors.centerIn: parent
0043         height: Math.min(parent.height, Kirigami.Units.gridUnit * 17)
0044         spacing: Kirigami.Units.smallSpacing
0045 
0046         Loader {
0047             id: imageContainer
0048 
0049             readonly property bool isImage:
0050                 // Image path in the file
0051                 Controller.customIntroIcon.startsWith("file:/") ||
0052                 // Our default image
0053                 Controller.customIntroIcon.length === 0
0054 
0055             Layout.alignment: Qt.AlignHCenter
0056             Layout.fillHeight: true
0057             Layout.maximumWidth: root.width
0058 
0059             sourceComponent: isImage ? imageComponent : iconComponent
0060 
0061             Component {
0062                 id: imageComponent
0063 
0064                 Image {
0065                     id: image
0066                     source: Controller.customIntroIcon || "konqi-kde-hi.png"
0067                     fillMode: Image.PreserveAspectFit
0068 
0069                     Kirigami.PlaceholderMessage {
0070                         width: root.width - (Kirigami.Units.largeSpacing * 4)
0071                         anchors.centerIn: parent
0072                         text: i18nc("@title", "Image loading failed")
0073                         explanation: xi18nc("@info:placeholder", "Could not load <filename>%1</filename>. Make sure it exists.", Controller.customIntroIcon)
0074                         visible: image.status == Image.Error
0075                     }
0076                 }
0077             }
0078 
0079             Component {
0080                 id: iconComponent
0081 
0082                 Kirigami.Icon {
0083                     implicitWidth: Kirigami.Units.iconSizes.enormous * 2
0084                     implicitHeight: implicitWidth
0085                     source: Controller.customIntroIcon || "kde"
0086                 }
0087             }
0088 
0089             HoverHandler {
0090                 id: hoverhandler
0091                 cursorShape: Qt.PointingHandCursor
0092             }
0093             TapHandler {
0094                 id: tapHandler
0095                 property string url: Controller.customIntroIconLink || plasmaLink.url
0096                 onTapped: Qt.openUrlExternally(url)
0097             }
0098             QQC2.ToolTip {
0099                 visible: hoverhandler.hovered
0100                 text: i18nc("@action:button clicking on this takes the user to a web page", "Visit %1", tapHandler.url)
0101             }
0102         }
0103 
0104         QQC2.Label {
0105             Layout.alignment: Qt.AlignHCenter
0106             Layout.maximumWidth: Math.round(Math.max(root.width / 2, imageContainer.implicitWidth / 2))
0107             text: Controller.customIntroIconCaption || i18nc("@info", "The KDE mascot Konqi welcomes you to the KDE community!")
0108             wrapMode: Text.Wrap
0109             horizontalAlignment: Text.AlignHCenter
0110         }
0111     }
0112 }