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/>
20 import "Themes.js" as Themes
21 import "Settings.js" as Settings
22 import "main.js" as Script
33 property int curMonth: Script.curMonth
34 property int curYear: Script.curYear
38 property alias theme: theme_manager.item
39 source: Themes.default_theme()
42 Component.onCompleted: {
43 Settings.restore_nomodel();
44 Script.createDateTimeDialog(screen);
45 Script.datetimedlg.toolbar.connect(show_toolbar);
46 Script.datetimedlg.updatedate.connect(update_date);
47 Script.amdatetimedlg.toolbar.connect(show_toolbar);
48 Script.amdatetimedlg.updatedate.connect(update_date);
49 Script.fullmonth.toolbar.connect(show_toolbar);
50 Script.fullmonth.updatedate.connect(update_date);
55 function show_toolbar(){
56 screen.state="mainscreen";
59 function update_date(day, month, year){
60 txtDATEpv.currentIndex = day-1;
61 screen.curMonth = month;
62 screen.curYear = year;
63 Script.curMonth = month;
64 Script.curYear = year;
65 Script.changeDay(day, txtTHU, txtInfo, txtDAYAmLich);
66 Script.fullmonth.m_day=Script.curDay;
67 Script.fullmonth.m_month=Script.curMonth;
68 Script.fullmonth.m_year=Script.curYear;
69 Script.fullmonth.reset();
70 maindatemodel.reset();
81 source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent
82 opacity: theme_manager.theme.background_opacity
91 property int fixed: 40
94 anchors.fill: parent;anchors.topMargin: 60;anchors.bottomMargin:60;
97 if (Settings.pressandhold()==1){
104 if (Settings.doubleclicked()==1){
105 screen.state="switchX";
106 Script.datetimedlg.state="show";
111 //------------------------------------------------
118 anchors.horizontalCenter: parent.horizontalCenter
119 property int index: 0
120 onIndexChanged: txtDATEpv.currentIndex = reelx.index
131 font.pixelSize: wrapper.PathView.isCurrentItem ? 80 : 40
133 if (wrapper.PathView.isCurrentItem){
134 var stemp = Script.convertSolar2Lunar(txtDATEpv.currentIndex+1,curMonth,curYear,7);
135 if (Script.is_holiday(txtDATEpv.currentIndex+1,curMonth, stemp[0], stemp[1])){
136 return theme_manager.theme.markdate.holidays;
138 var mark_day = (Script.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 "transparent";//theme_manager.theme.markdate.otherday;
161 Keys.onLeftPressed: decrementCurrentIndex()
162 Keys.onRightPressed: incrementCurrentIndex()
163 highlightMoveDuration:500
164 preferredHighlightBegin: 0.5
165 preferredHighlightEnd: 0.5
166 highlightRangeMode: PathView.StrictlyEnforceRange
169 highlight: Rectangle{
170 anchors.topMargin: 10;
180 PathLine {x: reelx.width; y: 50}
188 Script.changeDay(txtDATEpv.currentIndex+1, txtTHU, txtInfo, txtDAYAmLich);
189 Script.fullmonth.m_day=Script.curDay;
190 Script.fullmonth.m_month=Script.curMonth;
191 Script.fullmonth.m_year=Script.curYear;
192 Script.fullmonth.reset();
200 var days_of_this_month = Script.calDays();
201 var days_of_changes = days_of_this_month - maindatemodel.count;
205 if (days_of_changes<0){
206 ifs=Math.abs(days_of_changes);
208 maindatemodel.remove(maindatemodel.count-1);
211 }else if(days_of_changes>0){
212 ifs=maindatemodel.count;
213 for (var i=1;i<=days_of_changes;i++)
218 reelx.index = Script.curDay - 1;
223 for(var i=1;i<=Script.calDays();i++)
226 reelx.index = Script.curDay - 1;
230 //-------------------------------------------------
238 text: "Tháng <b>"+screen.curMonth+"</b> Năm <b>"+screen.curYear+"</b>"
239 horizontalAlignment: Text.AlignHCenter
240 anchors.horizontalCenter: parent.horizontalCenter
242 font.family: "Tahoma"
253 text: Script.__txtTHU_format()
254 horizontalAlignment: Text.AlignHCenter
255 anchors.horizontalCenter: parent.horizontalCenter
264 y: (screen.is_holiday ? 270 : 250)
266 color: (Script.is_holiday ? theme_manager.theme.markdate.holidays : theme_manager.theme.markdate.not_holidays)
267 text: Script.__txtInfo_format()
268 horizontalAlignment: Text.AlignHCenter
269 anchors.horizontalCenter: parent.horizontalCenter
271 font.bold: (screen.is_holiday ? true : false)
272 font.pixelSize: (screen.is_holiday ? 25 : 20)
281 color: theme_manager.theme.markdate.lunardate
282 text: Script.__txtDAYAmLich_format()
283 horizontalAlignment: Text.AlignHCenter
284 anchors.horizontalCenter: parent.horizontalCenter
290 ToolBar { id: toolBar; height: 42;
291 y: screen.height - 52
292 width: parent.width; opacity: 0.8
294 button2Label: "Lựa Chọn"
297 screen.state="switchX"
298 var menuscreen = Script.createObject("MenuScreen.qml", screen);
299 menuscreen.close.connect(closeDialogs);
300 menuscreen.item_click.connect(menu_item_Clicked);
301 menuscreen.state = "show";
304 screen.state="switchX"
305 var optionsscreen = Script.createObject("OptionsScreen.qml", screen);
306 optionsscreen.close.connect(closeDialogs);
307 optionsscreen.state = "show";
312 MultiTitleBar { id: titleBar; width: parent.width }
316 function closeDialogs(){
318 screen.state="mainscreen";
321 function menu_item_Clicked(id){
324 screen.state="switchX";
326 case 1: Script.reset_to_default_day(txtTHU, txtInfo, txtDAYAmLich);
327 txtDATEpv.currentIndex = Script.curDay-1;
328 screen.curMonth = Script.curMonth;
329 screen.curYear = Script.curYear;
330 Script.fullmonth.m_day= Script.curDay-1;
331 Script.fullmonth.m_month= Script.curMonth;
332 Script.fullmonth.m_year= Script.curYear;
334 case 2: Script.amdatetimedlg.state="show";break;
335 case 3: Script.datetimedlg.state="show";break;
336 case 4: qmlF="XemNgayTotXauHoangDao";break;
337 case 5: Script.fullmonth.state="show";break;
338 case 6: qmlF = "About";break;
339 default:screen.state = "mainscreen";qmlF="";break;
342 var qmlobj = Script.createObject(qmlF+".qml", screen);
343 qmlobj.close.connect(closeDialogs);
344 qmlobj.state = "show";
358 PropertyChanges { target: titleBar; y: -50 }
359 PropertyChanges { target: toolBar; y: screen.height }
360 PropertyChanges { target: toolBar }
361 PropertyChanges { target: mouseareaMM;enabled:false }
366 Transition { NumberAnimation { properties: "x,y,opacity"; duration: 300; easing.type: Easing.InOutBack } }