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 2 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 textFormat: Text.RichText
104 text: "Tháng <b>"+screen.curMonth+"</b> Năm <b>"+screen.curYear+"</b>"
105 anchors.horizontalCenter: parent.horizontalCenter
107 font.family: "Tahoma"
109 horizontalAlignment: Text.AlignHCenter
113 //------------------------------------------------
120 anchors.horizontalCenter: parent.horizontalCenter
121 property int index: 0
122 onIndexChanged: txtDATEpv.currentIndex = reelx.index
133 font.pixelSize: wrapper.PathView.isCurrentItem ? 80 : 40
135 if (wrapper.PathView.isCurrentItem){
136 var stemp = AmLich98.convertSolar2Lunar(txtDATEpv.currentIndex+1,curMonth,curYear,7);
137 if (CNLTN.is_holiday(txtDATEpv.currentIndex+1,curMonth, stemp[0], stemp[1])){
138 return theme_manager.theme.markdate.holidays;
140 var mark_day = (AmLich.getLunarDate(txtDATEpv.currentIndex+1,curMonth,curYear).jd+1)%7;
141 if (mark_day === 0) //sunday
142 return theme_manager.theme.markdate.sunday;
143 if (mark_day == 6) //saturday
144 return theme_manager.theme.markdate.saturday;
146 return theme_manager.theme.markdate.otherday_selected;
150 return "transparent";//theme_manager.theme.markdate.otherday;
163 highlightMoveDuration:500
164 Keys.onDownPressed: if (!moving && interactive) incrementCurrentIndex()
165 Keys.onUpPressed: if (!moving && interactive) decrementCurrentIndex()
166 preferredHighlightBegin: 0.5
167 preferredHighlightEnd: 0.5
168 highlightRangeMode: PathView.StrictlyEnforceRange
171 highlight: Rectangle{
172 anchors.topMargin: 10;
182 PathLine {x: reelx.width; y: 50}
188 calculateLunar(txtDATEpv.currentIndex+1, LC.curMonth(), LC.curYear())
196 var days_of_this_month = LC.calDays(screen.curMonth,screen.curYear);
197 var days_of_changes = days_of_this_month - maindatemodel.count;
201 if (days_of_changes<0){
202 ifs=Math.abs(days_of_changes);
204 maindatemodel.remove(maindatemodel.count-1);
207 }else if(days_of_changes>0){
208 ifs=maindatemodel.count;
209 for (var i=1;i<=days_of_changes;i++)
213 reelx.index = -1; // I dont now why must be added -1 before screen.curDay-1
214 reelx.index = screen.curDay-1;
219 for(var i=1;i<=LC.calDays(screen.curMonth,screen.curYear);i++)
222 reelx.index = screen.curDay -1
226 //-------------------------------------------------
235 text: AmLich.getTHU(screen.jd)
236 horizontalAlignment: Text.AlignHCenter
237 anchors.horizontalCenter: parent.horizontalCenter
246 y: (screen.is_holiday ? 270 : 250)
249 color: (screen.is_holiday ? theme_manager.theme.markdate.holidays : theme_manager.theme.markdate.not_holidays)
250 text: screen.day_info
251 horizontalAlignment: Text.AlignHCenter
252 anchors.horizontalCenter: parent.horizontalCenter
254 font.bold: (screen.is_holiday ? true : false)
255 font.pixelSize: (screen.is_holiday ? 25 : 20)
266 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>"
267 horizontalAlignment: Text.AlignHCenter
268 anchors.horizontalCenter: parent.horizontalCenter
278 anchors.verticalCenter: parent.verticalCenter
279 width: parent.width; height: parent.height-60;
280 x: -(screen.width * 1.5)
285 state:"optionsscreen"
286 anchors.verticalCenter: parent.verticalCenter
287 width: parent.width; height: parent.height-60;
288 x: -(screen.width * 1.5)
294 anchors.verticalCenter: parent.verticalCenter
295 width: parent.width; height: parent.height-60;
296 x: -(screen.width * 1.5)
299 XemNgayTotXauHoangDao{
301 state:"xemngaytotxauhoangdao"
302 anchors.verticalCenter: parent.verticalCenter
303 width: parent.width; height: parent.height-60;
304 x: -(screen.width * 1.5)
309 state:"datetimedialog"
310 anchors.verticalCenter: parent.verticalCenter
311 width: parent.width; height: parent.height-60;
312 x: -(screen.width * 1.5)
317 state:"amdatetimedialog"
318 anchors.verticalCenter: parent.verticalCenter
319 width: parent.width; height: parent.height-60;
320 x: -(screen.width * 1.5)
326 anchors.verticalCenter: parent.verticalCenter
327 width: parent.width; height: parent.height-60;
328 x: -(screen.width * 1.5)
334 anchors.verticalCenter: parent.verticalCenter
335 width: parent.width; height: parent.height-60;
336 x: -(screen.width * 1.5)
342 anchors.verticalCenter: parent.verticalCenter
343 width: parent.width; height: parent.height-60;
344 x: -(screen.width * 1.5)
348 MultiTitleBar { id: titleBar; width: parent.width }
349 ToolBar { id: toolBar; height: 50;
350 y: screen.height - 48
351 width: parent.width; opacity: 0.9
353 button2Label: "Lựa Chọn"
356 screen.state="menuscreen"
359 screen.state="optionsscreen"
374 PropertyChanges { target: menuScreen; x: 0; focus:true}
375 PropertyChanges { target: toolBar; y: screen.height }
376 PropertyChanges { target: toolBar }
377 PropertyChanges { target: mouseareaMM;enabled:false }
382 PropertyChanges { target: fileBrowser; x: 0; focus:true; visible:true;}
383 PropertyChanges { target: toolBar; y: screen.height }
384 PropertyChanges { target: toolBar }
387 fileBrowser.refresh();
392 name: "optionsscreen";
393 PropertyChanges { target: optionsScreen; x: 0; focus:true}
394 PropertyChanges { target: toolBar; y: screen.height }
395 PropertyChanges { target: toolBar }
396 PropertyChanges { target: mouseareaMM;enabled:false }
401 PropertyChanges { target: changeTheme; x: 0; focus:true}
402 PropertyChanges { target: toolBar; y: screen.height }
403 PropertyChanges { target: toolBar }
404 PropertyChanges { target: reelx;enabled:false }
405 PropertyChanges { target: mouseareaMM;enabled:false }
409 name: "xemngaytotxauhoangdao";
410 PropertyChanges { target: xntxhdScreen; x: 0; focus:true;visible:true;}
411 PropertyChanges { target: toolBar; y: screen.height }
412 PropertyChanges { target: toolBar }
413 PropertyChanges { target: mouseareaMM;enabled:false }
423 name: "datetimedialog";
424 PropertyChanges { target: datetimeDialog; x: 0; focus:true}
425 PropertyChanges { target: toolBar; y: screen.height }
426 PropertyChanges { target: toolBar }
427 PropertyChanges { target: mouseareaMM;enabled:false }
428 PropertyChanges { target: reelx;enabled:false }
431 datetimeDialog.reset()
436 name: "amdatetimedialog";
437 PropertyChanges { target: amdatetimeDialog; x: 0; focus:true}
438 PropertyChanges { target: toolBar; y: screen.height }
439 PropertyChanges { target: toolBar }
440 PropertyChanges { target: mouseareaMM;enabled:false }
441 PropertyChanges { target: reelx;enabled:false }
444 amdatetimeDialog.reset()
450 PropertyChanges { target: aboutDialog; x: 0; focus:true; visible:true;}
451 PropertyChanges { target: toolBar; y: screen.height }
452 PropertyChanges { target: toolBar }
453 PropertyChanges { target: mouseareaMM;enabled:false }
456 name: "xemtheothang";
457 PropertyChanges { target: fullmonthDialog; x: 0; focus:true; visible:true;}
458 PropertyChanges { target: toolBar; y: screen.height }
459 PropertyChanges { target: toolBar }
462 fullmonthDialog.reset()
465 PropertyChanges { target: mouseareaMM;enabled:false }
470 //normally i used InOutBack
471 Transition { NumberAnimation { properties: "x,y,opacity"; duration: 300; easing.type: Easing.InOutBack } }
475 function lunarTietKhi(){
476 return AmLich.TIETKHI[AmLich.getSunLongitude(screen.jd+1,7.0)];
480 function calculateLunar(D,M,Y){
484 screen.lunarDay = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).day
485 screen.lunarMonth = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).month
486 screen.lunarYearInt = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).year
487 screen.lunarYear = AmLich.getCanChi(AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear))[2]//AmLich.getYearCanChi(screen.curYear)
488 screen.jd = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).jd
489 screen.lunarGioHoangDao = AmLich.getGioHoangDao(screen.jd)
491 screen.lunarDayCanChi = AmLich.getCanChi(AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear))[0]
492 screen.lunarMonthCanChi = AmLich.getCanChi(AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear))[1]
497 calculateLunar(initcurDay, initcurMonth, initcurYear)
498 LC.reset(initcurDay, initcurMonth, initcurYear)
499 screen.state="mainscreen"
500 maindatemodel.reset()
501 txtDATEpv.currentIndex = initcurDay-1;
508 Component.onCompleted: {
509 amdatetimeDialog.reset()