}
signal toolbar
+ signal updatedate(int day, int month, int year)
Rectangle {
id: rectangle1
Button {
id: button2
- x: 313
- anchors.right: parent.right; anchors.rightMargin: 8; y: 185; width: 140; height: 40
+ anchors.right: parent.right; anchors.rightMargin: 145; y: 185; width: 100; height: 40
+ anchors.horizontalCenter: parent.horizontalCenter
+
text: "OK"
onClicked: {
var lday = lunarday_pathview.currentIndex+1;
if (thangnhuan!=-1 && lunarmonth_pathview.currentIndex> thangnhuan)
lmonth-=1;
- var finalSolarDay = Script.convertLunar2Solar(lday,lmonth,lyear,lnhuan,7)
-
- LC.reset(finalSolarDay[0],finalSolarDay[1],finalSolarDay[2])
- Script.calculateLunar( finalSolarDay[0], finalSolarDay[1], finalSolarDay[2])
- Script.state="mainscreen"
- Script.refresh()
+ var finalSolarDay = Script.convertLunar2Solar(lday,lmonth,lyear,lnhuan,7);
- maindatemodel.reset()
- txtDATEpv.currentIndex = finalSolarDay[0]-1;
+ amdatetime.state="close";
+ amdatetime.toolbar();
+ amdatetime.updatedate(finalSolarDay[0], finalSolarDay[1], finalSolarDay[2])
}
}
var rannum=Math.floor(Math.random()*Loi_Hay_Y_Dep.length)
day_info = Loi_Hay_Y_Dep[rannum];
}
+
return day_info;
}
}
signal toolbar
+ signal updatedate(int day, int month, int year)
Rectangle {
id: rectangle1
text: "OK"
visible: true
onClicked: {
- LC.reset(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
- Script.calculateLunar(datePicker.mDay,datePicker.mMonth,datePicker.mYear)
- Script.state="mainscreen"
- Script.refresh()
- maindatemodel.reset()
+ datetimedlg.state="close";
+ datetimedlg.toolbar();
+ datetimedlg.updatedate(datePicker.mDay, datePicker.mMonth, datePicker.mYear)
+
}
}
text: model.modelData
font.bold: true
- font.pointSize: width ? width / 6 : 1
+ font.pointSize: parent.width > parent.height ? width ? width / 6 : 1 : width / 4
}
}
}
Text {
id:txt_solar_day
anchors.fill: parent
- anchors.leftMargin: 10
+ anchors.leftMargin: parent.width > parent.height ? 10 : 5
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
text: model ? model.day : ""
color: model ? model.inmonth ? (model.current ? "red" : model.inholiday ? theme_manager.theme.markdate.holidays : "black") : "grey" : "red"
- font.pointSize: parent.width ? parent.width / 6 : 1
+ font.pointSize: parent.width > parent.height ? parent.width ? parent.width / 6 : 1 : parent.width / 4
font.bold: true
}
Text {
anchors.fill: parent
- anchors.leftMargin: txt_solar_day.anchors.leftMargin+40
+ anchors.leftMargin: txt_solar_day.anchors.leftMargin+ parent.width > parent.height ? 60 : 35
anchors.topMargin: 20
verticalAlignment: Text.AlignVCenter
text: model ? model.lunar_day : ""
color: model ? model.inmonth ? (model.current ? "red" : "#700070") : "grey" : "red"
- font.pointSize: parent.width ? parent.width / 8 : 1
+ font.pointSize: parent.width > parent.height ? parent.width ? parent.width / 8 : 1 : parent.width / 5
}
MouseArea {
+ id:memouse
anchors.fill: parent
property real mX
property real mY
property bool hold: false
+ property bool clicked: false
onClicked: {
- /*LC.reset(model.day,m_month,m_year)
- screen.calculateLunar(model.day,m_month,m_year)
- screen.state="mainscreen"
- screen.refresh()
- maindatemodel.reset()*/
- fullmonth.state="close";
- fullmonth.toolbar();
- fullmonth.updatedate(model.day, m_month, m_year)
+ if (model.inmonth){
+ fullmonth.updatedate(model.day, m_month, m_year)
+ hold=false;
+ m_day = model.day;
+ fullmonth.state="close";
+ fullmonth.toolbar();
+
+ }else{
+ if (model.isprevmonth){
+ m_month--;
+ if(m_month<=0){
+ m_month=12;
+ m_year--;
+ }
+ }else{
+ m_month++;
+ if (m_month >=13){
+ m_month=1;
+ m_year++;
+ }
+ }
+ fullmonth.reset();
+ }
}
onPositionChanged: {
mX = mouseX;
mY = mouseY;
hold=true;
+ clicked=false;
}
onPressed: {
recms.color="#F0F0F0"
+ clicked=true;
}
onReleased: {
+ recms.color=model ? model.inmonth ? (model.current ? "blue" : "lightsteelblue") : "#AAAAAA" : "black";
if (hold){
if (mouseY+mY<0){
- if (Math.abs(mouseY) >= 30){
- m_month+=1;
+ if (Math.abs(mouseY) >= 100){
+ m_month++;
if (m_month >=13){
m_month=1;
m_year++;
}
+ reset();
}
}
else
{
- if (mouseY >= 50){
- m_month-=1;
+ if (mouseY >= 100){
+ m_month--;
if(m_month<=0){
m_month=12;
m_year--;
}
+ reset();
}
}
- reset();
hold=false;
}
}
var prevmonth = get_prevmonth(startfrom)
var dayclick, monthclick, yearclick;
- var datas1,datas,lunarclmonth,inmonth;
+ var datas1,datas,lunarclmonth,inmonth,isprevmonth;
for (var i=0;i<42;i++){
if (i >= startfrom && j<= daysofthemonthyear){
monthclick = m_month;
yearclick = m_year;
inmonth = true;
+ isprevmonth=false;
j++;
}else{
- if (i<startfrom)
+ if (i<startfrom){
datas1=prevmonth[i];
- else
+ isprevmonth = true;
+ }
+ else{
datas1=nextmonth[(totalslot-i)-1];
+ isprevmonth = false;
+ }
dayclick = datas1.duong;
monthclick = datas1.month;
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})
+ monthModel.append({"day": dayclick, "current": current, "lunar_day":lunar_day, "inmonth":inmonth,"inholiday":inholiday,"isprevmonth":isprevmonth})
}
}
transitions: Transition {
AnchorAnimation { easing.type: Easing.OutQuart; duration: 300 }
- }
+ }
}
Column {
Rectangle {
- width:rectangle1.width-10;
+ width:rectangle1.width;
y:30;
x:0
height:1
ListView {
id: listView
- anchors.fill: parent;anchors.topMargin: 45;anchors.leftMargin: 5;anchors.rightMargin: 5;anchors.bottomMargin: 55
+ anchors.fill: parent;anchors.topMargin: 45;anchors.leftMargin: 0;anchors.rightMargin: 0;anchors.bottomMargin: 55
model: listModel
delegate: listDelegate
focus: true
return TIETKHI[getSunLongitude(jd+1,7.0)];
}
+function reset_to_default_day(txtTHU, txtInfo, txtDAYAmLich){
+ localdate = new Date();
+
+ curDay=localdate.getDate();
+ curMonth=localdate.getMonth()+1;
+ curYear=localdate.getFullYear();
+
+ changeDay(curDay, txtTHU, txtInfo, txtDAYAmLich);
+}
+
function changeDay(newday, txtTHU, txtInfo, txtDAYAmLich){
curDay = newday;
recalculate();
lunarDayCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[0];
lunarMonthCanChi = getCanChi(getLunarDate(curDay,curMonth,curYear))[1];
- day_info = get(curDay,curMonth, curYear, lunarDay, lunarMonth);
+ day_info = get(curDay,curMonth, lunarDay, lunarMonth);
isholiday = is_holiday(curDay,curMonth, curYear, lunarDay, lunarMonth);
}
Item {
id: screen
- width: 800
- height: 480
+ width: 480
+ height: 800
state:"mainscreen"
Settings.restore_nomodel();
Script.createDateTimeDialog(screen);
Script.datetimedlg.toolbar.connect(show_toolbar);
+ Script.datetimedlg.updatedate.connect(update_date);
Script.amdatetimedlg.toolbar.connect(show_toolbar);
+ Script.amdatetimedlg.updatedate.connect(update_date);
Script.fullmonth.toolbar.connect(show_toolbar);
Script.fullmonth.updatedate.connect(update_date);
maindatemodel.init();
Script.curMonth = month;
Script.curYear = year;
Script.changeDay(day, txtTHU, txtInfo, txtDAYAmLich);
+ Script.fullmonth.m_day=Script.curDay;
+ Script.fullmonth.m_month=Script.curMonth;
+ Script.fullmonth.m_year=Script.curYear;
+ Script.fullmonth.reset();
}
Rectangle {
state:"jumptodate"
- /*Image {
+ Image {
source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent
opacity: theme_manager.theme.background_opacity
- }*/
+ }
MouseArea {
onDoubleClicked:{
if (Settings.doubleclicked()==1){
- screen.state="datetimedialog";
-
+ screen.state="switchX";
+ Script.datetimedlg.state="show";
}
}
}
text: name
font.bold: true
font.pixelSize: wrapper.PathView.isCurrentItem ? 80 : 40
- color: "black"
+ color: {
+ if (wrapper.PathView.isCurrentItem){
+ var stemp = Script.convertSolar2Lunar(txtDATEpv.currentIndex+1,curMonth,curYear,7);
+ if (Script.is_holiday(txtDATEpv.currentIndex+1,curMonth, stemp[0], stemp[1])){
+ return theme_manager.theme.markdate.holidays;
+ }else{
+ var mark_day = (Script.getLunarDate(txtDATEpv.currentIndex+1,curMonth,curYear).jd+1)%7;
+ if (mark_day === 0) //sunday
+ return theme_manager.theme.markdate.sunday;
+ if (mark_day == 6) //saturday
+ return theme_manager.theme.markdate.saturday;
+ else
+ return theme_manager.theme.markdate.otherday_selected;
+ }
+ }
+ else
+ return "transparent";//theme_manager.theme.markdate.otherday;
+ }
}
}
}
onMovementEnded: {
Script.changeDay(txtDATEpv.currentIndex+1, txtTHU, txtInfo, txtDAYAmLich);
+ Script.fullmonth.m_day=Script.curDay;
+ Script.fullmonth.m_month=Script.curMonth;
+ Script.fullmonth.m_year=Script.curYear;
+ Script.fullmonth.reset();
}
}
}
function menu_item_Clicked(id){
var qmlF = "";
- screen.state="switchX";
+ if (id!=1)
+ screen.state="switchX";
switch(id){
+ case 1: Script.reset_to_default_day(txtTHU, txtInfo, txtDAYAmLich);
+ txtDATEpv.currentIndex = Script.curDay-1;
+ screen.curMonth = Script.curMonth;
+ screen.curYear = Script.curYear;
+ Script.fullmonth.m_day= Script.curDay-1;
+ Script.fullmonth.m_month= Script.curMonth;
+ Script.fullmonth.m_year= Script.curYear;
+ break;
case 2: Script.amdatetimedlg.state="show";break;
case 3: Script.datetimedlg.state="show";break;
case 4: qmlF="XemNgayTotXauHoangDao";break;
Transition { NumberAnimation { properties: "x,y,opacity"; duration: 300; easing.type: Easing.InOutBack } }
]
-
- function reset(){
- /*calculateLunar(initcurDay, initcurMonth, initcurYear)
- LC.reset(initcurDay, initcurMonth, initcurYear)
- screen.state="mainscreen"
- maindatemodel.reset()
- txtDATEpv.currentIndex = initcurDay-1;*/
- }
-
}
+++ /dev/null
-border.left: 10
-border.top: 10
-border.bottom: 10
-border.right: 10
-source: lineedit.png
+++ /dev/null
-border.left: 10
-border.top: 12
-border.bottom: 12
-border.right: 10
-source: titlebar.png
+++ /dev/null
-border.left: 15
-border.top: 4
-border.bottom: 4
-border.right: 15
-source: toolbutton.png
+++ /dev/null
-border.left: 15
-border.top: 4
-border.bottom: 4
-border.right: 15
-source: toolbutton_pressed.png