556af6229585b342441964f32920bd8863e4259c
[lichviet] / qml / LichViet / DateTimeDialog.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 import "../DatePicker/component" as Comp
20
21 Item{
22     id: item1
23     BorderImage { anchors.centerIn: parent;source: "./img/titlebar.sci"; width: 344+2; height: 234+14; y: +7  }
24     Rectangle {
25         id: rectangle1
26         x: 0
27         y: -16
28         anchors.centerIn: parent
29         width:344
30         height: 234
31         color: "#19262b"
32         radius: 8
33         border.color: "#b57e8f"
34         visible: true
35         opacity:0.9
36
37
38
39         Column {
40             id: datePicker
41             width: 260
42             property int mDay: screen.curDay
43             property int mMonth: screen.curMonth
44             property int mYear: screen.curYear
45             anchors.centerIn: parent
46
47             Comp.DateReel {
48                 id: dateReel
49                 width: parent.width
50             }}
51
52
53         Button {
54             id: button2
55             x: 102
56             anchors.right: parent.right; anchors.rightMargin: 102; y: 185; width: 140; height: 40
57             text: "OK"
58             visible: true
59             onClicked: {
60
61                 LC.reset(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
62                 screen.calculateLunar(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
63                 screen.state="mainscreen"
64                 screen.refresh()
65                 maindatemodel.reset()
66                 txtDATEpv.currentIndex = datePicker.mDay-1;
67                 }
68         }
69
70         Button {
71             id: button3
72             x: 298
73             y: 6
74             width: 39
75             height: 40
76             text: "X"
77             anchors.rightMargin: 56
78             onClicked: {screen.state="mainscreen";screen.refresh();}
79         }
80     }
81
82     function reset(){
83         dateReel.day_reset()
84                 dateReel.month_reset()
85                 dateReel.year_reset()
86     }
87
88     transitions: [
89         Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
90     ]
91 }