Use correctly the PageStackWindow
authorIvan Frade <ivan.frade@gmail.com>
Tue, 28 Jun 2011 11:50:24 +0000 (14:50 +0300)
committerIvan Frade <ivan.frade@gmail.com>
Tue, 28 Jun 2011 11:50:24 +0000 (14:50 +0300)
ui/AlbumsPage.qml
ui/Mussorgsky.qml [new file with mode: 0644]
ui/main.qml

index ce199c7..2c6fd6e 100644 (file)
@@ -4,17 +4,46 @@ 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
+
+    anchors.fill: parent
+
+    signal rowSelected (int index, variant selectedAlbum)
+
+    GridView { 
+        id: albumsView
+        model: albumModel
+        anchors.fill : albumsPage
+        cellWidth: 160
+        cellHeight: 160
+
+        delegate: Component {
+          Rectangle {
+              id: albumPaintArea
+              width: albumsView.cellWidth
+              height: albumsView.cellHeight
+              border.color: "red"
+              
+              Image {
+                 id: cover
+                 source: model.album.album_art // || "images/button-blue.png"
+                 //anchors.fill: parent
+                 anchors.centerIn: parent
+              }              
+              
+              Text {
+                 id: t
+                 text: model.album.title
+                 visible: (model.album.album_art != null)
+              }
+              
+
+              MouseArea {
+                   anchors.fill: albumPaintArea
+                   onClicked: { albumsPage.rowSelected (index, model.album) }
+              }
+
+        }
+      }
     }
+
 }
diff --git a/ui/Mussorgsky.qml b/ui/Mussorgsky.qml
new file mode 100644 (file)
index 0000000..7722426
--- /dev/null
@@ -0,0 +1,40 @@
+import QtQuick 1.1
+import com.meego 1.0
+
+Page {
+
+    TabGroup {
+      id: tabGroup
+      currentTab: albumsTab
+      AlbumsPage {id: albumsTab}
+      SongsPage {id: othersTab}
+    }
+
+    tools: 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()
+        }
+    }
+
+    Menu {
+        id: myMenu
+        MenuLayout {
+            MenuItem { text: "Download all" }
+        }
+    }
+}
+
index 543b8df..f7b65bf 100644 (file)
@@ -4,40 +4,9 @@ import com.meego 1.0
 PageStackWindow {
     id: appWindow
 
-    initialPage: Empty {}
+    platformStyle: PageStackWindowStyle { id: defaultStyle }
 
-    TabGroup {
-      id: tabGroup
-      currentTab: albumsTab
-      AlbumsPage {id: albumsTab}
-      SongsPage {id: othersTab}
-    }
+    initialPage: Mussorgsky {}
 
-    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()
-        }
-    }
-
-    Menu {
-        id: myMenu
-        MenuLayout {
-            MenuItem { text: "Download all" }
-        }
-    }
 
 }