]> 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 d1b74e606b7f1b34983c78be4532b27692adeece..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
 {
@@ -35,6 +37,8 @@ Page
                        MenuItem
                        {
                                text: "Set as default location"
+
+                               onClicked: defaultLocation.value = browseDirectory.directory
                        }
 
                        MenuItem
@@ -92,7 +96,17 @@ Page
        Component.onCompleted:
        {
                if(xinemaControl.connected)
-                       browseDirectory.directory = "/";
+                       browseDirectory.directory = defaultLocation.value;
+       }
+
+       Connections
+       {
+               target: xinemaControl
+               onConnectedChanged:
+               {
+                       if(!xinemaControl.connected)
+                               pageStack.replace("ConnectPage.qml");
+               }
        }
 
        StreamControl
@@ -101,7 +115,7 @@ Page
                control: xinemaControl
                onPlaybackStateChanged:
                {
-                       if(playbackState==StreamControl.Playing)
+                       if(playbackState==StreamControl.Playing && pageContainer.currentPage==page)
                        {
                                if(pageContainer.busy)
                                        pageContainer.completeAnimation();
@@ -109,5 +123,12 @@ Page
                        }
                }
        }
+
+       ConfigurationValue
+       {
+               id: defaultLocation
+               key: "/fi/mikkosoft/xinema-remote/defaultLocation"
+               defaultValue: "/"
+       }
 }