* Theme now is simple and very fast
[lichviet] / qml / LichViet / main.qml
index d9f2d59..ae8e241 100644 (file)
@@ -23,8 +23,8 @@ import "main.js" as Script
 
 Item {
      id: screen
 
 Item {
      id: screen
-     width: 800
-     height: 480
+     width: 480
+     height: 800
 
      state:"mainscreen"
 
 
      state:"mainscreen"
 
@@ -43,7 +43,9 @@ Item {
         Settings.restore_nomodel();
         Script.createDateTimeDialog(screen);
         Script.datetimedlg.toolbar.connect(show_toolbar);
         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.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.fullmonth.toolbar.connect(show_toolbar);
         Script.fullmonth.updatedate.connect(update_date);
         maindatemodel.init();
@@ -61,6 +63,10 @@ Item {
          Script.curMonth = month;
          Script.curYear = year;
          Script.changeDay(day, txtTHU, txtInfo, txtDAYAmLich);
          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 {
      }
 
      Rectangle {
@@ -70,10 +76,10 @@ Item {
 
          state:"jumptodate"
 
 
          state:"jumptodate"
 
-         /*Image {
+         Image {
              source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent
              opacity: theme_manager.theme.background_opacity
              source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent
              opacity: theme_manager.theme.background_opacity
-         }*/
+         }
 
 
          MouseArea {
 
 
          MouseArea {
@@ -95,8 +101,8 @@ Item {
              onDoubleClicked:{
 
                  if (Settings.doubleclicked()==1){
              onDoubleClicked:{
 
                  if (Settings.doubleclicked()==1){
-                     screen.state="datetimedialog";
-
+                     screen.state="switchX";
+                    Script.datetimedlg.state="show";
                  }
              }
          }
                  }
              }
          }
@@ -122,7 +128,24 @@ Item {
                                   text: name
                                   font.bold: true
                                   font.pixelSize: wrapper.PathView.isCurrentItem ? 80 : 40
                                   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;
+                                    }
                               }
                           }
                       }
                               }
                           }
                       }
@@ -162,6 +185,10 @@ Item {
 
                           onMovementEnded: {
                               Script.changeDay(txtDATEpv.currentIndex+1, txtTHU, txtInfo, txtDAYAmLich);
 
                           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();
                           }
                       }
                   }
                           }
                       }
                   }
@@ -297,8 +324,17 @@ Item {
 
      function menu_item_Clicked(id){
          var qmlF = "";
 
      function menu_item_Clicked(id){
          var qmlF = "";
-         screen.state="switchX";
+         if (id!=1)
+            screen.state="switchX";
          switch(id){
          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;
             case 2: Script.amdatetimedlg.state="show";break;
             case 3: Script.datetimedlg.state="show";break;
             case 4: qmlF="XemNgayTotXauHoangDao";break;
@@ -333,13 +369,4 @@ Item {
          Transition { NumberAnimation { properties: "x,y,opacity"; duration: 300; easing.type: Easing.InOutBack } }
      ]
 
          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;*/
-     }
-
 }
 }