Added global controller andalso filebrowser qml
[lichviet] / qml / LichViet / OptionsScreen.qml
1 /*
2 Copyright (C) 2011  by Cuong Le <metacuong@gmail.com>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>
16 */
17
18 import QtQuick 1.0
19 import "Settings.js" as Settings
20
21 Item{
22
23     Rectangle {
24         id: rectangle1
25         anchors.fill: parent; anchors.bottomMargin: 16
26         visible: true
27         opacity:0.9
28
29         Component {
30                 id: listDelegate
31                  Rectangle {
32                      height:60
33
34                      Rectangle {
35                                          width:rectangle1.width;
36                                          y:0;
37                                          x:0
38                                          height:1
39                                          border.color: "#b57e8f"
40                      }
41
42                      Text {
43                          id: text1
44                          text:name
45                          font.pixelSize: 21
46                          font.family: "Nokia Sans"
47                          x:20
48                          anchors.verticalCenter: parent.verticalCenter
49
50                      }
51                         Switch {
52                             id: switch_me
53                             x:rectangle1.width-220
54                             onSwitched:{
55                                 listModel.setProperty(index, "selected", switchedOn);
56                             }
57                             switchedOn: selected
58                             anchors.verticalCenter: parent.verticalCenter
59                         }
60
61                  }
62
63             }
64
65         ListModel {
66                  id: listModel
67                  Component.onCompleted: {
68                      Settings.restore(listModel);
69                      var cdx = Settings.chedoxoay();
70                      ROOT.initScreenOrientation(cdx);
71                  }
72          }
73
74         ListView {
75               id: listView
76               anchors.fill: parent;anchors.topMargin: 45;anchors.leftMargin: 0;
77               model: listModel
78               delegate: listDelegate
79               focus: true
80         }
81
82     }
83
84     ToolBar { id: toolBar; height: 50;
85         y: screen.height-78
86         width: parent.width;
87         button1Label: "Đồng Ý"
88         button2Label: "Hủy Bỏ"
89         onButton1Clicked:
90         {
91             Settings.save(listModel)
92             screen.state="mainscreen"
93
94             var cdx = Settings.chedoxoay();
95             ROOT.initScreenOrientation(cdx);
96         }
97         onButton2Clicked: {
98             Settings.restore(listModel)
99             screen.state="mainscreen"
100         }
101     }
102
103 }