This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
+the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
*/
import QtQuick 1.0
-import "amlich-hnd.js" as AmLich
-import "amlich-aa98.js" as AmLich98
+
+import "Themes.js" as Themes
+import "main.js" as Script
Item{
id: amdatetime
state: "switch_me"
+ anchors.verticalCenter: parent.verticalCenter
+ width: parent.width; height: parent.height;
+ x:(parent.width * 1.5)
+
+ Loader {
+ id: theme_manager
+ property alias theme: theme_manager.item
+ source: Themes.default_theme()
+ }
+
+ signal toolbar
+ signal updatedate(int day, int month, int year)
+
Rectangle {
id: rectangle1
x: 0
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 = AmLich98.convertLunar2Solar(lday,lmonth,lyear,lnhuan,7)
+ var finalSolarDay = Script.convertLunar2Solar(lday,lmonth,lyear,lnhuan,7);
- LC.reset(finalSolarDay[0],finalSolarDay[1],finalSolarDay[2])
- screen.calculateLunar( finalSolarDay[0], finalSolarDay[1], finalSolarDay[2])
- screen.state="mainscreen"
- screen.refresh()
-
- maindatemodel.reset()
- txtDATEpv.currentIndex = finalSolarDay[0]-1;
+ amdatetime.state="close";
+ amdatetime.toolbar();
+ amdatetime.updatedate(finalSolarDay[0], finalSolarDay[1], finalSolarDay[2])
}
}
height: 40
text: "X"
anchors.rightMargin: 56
- onClicked: {screen.state="mainscreen"}
+ onClicked: {
+ amdatetime.state="close"
+ amdatetime.toolbar()
+ }
}
Rectangle {
- id: rectangle2
+ id: rec22
x: 23
y: 89
width: 415
}
}
+ states: [
+ State {
+ name: "switch_to_day";
+ PropertyChanges { target:lmk;x:10;width:60;}
+ PropertyChanges { target:lunaryear_pathview;pathItemCount:1;}
+ PropertyChanges { target:lunarmonth_pathview;pathItemCount:1;}
+ PropertyChanges { target:lunarday_pathview;pathItemCount:3;}
+ PropertyChanges { target:lunarday_mousearea;visible:false;}
+ PropertyChanges { target:lunaryear_mousearea;visible:true;}
+ PropertyChanges { target:lunarmonth_mousearea;visible:true;}
+ },
+ State {
+ name: "switch_to_year";
+ PropertyChanges { target:lmk;x:207;width:198;}
+ PropertyChanges { target:lunarday_pathview;pathItemCount:1;}
+ PropertyChanges { target:lunarmonth_pathview;pathItemCount:1;}
+ PropertyChanges { target:lunaryear_pathview;pathItemCount:3;}
+ PropertyChanges { target:lunarday_mousearea;visible:true;}
+ PropertyChanges { target:lunaryear_mousearea;visible:false;}
+ PropertyChanges { target:lunarmonth_mousearea;visible:true;}
+ },
+ State {
+ name: "switch_to_month";
+ PropertyChanges { target:lmk;x:60;width:150;}
+ PropertyChanges { target:lunarday_pathview;pathItemCount:1;}
+ PropertyChanges { target:lunaryear_pathview;pathItemCount:1;}
+ PropertyChanges { target:lunarmonth_pathview;pathItemCount:3;}
+ PropertyChanges { target:lunarday_mousearea;visible:true;}
+ PropertyChanges { target:lunaryear_mousearea;visible:true;}
+ PropertyChanges { target:lunarmonth_mousearea;visible:false;}
+ }]
+
/**LUNAR YEAR**/
Rectangle {
id:lunaryear_rec
onMovementEnded: {
//console.log(lunaryear_pathview.currentIndex)
- AmLich.getYearInfo(lunaryear_pathview.currentIndex+1900);
+ Script.getYearInfo(lunaryear_pathview.currentIndex+1900);
lunarmonth_model.change(lunaryear_pathview.currentIndex+1900, lunarmonth_pathview.currentIndex+1);
}
}
id:lunaryear_mousearea
anchors.fill: parent
onClicked: {
- amdatetime.state="switch_to_year"
+ rec22.state="switch_to_year"
}
}
}
ListModel {
id:lunaryear_model
Component.onCompleted: {
- init()
+ //init()
}
function init(){
for(var i=1900;i<2099;i++){
- var lunarYear = AmLich.getYearCanChi(i)
+ var lunarYear = Script.getYearCanChi(i)
append({name:i+" ("+lunarYear+")"})
}
}
function change(YYYY){
+ lunaryear_pathview.currentIndex=-1;
lunaryear_pathview.currentIndex = YYYY - 1900
}
}
id:lunarday_mousearea
anchors.fill: parent
onClicked: {
- amdatetime.state="switch_to_day"
+ rec22.state="switch_to_day"
}
}
ListModel {
id:lunarday_model
Component.onCompleted: {
+
+ }
+
+ function init(){
for(var i=1;i<=30;i++)
- append({name:i})
+ lunarday_model.append({name:i})
}
function change(MM,DD){
}
- var daystotal = AmLich.RMM[MM-1];
+ var daystotal = Script.RMM[MM-1];
if(lunarmonth_model.get(MM-1).nhuan){
- for (var i=1;i<=AmLich.LML;i++)
+ for (var i=1;i<=Script.LML;i++)
lunarday_model.append({name:i})
}else{
lunarday_model.append({name:i})
}*/
- lunarday_rec.index = DD-1;
+ lunarday_pathview.currentIndex=-1;
lunarday_pathview.currentIndex= DD-1;
}
id:lunarmonth_mousearea
anchors.fill: parent
onClicked: {
- amdatetime.state="switch_to_month"
+ rec22.state="switch_to_month"
}
}
function readd(YYYY, MM){
var yTest = YYYY;
var preFix = "Tháng ";
- var a=AmLich.leapMonth(yTest)
+ var a=Script.leapMonth(yTest)
var t=0;
if(a){ // nam nhuan
for(var i=0;i<=12;i++){
- var l=AmLich.getYearInfo(yTest)[i].month
+ var l=Script.getYearInfo(yTest)[i].month
if (t==l)
lunarmonth_model.append({name:preFix+l+" (N)", nhuan:true})
else
lunarmonth_model.append({name:preFix+i, nhuan:false})
}
- lunarmonth_rec.index = MM -1;
+ //lunarmonth_rec.index = MM -1;
+ lunarmonth_pathview.currentIndex=-1;
lunarmonth_pathview.currentIndex = MM-1;
}
}
Component.onCompleted: {
-
+ reset();
}
states: [
State {
- name: "switch_to_day";
- PropertyChanges { target:lmk;x:10;width:60;}
- PropertyChanges { target:lunaryear_pathview;pathItemCount:1;}
- PropertyChanges { target:lunarmonth_pathview;pathItemCount:1;}
- PropertyChanges { target:lunarday_pathview;pathItemCount:3;}
- PropertyChanges { target:lunarday_mousearea;visible:false;}
- PropertyChanges { target:lunaryear_mousearea;visible:true;}
- PropertyChanges { target:lunarmonth_mousearea;visible:true;}
- },
- State {
- name: "switch_to_year";
- PropertyChanges { target:lmk;x:207;width:198;}
- PropertyChanges { target:lunarday_pathview;pathItemCount:1;}
- PropertyChanges { target:lunarmonth_pathview;pathItemCount:1;}
- PropertyChanges { target:lunaryear_pathview;pathItemCount:3;}
- PropertyChanges { target:lunarday_mousearea;visible:true;}
- PropertyChanges { target:lunaryear_mousearea;visible:false;}
- PropertyChanges { target:lunarmonth_mousearea;visible:true;}
+ name: "show"
+ AnchorChanges { target: amdatetime; anchors.right: parent.right }
},
State {
- name: "switch_to_month";
- PropertyChanges { target:lmk;x:60;width:150;}
- PropertyChanges { target:lunarday_pathview;pathItemCount:1;}
- PropertyChanges { target:lunaryear_pathview;pathItemCount:1;}
- PropertyChanges { target:lunarmonth_pathview;pathItemCount:3;}
- PropertyChanges { target:lunarday_mousearea;visible:true;}
- PropertyChanges { target:lunaryear_mousearea;visible:true;}
- PropertyChanges { target:lunarmonth_mousearea;visible:false;}
+ name: "close"
+ AnchorChanges { target: amdatetime; anchors.right: parent.left }
}
]
- transitions: [
- Transition { NumberAnimation { properties: "x,y,opacity"; duration: 100; easing.type: Easing.InOutBack } }
- ]
-
function reset(){
- var acs = AmLich.getYearInfo(screen.curYear)
- var a=AmLich.getLunarDate(screen.curDay,screen.curMonth,screen.curYear)
+ var acs = Script.getYearInfo(Script.curYear)
+ var a=Script.getLunarDate(Script.curDay,Script.curMonth,Script.curYear)
var finalmonth=a.month;
if (a.leap)
finalmonth+=1;
else{
- var aaa=AmLich.leapMonth(screen.curYear)
+ var aaa=Script.leapMonth(Script.curYear)
var t=-1;
if (aaa){
for (var i=0;i<=12;i++){
var l=acs[i].month
- if (t==l && a.leap==0){
+ if (t==l && a.leap===0){
if (a.month>i){
finalmonth = finalmonth+1;
break;
}
}
+ lunaryear_model.init()
+ lunarday_model.init()
lunaryear_model.change(a.year)
lunarmonth_model.change(a.year, finalmonth)
lunarday_model.change(finalmonth,a.day)
}
+
+ transitions: Transition {
+ AnchorAnimation { easing.type: Easing.OutQuart; duration: 300 }
+ }
}