f51130219a4c0b8d9a1fa7f69c06478a0ffd6bed
[lichviet] / qml / LichViet / MenuScreen.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 3 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
20 Item{
21     Rectangle {
22         id: rectangle1
23         anchors.fill: parent; anchors.bottomMargin: 0
24         visible: true
25         opacity:0.9
26
27         Component {
28                 id: listDelegate
29                 Rectangle {
30                     height:65
31                 Button {
32                     id: button1
33                      y: 3; width: parent.parent.width; height: 60
34                     onClicked: {
35                         getText(idm)
36                     }
37
38                     focus:true
39                     text: name
40                 }
41                 }
42             }
43
44         ListModel {
45                  id: listModel
46
47                  ListElement {
48                      idm:1;name: "Hôm Nay";
49                  }
50                  ListElement {
51                     idm:2; name: "Tới Ngày Âm";
52                  }
53                  ListElement {
54                      idm:3;name: "Tới Ngày Dương";
55                  }
56                  ListElement {
57                     idm:4; name: "Xem Ngày Tốt/Xấu, Hoàng Đạo ...";
58                  }
59                  ListElement {
60                     idm:5; name: "Xem Theo Tháng";
61                  }
62                  ListElement {
63                     idm:6; name: "Giới Thiệu";
64                  }
65          }
66
67         ListView {
68               id: listView
69               anchors.fill: parent;anchors.topMargin: 35;anchors.leftMargin: 5;anchors.rightMargin: 5;
70               model: listModel
71               delegate: listDelegate
72               focus: true
73         }
74
75     }
76
77     ToolBarSingle { id: toolBar; height: 50;
78         y: screen.height-78
79         width: parent.width;
80         button1Label: "Quay Về"
81         onButton1Clicked:
82         {
83             screen.state="mainscreen"
84         }
85     }
86
87     function getText(id) {
88         switch(id){
89         case 1:screen.reset();break;
90         case 2: screen.state="amdatetimedialog";break;
91         case 3: screen.state="datetimedialog";break;
92         case 4: screen.state="xemngaytotxauhoangdao";break;
93         case 5: screen.state="xemtheothang";break;
94         case 6: screen.state="aboutdialog";break;
95         default:
96             screen.state="nofeaturedialog"
97         }
98
99     }
100
101     transitions: [
102         Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
103     ]
104 }