diff --git a/discover/DiscoverObject.cpp b/discover/DiscoverObject.cpp --- a/discover/DiscoverObject.cpp +++ b/discover/DiscoverObject.cpp @@ -53,6 +53,7 @@ #include #include #include +#include // #include // DiscoverCommon includes @@ -114,6 +115,10 @@ qmlRegisterType(); qmlRegisterType(); qmlRegisterType(); + + qmlRegisterType(); + qmlRegisterType(); + qmlRegisterType(); qmlRegisterUncreatableType("org.kde.discover.app", 1, 0, "DiscoverMainWindow", QStringLiteral("don't do that")); setupActions(); @@ -127,6 +132,12 @@ 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("
  • KDE Frameworks %1
  • Qt %2 (built against %3)
  • The %4 windowing system
", + 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"))); diff --git a/discover/main.cpp b/discover/main.cpp --- a/discover/main.cpp +++ b/discover/main.cpp @@ -101,9 +101,10 @@ 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"), diff --git a/discover/qml/AboutPage.qml b/discover/qml/AboutPage.qml new file mode 100644 --- /dev/null +++ b/discover/qml/AboutPage.qml @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2018 Aleix Pol Gonzalez + * + * 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 " + bugDisplay + " 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) + } + } + } + } + } +} diff --git a/discover/qml/DiscoverDrawer.qml b/discover/qml/DiscoverDrawer.qml --- a/discover/qml/DiscoverDrawer.qml +++ b/discover/qml/DiscoverDrawer.qml @@ -121,19 +121,7 @@ } 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 { diff --git a/discover/qml/DiscoverWindow.qml b/discover/qml/DiscoverWindow.qml --- a/discover/qml/DiscoverWindow.qml +++ b/discover/qml/DiscoverWindow.qml @@ -19,6 +19,7 @@ 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 @@ component: topUpdateComp objectName: "update" } + TopLevelPageData { + id: aboutAction + iconName: "help-feedback" + text: i18n("Help") + component: topAboutComp + objectName: "about" + } TopLevelPageData { id: sourcesAction text: i18n("Sources") diff --git a/discover/resources.qrc b/discover/resources.qrc --- a/discover/resources.qrc +++ b/discover/resources.qrc @@ -34,6 +34,7 @@ qml/SearchField.qml qml/Shadow.qml qml/DiscoverPopup.qml + qml/AboutPage.qml qml/navigation.js