--- /dev/null
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import fi.mikkosoft.xinema 0.1
+
+Page
+{
+ id: page
+
+ SilicaFlickable
+ {
+ anchors.fill: parent
+ contentHeight: column.height
+
+ Column
+ {
+ id: column
+
+ width: parent.width
+ spacing: Theme.paddingLarge
+
+ PageHeader
+ {
+ title: qsTr("Browse files")
+ }
+
+ // This really should be SilicaListView, but I can't figure out an
+ // easy way to turn the string lists into a suitable ListModel
+ Column
+ {
+ width: parent.width
+ spacing: Theme.paddingSmall
+
+ DirectoryEntry
+ {
+ visible: browseDirectory.directory!="/"
+ icon: "image://theme/icon-m-back"
+ text: ".."
+ onPressed:
+ {
+ var newDir = browseDirectory.directory;
+ var slash = newDir.lastIndexOf("/");
+ if(slash>0)
+ newDir = newDir.substring(0, slash);
+ else
+ newDir = "/";
+ browseDirectory.directory = newDir;
+ }
+ }
+
+ Repeater
+ {
+ model: browseDirectory.subdirectories
+
+ DirectoryEntry
+ {
+ icon: "image://theme/icon-m-folder"
+ text: modelData
+
+ onPressed:
+ {
+ var newDir = browseDirectory.directory;
+ if(newDir!="/")
+ newDir += "/";
+ newDir += modelData;
+ browseDirectory.directory = newDir;
+ }
+ }
+ }
+
+ Repeater
+ {
+ model: browseDirectory.files
+ DirectoryEntry
+ {
+ text: modelData
+
+ onPressed: xinemaControl.play_file(browseDirectory.directory+"/"+modelData);
+ }
+ }
+ }
+ }
+ }
+
+ BrowseDirectory
+ {
+ id: browseDirectory
+ control: xinemaControl
+ }
+
+ Connections
+ {
+ target: xinemaControl
+ onConnectedChanged:
+ {
+ if(xinemaControl.connected)
+ browseDirectory.directory = "/";
+ }
+ }
+
+ Component.onCompleted:
+ {
+ if(xinemaControl.connected)
+ browseDirectory.directory = "/";
+ }
+}
+