From 64c12b211ef2385902b414d66e0200df50e4bbaf Mon Sep 17 00:00:00 2001 From: "nikwen.developer@gmail.com" Date: Sat, 12 Apr 2014 10:48:01 +0000 Subject: [PATCH] Fixed scrolling by removing deprecated property; covers do not work any more --- CMakeLists.txt | 1 + ubuntu/qml/cantata/AlbumPage.qml | 88 +++++---- .../qml/cantata/PlayQueueListItemDelegate.qml | 183 ++++++++++++++++++ ubuntu/ubuntu.qrc | 1 + 4 files changed, 230 insertions(+), 43 deletions(-) create mode 100644 ubuntu/qml/cantata/PlayQueueListItemDelegate.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bdc22191..b9617310c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -764,6 +764,7 @@ if (ENABLE_UBUNTU) ${CMAKE_SOURCE_DIR}/ubuntu/qml/cantata/ControlButtonsRow.qml ${CMAKE_SOURCE_DIR}/ubuntu/qml/cantata/ListItemDelegate.qml ${CMAKE_SOURCE_DIR}/ubuntu/qml/cantata/LabelVisual.qml + ${CMAKE_SOURCE_DIR}/ubuntu/qml/cantata/PlayQueueListItemDelegate.qml ) # diff --git a/ubuntu/qml/cantata/AlbumPage.qml b/ubuntu/qml/cantata/AlbumPage.qml index 5a57b0e95..3be0110a6 100644 --- a/ubuntu/qml/cantata/AlbumPage.qml +++ b/ubuntu/qml/cantata/AlbumPage.qml @@ -27,11 +27,12 @@ import QtQuick 2.0 import Ubuntu.Components 0.1 import Ubuntu.Components.ListItems 0.1 as ListItem +import 'qrc:/qml/cantata/' Page { id: albumPage - width: parent.width + anchors.fill: parent title: i18n.tr("Albums") actions: [ @@ -90,56 +91,57 @@ Page { model: albumsProxyModel clip: true - delegate: ListItemDelegate { + delegate: PlayQueueListItemDelegate { text: model.mainText subText: model.subText - icon: model.image +// icon: model.image // progression: true //Removed due to the app showdown, will be implemented later - Image { - width: units.gu(3) - height: units.gu(3) - smooth: true - source: "../../icons/toolbar/add.svg" - opacity: 0.9 +// Image { +// id: addImage +// width: units.gu(3) +// height: units.gu(3) +// smooth: true +// source: "../../icons/toolbar/add.svg" +// opacity: 0.9 - anchors { - right: parent.right - rightMargin: units.gu(4) - verticalCenter: parent.verticalCenter - } +// anchors { +// right: parent.right +// rightMargin: units.gu(4) +// verticalCenter: parent.verticalCenter +// } - MouseArea { - onClicked: { - backend.addAlbum(index, false) - pageStack.push(currentlyPlayingPage) - } - anchors.fill: parent - preventStealing: true - } - } - Image { - width: units.gu(3) - height: units.gu(3) - smooth: true - source: "../../icons/toolbar/media-playback-start-light.svg" - opacity: 0.9 +// MouseArea { +// onClicked: { +// backend.addAlbum(index, false) +// pageStack.push(currentlyPlayingPage) +// } +// anchors.fill: parent +// preventStealing: true +// } +// } +// Image { +// width: units.gu(3) +// height: units.gu(3) +// smooth: true +// source: "../../icons/toolbar/media-playback-start-light.svg" +// opacity: 0.9 - anchors { - right: parent.right - rightMargin: units.gu(0) - verticalCenter: parent.verticalCenter - } +// anchors { +// right: parent.right +// rightMargin: units.gu(0) +// verticalCenter: parent.verticalCenter +// } - MouseArea { - onClicked: { - backend.addAlbum(index, true) - pageStack.push(currentlyPlayingPage) - } - anchors.fill: parent - preventStealing: true - } - } +// MouseArea { +// onClicked: { +// backend.addAlbum(index, true) +// pageStack.push(currentlyPlayingPage) +// } +// anchors.fill: parent +// preventStealing: true +// } +// } } } diff --git a/ubuntu/qml/cantata/PlayQueueListItemDelegate.qml b/ubuntu/qml/cantata/PlayQueueListItemDelegate.qml new file mode 100644 index 000000000..683178e9c --- /dev/null +++ b/ubuntu/qml/cantata/PlayQueueListItemDelegate.qml @@ -0,0 +1,183 @@ +/* + * Copyright 2012 Canonical Ltd. + * Copyright 2014 Niklas Wenzel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; version 3. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +import QtQuick 2.0 +import Ubuntu.Components 0.1 +import Ubuntu.Components.ListItems 0.1 + +/*! + \qmltype MultiValue + \inqmlmodule Ubuntu.Components.ListItems 0.1 + \ingroup ubuntu-listitems + \brief List item displaying a second string under the main label. + \b{This component is under heavy development.} + + Examples: + \qml + import Ubuntu.Components.ListItems 0.1 as ListItem + Column { + ListItem.Subtitled { + text: "Idle" + subText: "Secondary label" + } + ListItem.Subtitled { + text: "Disabled" + enabled: false + subText: "Secondary label" + } + ListItem.Subtitled { + text: "Selected" + selected: true + subText: "Secondary label" + } + ListItem.Subtitled { + text: "Progression" + subText: "Secondary label" + progression: true + } + ListItem.Subtitled { + text: "Icon" + subText: "Secondary label" + icon: Qt.resolvedUrl("icon.png") + } + ListItem.Subtitled { + text: "Multiple lines" + subText: "This is a single-line subText." + } + ListItem.Subtitled { + text: "Multiple lines" + subText: "It also works well with icons and progression." + icon: Qt.resolvedUrl("icon.png") + progression: true + } + } + \endqml +*/ +Empty { + id: listItemDelegate + __height: Math.max(middleVisuals.height, units.gu(6)) + + /*! + \preliminary + The text that is shown in the list item as a label. + \qmlproperty string text + */ + property alias text: label.text + + /*! + \preliminary + The list of strings that will be shown under the label text + \qmlproperty string subText + */ + property alias subText: subLabel.text + + Image { + id: iconImage + width: units.gu(3) + height: units.gu(3) + smooth: true + source: "../../icons/toolbar/add.svg" + opacity: 0.9 + + anchors { + left: parent.left + leftMargin: units.gu(1) + verticalCenter: parent.verticalCenter + } + } + + Item { + id: middleVisuals + anchors { + left: iconImage.right + right: addImage.left + leftMargin: units.gu(1) + rightMargin: units.gu(1) + verticalCenter: parent.verticalCenter + } + height: childrenRect.height + label.anchors.topMargin + subLabel.anchors.bottomMargin + + LabelVisual { + id: label + selected: listItemDelegate.selected + anchors { + top: parent.top + left: parent.left + right: parent.right + } + } + LabelVisual { + id: subLabel + selected: listItemDelegate.selected + secondary: true + anchors { + left: parent.left + right: parent.right + top: label.bottom + } + fontSize: "small" + } + } + + Image { + id: addImage + width: units.gu(3) + height: units.gu(3) + smooth: true + source: "../../icons/toolbar/add.svg" + opacity: 0.9 + + anchors { + right: playImage.left + rightMargin: units.gu(1) + verticalCenter: parent.verticalCenter + } + + MouseArea { + onClicked: { + backend.addAlbum(index, false) + pageStack.push(currentlyPlayingPage) + } + anchors.fill: parent + preventStealing: true + } + } + + Image { + id: playImage + width: units.gu(3) + height: units.gu(3) + smooth: true + source: "../../icons/toolbar/media-playback-start-light.svg" + opacity: 0.9 + + anchors { + right: parent.right + rightMargin: units.gu(1) + verticalCenter: parent.verticalCenter + } + + MouseArea { + onClicked: { + backend.addAlbum(index, true) + pageStack.push(currentlyPlayingPage) + } + anchors.fill: parent + preventStealing: true + } + } +} diff --git a/ubuntu/ubuntu.qrc b/ubuntu/ubuntu.qrc index 887fbdba8..09dce61e4 100644 --- a/ubuntu/ubuntu.qrc +++ b/ubuntu/ubuntu.qrc @@ -25,5 +25,6 @@ icons/toolbar/navigation-menu.svg icons/toolbar/clear.svg icons/toolbar/speaker.svg + qml/cantata/PlayQueueListItemDelegate.qml