diff options
| author | Aleix Pol <aleixpol@kde.org> | 2015-10-15 14:05:12 (GMT) |
|---|---|---|
| committer | Aleix Pol <aleixpol@kde.org> | 2015-10-15 14:05:12 (GMT) |
| commit | 60e2928519c42a5f88f7fb7dd40f79ce726178c3 (patch) | |
| tree | 498ac6d3c9eda986e4f87a2ae42eb7e96aabb45c | |
| parent | 7ba51f3ff70981332928c8a4d6f6a780d7e96629 (diff) | |
Add a header to the Installed Page
| -rw-r--r-- | discover/qml/ApplicationsListPage.qml | 89 | ||||
| -rw-r--r-- | discover/qml/InstalledPage.qml | 22 | ||||
| -rw-r--r-- | discover/qml/PageHeader.qml | 23 | ||||
| -rw-r--r-- | discover/qml/PresentUpdatesPage.qml | 4 | ||||
| -rw-r--r-- | discover/resources.qrc | 1 |
5 files changed, 90 insertions, 49 deletions
diff --git a/discover/qml/ApplicationsListPage.qml b/discover/qml/ApplicationsListPage.qml index 2451ece..f79f3cd 100644 --- a/discover/qml/ApplicationsListPage.qml +++ b/discover/qml/ApplicationsListPage.qml @@ -27,6 +27,7 @@ import org.kde.muon 1.0 Item { id: page + readonly property var model: appsModel property alias category: appsModel.filteredCategory property alias sortRole: appsModel.stringSortRole property alias sortOrder: appsModel.sortOrder @@ -43,7 +44,7 @@ Item { property Component extendedToolBar: null property var icon: category ? category.icon : "go-home" property string title: category ? category.name : "" - + onSearchChanged: appsModel.sortOrder = Qt.AscendingOrder function searchFor(text) { @@ -65,6 +66,46 @@ Item { page.sectionProperty = section page.sectionDelegate = role=="canUpgrade" ? installedSectionDelegate : defaultSectionDelegate } + + readonly property alias currentSortAction: sortActionGroup.current + readonly property Menu sortMenu: Menu { + MenuItem { + text: i18n("Name") + onTriggered: page.changeSorting("name", Qt.AscendingOrder, "") + checked: appsModel.stringSortRole=="name" + checkable: true + exclusiveGroup: sortActionGroup + } + MenuItem { + text: i18n("Popularity") + onTriggered: page.changeSorting("sortableRating", Qt.DescendingOrder, "") + checked: appsModel.stringSortRole=="sortableRating" + checkable: true + exclusiveGroup: sortActionGroup + } + MenuItem { + text: i18n("Buzz") + onTriggered: page.changeSorting("ratingPoints", Qt.DescendingOrder, "") + checked: appsModel.stringSortRole=="ratingPoints" + checkable: true + exclusiveGroup: sortActionGroup + } + MenuItem { + text: i18n("Origin") + onTriggered: page.changeSorting("origin", Qt.DescendingOrder, "origin") + checked: appsModel.stringSortRole=="origin" + checkable: true + exclusiveGroup: sortActionGroup + } + MenuItem { + text: i18n("Installed") + onTriggered: page.changeSorting("canUpgrade", Qt.DescendingOrder, "canUpgrade") + checked: appsModel.stringSortRole=="canUpgrade" + checkable: true + exclusiveGroup: sortActionGroup + } + } + ExclusiveGroup { id: sortActionGroup } property Component tools: RowLayout { visible: page.visible @@ -80,52 +121,8 @@ Item { iconName: "view-sort-ascending" onClicked: menu.popup() - ExclusiveGroup { id: sortActionGroup } - menu: Menu { - id: menu - MenuItem { - id: nameItem - text: i18n("Name") - onTriggered: page.changeSorting("name", Qt.AscendingOrder, "") - checked: appsModel.stringSortRole=="name" - checkable: true - exclusiveGroup: sortActionGroup - } - MenuItem { - id: ratingItem - text: i18n("Popularity") - onTriggered: page.changeSorting("sortableRating", Qt.DescendingOrder, "") - checked: appsModel.stringSortRole=="sortableRating" - checkable: true - exclusiveGroup: sortActionGroup - } - MenuItem { - id: buzzItem - text: i18n("Buzz") - onTriggered: page.changeSorting("ratingPoints", Qt.DescendingOrder, "") - checked: appsModel.stringSortRole=="ratingPoints" - checkable: true - exclusiveGroup: sortActionGroup - } - MenuItem { - id: originItem - text: i18n("Origin") - onTriggered: page.changeSorting("origin", Qt.DescendingOrder, "origin") - checked: appsModel.stringSortRole=="origin" - checkable: true - exclusiveGroup: sortActionGroup - } - MenuItem { - id: installedItem - text: i18n("Installed") - onTriggered: page.changeSorting("canUpgrade", Qt.DescendingOrder, "canUpgrade") - checked: appsModel.stringSortRole=="canUpgrade" - checkable: true - exclusiveGroup: sortActionGroup - } - } + menu: sortMenu } - ToolButton { id: listViewShown iconName: "tools-wizard" diff --git a/discover/qml/InstalledPage.qml b/discover/qml/InstalledPage.qml index 8dc7217..77c5a8b 100644 --- a/discover/qml/InstalledPage.qml +++ b/discover/qml/InstalledPage.qml @@ -14,4 +14,26 @@ ApplicationsListPage { property var icon: "applications-other" property string title: i18n("Installed") + + header: PageHeader { + width: app.actualWidth + x: page.proposedMargin + + RowLayout { + anchors.fill: parent + + LabelBackground { + text: page.model.count + } + Label { + text: i18n("items installed") + } + Item { Layout.fillWidth: true } + Label { text: i18n("Sort by ") } + Button { + text: page.currentSortAction.text + menu: page.sortMenu + } + } + } } diff --git a/discover/qml/PageHeader.qml b/discover/qml/PageHeader.qml new file mode 100644 index 0000000..f6165df --- /dev/null +++ b/discover/qml/PageHeader.qml @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com> + * + * 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. + */ + +GridItem { + height: 50 + hoverEnabled: false +} diff --git a/discover/qml/PresentUpdatesPage.qml b/discover/qml/PresentUpdatesPage.qml index cddabc7..781dfd3 100644 --- a/discover/qml/PresentUpdatesPage.qml +++ b/discover/qml/PresentUpdatesPage.qml @@ -19,10 +19,8 @@ ScrollView x: proposedMargin width: app.actualWidth - GridItem { + PageHeader { Layout.fillWidth: true - height: 50 - hoverEnabled: false ConditionalLoader { anchors { diff --git a/discover/resources.qrc b/discover/resources.qrc index 86506a2..a18bddc 100644 --- a/discover/resources.qrc +++ b/discover/resources.qrc @@ -41,6 +41,7 @@ <file>qml/ApplicationScreenshots.qml</file> <file>qml/ApplicationIndicator.qml</file> <file>qml/LabelBackground.qml</file> + <file>qml/PageHeader.qml</file> <file>qml/navigation.js</file> </qresource> |
