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();
80 source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent
81 opacity: theme_manager.theme.background_opacity
90 property int fixed: 40
93 anchors.fill: parent;anchors.topMargin: 60;anchors.bottomMargin:60;
96 if (Settings.pressandhold()==1){
103 if (Settings.doubleclicked()==1){
104 screen.state="switchX";
105 Script.datetimedlg.state="show";
110 //------------------------------------------------
117 anchors.horizontalCenter: parent.horizontalCenter
118 property int index: 0
119 onIndexChanged: txtDATEpv.currentIndex = reelx.index
130 font.pixelSize: wrapper.PathView.isCurrentItem ? 80 : 40
132 if (wrapper.PathView.isCurrentItem){
133 var stemp = Script.convertSolar2Lunar(txtDATEpv.currentIndex+1,curMonth,curYear,7);
134 if (Script.is_holiday(txtDATEpv.currentIndex+1,curMonth, stemp[0], stemp[1])){
135 return theme_manager.theme.markdate.holidays;
137 var mark_day = (Script.getLunarDate(txtDATEpv.currentIndex+1,curMonth,curYear).jd+1)%7;
138 if (mark_day === 0) //sunday
139 return theme_manager.theme.markdate.sunday;
140 if (mark_day == 6) //saturday
141 return theme_manager.theme.markdate.saturday;
143 return theme_manager.theme.markdate.otherday_selected;
147 return "transparent";//theme_manager.theme.markdate.otherday;
160 Keys.onLeftPressed: decrementCurrentIndex()
161 Keys.onRightPressed: incrementCurrentIndex()
162 highlightMoveDuration:500
163 preferredHighlightBegin: 0.5
164 preferredHighlightEnd: 0.5
165 highlightRangeMode: PathView.StrictlyEnforceRange
168 highlight: Rectangle{
169 anchors.topMargin: 10;
179 PathLine {x: reelx.width; y: 50}
187 Script.changeDay(txtDATEpv.currentIndex+1, txtTHU, txtInfo, txtDAYAmLich);
188 Script.fullmonth.m_day=Script.curDay;
189 Script.fullmonth.m_month=Script.curMonth;
190 Script.fullmonth.m_year=Script.curYear;
191 Script.fullmonth.reset();
199 var days_of_this_month = Script.calDays();
200 var days_of_changes = days_of_this_month - maindatemodel.count;
204 if (days_of_changes<0){
205 ifs=Math.abs(days_of_changes);
207 maindatemodel.remove(maindatemodel.count-1);
210 }else if(days_of_changes>0){
211 ifs=maindatemodel.count;
212 for (var i=1;i<=days_of_changes;i++)
217 reelx.index = Script.curDay - 1;
222 for(var i=1;i<=Script.calDays();i++)
225 reelx.index = Script.curDay - 1;
229 //-------------------------------------------------
237 text: "Tháng <b>"+screen.curMonth+"</b> Năm <b>"+screen.curYear+"</b>"
238 horizontalAlignment: Text.AlignHCenter
239 anchors.horizontalCenter: parent.horizontalCenter
241 font.family: "Tahoma"
252 text: Script.__txtTHU_format()
253 horizontalAlignment: Text.AlignHCenter
254 anchors.horizontalCenter: parent.horizontalCenter
263 y: (screen.is_holiday ? 270 : 250)
265 color: (Script.is_holiday ? theme_manager.theme.markdate.holidays : theme_manager.theme.markdate.not_holidays)
266 text: Script.__txtInfo_format()
267 horizontalAlignment: Text.AlignHCenter
268 anchors.horizontalCenter: parent.horizontalCenter
270 font.bold: (screen.is_holiday ? true : false)
271 font.pixelSize: (screen.is_holiday ? 25 : 20)
280 color: theme_manager.theme.markdate.lunardate
281 text: Script.__txtDAYAmLich_format()
282 horizontalAlignment: Text.AlignHCenter
283 anchors.horizontalCenter: parent.horizontalCenter
289 ToolBar { id: toolBar; height: 42;
290 y: screen.height - 52
291 width: parent.width; opacity: 0.8
293 button2Label: "Lựa Chọn"
296 screen.state="switchX"
297 var menuscreen = Script.createObject("MenuScreen.qml", screen);
298 menuscreen.close.connect(closeDialogs);
299 menuscreen.item_click.connect(menu_item_Clicked);
300 menuscreen.state = "show";
303 screen.state="switchX"
304 var optionsscreen = Script.createObject("OptionsScreen.qml", screen);
305 optionsscreen.close.connect(closeDialogs);
306 optionsscreen.state = "show";
311 MultiTitleBar { id: titleBar; width: parent.width }
315 function closeDialogs(){
317 screen.state="mainscreen";
320 function menu_item_Clicked(id){
323 screen.state="switchX";
325 case 1: Script.reset_to_default_day(txtTHU, txtInfo, txtDAYAmLich);
326 txtDATEpv.currentIndex = Script.curDay-1;
327 screen.curMonth = Script.curMonth;
328 screen.curYear = Script.curYear;
329 Script.fullmonth.m_day= Script.curDay-1;
330 Script.fullmonth.m_month= Script.curMonth;
331 Script.fullmonth.m_year= Script.curYear;
333 case 2: Script.amdatetimedlg.state="show";break;
334 case 3: Script.datetimedlg.state="show";break;
335 case 4: qmlF="XemNgayTotXauHoangDao";break;
336 case 5: Script.fullmonth.state="show";break;
337 case 6: qmlF = "About";break;
338 default:screen.state = "mainscreen";qmlF="";break;
341 var qmlobj = Script.createObject(qmlF+".qml", screen);
342 qmlobj.close.connect(closeDialogs);
343 qmlobj.state = "show";
357 PropertyChanges { target: titleBar; y: -50 }
358 PropertyChanges { target: toolBar; y: screen.height }
359 PropertyChanges { target: toolBar }
360 PropertyChanges { target: mouseareaMM;enabled:false }
365 Transition { NumberAnimation { properties: "x,y,opacity"; duration: 300; easing.type: Easing.InOutBack } }