3ebb54f1639f0c32e70af1b03a273bc3cd49e24a
[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 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 import QtQuick 1.0
18 import "../DatePicker/component" as Comp
19
20 import "Themes.js" as Themes
21 import "main.js" as Script
22
23 Item{
24     id: datetimedlg
25
26     anchors.verticalCenter: parent.verticalCenter
27     width: parent.width; height: parent.height;
28     x:(parent.width * 1.5)
29
30     Loader {
31         id: theme_manager
32         property alias theme: theme_manager.item
33         source: Themes.default_theme()
34     }
35
36     signal toolbar
37
38     Rectangle {
39         id: rectangle1
40         x: 0
41         y: -16
42         anchors.centerIn: parent
43         width:344
44         height: 234
45         color: "#19262b"
46         radius: 8
47         border.color: "#b57e8f"
48         visible: true
49         opacity:0.9
50
51
52
53         Column {
54             id: datePicker
55             width: 260
56             property int mDay: Script.curDay
57             property int mMonth: Script.curMonth
58             property int mYear: Script.curYear
59             anchors.centerIn: parent
60
61             Comp.DateReel {
62                 id: dateReel
63                 width: parent.width
64             }}
65
66
67         Button {
68             id: button2
69             x: 102
70             anchors.right: parent.right; anchors.rightMargin: 102; y: 185; width: 140; height: 40
71             text: "OK"
72             visible: true
73             onClicked: {
74                 LC.reset(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
75                 Script.calculateLunar(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
76                 Script.state="mainscreen"
77                 Script.refresh()
78                 maindatemodel.reset()
79                 }
80         }
81
82         Button {
83             id: button3
84             x: 298
85             y: 6
86             width: 39
87             height: 40
88             text: "X"
89             anchors.rightMargin: 56
90             onClicked: {
91                 datetimedlg.state="close";
92                 datetimedlg.toolbar();
93             }
94         }
95     }
96
97     function reset(){
98         dateReel.day_reset()
99                 dateReel.month_reset()
100                 dateReel.year_reset()
101     }
102
103     states: [
104         State {
105             name: "show"
106             AnchorChanges { target: datetimedlg; anchors.right: parent.right }
107         },
108         State {
109             name: "close"
110             AnchorChanges { target: datetimedlg; anchors.right: parent.left }
111         }
112     ]
113
114     transitions: Transition {
115         AnchorAnimation { easing.type: Easing.OutQuart; duration: 300 }
116     }
117
118 }