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
30 property int curDay: LC.curDay()
31 property int curMonth: LC.curMonth()
32 property int curYear: LC.curYear()
34 property int initcurDay: LC.curDay()
35 property int initcurMonth: LC.curMonth()
36 property int initcurYear:LC.curYear()
38 property int lunarDay: AmLich.getLunarDate(curDay,curMonth,curYear).day
39 property int lunarMonth: AmLich.getLunarDate(curDay,curMonth,curYear).month
40 property string lunarYear: AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[2]
42 property int lunarYearInt : AmLich.getLunarDate(curDay,curMonth,curYear).year
43 property int jd : AmLich.getLunarDate(curDay,curMonth,curYear).jd
44 property string lunarGioHoangDao : AmLich.getGioHoangDao(jd)
46 property string lunarDayCanChi : AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[0]
47 property string lunarMonthCanChi : AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[1]
49 //property string lunarCanHour : AmLich.getCanHour0(LC.curHour())
55 property alias theme: theme_manager.item
56 source: Themes.default_theme()
66 source: theme_manager.theme.background_image; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3
75 property int fixed: 40
81 if (Settings.pressandhold()==1){
82 screen.state="xemngaytotxauhoangdao"
88 if (Settings.doubleclicked()==1){
89 screen.state="datetimedialog"
100 if (rise > fixed || rise < -fixed){
102 calculateLunar(LC.nextDay(), LC.curMonth(), LC.curYear())
104 calculateLunar(LC.prevDay(), LC.curMonth(), LC.curYear())
118 text: "Tháng "+screen.curMonth+" Năm "+screen.curYear
119 anchors.horizontalCenter: parent.horizontalCenter
121 font.family: "Tahoma"
123 horizontalAlignment: Text.AlignHCenter
136 horizontalAlignment: Text.AlignHCenter
137 anchors.horizontalCenter: parent.horizontalCenter
144 //------------------------------------------------
151 anchors.horizontalCenter: parent.horizontalCenter
152 property int index: 0
153 onIndexChanged: txtDATEpv.currentIndex = reelx.index
163 font.pixelSize: wrapper.PathView.isCurrentItem ? 80 : 40
164 color: wrapper.PathView.isCurrentItem ? "#FFFFFF" : "grey"
176 preferredHighlightBegin: 0.5
177 preferredHighlightEnd: 0.5
178 highlightRangeMode: PathView.StrictlyEnforceRange
183 PathLine {x: reelx.width; y: 50}
186 calculateLunar(txtDATEpv.currentIndex+1, LC.curMonth(), LC.curYear())
194 while(maindatemodel.count>0){
195 try{maindatemodel.remove(maindatemodel.count-1)}catch(e){}
198 for(var i=1;i<=LC.calDays(screen.curMonth,screen.curYear);i++)
200 reelx.index = screen.curDay -1
204 //-------------------------------------------------
205 Component.onCompleted: {
206 maindatemodel.reset()
216 text: AmLich.getTHU(screen.jd)
217 horizontalAlignment: Text.AlignHCenter
218 anchors.horizontalCenter: parent.horizontalCenter
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)
257 XemNgayTotXauHoangDao{
259 state:"xemngaytotxauhoangdao"
260 anchors.verticalCenter: parent.verticalCenter
261 width: parent.width; height: parent.height-60;
262 x: -(screen.width * 1.5)
267 state:"datetimedialog"
268 anchors.verticalCenter: parent.verticalCenter
269 width: parent.width; height: parent.height-60;
270 x: -(screen.width * 1.5)
275 state:"amdatetimedialog"
276 anchors.verticalCenter: parent.verticalCenter
277 width: parent.width; height: parent.height-60;
278 x: -(screen.width * 1.5)
284 anchors.verticalCenter: parent.verticalCenter
285 width: parent.width; height: parent.height-60;
286 x: -(screen.width * 1.5)
291 state:"nofeaturedialog"
292 anchors.verticalCenter: parent.verticalCenter
293 width: parent.width; height: parent.height-60;
294 x: -(screen.width * 1.5)
301 anchors.verticalCenter: parent.verticalCenter
302 width: parent.width; height: parent.height-60;
303 x: -(screen.width * 1.5)
307 MultiTitleBar { id: titleBar; width: parent.width }
308 ToolBar { id: toolBar; height: 50;
309 y: screen.height - 48
310 width: parent.width; opacity: 0.9
312 button2Label: "Lựa Chọn"
315 screen.state="menuscreen"
318 screen.state="optionsscreen"
326 PropertyChanges { target: menuScreen; x: 0; focus:true}
327 PropertyChanges { target: toolBar; y: screen.height }
328 PropertyChanges { target: toolBar }
329 PropertyChanges { target: mouseareaMM;enabled:false }
333 name: "optionsscreen";
334 PropertyChanges { target: optionsScreen; x: 0; focus:true}
335 PropertyChanges { target: toolBar; y: screen.height }
336 PropertyChanges { target: toolBar }
337 PropertyChanges { target: mouseareaMM;enabled:false }
341 name: "xemngaytotxauhoangdao";
342 PropertyChanges { target: xntxhdScreen; x: 0; focus:true}
343 PropertyChanges { target: toolBar; y: screen.height }
344 PropertyChanges { target: toolBar }
345 PropertyChanges { target: mouseareaMM;enabled:false }
349 name: "datetimedialog";
350 PropertyChanges { target: datetimeDialog; x: 0; focus:true}
351 PropertyChanges { target: toolBar; y: screen.height }
352 PropertyChanges { target: toolBar }
353 PropertyChanges { target: mouseareaMM;enabled:false }
354 PropertyChanges { target: reelx;enabled:false }
357 datetimeDialog.reset()
362 name: "amdatetimedialog";
363 PropertyChanges { target: amdatetimeDialog; x: 0; focus:true}
364 PropertyChanges { target: toolBar; y: screen.height }
365 PropertyChanges { target: toolBar }
366 PropertyChanges { target: mouseareaMM;enabled:false }
367 PropertyChanges { target: reelx;enabled:false }
370 amdatetimeDialog.reset()
375 name: "nofeaturedialog";
376 PropertyChanges { target: nofeatureDialog; x: 0; focus:true}
377 PropertyChanges { target: toolBar; y: screen.height }
378 PropertyChanges { target: toolBar }
379 PropertyChanges { target: mouseareaMM;enabled:false }
380 PropertyChanges { target: reelx;enabled:false }
384 PropertyChanges { target: aboutDialog; x: 0; focus:true}
385 PropertyChanges { target: toolBar; y: screen.height }
386 PropertyChanges { target: toolBar }
387 PropertyChanges { target: mouseareaMM;enabled:false }
390 name: "xemtheothang";
391 PropertyChanges { target: fullmonthDialog; x: 0; focus:true}
392 PropertyChanges { target: toolBar; y: screen.height }
393 PropertyChanges { target: toolBar }
396 fullmonthDialog.reset()
399 PropertyChanges { target: mouseareaMM;enabled:false }
404 Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
408 function lunarTietKhi(){
409 return AmLich.TIETKHI[AmLich.getSunLongitude(screen.jd+1,7.0)];
413 function calculateLunar(D,M,Y){
417 screen.lunarDay = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).day
418 screen.lunarMonth = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).month
419 screen.lunarYearInt = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).year
420 screen.lunarYear = AmLich.getCanChi(AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear))[2]//AmLich.getYearCanChi(screen.curYear)
421 screen.jd = AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear).jd
422 screen.lunarGioHoangDao = AmLich.getGioHoangDao(screen.jd)
424 screen.lunarDayCanChi = AmLich.getCanChi(AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear))[0]
425 screen.lunarMonthCanChi = AmLich.getCanChi(AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear))[1]
427 //console.log(screen.curDay+" "+screen.curMonth+" "+screen.curYear)
428 //console.log( AmLich.getCanChi(AmLich.getLunarDate(30,1,2007)))
432 calculateLunar(initcurDay, initcurMonth, initcurYear)
433 LC.reset(initcurDay, initcurMonth, initcurYear)
434 screen.state="mainscreen"
435 maindatemodel.reset()
436 txtDATEpv.currentIndex = initcurDay-1;
442 Component.onCompleted: {