0.9.3-1 release
[ubi] / qml / ubi / InitPage.qml
index 755df06..3c9fdbc 100644 (file)
@@ -3,15 +3,10 @@ import "UIConstants.js" as Const
 import "u1.js" as U1
 import "components"
 
-Rectangle {
+Showable {
     id: root
 
-    color: Const.DEFAULT_BACKGROUND_COLOR
-    state: "opened"
-
-    function hide() {
-        root.state = "closed";
-    }
+    hidden: false
 
     Component.onCompleted: init()
 
@@ -26,13 +21,7 @@ Rectangle {
     }
 
     function login() {
-        var secrets = {
-            token: Utils.token(),
-            secret: Utils.tokenSecret(),
-            consumer_key : Utils.customerKey(),
-            consumer_secret: Utils.customerSecret()
-        };
-        U1.getRootNode(secrets,root);
+        pageStack.currentPage.init();
     }
 
     function onRespRootNode(resp) {
@@ -42,84 +31,67 @@ Rectangle {
     function onErr(status) {
         hide()
         if(status==401) {
-            tip.show(qsTr("Authorization failed!"));
+            tip.show(qsTr("Ubuntu One authorization has failed. Try once again or check login settings."));
         } else if(status==0) {
-            tip.show(qsTr("Unable to connect!"));
+            tip.show(qsTr("Unable to connect. Check internet connection."));
         } else {
-            tip.show(qsTr("Error: ")+status);
+            tip.show(qsTr("Unknown error: ")+status);
         }
     }
 
-    Image {
-        id: pic
-        source: "images/ubi100.png"
-        width: 104; height: 70
-        anchors.horizontalCenter: parent.horizontalCenter
-        y: (root.height-height)/3
-    }
-
-    Text {
-        id: loading
-        anchors.top: pic.bottom
-        anchors.margins: Const.TEXT_MARGIN
-        anchors.horizontalCenter: parent.horizontalCenter
-        font.pixelSize: 25
-        color: "white"
-        text: "Loading..."
+    MouseArea {
+        anchors.fill: parent
     }
 
-    Image {
-        id: icon
-        width: 64
-        height: 64
-        anchors.top: loading.bottom
-        anchors.margins: 2*Const.TEXT_MARGIN
-        source: "images/progress.png"
-        sourceSize.width: width
-        sourceSize.height: height
-        anchors.horizontalCenter: parent.horizontalCenter
-        Component.onCompleted: animationIcon.start()
-
-        NumberAnimation {
-            id: animationIcon
-            target: icon
-            properties: "rotation"
-            from: 0
-            to: 360
-            duration: 500
-            loops: Animation.Infinite
+    Rectangle {
+        id: box
+
+        width: root.width; height: root.height
+        color: Const.DEFAULT_BACKGROUND_COLOR
+
+        Column {
+            spacing: Const.TEXT_MARGIN
+            anchors.horizontalCenter: parent.horizontalCenter
+            anchors.verticalCenter: parent.verticalCenter
+
+            Image {
+                id: pic
+                source: "images/ubi100.png"
+                width: 104; height: 70
+                anchors.horizontalCenter: parent.horizontalCenter
+            }
+
+            Text {
+                id: loading
+                anchors.horizontalCenter: parent.horizontalCenter
+                font.pixelSize: 25
+                color: "white"
+                text: qsTr("Connecting...")
+            }
+
+            BusyIndicator {
+                anchors.horizontalCenter: parent.horizontalCenter
+                running: true
+            }
         }
-    }
 
-    Text {
-        anchors.bottom: root.bottom
-        anchors.bottomMargin: Const.TEXT_MARGIN
-        anchors.horizontalCenter: parent.horizontalCenter
-        font.pixelSize: 18
-        color: "white"
-        text: "ver. 0.9.2-2"
-    }
-
-    MouseArea {
-        anchors.fill: parent
-    }
+        Text {
+            anchors.bottom: ver.top
+            anchors.horizontalCenter: parent.horizontalCenter
+            font.pixelSize: 20
+            color: "white"
+            text: "v0.9.3-1 © 2012 Michal Kosciesza"
+        }
 
-    states: [
-        State {
-            name: "opened"
-            //PropertyChanges { target: root; opacity: 1 }
-            PropertyChanges { target: root; y: 0}
-        },
-        State {
-            name: "closed"
-            //PropertyChanges { target: root; opacity: 0 }
-            PropertyChanges { target: root; y: root.height }
+        Text {
+            id: ver
+            anchors.bottom: box.bottom
+            anchors.bottomMargin: 2*Const.TEXT_MARGIN
+            anchors.horizontalCenter: parent.horizontalCenter
+            font.pixelSize: 20
+            color: "white"
+            text: "http://ubi.garage.maemo.org"
         }
-    ]
 
-    transitions: Transition {
-        //NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
-        NumberAnimation { properties: "y"; easing.type: Easing.InOutQuad }
     }
-
 }