Added global controller andalso filebrowser qml
[lichviet] / qml / LichViet / ChangeTheme.qml
index 7f7aa5a..181fc1e 100644 (file)
@@ -3,7 +3,7 @@ Copyright (C) 2011  by Cuong Le <metacuong@gmail.com>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
+the Free Software Foundation, either version 2 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
@@ -19,13 +19,57 @@ import QtQuick 1.0
 import "Themes.js" as Themes
 
 Item{
+    id:change_theme
 
     Rectangle {
         id: rectangle1
         anchors.fill: parent; anchors.bottomMargin: 0
         visible: true
         opacity:0.9
-        color:"black"
+        color:"white"
+
+        Component {
+                id: listDelegate
+                Rectangle {
+                    height:65
+                MenuButton {
+                     y: 3; width: parent.parent.width; height: 60
+                    onClicked: {
+                        listModel.select(index)
+                    }
+                    text: name
+                    tip: title
+                    selected:is_selected
+                }
+                }
+            }
+
+        ListModel {
+                 id: listModel
+
+                 Component.onCompleted: {
+                     Themes.init(Controller, listModel);
+                 }
+
+                 ListElement {
+                     idm:1;name: "DEFAULT";title:"Theme mặc định, không thể xóa";can_be_deleted:false;is_selected:true
+                 }
+
+                 function select(idx){
+                     for(var i=0;i<listModel.count;i++)
+                         setProperty(i, "is_selected",false)
+                     setProperty(idx, "is_selected", true)
+                 }
+         }
+
+        ListView {
+              id: listView
+              anchors.fill: parent;anchors.topMargin: 35;anchors.leftMargin: 5;anchors.rightMargin: 5;anchors.bottomMargin: 12
+              model: listModel
+              delegate: listDelegate
+              focus: true
+        }
+
     }
 
     ToolBar { id: toolBar; height: 50;
@@ -38,11 +82,9 @@ Item{
             screen.state="mainscreen"
         }
         onButton2Clicked: {
+            listModel.select(0)
             screen.state="mainscreen"
         }
     }
 
-    transitions: [
-        Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
-    ]
 }