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 //-------------------------------------------------
238 textFormat: Text.RichText
239 text: "Tháng <b>"+screen.curMonth+"</b> Năm <b>"+screen.curYear+"</b>"
240 anchors.horizontalCenter: parent.horizontalCenter
242 font.family: "Tahoma"
244 horizontalAlignment: Text.AlignHCenter
255 text: Script.__txtTHU_format()
256 horizontalAlignment: Text.AlignHCenter
257 anchors.horizontalCenter: parent.horizontalCenter
266 y: (screen.is_holiday ? 270 : 250)
269 color: (Script.is_holiday ? theme_manager.theme.markdate.holidays : theme_manager.theme.markdate.not_holidays)
270 text: Script.__txtInfo_format()
271 horizontalAlignment: Text.AlignHCenter
272 anchors.horizontalCenter: parent.horizontalCenter
274 font.bold: (screen.is_holiday ? true : false)
275 font.pixelSize: (screen.is_holiday ? 25 : 20)
286 text: Script.__txtDAYAmLich_format()
287 horizontalAlignment: Text.AlignHCenter
288 anchors.horizontalCenter: parent.horizontalCenter
294 ToolBar { id: toolBar; height: 42;
295 y: screen.height - 52
296 width: parent.width; opacity: 0.8
298 button2Label: "Lựa Chọn"
301 screen.state="switchX"
302 var menuscreen = Script.createObject("MenuScreen.qml", screen);
303 menuscreen.close.connect(closeDialogs);
304 menuscreen.item_click.connect(menu_item_Clicked);
305 menuscreen.state = "show";
308 screen.state="switchX"
309 var optionsscreen = Script.createObject("OptionsScreen.qml", screen);
310 optionsscreen.close.connect(closeDialogs);
311 optionsscreen.state = "show";
316 MultiTitleBar { id: titleBar; width: parent.width }
320 function closeDialogs(){
322 screen.state="mainscreen";
325 function menu_item_Clicked(id){
328 screen.state="switchX";
330 case 1: Script.reset_to_default_day(txtTHU, txtInfo, txtDAYAmLich);
331 txtDATEpv.currentIndex = Script.curDay-1;
332 screen.curMonth = Script.curMonth;
333 screen.curYear = Script.curYear;
334 Script.fullmonth.m_day= Script.curDay-1;
335 Script.fullmonth.m_month= Script.curMonth;
336 Script.fullmonth.m_year= Script.curYear;
338 case 2: Script.amdatetimedlg.state="show";break;
339 case 3: Script.datetimedlg.state="show";break;
340 case 4: qmlF="XemNgayTotXauHoangDao";break;
341 case 5: Script.fullmonth.state="show";break;
342 case 6: qmlF = "About";break;
343 default:screen.state = "mainscreen";qmlF="";break;
346 var qmlobj = Script.createObject(qmlF+".qml", screen);
347 qmlobj.close.connect(closeDialogs);
348 qmlobj.state = "show";
362 PropertyChanges { target: toolBar; y: screen.height }
363 PropertyChanges { target: toolBar }
364 PropertyChanges { target: mouseareaMM;enabled:false }
369 Transition { NumberAnimation { properties: "x,y,opacity"; duration: 300; easing.type: Easing.InOutBack } }