Commit 67398163 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Provide a qqc2/kirigami-based about page

Summary:
Instead of using the one in xmlgui, create one that integrates properly in Kirigami/Discover.

Depends on D17078 and D17080.

Test Plan: Used it, saw myself in it.

Reviewers: #plasma, #frameworks

Subscribers: vkrause, mart, leinir, ngraham, ltoscano, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D17079
parent 48cb4db4
......@@ -53,6 +53,7 @@
#include <KConfigGroup>
#include <KStandardAction>
#include <KIO/AccessManager>
#include <kcoreaddons_version.h>
// #include <KSwitchLanguageDialog>
// DiscoverCommon includes
......@@ -114,6 +115,10 @@ DiscoverObject::DiscoverObject(CompactMode mode)
qmlRegisterType<QQuickView>();
qmlRegisterType<QActionGroup>();
qmlRegisterType<QAction>();
qmlRegisterType<KAboutData>();
qmlRegisterType<KAboutLicense>();
qmlRegisterType<KAboutPerson>();
qmlRegisterUncreatableType<DiscoverObject>("org.kde.discover.app", 1, 0, "DiscoverMainWindow", QStringLiteral("don't do that"));
setupActions();
......@@ -127,6 +132,12 @@ DiscoverObject::DiscoverObject(CompactMode mode)
delete m_engine->networkAccessManagerFactory();
m_engine->setNetworkAccessManagerFactory(m_networkAccessManagerFactory.data());
m_engine->rootContext()->setContextProperty(QStringLiteral("app"), this);
m_engine->rootContext()->setContextProperty(QStringLiteral("discoverAboutData"), QVariant::fromValue(KAboutData::applicationData()));
m_engine->rootContext()->setContextProperty(QStringLiteral("discoverAboutLibraries"), i18n("<ul><li>KDE Frameworks %1</li><li>Qt %2 (built against %3)</li><li>The <em>%4</em> windowing system</li></ul>",
QStringLiteral(KCOREADDONS_VERSION_STRING),
QString::fromLocal8Bit(qVersion()),
QStringLiteral(QT_VERSION_STR),
QGuiApplication::platformName()));
connect(m_engine, &QQmlApplicationEngine::objectCreated, this, &DiscoverObject::integrateObject);
m_engine->load(QUrl(QStringLiteral("qrc:/qml/DiscoverWindow.qml")));
......
......@@ -101,9 +101,10 @@ int main(int argc, char** argv)
KLocalizedString::setApplicationDomain("plasma-discover");
KAboutData about(QStringLiteral("discover"), i18n("Discover"), version, i18n("An application explorer"),
KAboutLicense::GPL, i18n("© 2010-2018 Plasma Development Team"));
about.addAuthor(i18n("Aleix Pol Gonzalez"), QString(), QStringLiteral("aleixpol@blue-systems.com"));
about.addAuthor(i18n("Aleix Pol Gonzalez"), QString(), QStringLiteral("aleixpol@kde.org"));
about.addAuthor(i18n("Jonathan Thomas"), QString(), QStringLiteral("echidnaman@kubuntu.org"));
about.setProductName("discover/discover");
about.setProgramLogo(app.windowIcon());
about.setTranslator(
i18ndc(nullptr, "NAME OF TRANSLATORS", "Your names"),
......
/*
* Copyright (C) 2018 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library/Lesser General Public License
* version 2, or (at your option) any later version, as published by the
* Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library/Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.1
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.5 as Kirigami
Kirigami.Page
{
id: page
property var aboutData: discoverAboutData
property var aboutLibraries: discoverAboutLibraries
contextualActions: [
KirigamiActionBridge { action: app.action("help_report_bug") }
]
title: i18n("About")
header: ColumnLayout {
GridLayout {
columns: 2
Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.iconSizes.huge
Kirigami.Icon {
Layout.rowSpan: 2
Layout.fillHeight: true
Layout.minimumWidth: height
Layout.rightMargin: Kirigami.Units.largeSpacing
source: page.aboutData.programLogo || page.aboutData.programIconName
}
Kirigami.Heading {
Layout.fillWidth: true
text: page.aboutData.displayName + " " + page.aboutData.version
}
Kirigami.Heading {
Layout.fillWidth: true
level: 2
text: page.aboutData.shortDescription
}
}
TabBar {
Layout.fillWidth: true
id: bar
TabButton { text: i18n("About") }
TabButton { text: i18n("Libraries") }
TabButton { text: i18n("Authors") }
}
}
Component {
id: licencePage
Kirigami.ScrollablePage {
property alias text: content.text
TextArea {
id: content
readOnly: true
}
}
}
SwipeView {
anchors.fill: parent
currentIndex: bar.currentIndex
interactive: false
ColumnLayout {
Label {
text: aboutData.shortDescription
visible: text.length > 0
}
Label {
text: aboutData.otherText
visible: text.length > 0
}
Label {
text: aboutData.copyrightStatement
visible: text.length > 0
}
UrlButton {
url: aboutData.homepage
visible: url.length > 0
}
Repeater {
id: rep
model: aboutData.licenses
delegate: LinkButton {
text: modelData.name
onClicked: applicationWindow().pageStack.push(licencePage, { text: modelData.text, title: modelData.name } )
}
}
Item {
Layout.fillHeight: true
}
}
Label {
id: libraries
text: page.aboutLibraries
}
Kirigami.CardsListView {
header: Label {
readonly property string bugAddress: aboutData.bugAddress || "https://bugs.kde.org"
readonly property string bugDisplay: aboutData.bugAddress ? ("mailto:" + aboutData.bugAddress) : "https://bugs.kde.org"
text: i18n("Please use <a href=\"" + + bugAddress + "\">" + bugDisplay + "</a> to report bugs.\n")
}
model: aboutData.authors
delegate: Kirigami.AbstractCard {
contentItem: RowLayout {
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
Kirigami.Icon {
Layout.fillHeight: true
Layout.minimumWidth: Kirigami.Units.iconSizes.medium
Layout.maximumWidth: Kirigami.Units.iconSizes.medium
source: "https://www.gravatar.com/avatar/" + Qt.md5(modelData.emailAddress) + "?d=404&s=" + Kirigami.Units.iconSizes.medium
fallback: "user"
}
Label {
Layout.fillWidth: true
text: i18n("%1 <%2>", modelData.name, modelData.emailAddress)
}
}
}
}
}
}
......@@ -121,19 +121,7 @@ Kirigami.GlobalDrawer {
}
ActionListItem {
action: Kirigami.Action {
text: i18n("Help")
icon.name: "help-feedback"
onTriggered: helpMenu.open()
}
readonly property var p0: Menu {
id: helpMenu
title: i18n("Help")
MenuItem { action: ActionBridge { action: app.action("help_about_app") } }
MenuItem { action: ActionBridge { action: app.action("help_report_bug") } }
}
action: aboutAction
}
ActionListItem {
......
......@@ -19,6 +19,7 @@ Kirigami.ApplicationWindow
readonly property string topSearchComp: ("qrc:/qml/SearchPage.qml")
readonly property string topUpdateComp: ("qrc:/qml/UpdatesPage.qml")
readonly property string topSourcesComp: ("qrc:/qml/SourcesPage.qml")
readonly property string topAboutComp: ("qrc:/qml/AboutPage.qml")
readonly property string loadingComponent: ("qrc:/qml/LoadingPage.qml")
readonly property QtObject stack: window.pageStack
property string currentTopLevel: defaultStartup ? topBrowsingComp : loadingComponent
......@@ -72,6 +73,13 @@ Kirigami.ApplicationWindow
component: topUpdateComp
objectName: "update"
}
TopLevelPageData {
id: aboutAction
iconName: "help-feedback"
text: i18n("Help")
component: topAboutComp
objectName: "about"
}
TopLevelPageData {
id: sourcesAction
text: i18n("Sources")
......
......@@ -34,6 +34,7 @@
<file>qml/SearchField.qml</file>
<file>qml/Shadow.qml</file>
<file>qml/DiscoverPopup.qml</file>
<file>qml/AboutPage.qml</file>
<file>qml/navigation.js</file>
</qresource>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment