]> git.tdb.fi Git - xinema.git/blobdiff - remote/qml/pages/BrowsePage.qml
Implement the set default location menu item
[xinema.git] / remote / qml / pages / BrowsePage.qml
index cfd518b02412acdc3c82e59894538a7fb871824b..a4e1ac2ec452a68af3c633f6a6624f558d67b05c 100644 (file)
@@ -1,5 +1,6 @@
 import QtQuick 2.0
 import Sailfish.Silica 1.0
+import org.nemomobile.configuration 1.0
 import fi.mikkosoft.xinema 0.1
 
 Page
@@ -30,6 +31,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 +92,32 @@ Page
                control: xinemaControl
        }
 
-       Connections
+       Component.onCompleted:
+       {
+               if(xinemaControl.connected)
+                       browseDirectory.directory = defaultLocation.value;
+       }
+
+       StreamControl
        {
-               target: xinemaControl
-               onConnectedChanged:
+               id: streamControl
+               control: xinemaControl
+               onPlaybackStateChanged:
                {
-                       if(xinemaControl.connected)
-                               browseDirectory.directory = "/";
+                       if(playbackState==StreamControl.Playing)
+                       {
+                               if(pageContainer.busy)
+                                       pageContainer.completeAnimation();
+                               pageStack.push("PlaybackPage.qml");
+                       }
                }
        }
 
-       Component.onCompleted:
+       ConfigurationValue
        {
-               if(xinemaControl.connected)
-                       browseDirectory.directory = "/";
+               id: defaultLocation
+               key: "/fi/mikkosoft/xinema-remote/defaultLocation"
+               defaultValue: "/"
        }
 }