Added more information to the lunar calendar
[lichviet] / qml / LichViet / main.qml
index aa948ae..565b3ad 100644 (file)
@@ -21,11 +21,12 @@ import "amlich-aa98.js" as AmLich98
 
 import "Settings.js" as Settings
 import "Themes.js" as Themes
 
 import "Settings.js" as Settings
 import "Themes.js" as Themes
+import "CacNgayLeTrongNam.js" as CNLTN
 
 Item {
      id: screen
 
 Item {
      id: screen
-     width: 800
-     height: 480
+     width: 480
+     height: 800
 
      property int curDay: LC.curDay()
      property int curMonth: LC.curMonth()
 
      property int curDay: LC.curDay()
      property int curMonth: LC.curMonth()
@@ -46,7 +47,8 @@ Item {
      property string lunarDayCanChi : AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[0]
      property string lunarMonthCanChi : AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[1]
 
      property string lunarDayCanChi : AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[0]
      property string lunarMonthCanChi : AmLich.getCanChi(AmLich.getLunarDate(curDay,curMonth,curYear))[1]
 
-     //property string lunarCanHour : AmLich.getCanHour0(LC.curHour())
+     property string day_info : CNLTN.get(screen)
+     property bool is_holiday : CNLTN.is_holiday(screen.curDay,screen.curMonth, screen.curYear, screen.lunarDay, screen.lunarMonth)
 
      state:"mainscreen"
 
 
      state:"mainscreen"
 
@@ -63,7 +65,7 @@ Item {
 
          state:"jumptodate"
          Image {
 
          state:"jumptodate"
          Image {
-             source: theme_manager.theme.background_image; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3
+             source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent; opacity: 0.3
          }
 
 
          }
 
 
@@ -111,13 +113,13 @@ Item {
 
                   Rectangle {
                       id:reelx
 
                   Rectangle {
                       id:reelx
-                              width: 300
-                              height: 100
-                                           y: 126
-                                           anchors.horizontalCenter: parent.horizontalCenter
-                                           property int index: 0
-         onIndexChanged: txtDATEpv.currentIndex = reelx.index
-         color: "transparent"
+                      width: 300
+                      height: 100
+                      y: 116
+                      anchors.horizontalCenter: parent.horizontalCenter
+                      property int index: 0
+                      onIndexChanged: txtDATEpv.currentIndex = reelx.index
+                      color: "transparent"
                       Component {
                           id: delegate
                           Column {
                       Component {
                           id: delegate
                           Column {
@@ -127,7 +129,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: wrapper.PathView.isCurrentItem ? "#FFFFFF" : "grey"
+                                  color: {
+                                      if (wrapper.PathView.isCurrentItem){
+                                          var stemp = AmLich98.convertSolar2Lunar(txtDATEpv.currentIndex+1,curMonth,curYear,7);
+                                          if (CNLTN.is_holiday(txtDATEpv.currentIndex+1,curMonth, stemp[0], stemp[1])){
+                                              return theme_manager.theme.markdate.holidays;
+                                          }else{
+                                          var mark_day = (AmLich.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 theme_manager.theme.markdate.otherday;
+                                    }
                               }
                           }
                       }
                               }
                           }
                       }
@@ -175,7 +194,7 @@ Item {
          Text {
              id: txtTHU
              x: 151
          Text {
              id: txtTHU
              x: 151
-             y: 240
+             y: 210
              width: 80
              height: 20
              color: "#f0f0f5"
              width: 80
              height: 20
              color: "#f0f0f5"
@@ -188,10 +207,25 @@ Item {
          }
 
          Text {
          }
 
          Text {
+             id: txtInfo
+             x: 151
+             y: (screen.is_holiday ? 270 : 250)
+             width: 80
+             height: 20
+             color: (screen.is_holiday ? theme_manager.theme.markdate.holidays : theme_manager.theme.markdate.not_holidays)
+             text: screen.day_info
+             horizontalAlignment: Text.AlignHCenter
+             anchors.horizontalCenter: parent.horizontalCenter
+             opacity: 0.6
+             font.bold: (screen.is_holiday ? true : false)
+             font.pixelSize: (screen.is_holiday ? 25 : 20)
+         }
+
+         Text {
 
              id: txtDAYAmLich
              x: 151
 
              id: txtDAYAmLich
              x: 151
-             y: 300
+             y: 330
              width: 80
              height: 20
              color: "#f0f0f5"
              width: 80
              height: 20
              color: "#f0f0f5"
@@ -200,7 +234,7 @@ Item {
              anchors.horizontalCenter: parent.horizontalCenter
              opacity: 0.6
              font.bold: true
              anchors.horizontalCenter: parent.horizontalCenter
              opacity: 0.6
              font.bold: true
-             font.pixelSize: 28
+             font.pixelSize: 25
          }
 
 
          }
 
 
@@ -220,6 +254,14 @@ Item {
              x: -(screen.width * 1.5)
          }
 
              x: -(screen.width * 1.5)
          }
 
+         ChangeTheme{
+             id: changeTheme
+             state:"changetheme"
+             anchors.verticalCenter: parent.verticalCenter
+             width: parent.width; height: parent.height-60;
+             x: -(screen.width * 1.5)
+         }
+
          XemNgayTotXauHoangDao{
              id: xntxhdScreen
              state:"xemngaytotxauhoangdao"
          XemNgayTotXauHoangDao{
              id: xntxhdScreen
              state:"xemngaytotxauhoangdao"
@@ -304,6 +346,14 @@ Item {
 
          },
          State {
 
          },
          State {
+             name: "changetheme";
+             PropertyChanges { target: changeTheme; x: 0; focus:true}
+             PropertyChanges { target: toolBar; y: screen.height }
+             PropertyChanges { target: toolBar }
+                          PropertyChanges { target: mouseareaMM;enabled:false }
+
+         },
+         State {
              name: "xemngaytotxauhoangdao";
              PropertyChanges { target: xntxhdScreen; x: 0; focus:true}
              PropertyChanges { target: toolBar; y: screen.height }
              name: "xemngaytotxauhoangdao";
              PropertyChanges { target: xntxhdScreen; x: 0; focus:true}
              PropertyChanges { target: toolBar; y: screen.height }