Start using QtQuick components instead of plain QML
authorIvan Frade <ivan.frade@gmail.com>
Tue, 28 Jun 2011 07:39:58 +0000 (10:39 +0300)
committerIvan Frade <ivan.frade@gmail.com>
Tue, 28 Jun 2011 07:39:58 +0000 (10:39 +0300)
ui/AlbumsPage.qml [new file with mode: 0644]
ui/Empty.qml [new file with mode: 0644]
ui/SongsPage.qml [new file with mode: 0644]
ui/main.qml

diff --git a/ui/AlbumsPage.qml b/ui/AlbumsPage.qml
new file mode 100644 (file)
index 0000000..ce199c7
--- /dev/null
@@ -0,0 +1,20 @@
+import QtQuick 1.1
+import com.meego 1.0
+
+Page {
+    id: albumsPage
+    tools: commonTools
+    Label {
+        id: label
+        anchors.centerIn: parent
+        text: "albums page"
+        visible: false
+    }
+    Button{
+        anchors.horizontalCenter: parent.horizontalCenter
+        anchors.top: label.bottom
+        anchors.topMargin: 10
+        text: qsTr("Click here!")
+        onClicked: label.visible=true
+    }
+}
diff --git a/ui/Empty.qml b/ui/Empty.qml
new file mode 100644 (file)
index 0000000..d75cb21
--- /dev/null
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+import com.meego 1.0
+
+Page {
+     id: emtpyPage
+     tools: commonTools
+}
diff --git a/ui/SongsPage.qml b/ui/SongsPage.qml
new file mode 100644 (file)
index 0000000..1ff9e79
--- /dev/null
@@ -0,0 +1,20 @@
+import QtQuick 1.1
+import com.meego 1.0
+
+Page {
+    id: songsPage
+    tools: commonTools
+    Label {
+        id: label
+        anchors.centerIn: parent
+        text: "songs page"
+        visible: false
+    }
+    Button{
+        anchors.horizontalCenter: parent.horizontalCenter
+        anchors.top: label.bottom
+        anchors.topMargin: 10
+        text: qsTr("Click here also")
+        onClicked: label.visible=true
+    }
+}
index 9ecc5b3..543b8df 100644 (file)
@@ -1,90 +1,43 @@
-import Qt 4.7
+import QtQuick 1.1
+import com.meego 1.0
 
-Rectangle {
-    id: screen
-    width: 800
-    height: 480
-    color: "black"
-    state: "in_initPage"
-    //state: "in_albumsPage"
+PageStackWindow {
+    id: appWindow
 
-    TitleBar {
-       closeOrBack: ( screen.state == "in_initPage" ? "close" : "back")
-       onBack: {
-          switch (screen.state) {
-            case "in_initPage":
-               Qt.quit()
-               break
-            case "in_albumsPage":
-               screen.state = "in_initPage"
-               break
-            case "in_alternativesPage":
-               screen.state = "in_albumsPage"
-               break
-            default:
-               console.log ("WFT")        
-          }
-       }    
+    initialPage: Empty {}
 
+    TabGroup {
+      id: tabGroup
+      currentTab: albumsTab
+      AlbumsPage {id: albumsTab}
+      SongsPage {id: othersTab}
     }
 
-     
-    Intro {
-       id: initPage
-       onSelected: {
-          screen.state = state
-       }
-    }
-
-
-    AlbumList {
-        id: albumsPage
-        model: albumModel
-        onRowSelected: {
-            screen.state = "in_alternativesPage"
-            missionControl.albumSelected (coversModel, selectedAlbum)
-            alternativesPage.indexInAlbumList = index
+    ToolBarLayout {
+        id: commonTools
+        visible: true
+        ButtonRow {
+             style: TabButtonStyle { }
+             TabButton {
+                  text: "Albums"
+                  tab: albumsTab
+             }
+             TabButton {
+                  text: "Songs"
+                  tab: othersTab
+             }
+        }
+        ToolIcon { platformIconId: "toolbar-view-menu";
+             anchors.right: parent===undefined ? undefined : parent.right
+             onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close()
         }
     }
 
-    Alternatives {
-        id:alternativesPage
-        altmodel: coversModel
-        albumListModel : albumModel
-        mc: missionControl
-        onDone: {
-           screen.state = "in_albumsPage"
+    Menu {
+        id: myMenu
+        MenuLayout {
+            MenuItem { text: "Download all" }
         }
     }
 
-    states: [
-       State {
-           name: "in_initPage"
-           PropertyChanges {target: initPage; visible: true }
-           PropertyChanges {target: albumsPage; visible: false }
-           PropertyChanges {target: alternativesPage; visible: false }
-       },
-
-       State {
-           name: "in_albumsPage"
-           PropertyChanges {target: initPage; visible: false }
-           PropertyChanges {target: albumsPage; visible: true }
-           PropertyChanges {target: alternativesPage; visible: false }
-           StateChangeScript {
-             script: { 
-                // This runs on entering the state
-                missionControl.resetAlternatives (coversModel) 
-             }
-           }
-       },
-
-       State {
-           name: "in_alternativesPage"
-           PropertyChanges {target: initPage; visible: false }
-           PropertyChanges {target: albumsPage; visible: false }
-           PropertyChanges {target: alternativesPage; visible: true }
-       }
-    ]
-
-
 }