512680b128f1298d528fa77ebfa241d186ca7e49
[lichviet] / qml / LichViet / XemNgayTotXauHoangDao.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 import "amlich-hnd.js" as AmLich
21 import "xemngaytotxau.js" as NTX
22
23 Item{
24     Rectangle {
25         id: rectangle1
26         x: 0
27         y: -5
28         anchors.rightMargin: 0
29         anchors.leftMargin: 0
30         anchors.topMargin:30
31         anchors.fill: parent; anchors.bottomMargin: 16
32         visible: true
33         opacity:0.9
34
35         Component {
36             id: listDelegate
37             Item {
38                 height: lheight+5
39                 Rectangle {
40                                  width:rectangle1.width-20;
41                                  y:10;
42                                  x:10
43                                  height:lheight
44                                  color: "#ffffff"
45                                  radius: 8
46                                  border.color: "#b57e8f"
47                 Column {
48                     Text { x:5;y:50;text:name;color:"blue";    font.pixelSize: 20
49                         font.family: "Tahoma" }
50                     Text { x:5;y:50;text:getHD(idm) ;    font.pixelSize: 20
51                         font.family: "Tahoma"}
52                     }                anchors.bottomMargin: -10
53                 }
54             }
55         }
56
57
58
59
60         ListModel {
61                  id: listModel
62
63                  ListElement {
64                      lheight:55;idm:0;name: "";
65                  }
66                  ListElement {
67                      lheight:30;idm:-1;name: "";
68                  }
69                  ListElement {
70                      lheight:85;idm:1;name: "<b>Giờ Hoàng Đạo</b>";
71                  }
72                  ListElement {
73                      lheight:55;idm:2;name: "<b>Tiết Khí</b>";
74                  }
75                 ListElement {
76                      lheight:55;idm:3;name: "<b>Nhị Thập Bát Tú</b>";
77                  }
78                 ListElement {
79                      lheight:80;idm:6;name: "<b>Các sao tốt</b>";
80                  }
81             /*    ListElement {
82                      lheight:80;idm:7;name: "<b>Các sao xấu</b>";
83                  }
84                 ListElement {
85                      lheight:120;idm:5;name: "<b>Ngày Tốt/Xấu</b>";
86                  }*/
87          }
88
89
90
91         ListView {
92               id: listView
93               anchors.fill: parent;anchors.topMargin: 0;anchors.leftMargin: 0; anchors.bottomMargin: 16
94               model: listModel
95               delegate: listDelegate
96               focus: true
97         }
98
99     }
100
101     ToolBarSingle { id: toolBar; height: 50;
102         y: screen.height-78
103         width: parent.width;
104         button1Label: "Quay Về"
105         onButton1Clicked:
106         {
107             screen.state="mainscreen"
108         }
109     }
110
111     function getHD(idm){
112         NTX.test();
113         switch(idm){
114         case 0 : return AmLich.getTHU(screen.jd)+",ngày <b>"+screen.curDay+"</b> tháng <b>"+screen.curMonth+"</b> năm <b>"+screen.curYear+"</b><br>Ngày <b>"+screen.lunarDay+"</b> tháng <b>"+screen.lunarMonth+"</b> năm <b>"+screen.lunarYear+"</b> (<b>"+screen.lunarYearInt+"</b>)";break;
115         case 1 : return screen.lunarGioHoangDao;break;
116         case 2 : return screen.lunarTietKhi();break;
117         case 3 : return NTX.sao(screen.curYear,AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).jd - AmLich.getLunarDate(1,1,screen.curYear).jd);break;
118         case 5 :  return NTX.luangiai(screen.curDay);break;
119         case -1: return NTX.truc(screen.lunarMonth, screen.lunarDayCanChi, screen.lunarMonthCanChi);break;//"Là ngày: <b>Thiên Lao Hắc Đạo</b> Trực: <b>Định</b>"
120         case 6: return NTX.cacsaotot(screen.lunarMonth, screen.lunarDayCanChi);break;
121         case 7: return NTX.cacsaoxau(screen.lunarMonth, screen.lunarDayCanChi);break;
122         }
123     }
124
125     transitions: [
126         Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
127     ]
128 }