Warning, /sdk/licensedigger/autotests/testdata/LGPL-2.0-or-later/AboutPage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   Copyright (C) 2018 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library/Lesser General Public License
0006  *   version 2, or (at your option) any later version, as published by the
0007  *   Free Software Foundation
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library/Lesser General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 import QtQuick 2.1
0021 import QtQuick.Controls 2.4 as QQC2
0022 import QtQuick.Layouts 1.3
0023 import org.kde.kirigami 2.5
0024 
0025 /**
0026  * An about page that is ready to integrate in a kirigami app
0027  *
0028  * Allows to have a page that will show the copyright notice of the application
0029  * together with the contributors and some information of which platform it's
0030  * running on.
0031  *
0032  * @since 5.52
0033  * @since org.kde.kirigami 2.6
0034  */
0035 ScrollablePage
0036 {
0037     id: page
0038     /**
0039      * An object with the same shape of KAboutData
0040      *
0041      * For example:
0042      * @code
0043      * aboutData: {
0044         "displayName" : "KirigamiApp",
0045         "productName" : "kirigami/app",
0046         "componentName" : "kirigamiapp",
0047         "shortDescription" : "A Kirigami example",
0048         "homepage" : "",
0049         "bugAddress" : "submit@bugs.kde.org",
0050         "version" : "5.14.80",
0051         "otherText" : "",
0052         "authors" : [
0053             {
0054                 "name" : "...",
0055                 "task" : "",
0056                 "emailAddress" : "somebody@kde.org",
0057                 "webAddress" : "",
0058                 "ocsUsername" : ""
0059             }
0060         ],
0061         "credits" : [],
0062         "translators" : [],
0063         "licenses" : [
0064             {
0065                 "name" : "GPL v2",
0066                 "text" : "long, boring, license text",
0067                 "spdx" : "GPL-2.0"
0068             }
0069         ],
0070         "copyrightStatement" : "© 2010-2018 Plasma Development Team",
0071         "desktopFileName" : "org.kde.kirigamiapp"
0072         }
0073         @endcode
0074      *
0075      * @see KAboutData
0076      */
0077     property var aboutData
0078 
0079     title: qsTr("About")
0080 
0081     Component {
0082         id: licencePage
0083         ScrollablePage {
0084             property alias text: content.text
0085             QQC2.TextArea {
0086                 id: content
0087                 readOnly: true
0088             }
0089         }
0090     }
0091 
0092     Component {
0093         id: personDelegate
0094 
0095         RowLayout {
0096             height: implicitHeight + (Units.smallSpacing * 2)
0097 
0098             spacing: Units.smallSpacing * 2
0099             Icon {
0100                 width: Units.iconSizes.smallMedium
0101                 height: width
0102                 source: "user"
0103             }
0104             QQC2.Label {
0105                 text: modelData.emailAddress ? qsTr("%1 <%2>").arg(modelData.name).arg(modelData.emailAddress) : modelData.name
0106             }
0107         }
0108     }
0109 
0110     FormLayout {
0111         id: form
0112 
0113         GridLayout {
0114             columns: 2
0115             Layout.fillWidth: true
0116 
0117             Icon {
0118                 Layout.rowSpan: 2
0119                 Layout.preferredHeight: Units.iconSizes.huge
0120                 Layout.preferredWidth: height
0121                 Layout.maximumWidth: page.width / 3;
0122                 Layout.rightMargin: Units.largeSpacing
0123                 source: Settings.applicationWindowIcon || page.aboutData.programLogo || page.aboutData.programIconName || page.aboutData.componentName
0124             }
0125             Heading {
0126                 Layout.fillWidth: true
0127                 text: page.aboutData.displayName + " " + page.aboutData.version
0128             }
0129             Heading {
0130                 Layout.fillWidth: true
0131                 level: 2
0132                 wrapMode: Text.WordWrap
0133                 text: page.aboutData.shortDescription
0134             }
0135         }
0136 
0137         Separator {
0138             Layout.fillWidth: true
0139         }
0140 
0141         Heading {
0142             FormData.isSection: true
0143             text: qsTr("Copyright")
0144         }
0145         QQC2.Label {
0146             Layout.leftMargin: Units.gridUnit
0147             text: aboutData.otherText
0148             visible: text.length > 0
0149         }
0150         QQC2.Label {
0151             Layout.leftMargin: Units.gridUnit
0152             text: aboutData.copyrightStatement
0153             visible: text.length > 0
0154         }
0155         UrlButton {
0156             Layout.leftMargin: Units.gridUnit
0157             url: aboutData.homepage
0158             visible: url.length > 0
0159         }
0160 
0161         Component {
0162             id: licenseLinkButton
0163 
0164             RowLayout {
0165                 Layout.leftMargin: Units.smallSpacing
0166                 QQC2.Label { text: qsTr("License:") }
0167                 LinkButton {
0168                     text: modelData.name
0169                     onClicked: applicationWindow().pageStack.push(licencePage, { text: modelData.text, title: modelData.name } )
0170                 }
0171             }
0172         }
0173 
0174         Component {
0175             id: licenseTextItem
0176 
0177             RowLayout {
0178                 Layout.leftMargin: Units.smallSpacing
0179                 QQC2.Label { text: qsTr("License: %1").arg(modelData.name) }
0180             }
0181         }
0182 
0183         Repeater {
0184             model: aboutData.licenses
0185             delegate: applicationWindow().pageStack ? licenseLinkButton : licenseTextItem
0186         }
0187 
0188         Heading {
0189             FormData.isSection: visible
0190             text: qsTr("Libraries in use")
0191             visible: Settings.information
0192         }
0193         Repeater {
0194             model: Settings.information
0195             delegate: QQC2.Label {
0196                 Layout.leftMargin: Units.gridUnit
0197                 id: libraries
0198                 text: modelData
0199             }
0200         }
0201         Heading {
0202             Layout.fillWidth: true
0203             FormData.isSection: visible
0204             text: qsTr("Authors")
0205             visible: aboutData.authors.length > 0
0206         }
0207         Repeater {
0208             model: aboutData.authors
0209             delegate: personDelegate
0210         }
0211         Heading {
0212             height: visible ? implicitHeight : 0
0213             FormData.isSection: visible
0214             text: qsTr("Credits")
0215             visible: repCredits.count > 0
0216         }
0217         Repeater {
0218             id: repCredits
0219             model: aboutData.credits
0220             delegate: personDelegate
0221         }
0222         Heading {
0223             height: visible ? implicitHeight : 0
0224             FormData.isSection: visible
0225             text: qsTr("Translators")
0226             visible: repTranslators.count > 0
0227         }
0228         Repeater {
0229             id: repTranslators
0230             model: aboutData.translators
0231             delegate: personDelegate
0232         }
0233     }
0234 }