From d03dfaa1e05693b9a55166551657430314eef70a Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 7 Jul 2016 15:56:21 +0200 Subject: Fixed insert,move,remove in the mediplayer and tuner examples and backends The mediaplayer backend is now correctly updating the internal sql database for the queue and also updating the model thru the dataChanged signal. The mediaplayer ui got improved to support moving and remove items in the queue. The tuner backend was improved to now also support a preset list, which supports editing (insert, move, remove) and the example was improved to add stations to the presets list and organizing it Change-Id: I5ff8ba1dbbbb7ed40b3f441845dbe40641ac6f54 Reviewed-by: Johan Thelin --- examples/media/mediaplayer/main.qml | 54 ++++++++++++++++--- examples/media/tuner/main.qml | 100 +++++++++++++++++++++++++++++++++--- 2 files changed, 138 insertions(+), 16 deletions(-) (limited to 'examples') diff --git a/examples/media/mediaplayer/main.qml b/examples/media/mediaplayer/main.qml index 4376122..c9a4a3f 100644 --- a/examples/media/mediaplayer/main.qml +++ b/examples/media/mediaplayer/main.qml @@ -122,21 +122,59 @@ ApplicationWindow { height: column.height color: "#efefef" - Column { - id: column - width: parent.width + MouseArea { + anchors.fill: parent + onClicked: { - Text { text: "Index: " + index } - Text { text: "Name: " + model.name } - Text { text: "Type: " + model.item.type } + } } - MouseArea { + Row { anchors.fill: parent - onClicked: { + Column { + id: column + width: parent.width * 7 / 10 + + Text { text: "Index: " + index } + Text { text: "Name: " + model.name } + Text { text: "Type: " + model.item.type } + } + Button { + text: "\u2227" + width: parent.width / 10 + height: parent.height + + enabled: index > 0 + + onClicked: { + mediaPlayer.playQueue.move(index, index - 1) + } + } + + Button { + text: "\u2228" + width: parent.width / 10 + height: parent.height + + enabled: index < mediaPlayer.playQueue.count -1 + + onClicked: { + mediaPlayer.playQueue.move(index, index + 1) + } + } + + Button { + text: "X" + width: parent.width / 10 + height: parent.height + + onClicked: { + mediaPlayer.playQueue.remove(index) + } } } + } } } diff --git a/examples/media/tuner/main.qml b/examples/media/tuner/main.qml index 3f19bcc..fe5313f 100644 --- a/examples/media/tuner/main.qml +++ b/examples/media/tuner/main.qml @@ -58,8 +58,8 @@ import QtIvi.Media 1.0 ApplicationWindow { visible: true - width: 500 - height: 250 + width: 1000 + height: 500 title: qsTr("Tuner") AmFmTuner { @@ -159,8 +159,9 @@ ApplicationWindow { ListView { spacing: 8 clip: true + + width: 300 Layout.fillHeight: true - Layout.fillWidth: true model: SearchAndBrowseModel { serviceObject: tuner.serviceObject @@ -172,13 +173,51 @@ ApplicationWindow { height: column.height color: "#efefef" - Column { - id: column - width: parent.width + MouseArea { + anchors.fill: parent + onClicked: { + tuner.tune(model.item) + } + } + + Row { + anchors.fill: parent + Column { + id: column + width: parent.width * 9 / 10 + + Text { text: "Name: " + model.item.stationName } + Text { text: "Type: " + model.item.frequency } + } - Text { text: "Name: " + model.item.stationName } - Text { text: "Type: " + model.item.frequency } + Button { + text: "+" + width: parent.width / 10 + height: parent.height + + onClicked: { + presetsModel.insert(0, model.item) + } + } } + } + } + + ListView { + spacing: 8 + clip: true + Layout.fillWidth: true + + model: SearchAndBrowseModel { + id: presetsModel + serviceObject: tuner.serviceObject + contentType: "presets" + } + + delegate: Rectangle { + width: ListView.view.width + height: column.height + color: "#efefef" MouseArea { anchors.fill: parent @@ -186,6 +225,51 @@ ApplicationWindow { tuner.tune(model.item) } } + + Row { + anchors.fill: parent + Column { + id: column + width: parent.width * 7 / 10 + + Text { text: "Name: " + model.item.stationName } + Text { text: "Type: " + model.item.frequency } + } + + Button { + text: "\u2227" + width: parent.width / 10 + height: parent.height + + enabled: index > 0 + + onClicked: { + presetsModel.move(index, index - 1) + } + } + + Button { + text: "\u2228" + width: parent.width / 10 + height: parent.height + + enabled: index < presetsModel.count -1 + + onClicked: { + presetsModel.move(index, index + 1) + } + } + + Button { + text: "X" + width: parent.width / 10 + height: parent.height + + onClicked: { + presetsModel.remove(index) + } + } + } } } } -- cgit v1.2.1