diff --git a/discover/qml/AddonsView.qml b/discover/qml/AddonsView.qml index 0215280e..a6de8d77 100644 --- a/discover/qml/AddonsView.qml +++ b/discover/qml/AddonsView.qml @@ -1,97 +1,97 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import org.kde.discover 1.0 import org.kde.kquickcontrolsaddons 2.0 import "navigation.js" as Navigation import org.kde.kirigami 2.0 as Kirigami Kirigami.OverlaySheet { id: addonsView property alias application: addonsModel.application property bool isInstalling: false readonly property bool containsAddons: rep.count>0 || isExtended readonly property bool isExtended: ResourcesModel.isExtended(application.appstreamId) ColumnLayout { visible: addonsView.containsAddons enabled: !addonsView.isInstalling spacing: 5 Heading { text: i18n("Addons") } Repeater { id: rep model: ApplicationAddonsModel { id: addonsModel } delegate: RowLayout { Layout.fillWidth: true CheckBox { enabled: !addonsView.isInstalling checked: model.checked onClicked: addonsModel.changeState(packageName, checked) } - QIconItem { - icon: "applications-other" + Kirigami.Icon { + source: "applications-other" smooth: true Layout.minimumWidth: content.implicitHeight Layout.minimumHeight: content.implicitHeight opacity: addonsView.isInstalling ? 0.3 : 1 } ColumnLayout { id: content Layout.fillWidth: true spacing: 0 Label { Layout.fillWidth: true elide: Text.ElideRight text: display } Label { Layout.fillWidth: true elide: Text.ElideRight font.italic: true text: toolTip } } } } RowLayout { readonly property bool active: addonsModel.hasChanges && !addonsView.isInstalling spacing: 5 Button { iconName: "dialog-ok" text: i18n("Apply Changes") onClicked: addonsModel.applyChanges() visible: parent.active } Button { iconName: "document-revert" text: i18n("Discard") onClicked: addonsModel.discardChanges() visible: parent.active } Item { Layout.fillWidth: true height: 5 } Button { Layout.alignment: Qt.AlignRight text: i18n("More...") visible: application.appstreamId.length>0 && addonsView.isExtended onClicked: Navigation.openExtends(application.appstreamId) } } } } diff --git a/discover/qml/ApplicationDelegate.qml b/discover/qml/ApplicationDelegate.qml index eb8da806..2deaa1d7 100644 --- a/discover/qml/ApplicationDelegate.qml +++ b/discover/qml/ApplicationDelegate.qml @@ -1,120 +1,119 @@ /* * 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 Item { implicitHeight: Math.max(conts.implicitHeight, resourceIcon.height) - QIconItem { + Kirigami.Icon { id: resourceIcon - icon: application.icon - + source: application.icon readonly property real contHeight: delegateArea.compact ? Kirigami.Units.gridUnit * 4 : Kirigami.Units.gridUnit * 7 height: contHeight width: contHeight anchors { verticalCenter: parent.verticalCenter left: parent.left leftMargin: Kirigami.Units.smallSpacing } } ColumnLayout { id: conts anchors { right: parent.right left: resourceIcon.right leftMargin: Kirigami.Units.largeSpacing } 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 } } } } diff --git a/discover/qml/ApplicationPage.qml b/discover/qml/ApplicationPage.qml index 970cfdb4..3ce95b30 100644 --- a/discover/qml/ApplicationPage.qml +++ b/discover/qml/ApplicationPage.qml @@ -1,233 +1,233 @@ /* * 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 { 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 } ToolButton { iconName: "draw-arrow-forward" enabled: appInfo.sClose.enabled onClicked: appInfo.sClose.activated() } Label { enabled: appInfo.sClose.enabled text: i18n("Close Description") } Item { Layout.fillWidth: true } spacing: 0 ToolButton { Layout.minimumWidth: Kirigami.Units.gridUnit * 10 visible: application.isInstalled && application.canExecute text: i18n("Launch") onClicked: application.invokeApplication() } InstallApplicationButton { application: appInfo.application flat: true 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 { + Kirigami.Icon { Layout.preferredHeight: 128 Layout.preferredWidth: 128 - icon: appInfo.application.icon + source: 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/ProgressView.qml b/discover/qml/ProgressView.qml index f6c79745..898c9930 100644 --- a/discover/qml/ProgressView.qml +++ b/discover/qml/ProgressView.qml @@ -1,119 +1,119 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import org.kde.kquickcontrolsaddons 2.0 import org.kde.discover 1.0 import org.kde.kirigami 2.0 as Kirigami import "navigation.js" as Navigation Kirigami.BasicListItem { id: listItem label: TransactionModel.count ? i18n("Tasks (%1%)", TransactionModel.progress) : i18n("Tasks") visible: progressModel.count > 0 background: Item { Rectangle { anchors { fill: parent rightMargin: TransactionModel.count>=1 ? listItem.width*(1-TransactionModel.progress/100) : 0 } color: TransactionModel.count>=1 || listItem.hovered || listItem.highlighted || listItem.pressed || listItem.checked ? listItem.activeBackgroundColor : listItem.backgroundColor opacity: listItem.hovered || listItem.highlighted ? 0.2 : 1 } } onClicked: { sheet.open() } readonly property var v1: Connections { target: TransactionModel onTransactionAdded: { if(listItem.enabled && trans.resource && progressModel.appAt(trans.resource)<0) progressModel.append({app: trans.resource}) } onTransactionCancelled: { var id = progressModel.appAt(trans.resource) if(id>=0) progressModel.remove(id) } } readonly property var v2: ListModel { id: progressModel function appAt(app) { for(var i=0; i * * 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.Layouts 1.1 import org.kde.kquickcontrolsaddons 2.0 import org.kde.discover.app 1.0 +import org.kde.kirigami 2.0 as Kirigami RowLayout { id: view property bool editable: false property int max: 10 property int rating: 2 property real starSize: SystemFonts.generalFont.pointSize*2 clip: true spacing: 0 readonly property var ratingIndex: (theRepeater.count/view.max)*view.rating Repeater { id: theRepeater model: view.rating>0 ? 5 : 0 - delegate: QIconItem { + delegate: Kirigami.Icon { Layout.minimumWidth: view.starSize Layout.minimumHeight: view.starSize Layout.preferredWidth: view.starSize Layout.preferredHeight: view.starSize width: height - icon: "rating" + source: "rating" opacity: (view.editable && mouse.item.containsMouse ? 0.7 : index>=view.ratingIndex ? 0.2 : 1) ConditionalLoader { id: mouse anchors.fill: parent condition: view.editable componentTrue: MouseArea { hoverEnabled: true onClicked: rating = (max/theRepeater.model*(index+1)) } componentFalse: null } } } } diff --git a/discover/qml/SourcesPage.qml b/discover/qml/SourcesPage.qml index c482fe93..c680b2a2 100644 --- a/discover/qml/SourcesPage.qml +++ b/discover/qml/SourcesPage.qml @@ -1,174 +1,174 @@ import QtQuick 2.4 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import org.kde.discover 1.0 import org.kde.discover.app 1.0 import org.kde.kquickcontrolsaddons 2.0 import org.kde.kirigami 2.0 as Kirigami import "navigation.js" as Navigation DiscoverPage { id: page clip: true title: i18n("Settings") property string search: "" readonly property var fu: Instantiator { model: SourcesModel delegate: QtObject { readonly property var sourcesModel: sourceBackend.sources readonly property var a: Connections { target: sourceBackend onPassiveMessage: window.showPassiveNotification(message) } readonly property var b: AddSourceDialog { id: addSourceDialog source: sourceBackend } readonly property var c: MenuItem { id: menuItem text: sourceBackend.name onTriggered: { try { addSourceDialog.open() addSourceDialog.visible = true } catch (e) { console.log("error loading dialog:", e) } } } Component.onCompleted: { sourcesMenu.insertItem(0, menuItem) } } onObjectAdded: { everySourceModel.addSourceModel(object.sourcesModel) } onObjectRemoved: { everySourceModel.removeSourceModel(object.sourcesModel) } } mainItem: ListView { id: sourcesView model: QSortFilterProxyModel{ filterRegExp: new RegExp(page.search) sourceModel: KConcatenateRowsProxyModel { id: everySourceModel } } currentIndex: -1 Menu { id: sourcesMenu } section { property: "statusTip" delegate: Kirigami.Heading { leftPadding: Kirigami.Units.largeSpacing text: section } } headerPositioning: ListView.OverlayHeader header: PageHeader { extra: RowLayout { anchors { topMargin: Kirigami.Units.smallSpacing bottomMargin: Kirigami.Units.smallSpacing } ToolButton { // iconName: "list-add" text: i18n("Add Source") visible: sourcesMenu.items.count > 0 tooltip: text menu: sourcesMenu } Repeater { model: SourcesModel.actions delegate: RowLayout { - QIconItem { - icon: modelData.icon + Kirigami.Icon { + source: modelData.icon } ToolButton { height: parent.height action: Action { readonly property QtObject action: modelData text: action.text onTriggered: action.trigger() enabled: action.enabled } } } } ToolButton { text: i18n("More...") menu: actionsMenu enabled: actionsMenu.items.length>0 } ToolButton { text: i18n("Help...") menu: Menu { MenuItem { action: ActionBridge { action: app.action("help_about_app") } } MenuItem { action: ActionBridge { action: app.action("help_report_bug") } } } } Item { Layout.fillWidth: true } } } delegate: Kirigami.SwipeListItem { Layout.fillWidth: true enabled: display.length>0 highlighted: ListView.isCurrentItem onClicked: Navigation.openApplicationListSource(model.display) readonly property string backendName: model.statusTip readonly property variant modelIndex: sourcesView.model.index(model.index, 0) Keys.onReturnPressed: clicked() actions: [ Kirigami.Action { enabled: display.length>0 iconName: "view-filter" tooltip: i18n("Browse the origin's resources") onTriggered: Navigation.openApplicationListSource(model.display) }, Kirigami.Action { iconName: "edit-delete" tooltip: i18n("Delete the origin") onTriggered: { var backend = sourcesView.model.data(modelIndex, AbstractSourcesBackend.SourcesBackend) backend.removeSource(model.display) } } ] RowLayout { CheckBox { id: enabledBox readonly property variant modelChecked: sourcesView.model.data(modelIndex, Qt.CheckStateRole) checked: modelChecked != Qt.Unchecked enabled: modelChecked !== undefined onClicked: { model.checked = checkedState } } Label { text: model.display + " - " + model.toolTip + "" elide: Text.ElideRight Layout.fillWidth: true } } } } } diff --git a/discover/qml/UpdatesPage.qml b/discover/qml/UpdatesPage.qml index 1e72039d..ba3c3b81 100644 --- a/discover/qml/UpdatesPage.qml +++ b/discover/qml/UpdatesPage.qml @@ -1,250 +1,250 @@ import QtQuick.Controls 1.2 import QtQuick.Layouts 1.1 import QtQuick 2.4 import org.kde.discover 1.0 import org.kde.discover.app 1.0 import org.kde.kquickcontrolsaddons 2.0 import org.kde.kcoreaddons 1.0 import "navigation.js" as Navigation import org.kde.kirigami 2.0 as Kirigami DiscoverPage { id: page title: i18n("Updates") function start() { resourcesUpdatesModel.updateAll() } property string search: "" property string footerLabel: "" //TODO: use supportsRefreshing to fetch updates mainItem: ListView { id: updatesView currentIndex: -1 ResourcesUpdatesModel { id: resourcesUpdatesModel onIsProgressingChanged: { window.navigationEnabled = !isProgressing if (!isProgressing) { resourcesUpdatesModel.prepare() } } Component.onCompleted: { if (!isProgressing) { resourcesUpdatesModel.prepare() } } } UpdateModel { id: updateModel backend: resourcesUpdatesModel } headerPositioning: ListView.OverlayHeader header: PageHeader { backgroundImage.source: "qrc:/banners/updatescrop.jpg" extra: RowLayout { id: updateControls Layout.fillWidth: true visible: (updateModel.totalUpdatesCount > 0 && resourcesUpdatesModel.isProgressing) || updateModel.hasUpdates LabelBackground { Layout.leftMargin: Kirigami.Units.gridUnit text: updateModel.toUpdateCount + " (" + updateModel.updateSize+")" } Label { text: i18n("updates selected") } LabelBackground { id: unselectedItem readonly property int unselected: (updateModel.totalUpdatesCount - updateModel.toUpdateCount) text: unselected visible: unselected>0 } Label { text: i18n("updates not selected") visible: unselectedItem.visible } Item { Layout.fillWidth: true} Button { Layout.minimumWidth: Kirigami.Units.gridUnit * 6 Layout.rightMargin: Kirigami.Units.gridUnit text: unselectedItem.visible ? i18n("Update Selected") : i18n("Update All") enabled: !resourcesUpdatesModel.isProgressing onClicked: page.start() } } } footer: ColumnLayout { anchors.right: parent.right anchors.left: parent.left Kirigami.Heading { Layout.fillWidth: true Layout.alignment: Qt.AlignHCenter horizontalAlignment: Text.AlignHCenter visible: page.footerLabel !== "" text: page.footerLabel } - QIconItem { + Kirigami.Icon { Layout.alignment: Qt.AlignHCenter visible: page.footerLabel !== "" - icon: "update-none" + source: "update-none" opacity: 0.3 width: 200 height: 200 } Item { visible: page.footerLabel === "" height: Kirigami.Units.gridUnit width: 1 } } model: updateModel section { property: "section" delegate: Kirigami.Heading { x: Kirigami.Units.gridUnit level: 2 text: section } } spacing: Kirigami.Units.smallSpacing delegate: Kirigami.AbstractListItem { x: Kirigami.Units.gridUnit width: ListView.view.width - Kirigami.Units.gridUnit * 2 highlighted: ListView.isCurrentItem || (page.search.length>0 && display.indexOf(page.search)>=0) onEnabledChanged: if (!enabled) { layout.extended = false; } Keys.onReturnPressed: { itemChecked.clicked() } Keys.onPressed: if (event.key===Qt.Key_Alt) layout.extended = true Keys.onReleased: if (event.key===Qt.Key_Alt) layout.extended = false ColumnLayout { id: layout property bool extended: false onExtendedChanged: if (extended) { updateModel.fetchChangelog(index) } RowLayout { Layout.fillWidth: true Layout.fillHeight: true CheckBox { id: itemChecked anchors.verticalCenter: parent.verticalCenter checked: model.checked == Qt.Checked onClicked: model.checked = (model.checked==Qt.Checked ? Qt.Unchecked : Qt.Checked) } - QIconItem { + Kirigami.Icon { Layout.fillHeight: true Layout.preferredWidth: height - icon: decoration + source: decoration } Label { Layout.fillWidth: true text: i18n("%1 (%2)", display, version) elide: Text.ElideRight } LabelBackground { Layout.minimumWidth: Kirigami.Units.gridUnit * 6 text: size progress: resourceProgress/100 } } ScrollView { id: view Layout.fillHeight: true Layout.fillWidth: true frameVisible: true visible: layout.extended && changelog.length>0 Label { width: view.viewport.width text: changelog textFormat: Text.RichText wrapMode: Text.WordWrap } } Button { text: i18n("Open") visible: layout.extended enabled: !resourcesUpdatesModel.isProgressing onClicked: Navigation.openApplication(resource) } } onClicked: { layout.extended = !layout.extended } } } readonly property alias secSinceUpdate: resourcesUpdatesModel.secsToLastUpdate state: ( updateModel.hasUpdates ? "has-updates" : resourcesUpdatesModel.isProgressing ? "progressing" : secSinceUpdate < 0 ? "unknown" : secSinceUpdate === 0 ? "now-uptodate" : secSinceUpdate < 1000 * 60 * 60 * 24 ? "uptodate" : secSinceUpdate < 1000 * 60 * 60 * 24 * 7 ? "medium" : "low" ) states: [ State { name: "progressing" PropertyChanges { target: page; title: i18nc("@info", "Updating...") } PropertyChanges { target: page; footerLabel: resourcesUpdatesModel.progress<=0 ? i18nc("@info", "Fetching updates") : "" } }, State { name: "has-updates" PropertyChanges { target: page; title: i18nc("@info", "Updates") } }, State { name: "now-uptodate" PropertyChanges { target: page; title: i18nc("@info", "The system is up to date") } PropertyChanges { target: page; footerLabel: i18nc("@info", "No updates") } }, State { name: "uptodate" PropertyChanges { target: page; title: i18nc("@info", "The system is up to date") } PropertyChanges { target: page; footerLabel: i18nc("@info", "No updates") } }, State { name: "medium" PropertyChanges { target: page; title: i18nc("@info", "No updates are available") } }, State { name: "low" PropertyChanges { target: page; title: i18nc("@info", "Should check for updates") } }, State { name: "unknown" PropertyChanges { target: page; title: i18nc("@info", "It is unknown when the last check for updates was") } } ] }