* Improved QML/JS.
[lichviet] / qml / LichViet / OptionsScreen.qml
index 69c34f0..c3d3b5d 100644 (file)
@@ -17,9 +17,33 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>
 
 import QtQuick 1.0
 import "Settings.js" as Settings
+import "Themes.js" as Themes
 
 Item{
 
+    id:optionsscreen
+
+    anchors.verticalCenter: parent.verticalCenter
+    width: parent.width; height: parent.height;
+    x:-(parent.width * 1.5)
+
+    signal close
+
+    Loader {
+        id: theme_manager
+        property alias theme: theme_manager.item
+        source: Themes.default_theme()
+    }
+
+    Connections {
+        target: optionsscreen.parent
+
+        onDialogClose: {
+            optionsscreen.state = "close";
+            optionsscreen.destroy(600);
+        }
+    }
+
     Rectangle {
         id: rectangle1
         anchors.fill: parent; anchors.bottomMargin: 16
@@ -82,24 +106,56 @@ Item{
 
     }
 
+    Rectangle {
+        width : optionsscreen.width
+        height: 45
+        color:"white"
+        opacity: 0.5
+    }
+
+    Text {
+        id: title
+
+        anchors { horizontalCenter: optionsscreen.horizontalCenter; top: optionsscreen.top; topMargin: 10 }
+        font.pixelSize: 22
+        color: "black"
+        text: "Lựa Chọn"
+        smooth: true
+        font.bold: true
+    }
 
-    ToolBar { id: toolBar; height: 50;
-        y: screen.height-78
+    ToolBar {
+        id: toolBar; height: 42;
+        y: parent.height-52
         width: parent.width;
         button1Label: "Đồng Ý"
         button2Label: "Hủy Bỏ"
         onButton1Clicked:
         {
             Settings.save(listModel)
-            screen.state="mainscreen"
+            optionsscreen.close();
 
             var cdx = Settings.chedoxoay();
             ROOT.initScreenOrientation(cdx);
         }
         onButton2Clicked: {
             Settings.restore(listModel)
-            screen.state="mainscreen"
+            optionsscreen.close();
         }
     }
 
+    states: [
+        State {
+            name: "show"
+            AnchorChanges { target: optionsscreen; anchors.right: parent.right }
+        },
+        State {
+            name: "close"
+            AnchorChanges { target: optionsscreen; anchors.right: parent.left }
+        }
+    ]
+
+    transitions: Transition {
+        AnchorAnimation { easing.type: Easing.OutQuart; duration: 300 }
+    }
 }