2 Copyright (C) 2011 by Cuong Le <metacuong@gmail.com>
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.
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.
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/>
19 import "amlich-hnd.js" as AmLich
20 import "amlich-aa98.js" as AmLich98
22 import "Settings.js" as Settings
23 import "Themes.js" as Themes
24 import "CacNgayLeTrongNam.js" as CNLTN
31 property int curDay: LC.curDay()
32 property int curMonth: LC.curMonth()
33 property int curYear: LC.curYear()
35 property int initcurDay: LC.curDay()
36 property int initcurMonth: LC.curMonth()
37 property int initcurYear:LC.curYear()
39 property int lunarDay: AmLich.getLunarDate(curDay,curMonth,curYear).day
40 property int lunarMonth: AmLich.getLunarDate(curDay,curMonth,curYear).month
41 property string lunarYear: AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[2]
43 property int lunarYearInt : AmLich.getLunarDate(curDay,curMonth,curYear).year
44 property int jd : AmLich.getLunarDate(curDay,curMonth,curYear).jd
45 property string lunarGioHoangDao : AmLich.getGioHoangDao(jd)
47 property string lunarDayCanChi : AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[0]
48 property string lunarMonthCanChi : AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[1]
50 property string day_info : CNLTN.get(screen)
51 property bool is_holiday : CNLTN.is_holiday(screen.curDay,screen.curMonth, screen.curYear, screen.lunarDay, screen.lunarMonth)
57 property alias theme: theme_manager.item
58 source: Themes.default_theme()
68 source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent; opacity: 0.3
77 property int fixed: 40
80 anchors.fill: parent;anchors.topMargin: 60;anchors.bottomMargin:60;
83 if (Settings.pressandhold()==1){
84 screen.state="xemngaytotxauhoangdao"
90 if (Settings.doubleclicked()==1){
91 screen.state="datetimedialog"
103 text: "Tháng "+screen.curMonth+" Năm "+screen.curYear
104 anchors.horizontalCenter: parent.horizontalCenter
106 font.family: "Tahoma"
108 horizontalAlignment: Text.AlignHCenter
112 //------------------------------------------------
119 anchors.horizontalCenter: parent.horizontalCenter
120 property int index: 0
121 onIndexChanged: txtDATEpv.currentIndex = reelx.index
131 font.pixelSize: wrapper.PathView.isCurrentItem ? 80 : 40
133 if (wrapper.PathView.isCurrentItem){
134 var stemp = AmLich98.convertSolar2Lunar(txtDATEpv.currentIndex+1,curMonth,curYear,7);
135 if (CNLTN.is_holiday(txtDATEpv.currentIndex+1,curMonth, stemp[0], stemp[1])){
136 return theme_manager.theme.markdate.holidays;
138 var mark_day = (AmLich.getLunarDate(txtDATEpv.currentIndex+1,curMonth,curYear).jd+1)%7;
139 if (mark_day === 0) //sunday
140 return theme_manager.theme.markdate.sunday;
141 if (mark_day == 6) //saturday
142 return theme_manager.theme.markdate.saturday;
144 return theme_manager.theme.markdate.otherday_selected;
148 return theme_manager.theme.markdate.otherday;
161 preferredHighlightBegin: 0.5
162 preferredHighlightEnd: 0.5
163 highlightRangeMode: PathView.StrictlyEnforceRange
168 PathLine {x: reelx.width; y: 50}
171 calculateLunar(txtDATEpv.currentIndex+1, LC.curMonth(), LC.curYear())
179 while(maindatemodel.count>0){
180 try{maindatemodel.remove(maindatemodel.count-1)}catch(e){}
183 for(var i=1;i<=LC.calDays(screen.curMonth,screen.curYear);i++)
185 reelx.index = screen.curDay -1
189 //-------------------------------------------------
190 Component.onCompleted: {
191 maindatemodel.reset()
201 text: AmLich.getTHU(screen.jd)
202 horizontalAlignment: Text.AlignHCenter
203 anchors.horizontalCenter: parent.horizontalCenter
212 y: (screen.is_holiday ? 270 : 250)
215 color: (screen.is_holiday ? theme_manager.theme.markdate.holidays : theme_manager.theme.markdate.not_holidays)
216 text: screen.day_info
217 horizontalAlignment: Text.AlignHCenter
218 anchors.horizontalCenter: parent.horizontalCenter
220 font.bold: (screen.is_holiday ? true : false)
221 font.pixelSize: (screen.is_holiday ? 25 : 20)
232 text: "Ngày <span style='color:#C0C0C0;'>"+screen.lunarDay+" ("+screen.lunarDayCanChi+")</span><br>Tháng <span style='color:#C0C0C0;'>"+screen.lunarMonth+" ("+screen.lunarMonthCanChi+")</span><br>Năm <span style='color:#C0C0C0;'>"+screen.lunarYearInt+" ("+screen.lunarYear+")</span>"
233 horizontalAlignment: Text.AlignHCenter
234 anchors.horizontalCenter: parent.horizontalCenter
244 anchors.verticalCenter: parent.verticalCenter
245 width: parent.width; height: parent.height-60;
246 x: -(screen.width * 1.5)
251 state:"optionsscreen"
252 anchors.verticalCenter: parent.verticalCenter
253 width: parent.width; height: parent.height-60;
254 x: -(screen.width * 1.5)
260 anchors.verticalCenter: parent.verticalCenter
261 width: parent.width; height: parent.height-60;
262 x: -(screen.width * 1.5)
265 XemNgayTotXauHoangDao{
267 state:"xemngaytotxauhoangdao"
268 anchors.verticalCenter: parent.verticalCenter
269 width: parent.width; height: parent.height-60;
270 x: -(screen.width * 1.5)
275 state:"datetimedialog"
276 anchors.verticalCenter: parent.verticalCenter
277 width: parent.width; height: parent.height-60;
278 x: -(screen.width * 1.5)
283 state:"amdatetimedialog"
284 anchors.verticalCenter: parent.verticalCenter
285 width: parent.width; height: parent.height-60;
286 x: -(screen.width * 1.5)
292 anchors.verticalCenter: parent.verticalCenter
293 width: parent.width; height: parent.height-60;
294 x: -(screen.width * 1.5)
299 state:"nofeaturedialog"
300 anchors.verticalCenter: parent.verticalCenter
301 width: parent.width; height: parent.height-60;
302 x: -(screen.width * 1.5)
309 anchors.verticalCenter: parent.verticalCenter
310 width: parent.width; height: parent.height-60;
311 x: -(screen.width * 1.5)
315 MultiTitleBar { id: titleBar; width: parent.width }
316 ToolBar { id: toolBar; height: 50;
317 y: screen.height - 48
318 width: parent.width; opacity: 0.9
320 button2Label: "Lựa Chọn"
323 screen.state="menuscreen"
326 screen.state="optionsscreen"
334 PropertyChanges { target: menuScreen; x: 0; focus:true}
335 PropertyChanges { target: toolBar; y: screen.height }
336 PropertyChanges { target: toolBar }
337 PropertyChanges { target: mouseareaMM;enabled:false }
341 name: "optionsscreen";
342 PropertyChanges { target: optionsScreen; x: 0; focus:true}
343 PropertyChanges { target: toolBar; y: screen.height }
344 PropertyChanges { target: toolBar }
345 PropertyChanges { target: mouseareaMM;enabled:false }
350 PropertyChanges { target: changeTheme; x: 0; focus:true}
351 PropertyChanges { target: toolBar; y: screen.height }
352 PropertyChanges { target: toolBar }
353 PropertyChanges { target: mouseareaMM;enabled:false }
357 name: "xemngaytotxauhoangdao";
358 PropertyChanges { target: xntxhdScreen; x: 0; focus:true}
359 PropertyChanges { target: toolBar; y: screen.height }
360 PropertyChanges { target: toolBar }
361 PropertyChanges { target: mouseareaMM;enabled:false }
371 name: "datetimedialog";
372 PropertyChanges { target: datetimeDialog; x: 0; focus:true}
373 PropertyChanges { target: toolBar; y: screen.height }
374 PropertyChanges { target: toolBar }
375 PropertyChanges { target: mouseareaMM;enabled:false }
376 PropertyChanges { target: reelx;enabled:false }
379 datetimeDialog.reset()
384 name: "amdatetimedialog";
385 PropertyChanges { target: amdatetimeDialog; x: 0; focus:true}
386 PropertyChanges { target: toolBar; y: screen.height }
387 PropertyChanges { target: toolBar }
388 PropertyChanges { target: mouseareaMM;enabled:false }
389 PropertyChanges { target: reelx;enabled:false }
392 amdatetimeDialog.reset()
397 name: "nofeaturedialog";
398 PropertyChanges { target: nofeatureDialog; x: 0; focus:true}
399 PropertyChanges { target: toolBar; y: screen.height }
400 PropertyChanges { target: toolBar }
401 PropertyChanges { target: mouseareaMM;enabled:false }
402 PropertyChanges { target: reelx;enabled:false }
406 PropertyChanges { target: aboutDialog; x: 0; focus:true}
407 PropertyChanges { target: toolBar; y: screen.height }
408 PropertyChanges { target: toolBar }
409 PropertyChanges { target: mouseareaMM;enabled:false }
412 name: "xemtheothang";
413 PropertyChanges { target: fullmonthDialog; x: 0; focus:true}
414 PropertyChanges { target: toolBar; y: screen.height }
415 PropertyChanges { target: toolBar }
418 fullmonthDialog.reset()
421 PropertyChanges { target: mouseareaMM;enabled:false }
426 Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
430 function lunarTietKhi(){
431 return AmLich.TIETKHI[AmLich.getSunLongitude(screen.jd+1,7.0)];
435 function calculateLunar(D,M,Y){
439 screen.lunarDay = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).day
440 screen.lunarMonth = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).month
441 screen.lunarYearInt = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).year
442 screen.lunarYear = AmLich.getCanChi(AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear))[2]//AmLich.getYearCanChi(screen.curYear)
443 screen.jd = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).jd
444 screen.lunarGioHoangDao = AmLich.getGioHoangDao(screen.jd)
446 screen.lunarDayCanChi = AmLich.getCanChi(AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear))[0]
447 screen.lunarMonthCanChi = AmLich.getCanChi(AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear))[1]
452 calculateLunar(initcurDay, initcurMonth, initcurYear)
453 LC.reset(initcurDay, initcurMonth, initcurYear)
454 screen.state="mainscreen"
455 maindatemodel.reset()
456 txtDATEpv.currentIndex = initcurDay-1;
462 Component.onCompleted: {