summaryrefslogtreecommitdiff
path: root/examples/media/tuner/main.qml
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2016-07-08 11:49:32 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2016-07-11 09:32:45 +0000
commitecbdc9eb621e0042f6778f4a9a5cac87d95f6d1b (patch)
tree089fecbfb99859bd1ed10b4864e300fc359ba109 /examples/media/tuner/main.qml
parentd03dfaa1e05693b9a55166551657430314eef70a (diff)
downloadqtivi-ecbdc9eb621e0042f6778f4a9a5cac87d95f6d1b.tar.gz
Added an async indexOf function to the SearchAndBrowseModel
It takes a JS functor as the second argument, which will be executed once the result is returned from the backend. Started to use this method in the tuner example and backend Change-Id: I11794e1dbc8f182f1ba06e10423fc937ceae8909 Reviewed-by: Johan Thelin <johan.thelin@pelagicore.com>
Diffstat (limited to 'examples/media/tuner/main.qml')
-rw-r--r--examples/media/tuner/main.qml16
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/media/tuner/main.qml b/examples/media/tuner/main.qml
index fe5313f..bca4849 100644
--- a/examples/media/tuner/main.qml
+++ b/examples/media/tuner/main.qml
@@ -191,6 +191,7 @@ ApplicationWindow {
}
Button {
+ id: addButton
text: "+"
width: parent.width / 10
height: parent.height
@@ -198,6 +199,21 @@ ApplicationWindow {
onClicked: {
presetsModel.insert(0, model.item)
}
+
+ function checkExists() {
+ presetsModel.indexOf(model.item, function (index) {
+ addButton.enabled = (index == -1)
+ })
+ }
+
+ Component.onCompleted: {
+ checkExists()
+ }
+
+ Connections {
+ target: presetsModel
+ onCountChanged: addButton.checkExists()
+ }
}
}
}