*/
import QtQuick 1.0
-import "../DatePicker/component" as Comp
-import "amlich-hnd.js" as AmLich
-import "amlich-aa98.js" as AmLich98
-
-import "CacNgayLeTrongNam.js" as CNLTN
+import "Themes.js" as Themes
+import "main.js" as Script
Item{
id: fullmonth
- property int m_day: screen.curDay
- property int m_month: screen.curMonth
- property int m_year: screen.curYear
+ anchors.verticalCenter: parent.verticalCenter
+ width: parent.width; height: parent.height;
+ x:-(parent.width * 1.5)
+
+ signal toolbar
+ signal updatedate(int day, int month, int year)
+
+ Loader {
+ id: theme_manager
+ property alias theme: theme_manager.item
+ source: Themes.default_theme()
+ }
+
+
+ Component.onCompleted: {
+ reset();
+ }
+
+ property int m_day: Script.curDay
+ property int m_month: Script.curMonth
+ property int m_year: Script.curYear
property Component headerRenderer:Component {
id: defaultHeaderRenderer
property bool hold: false
onClicked: {
- LC.reset(model.day,m_month,m_year)
+ /*LC.reset(model.day,m_month,m_year)
screen.calculateLunar(model.day,m_month,m_year)
screen.state="mainscreen"
screen.refresh()
- maindatemodel.reset()
- txtDATEpv.currentIndex = model.day-1;
+ maindatemodel.reset()*/
+ fullmonth.state="close";
+ fullmonth.toolbar();
+ fullmonth.updatedate(model.day, m_month, m_year)
}
onPositionChanged: {
Grid {
id: grid
- anchors.bottomMargin: -52
- anchors.topMargin: 78
+ anchors.topMargin: 40
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.top: parent.top
}
- Text {
- id: txt_caption
- y: 40
- width:parent.width
- text: "Tháng "+m_month+", "+m_year
- horizontalAlignment: Text.AlignHCenter
- font.pixelSize: 24
- font.bold: true
- }
+ }
+
+ Rectangle {
+ width : fullmonth.width
+ height: 45
+ color:"white"
+ opacity: 0.5
+ }
+
+ Text {
+ id: title
+ anchors { horizontalCenter: fullmonth.horizontalCenter; top: fullmonth.top; topMargin: 10 }
+ font.pixelSize: 22
+ color: "black"
+ text: "Tháng "+fullmonth.m_month+", "+fullmonth.m_year
+ smooth: true
+ font.bold: true
}
- ToolBarSingle { id: toolBar; height: 50;
- y: screen.height-78
+ ToolBarSingle {
+ id: toolBar; height: 42;
+ y: parent.height-52
width: parent.width;
button1Label: "Quay Về"
- onButton1Clicked:
- {
- screen.state="mainscreen"
+ onButton1Clicked:{
+ fullmonth.state="close";
+ fullmonth.toolbar();
}
}
function reset() {
monthModel.clear()
- var firstdayofthemonthyear = AmLich.getLunarDate(1,m_month,m_year).jd;
+ var firstdayofthemonthyear = Script.getLunarDate(1,m_month,m_year).jd;
var startfrom = (firstdayofthemonthyear+1)%7;
- var daysofthemonthyear = LC.calDays(m_month,m_year);
+ var daysofthemonthyear = Script.calDays(m_month,m_year);
var j=1;
var totalslot = 42;
}
var current = false;
- if (dayclick == screen.curDay && monthclick==screen.curMonth && yearclick==screen.curYear)
+ if (dayclick == Script.curDay && monthclick==Script.curMonth && yearclick==Script.curYear)
current = true
- var lunarcl = AmLich.getLunarDate(dayclick,monthclick,yearclick)
+ var lunarcl = Script.getLunarDate(dayclick,monthclick,yearclick)
var lunar_day = lunarcl.day;
if (lunarcl.day === 1)
lunar_day = lunarcl.day+"/"+lunarcl.month;
- var stemp = AmLich98.convertSolar2Lunar(dayclick,monthclick,yearclick,7);
- var inholiday = CNLTN.is_holiday(dayclick, monthclick, stemp[0], stemp[1]);
+ var stemp = Script.convertSolar2Lunar(dayclick,monthclick,yearclick,7);
+ var inholiday = Script.is_holiday(dayclick, monthclick, stemp[0], stemp[1]);
monthModel.append({"day": dayclick, "current": current, "lunar_day":lunar_day, "inmonth":inmonth,"inholiday":inholiday})
}
cYear--;
}else
cMonth--;
- var daysofthemonthyear = LC.calDays(cMonth,cYear);
+ var daysofthemonthyear = Script.calDays(cMonth,cYear);
for (var i=daysofthemonthyear;i>daysofthemonthyear-startfrom;i--){
- var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
+ var lunarcl = Script.getLunarDate(i,cMonth,cYear)
pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear})
}
return pmonth.reverse()
cMonth++;
for (var i=1;i<=startfrom;i++){
- var lunarcl = AmLich.getLunarDate(i,cMonth,cYear)
+ var lunarcl = Script.getLunarDate(i,cMonth,cYear)
pmonth.push({duong:i, am:lunarcl.day, month:cMonth, year:cYear});
}
return pmonth.reverse();
}
+ states: [
+ State {
+ name: "show"
+ AnchorChanges { target: fullmonth; anchors.right: parent.right }
+ },
+ State {
+ name: "close"
+ AnchorChanges { target: fullmonth; anchors.right: parent.left }
+ }
+ ]
+
+ transitions: Transition {
+ AnchorAnimation { easing.type: Easing.OutQuart; duration: 300 }
+ }
+
}