diff --git a/discover/qml/ApplicationDelegate.qml b/discover/qml/ApplicationDelegate.qml index 90cd78d3..9bb4d77f 100644 --- a/discover/qml/ApplicationDelegate.qml +++ b/discover/qml/ApplicationDelegate.qml @@ -1,114 +1,113 @@ /* * Copyright (C) 2012 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 1.1 import QtQuick.Layouts 1.1 import org.kde.kquickcontrolsaddons 2.0 import org.kde.discover.app 1.0 import QtQuick.Window 2.1 import org.kde.kcoreaddons 1.0 import "navigation.js" as Navigation import org.kde.kirigami 2.0 as Kirigami Kirigami.AbstractListItem { id: delegateArea property alias application: installButton.application property bool compact: false function trigger() { if (ListView.view) ListView.view.currentIndex = index Navigation.openApplication(application) } highlighted: ListView.isCurrentItem Keys.onReturnPressed: trigger() onClicked: trigger() rightPadding: Kirigami.Units.largeSpacing RowLayout { id: lowLayout implicitHeight: conts.implicitHeight QIconItem { id: resourceIcon icon: application.icon readonly property real contHeight: lowLayout.height * 0.8 Layout.minimumWidth: contHeight height: contHeight anchors.verticalCenter: parent.verticalCenter } ColumnLayout { id: conts Layout.fillWidth: true RowLayout { Layout.fillWidth: true Heading { Layout.fillWidth: true elide: Text.ElideRight text: delegateArea.application.name maximumLineCount: 1 } Label { Layout.fillWidth: true elide: Text.ElideRight horizontalAlignment: Text.AlignRight text: delegateArea.application.categoryDisplay color: Kirigami.Theme.linkColor visible: conts.width > implicitWidth } } Rectangle { color: Kirigami.Theme.linkColor Layout.fillWidth: true height: Kirigami.Units.devicePixelRatio } Label { Layout.fillWidth: true elide: Text.ElideRight text: delegateArea.application.comment maximumLineCount: 1 font: SystemFonts.titleFont } Label { Layout.fillWidth: true horizontalAlignment: Text.AlignJustify wrapMode: Text.WordWrap elide: Text.ElideRight textFormat: Text.StyledText text: delegateArea.application.longDescription maximumLineCount: delegateArea.compact ? 1 : 3 } InstallApplicationButton { id: installButton Layout.alignment: Qt.AlignRight - canUpgrade: false } } } } diff --git a/discover/qml/ApplicationPage.qml b/discover/qml/ApplicationPage.qml index 07bc898e..dca579ee 100644 --- a/discover/qml/ApplicationPage.qml +++ b/discover/qml/ApplicationPage.qml @@ -1,208 +1,225 @@ /* * Copyright (C) 2012 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 1.1 import QtQuick.Window 2.1 import QtQuick.Layouts 1.1 import QtGraphicalEffects 1.0 import org.kde.kquickcontrolsaddons 2.0 import org.kde.discover 1.0 import org.kde.discover.app 1.0 import org.kde.kirigami 2.0 as Kirigami import "navigation.js" as Navigation DiscoverPage { id: appInfo property QtObject application: null clip: true title: application.name background: Rectangle { color: Kirigami.Theme.viewBackgroundColor } ReviewsPage { id: reviewsSheet model: reviewsModel } pageOverlay: Item { - InstallApplicationButton { - id: button + Rectangle { + id: bg + color: Kirigami.Theme.viewBackgroundColor + anchors.fill: layo + } + RowLayout { + Binding { + target: appInfo + property: "bottomPadding" + value: layo.height + Kirigami.Units.largeSpacing + } + id: layo anchors { + left: parent.left right: parent.right bottom: parent.bottom - bottomMargin: Kirigami.Units.gridUnit - rightMargin: appInfo.width - appInfo.flickable.width + } + ToolButton { + iconName: "draw-arrow-forward" + enabled: appInfo.sClose.enabled + onClicked: appInfo.sClose.activated() + } + Label { + enabled: appInfo.sClose.enabled + text: i18n("Close Description") } - Layout.alignment: Qt.AlignRight - application: appInfo.application - fill: true - additionalItem: Button { + Item { Layout.fillWidth: true - visible: application.isInstalled && application.canExecute - text: i18n("Launch") - onClicked: application.invokeApplication() } - } - DropShadow { - anchors.fill: button - source: button - horizontalOffset: 3 - verticalOffset: 3 - radius: 8 - samples: 10 - color: "#000000" + spacing: 0 + + InstallApplicationButton { + application: appInfo.application + Layout.minimumWidth: Kirigami.Units.gridUnit * 10 + } + } + Kirigami.Separator { + anchors { + left: bg.left + right: bg.right + top: bg.top + } + z: 4000 } } ColumnLayout { RowLayout { Layout.fillWidth: true spacing: Kirigami.Units.gridUnit QIconItem { Layout.preferredHeight: 128 Layout.preferredWidth: 128 icon: appInfo.application.icon Layout.alignment: Qt.AlignVCenter } ColumnLayout { id: conts Layout.fillWidth: true Layout.fillHeight: true Layout.topMargin: Kirigami.Units.largeSpacing Layout.bottomMargin: Kirigami.Units.largeSpacing spacing: 0 Heading { id: title text: appInfo.application.name Layout.fillWidth: true elide: Text.ElideRight } Rectangle { color: Kirigami.Theme.linkColor Layout.fillWidth: true height: 1 } Label { Layout.fillWidth: true text: appInfo.application.comment wrapMode: Text.WordWrap elide: Text.ElideRight maximumLineCount: 1 } Label { Layout.fillWidth: true elide: Text.ElideRight text: appInfo.application.categoryDisplay color: Kirigami.Theme.linkColor } Item { Layout.fillWidth: true Layout.fillHeight: true } Label { text: i18n("Version: %1", appInfo.application.isInstalled ? appInfo.application.installedVersion : appInfo.application.availableVersion) } Label { text: i18n("Size: %1", appInfo.application.sizeDescription) } Label { visible: text.length>0 text: appInfo.application.license ? i18n("License: %1", appInfo.application.license) : "" } } } ApplicationScreenshots { Layout.fillWidth: true resource: appInfo.application page: appInfo } Heading { text: i18n("Description") Layout.fillWidth: true visible: appInfo.application.longDescription.length > 0 } Label { Layout.fillWidth: true horizontalAlignment: Text.AlignJustify wrapMode: Text.WordWrap text: appInfo.application.longDescription } RowLayout { visible: button.text.length > 0 Label { text: i18n("Homepage: ") } LinkButton { id: button text: application.homepage onClicked: Qt.openUrlExternally(application.homepage) } } LinkButton { id: addonsButton text: i18n("Addons") visible: addonsView.containsAddons onClicked: addonsView.sheetOpen = true } LinkButton { text: i18n("Review") onClicked: reviewsSheet.openReviewDialog() visible: !commentsButton.visible } LinkButton { id: commentsButton readonly property QtObject rating: appInfo.application.rating visible: rating && rating.ratingCount>0 && reviewsModel.count text: i18n("Show comments (%1)...", rating ? reviewsModel.count : 0) ReviewsModel { id: reviewsModel resource: appInfo.application } onClicked: { reviewsSheet.open() } } Item { height: addonsButton.height width: 5 } } readonly property var addons: AddonsView { id: addonsView application: appInfo.application parent: overlay } } diff --git a/discover/qml/InstallApplicationButton.qml b/discover/qml/InstallApplicationButton.qml index 96a25090..83d1b020 100644 --- a/discover/qml/InstallApplicationButton.qml +++ b/discover/qml/InstallApplicationButton.qml @@ -1,71 +1,56 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import org.kde.discover 1.0 +import org.kde.kirigami 2.0 as Kirigami ConditionalLoader { id: root property alias application: listener.resource readonly property alias isActive: listener.isActive readonly property alias progress: listener.progress readonly property alias listener: listener property Component additionalItem: null - property bool canUpgrade: true - property bool fill: false TransactionListener { id: listener } function click() { if (!isActive) { item.click(); } } condition: listener.isActive componentTrue: RowLayout { LabelBackground { Layout.fillWidth: true text: listener.statusText progress: listener.progress/100 } ToolButton { Layout.fillHeight: true iconName: "dialog-cancel" enabled: listener.isCancellable onClicked: listener.cancel() } } - componentFalse: RowLayout { + componentFalse: ToolButton { + id: button function click() { button.clicked(); } - Loader { - Layout.fillWidth: root.fill - Component { - id: updateButton - Button { - text: i18n("Update") - onClicked: ResourcesModel.installApplication(application) - } - } - sourceComponent: (root.canUpgrade && application.canUpgrade) ? updateButton : root.additionalItem - } - Button { - id: button - enabled: application.state != AbstractResource.Broken - text: !application.isInstalled ? i18n("Install") : i18n("Remove") - Layout.fillWidth: root.fill + enabled: application.state != AbstractResource.Broken + text: !application.isInstalled ? i18n("Install") : i18n("Remove") - onClicked: { - if(application.isInstalled) - ResourcesModel.removeApplication(application); - else - ResourcesModel.installApplication(application); - } + onClicked: { + if(application.isInstalled) + ResourcesModel.removeApplication(application); + else + ResourcesModel.installApplication(application); } } }