diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2016-06-06 13:42:28 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2016-06-09 13:50:23 +0000 |
commit | 50f83270d9c018385844821077b0d432415839b3 (patch) | |
tree | 0dadc68da4ff49dc5ad51d0aaa247cdd1a368ece /examples | |
parent | 031ec848087728a4d090cdf9a5a412ed7fb415c0 (diff) | |
download | qtivi-50f83270d9c018385844821077b0d432415839b3.tar.gz |
Extended the mediaplayer example and the media simulator plugin
The Mediaplayer shows now the discovered media devices and the
list can be used to navigate thru the device content.
The media_simulator uses a QFileSystemWatcher to watch for changes
in a specific folder and every new folder acts as a detected
USBMediaDevice which can be browsed using a SearchAndBrowseModel
Change-Id: Ibef7447d4e43eb8b622cf90f4c6fb01c24caab7e
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/media/mediaplayer/main.qml | 75 |
1 files changed, 71 insertions, 4 deletions
diff --git a/examples/media/mediaplayer/main.qml b/examples/media/mediaplayer/main.qml index f7a1c3f..80448c9 100644 --- a/examples/media/mediaplayer/main.qml +++ b/examples/media/mediaplayer/main.qml @@ -58,8 +58,8 @@ import QtIvi.Media 1.0 ApplicationWindow { visible: true - width: 640 - height: 480 + width: 800 + height: 600 title: qsTr("Media Player") MediaPlayer { @@ -152,7 +152,7 @@ ApplicationWindow { spacing: 8 clip: true Layout.fillHeight: true - Layout.fillWidth: true + Layout.minimumWidth: 300 header: Rectangle { width: ListView.view.width @@ -191,7 +191,6 @@ ApplicationWindow { id: column width: parent.width - Text { text: "Index: " + index } Text { text: "Name: " + model.name } Text { text: "Type: " + model.item.type } Text { text: "CanForward: " + model.canGoForward } @@ -209,5 +208,73 @@ ApplicationWindow { } } } + + ColumnLayout { + ListView { + id: browseView + spacing: 8 + clip: true + Layout.fillHeight: true + Layout.minimumWidth: 300 + + header: Rectangle { + width: ListView.view.width + height: browseView.model !== discoveryModel ? 50 : 0 + visible: height > 0 + color: "#efefef" + + Text { + anchors.centerIn: parent + text: "back" + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (filterModel.canGoBack) + filterModel.goBack() + else + browseView.model = discoveryModel + } + } + } + + model: MediaDeviceDiscoveryModel { + id: discoveryModel + } + + SearchAndBrowseModel { + id: filterModel + contentType: "file" + } + + delegate: Rectangle { + width: ListView.view.width + height: column.height + color: "#efefef" + + Column { + id: column + width: parent.width + + Text { text: "Name: " + model.name } + Text { text: "Type: " + model.item.type } + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (browseView.model === discoveryModel) { + filterModel.serviceObject = model.item + browseView.model = filterModel + return; + } + + filterModel.goForward(index, SearchAndBrowseModel.InModelNavigation) + } + } + } + } + } } } |