summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2016-07-07 15:56:21 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2016-07-11 09:32:42 +0000
commitd03dfaa1e05693b9a55166551657430314eef70a (patch)
tree856594d3c2d19fd1f6d0ae180b9992535a64bdc8 /examples
parent8825fc4cca24d174a806500662c5f4b928291ff2 (diff)
downloadqtivi-d03dfaa1e05693b9a55166551657430314eef70a.tar.gz
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 <johan.thelin@pelagicore.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/media/mediaplayer/main.qml54
-rw-r--r--examples/media/tuner/main.qml100
2 files changed, 138 insertions, 16 deletions
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)
+ }
+ }
+ }
}
}
}