Changeset View
Changeset View
Standalone View
Standalone View
discover/qml/AboutPage.qml
Show All 11 Lines | |||||
12 | * GNU General Public License for more details | 12 | * GNU General Public License for more details | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library/Lesser General Public | 14 | * You should have received a copy of the GNU Library/Lesser General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQml 2.1 | ||
21 | import QtQuick.Controls 2.4 | 21 | import org.kde.kirigami 2.6 as Kirigami | ||
22 | import QtQuick.Layouts 1.3 | | |||
23 | import org.kde.kirigami 2.5 as Kirigami | | |||
24 | 22 | | |||
25 | Kirigami.Page | 23 | Kirigami.AboutPage | ||
26 | { | 24 | { | ||
27 | id: page | | |||
28 | property var aboutData: discoverAboutData | | |||
29 | property var aboutLibraries: discoverAboutLibraries | | |||
30 | | ||||
31 | contextualActions: [ | 25 | contextualActions: [ | ||
32 | KirigamiActionBridge { action: app.action("help_report_bug") } | 26 | KirigamiActionBridge { action: app.action("help_report_bug") } | ||
33 | ] | 27 | ] | ||
34 | 28 | | |||
35 | title: i18n("About") | 29 | aboutData: discoverAboutData | ||
36 | header: ColumnLayout { | 30 | Component.onCompleted: { | ||
37 | GridLayout { | 31 | console.log("xxx", JSON.stringify(discoverAboutData)) | ||
38 | columns: 2 | | |||
39 | Layout.fillWidth: true | | |||
40 | Layout.preferredHeight: Kirigami.Units.iconSizes.huge | | |||
41 | | ||||
42 | Kirigami.Icon { | | |||
43 | Layout.rowSpan: 2 | | |||
44 | Layout.fillHeight: true | | |||
45 | Layout.minimumWidth: height | | |||
46 | Layout.rightMargin: Kirigami.Units.largeSpacing | | |||
47 | source: page.aboutData.programLogo || page.aboutData.programIconName | | |||
48 | } | | |||
49 | Kirigami.Heading { | | |||
50 | Layout.fillWidth: true | | |||
51 | text: page.aboutData.displayName + " " + page.aboutData.version | | |||
52 | } | | |||
53 | Kirigami.Heading { | | |||
54 | Layout.fillWidth: true | | |||
55 | level: 2 | | |||
56 | text: page.aboutData.shortDescription | | |||
57 | } | | |||
58 | } | | |||
59 | TabBar { | | |||
60 | Layout.fillWidth: true | | |||
61 | id: bar | | |||
62 | TabButton { text: i18n("About") } | | |||
63 | TabButton { text: i18n("Libraries") } | | |||
64 | TabButton { text: i18n("Authors") } | | |||
65 | } | | |||
66 | } | | |||
67 | | ||||
68 | Component { | | |||
69 | id: licencePage | | |||
70 | Kirigami.ScrollablePage { | | |||
71 | property alias text: content.text | | |||
72 | TextArea { | | |||
73 | id: content | | |||
74 | readOnly: true | | |||
75 | } | | |||
76 | } | | |||
77 | } | | |||
78 | | ||||
79 | SwipeView { | | |||
80 | anchors.fill: parent | | |||
81 | currentIndex: bar.currentIndex | | |||
82 | interactive: false | | |||
83 | ColumnLayout { | | |||
84 | Label { | | |||
85 | text: aboutData.shortDescription | | |||
86 | visible: text.length > 0 | | |||
87 | } | | |||
88 | Label { | | |||
89 | text: aboutData.otherText | | |||
90 | visible: text.length > 0 | | |||
91 | } | | |||
92 | Label { | | |||
93 | text: aboutData.copyrightStatement | | |||
94 | visible: text.length > 0 | | |||
95 | } | | |||
96 | UrlButton { | | |||
97 | url: aboutData.homepage | | |||
98 | visible: url.length > 0 | | |||
99 | } | | |||
100 | | ||||
101 | Repeater { | | |||
102 | id: rep | | |||
103 | model: aboutData.licenses | | |||
104 | delegate: LinkButton { | | |||
105 | text: modelData.name | | |||
106 | onClicked: applicationWindow().pageStack.push(licencePage, { text: modelData.text, title: modelData.name } ) | | |||
107 | } | | |||
108 | } | | |||
109 | | ||||
110 | Item { | | |||
111 | Layout.fillHeight: true | | |||
112 | } | | |||
113 | } | | |||
114 | Label { | | |||
115 | id: libraries | | |||
116 | text: page.aboutLibraries | | |||
117 | } | | |||
118 | Kirigami.CardsListView { | | |||
119 | header: Label { | | |||
120 | readonly property string bugAddress: aboutData.bugAddress || "https://bugs.kde.org" | | |||
121 | readonly property string bugDisplay: aboutData.bugAddress ? ("mailto:" + aboutData.bugAddress) : "https://bugs.kde.org" | | |||
122 | text: i18n("Please use <a href=\"%1\">%2</a> to report bugs.\n", bugDisplay, bugAddress) | | |||
123 | } | | |||
124 | model: aboutData.authors | | |||
125 | delegate: Kirigami.AbstractCard { | | |||
126 | contentItem: RowLayout { | | |||
127 | Layout.preferredHeight: Kirigami.Units.iconSizes.medium | | |||
128 | Kirigami.Icon { | | |||
129 | Layout.fillHeight: true | | |||
130 | Layout.minimumWidth: Kirigami.Units.iconSizes.medium | | |||
131 | Layout.maximumWidth: Kirigami.Units.iconSizes.medium | | |||
132 | source: "https://www.gravatar.com/avatar/" + Qt.md5(modelData.emailAddress) + "?d=404&s=" + Kirigami.Units.iconSizes.medium | | |||
133 | fallback: "user" | | |||
134 | } | | |||
135 | Label { | | |||
136 | Layout.fillWidth: true | | |||
137 | text: i18n("%1 <%2>", modelData.name, modelData.emailAddress) | | |||
138 | } | | |||
139 | } | | |||
140 | } | | |||
141 | } | | |||
142 | } | 32 | } | ||
143 | } | 33 | } |