Commit 50c69c2c authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Drop tab-based UI for the about page

Summary: Integrates better with Kirigami.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D17177
parent 20eb939c
......@@ -133,11 +133,6 @@ DiscoverObject::DiscoverObject(CompactMode mode)
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")));
......
......@@ -17,127 +17,17 @@
* 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
import QtQml 2.1
import org.kde.kirigami 2.6 as Kirigami
Kirigami.Page
Kirigami.AboutPage
{
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=\"%1\">%2</a> to report bugs.\n", bugDisplay, bugAddress)
}
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)
}
}
}
}
aboutData: discoverAboutData
Component.onCompleted: {
console.log("xxx", JSON.stringify(discoverAboutData))
}
}
......@@ -23,7 +23,7 @@ import QtQuick.Window 2.1
import QtQuick.Layouts 1.1
import org.kde.discover 2.0
import org.kde.discover.app 1.0
import org.kde.kirigami 2.1 as Kirigami
import org.kde.kirigami 2.6 as Kirigami
import "navigation.js" as Navigation
DiscoverPage {
......@@ -197,7 +197,7 @@ DiscoverPage {
}
}
LinkButton {
Kirigami.LinkButton {
id: addonsButton
text: i18n("Addons")
visible: addonsView.containsAddons
......@@ -217,7 +217,7 @@ DiscoverPage {
visible: rep.count > 0
}
LinkButton {
Kirigami.LinkButton {
visible: reviewsModel.count > visibleReviews
text: i18np("Show %1 review...", "Show all %1 reviews...", reviewsModel.count)
Layout.alignment: Qt.AlignRight | Qt.AlignBottom
......@@ -248,7 +248,7 @@ DiscoverPage {
Layout.bottomMargin: Kirigami.Units.largeSpacing
}
}
LinkButton {
Kirigami.LinkButton {
function writeReviewText() {
if (appInfo.application.isInstalled) {
if (reviewsModel.count > 0) {
......@@ -384,7 +384,7 @@ DiscoverPage {
text: i18n("License:")
visible: appInfo.application.license.length>0
}
UrlButton {
Kirigami.UrlButton {
Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft
// tooltip: i18n("See full license terms")
......@@ -398,7 +398,7 @@ DiscoverPage {
Layout.alignment: Qt.AlignRight
text: i18n("Homepage:")
}
UrlButton {
Kirigami.UrlButton {
id: homepageLink
url: application.homepage
Layout.fillWidth: true
......@@ -411,7 +411,7 @@ DiscoverPage {
Layout.alignment: Qt.AlignRight
text: i18n("User Guide:")
}
UrlButton {
Kirigami.UrlButton {
id: docsLink
url: application.helpURL
Layout.fillWidth: true
......@@ -424,7 +424,7 @@ DiscoverPage {
Layout.alignment: Qt.AlignRight
text: i18n("Donate:")
}
UrlButton {
Kirigami.UrlButton {
id: donationLink
url: application.donationURL
Layout.fillWidth: true
......@@ -437,7 +437,7 @@ DiscoverPage {
Layout.alignment: Qt.AlignRight
text: i18n("Report a Problem:")
}
UrlButton {
Kirigami.UrlButton {
id: bugLink
url: application.bugURL
Layout.fillWidth: true
......
import QtQuick 2.2
import org.kde.kirigami 2.0 as Kirigami
import QtQuick.Controls 2.1 as QQC2
QQC2.Label {
id: control
property QtObject action: null //some older Qt versions don't support the namespacing in Kirigami.Action
property alias acceptedButtons: area.acceptedButtons
text: action ? action.text : ""
enabled: !action || action.enabled
onClicked: if (action) action.trigger()
font: control.font
color: enabled ? Kirigami.Theme.linkColor : Kirigami.Theme.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
signal clicked(QtObject mouse)
MouseArea {
id: area
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onContainsMouseChanged: {
control.font.underline = containsMouse && control.enabled
}
onClicked: control.clicked(mouse)
}
}
import QtQuick 2.2
import org.kde.kirigami 2.0 as Kirigami
import QtQuick.Controls 2.1 as QQC2
LinkButton
{
id: button
property string url
text: url
visible: text.length>0
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
if (mouse.button === Qt.RightButton)
menu.popup()
else
Qt.openUrlExternally(url)
}
QQC2.Menu {
id: menu
QQC2.MenuItem {
text: i18n("Copy link address")
onClicked: app.copyTextToClipboard(button.url)
}
}
}
......@@ -20,8 +20,6 @@
<file>qml/AddSourceDialog.qml</file>
<file>qml/ConditionalLoader.qml</file>
<file>qml/ConditionalObject.qml</file>
<file>qml/LinkButton.qml</file>
<file>qml/UrlButton.qml</file>
<file>qml/ApplicationScreenshots.qml</file>
<file>qml/LabelBackground.qml</file>
<file>qml/ActionBridge.qml</file>
......
......@@ -19,9 +19,9 @@
import QtQuick 2.8
import QtQuick.Controls 2.1
import org.kde.kirigami 2.1 as Kirigami
import org.kde.kirigami 2.6 as Kirigami
LinkButton
Kirigami.LinkButton
{
text: i18n("Show Dependencies...")
......
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