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.amdatetimedlg.toolbar.connect(show_toolbar);
47 Script.fullmonth.toolbar.connect(show_toolbar);
48 Script.fullmonth.updatedate.connect(update_date);
53 function show_toolbar(){
54 screen.state="mainscreen";
57 function update_date(day, month, year){
58 txtDATEpv.currentIndex = day-1;
59 screen.curMonth = month;
60 screen.curYear = year;
61 Script.curMonth = month;
62 Script.curYear = year;
63 Script.changeDay(day, txtTHU, txtInfo, txtDAYAmLich);
74 source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent
75 opacity: theme_manager.theme.background_opacity
84 property int fixed: 40
87 anchors.fill: parent;anchors.topMargin: 60;anchors.bottomMargin:60;
90 if (Settings.pressandhold()==1){
97 if (Settings.doubleclicked()==1){
98 screen.state="datetimedialog";
104 //------------------------------------------------
111 anchors.horizontalCenter: parent.horizontalCenter
112 property int index: 0
113 onIndexChanged: txtDATEpv.currentIndex = reelx.index
124 font.pixelSize: wrapper.PathView.isCurrentItem ? 80 : 40
137 Keys.onLeftPressed: decrementCurrentIndex()
138 Keys.onRightPressed: incrementCurrentIndex()
139 highlightMoveDuration:500
140 preferredHighlightBegin: 0.5
141 preferredHighlightEnd: 0.5
142 highlightRangeMode: PathView.StrictlyEnforceRange
145 highlight: Rectangle{
146 anchors.topMargin: 10;
156 PathLine {x: reelx.width; y: 50}
164 Script.changeDay(txtDATEpv.currentIndex+1, txtTHU, txtInfo, txtDAYAmLich);
172 var days_of_this_month = Script.calDays();
173 var days_of_changes = days_of_this_month - maindatemodel.count;
177 if (days_of_changes<0){
178 ifs=Math.abs(days_of_changes);
180 maindatemodel.remove(maindatemodel.count-1);
183 }else if(days_of_changes>0){
184 ifs=maindatemodel.count;
185 for (var i=1;i<=days_of_changes;i++)
190 reelx.index = Script.curDay - 1;
195 for(var i=1;i<=Script.calDays();i++)
198 reelx.index = Script.curDay - 1;
202 //-------------------------------------------------
211 textFormat: Text.RichText
212 text: "Tháng <b>"+screen.curMonth+"</b> Năm <b>"+screen.curYear+"</b>"
213 anchors.horizontalCenter: parent.horizontalCenter
215 font.family: "Tahoma"
217 horizontalAlignment: Text.AlignHCenter
228 text: Script.__txtTHU_format()
229 horizontalAlignment: Text.AlignHCenter
230 anchors.horizontalCenter: parent.horizontalCenter
239 y: (screen.is_holiday ? 270 : 250)
242 color: (Script.is_holiday ? theme_manager.theme.markdate.holidays : theme_manager.theme.markdate.not_holidays)
243 text: Script.__txtInfo_format()
244 horizontalAlignment: Text.AlignHCenter
245 anchors.horizontalCenter: parent.horizontalCenter
247 font.bold: (screen.is_holiday ? true : false)
248 font.pixelSize: (screen.is_holiday ? 25 : 20)
259 text: Script.__txtDAYAmLich_format()
260 horizontalAlignment: Text.AlignHCenter
261 anchors.horizontalCenter: parent.horizontalCenter
267 ToolBar { id: toolBar; height: 42;
268 y: screen.height - 52
269 width: parent.width; opacity: 0.8
271 button2Label: "Lựa Chọn"
274 screen.state="switchX"
275 var menuscreen = Script.createObject("MenuScreen.qml", screen);
276 menuscreen.close.connect(closeDialogs);
277 menuscreen.item_click.connect(menu_item_Clicked);
278 menuscreen.state = "show";
281 screen.state="switchX"
282 var optionsscreen = Script.createObject("OptionsScreen.qml", screen);
283 optionsscreen.close.connect(closeDialogs);
284 optionsscreen.state = "show";
289 MultiTitleBar { id: titleBar; width: parent.width }
293 function closeDialogs(){
295 screen.state="mainscreen";
298 function menu_item_Clicked(id){
300 screen.state="switchX";
302 case 2: Script.amdatetimedlg.state="show";break;
303 case 3: Script.datetimedlg.state="show";break;
304 case 4: qmlF="XemNgayTotXauHoangDao";break;
305 case 5: Script.fullmonth.state="show";break;
306 case 6: qmlF = "About";break;
307 default:screen.state = "mainscreen";qmlF="";break;
310 var qmlobj = Script.createObject(qmlF+".qml", screen);
311 qmlobj.close.connect(closeDialogs);
312 qmlobj.state = "show";
326 PropertyChanges { target: toolBar; y: screen.height }
327 PropertyChanges { target: toolBar }
328 PropertyChanges { target: mouseareaMM;enabled:false }
333 Transition { NumberAnimation { properties: "x,y,opacity"; duration: 300; easing.type: Easing.InOutBack } }
338 /*calculateLunar(initcurDay, initcurMonth, initcurYear)
339 LC.reset(initcurDay, initcurMonth, initcurYear)
340 screen.state="mainscreen"
341 maindatemodel.reset()
342 txtDATEpv.currentIndex = initcurDay-1;*/