summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleix Pol <[email protected]>2018-11-26 18:22:52 +0100
committerAleix Pol <[email protected]>2018-11-29 15:54:18 +0100
commit50c69c2c069fa56b9adefee4e72c5b3d304f474a (patch)
treea4a3453bc3bf2880150cf96eda63b2327fbeb261
parent20eb939cd53f98ba4bd07b128989c1e1dab3c66d (diff)
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
-rw-r--r--discover/DiscoverObject.cpp5
-rw-r--r--discover/qml/AboutPage.qml122
-rw-r--r--discover/qml/ApplicationPage.qml18
-rw-r--r--discover/qml/LinkButton.qml33
-rw-r--r--discover/qml/UrlButton.qml27
-rw-r--r--discover/resources.qrc2
-rw-r--r--libdiscover/backends/PackageKitBackend/qml/DependenciesButton.qml4
7 files changed, 17 insertions, 194 deletions
diff --git a/discover/DiscoverObject.cpp b/discover/DiscoverObject.cpp
index 97d0dec..c827fb2 100644
--- a/discover/DiscoverObject.cpp
+++ b/discover/DiscoverObject.cpp
@@ -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")));
diff --git a/discover/qml/AboutPage.qml b/discover/qml/AboutPage.qml
index 715e195..c30517b 100644
--- a/discover/qml/AboutPage.qml
+++ b/discover/qml/AboutPage.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))
}
}
diff --git a/discover/qml/ApplicationPage.qml b/discover/qml/ApplicationPage.qml
index 6f41dc7..b2dabf0 100644
--- a/discover/qml/ApplicationPage.qml
+++ b/discover/qml/ApplicationPage.qml
@@ -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
diff --git a/discover/qml/LinkButton.qml b/discover/qml/LinkButton.qml
deleted file mode 100644
index 7cb695d..0000000
--- a/discover/qml/LinkButton.qml
+++ /dev/null
@@ -1,33 +0,0 @@
-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)
- }
-}
diff --git a/discover/qml/UrlButton.qml b/discover/qml/UrlButton.qml
deleted file mode 100644
index abd8751..0000000
--- a/discover/qml/UrlButton.qml
+++ /dev/null
@@ -1,27 +0,0 @@
-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)
- }
- }
-}
diff --git a/discover/resources.qrc b/discover/resources.qrc
index 6ab069b..b93bd29 100644
--- a/discover/resources.qrc
+++ b/discover/resources.qrc
@@ -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>
diff --git a/libdiscover/backends/PackageKitBackend/qml/DependenciesButton.qml b/libdiscover/backends/PackageKitBackend/qml/DependenciesButton.qml
index f2a1a20..e824a54 100644
--- a/libdiscover/backends/PackageKitBackend/qml/DependenciesButton.qml
+++ b/libdiscover/backends/PackageKitBackend/qml/DependenciesButton.qml
@@ -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...")