cfe9aae404b480afff968b8ff93bcedc756ce3d5
[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
38                 Column {
39
40                     Rectangle {
41                                         width:rectangle1.width;
42                                         y:30;
43                                         x:0
44                                         height:1
45                                         border.color: "#b57e8f"
46                     }
47
48                     width:rectangle1.width
49
50                     Rectangle{
51                         width:rectangle1.width;
52                         height:10;
53                     }
54
55                     Text { x:5;y:50;text:getHD(name,idm) ;textFormat: Text.RichText;wrapMode: Text.WordWrap; font.pixelSize: 20
56                         font.family: "Tahoma";width:parent.width;}
57
58                     Rectangle{
59                         width:rectangle1.width;
60                         height:10;
61                     }
62                 }
63
64
65         }
66
67         ListModel {
68                  id: listModel
69
70                  ListElement {
71                      lheight:55;idm:0;name: "";
72                  }
73                  ListElement {
74                      lheight:30;idm:-1;name: "";
75                  }
76                  ListElement {
77                      lheight:85;idm:1;name: "<b>Giờ Hoàng Đạo</b>";
78                  }
79                  ListElement {
80                      lheight:55;idm:2;name: "<b>Tiết Khí</b>";
81                  }
82                 ListElement {
83                      lheight:55;idm:3;name: "<b>Nhị Thập Bát Tú</b>";
84                  }
85                 ListElement {
86                      lheight:80;idm:6;name: "<b>Các sao tốt</b>";
87                  }
88             /*    ListElement {
89                      lheight:80;idm:7;name: "<b>Các sao xấu</b>";
90                  }
91                 ListElement {
92                      lheight:120;idm:5;name: "<b>Ngày Tốt/Xấu</b>";
93                  }*/
94          }
95
96
97
98         ListView {
99               id: listView
100               anchors.fill: parent;anchors.topMargin: 0;anchors.leftMargin: 0; anchors.bottomMargin: 16
101               model: listModel
102               delegate: listDelegate
103               focus: true
104         }
105
106     }
107
108     ToolBarSingle { id: toolBar; height: 50;
109         y: screen.height-78
110         width: parent.width;
111         button1Label: "Quay Về"
112         onButton1Clicked:
113         {
114             screen.state="mainscreen"
115         }
116     }
117
118     function getHD(name,idm){
119         if (name.length){
120             name="<span style='color:blue;'>"+name+"</span><br>";
121         }
122
123         NTX.test();
124         switch(idm){
125         case 0 : return name+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;
126         case 1 : return name+screen.lunarGioHoangDao;break;
127         case 2 : return name+screen.lunarTietKhi();break;
128         case 3 : return name+NTX.sao(screen.curYear,AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).jd - AmLich.getLunarDate(1,1,screen.curYear).jd);break;
129         case 5 :  return name+NTX.luangiai(screen.curDay);break;
130         case -1: return name+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>"
131         case 6: return name+NTX.cacsaotot(screen.lunarMonth, screen.lunarDayCanChi);break;
132         case 7: return name+NTX.cacsaoxau(screen.lunarMonth, screen.lunarDayCanChi);break;
133         }
134     }
135
136     transitions: [
137         Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
138     ]
139 }