]> git.tdb.fi Git - xinema.git/blobdiff - remote/qml/pages/BrowsePage.qml
Go back to ConnectPage if connection to the server is lost
[xinema.git] / remote / qml / pages / BrowsePage.qml
index cfd518b02412acdc3c82e59894538a7fb871824b..74758a69c74e8e0ca42bb47087aa09c42fbf843a 100644 (file)
@@ -1,6 +1,8 @@
 import QtQuick 2.0
 import Sailfish.Silica 1.0
+import org.nemomobile.configuration 1.0
 import fi.mikkosoft.xinema 0.1
+import "../components"
 
 Page
 {
@@ -30,6 +32,24 @@ Page
        {
                anchors.fill: parent
 
+               PullDownMenu
+               {
+                       MenuItem
+                       {
+                               text: "Set as default location"
+
+                               onClicked: defaultLocation.value = browseDirectory.directory
+                       }
+
+                       MenuItem
+                       {
+                               visible: streamControl.title
+                               text: streamControl.title
+
+                               onClicked: pageStack.push("PlaybackPage.qml");
+                       }
+               }
+
                header: PageHeader
                {
                        title: qsTr("Browse files")
@@ -73,20 +93,42 @@ Page
                control: xinemaControl
        }
 
+       Component.onCompleted:
+       {
+               if(xinemaControl.connected)
+                       browseDirectory.directory = defaultLocation.value;
+       }
+
        Connections
        {
                target: xinemaControl
                onConnectedChanged:
                {
-                       if(xinemaControl.connected)
-                               browseDirectory.directory = "/";
+                       if(!xinemaControl.connected)
+                               pageStack.replace("ConnectPage.qml");
                }
        }
 
-       Component.onCompleted:
+       StreamControl
        {
-               if(xinemaControl.connected)
-                       browseDirectory.directory = "/";
+               id: streamControl
+               control: xinemaControl
+               onPlaybackStateChanged:
+               {
+                       if(playbackState==StreamControl.Playing && pageContainer.currentPage==page)
+                       {
+                               if(pageContainer.busy)
+                                       pageContainer.completeAnimation();
+                               pageStack.push("PlaybackPage.qml");
+                       }
+               }
+       }
+
+       ConfigurationValue
+       {
+               id: defaultLocation
+               key: "/fi/mikkosoft/xinema-remote/defaultLocation"
+               defaultValue: "/"
        }
 }