qmlFrontend/qml/qmlFrontend/main.qml
branchqmlfrontend
changeset 10422 4cf23d4c7624
parent 10420 02c573d19224
child 10896 5a74923120d5
--- a/qmlFrontend/qml/qmlFrontend/main.qml	Mon Sep 22 02:10:39 2014 +0400
+++ b/qmlFrontend/qml/qmlFrontend/main.qml	Fri Sep 26 00:56:36 2014 +0400
@@ -1,41 +1,35 @@
 import QtQuick 2.0
-import Hedgewars.Engine 1.0
 
 Rectangle {
-    width: 400
-    height: 400
+    id: pages
+    width: 800
+    height: 600
+
+    property variant pagesList  : [
+        "First"
+        , "LocalGame"
+        , "GameConfig"
+    ];
+
+    property string  currentPage : "First";
+
+    Repeater {
+        model: pagesList;
 
-    HWButton {
-        id: hwbutton1
-        x: 8
-        y: 66
-        width: 166
-        height: 158
+        delegate: Loader {
+            active: false
+            asynchronous: true
+            anchors.fill: parent
+            visible: (currentPage === modelData)
+            source: "%1.qml".arg(modelData)
+            onVisibleChanged:      loadIfNotLoaded();
+            Component.onCompleted: loadIfNotLoaded();
 
-        onClicked: {
-            HWEngine.run()
-        }
-
-        Connections {
-            target: HWEngine
-            onPreviewImageChanged: previewImage.source = "image://preview/1"
+            function loadIfNotLoaded ()
+            {
+                if (visible && !active)
+                    active = true;
+            }
         }
     }
-
-    HWButton {
-        id: hwbutton2
-        x: 192
-        y: 66
-        width: 200
-        height: 139
-    }
-
-    Image {
-        id: previewImage
-        x: 70
-        y: 250
-        width: 256
-        height: 128
-        cache: false
-    }
 }