qml/LichViet/About.qml \
qml/LichViet/amlich-aa98.js \
qml/LichViet/AmDateTimeDialog.qml \
- qml/LichViet/xemngaytotxau.js
+ qml/LichViet/xemngaytotxau.js \
+ qml/LichViet/CacNgayLeTrongNam.js \
+ qml/LichViet/ChangeTheme.qml
#############################################################################
# Makefile for building: LichViet
-# Generated by qmake (2.01a) (Qt 4.7.3) on: Thu Aug 25 00:22:47 2011
+# Generated by qmake (2.01a) (Qt 4.7.3) on: Fri Aug 26 14:38:18 2011
# Project: LichViet.pro
# Template: app
# Command: /opt/QtSDK/Desktop/Qt/473/gcc/bin/qmake -spec /opt/QtSDK/Desktop/Qt/473/gcc/mkspecs/linux-g++-64 -o Makefile LichViet.pro
qml/LichViet/NoFeatureDialog.qml \
qml/LichViet/FullMonth.qml \
qml/LichViet/ToolBarSingle.qml \
+ qml/LichViet/CacNgayLeTrongNam.js \
qml/LichViet/Switch.qml \
qml/LichViet/amlich-aa98.js \
qml/LichViet/XemNgayTotXauHoangDao.qml \
qml/LichViet/Button.qml \
qml/LichViet/xemngaytotxau.js \
qml/LichViet/TitleBar.qml \
+ qml/LichViet/ChangeTheme.qml \
qml/DatePicker/component/Reel.qml \
qml/DatePicker/component/Button.qml \
qml/DatePicker/component/DateReel.qml
<file>qml/LichViet/ToolBarSingle.qml</file>
<file>qml/LichViet/XemNgayTotXauHoangDao.qml</file>
<file>qml/LichViet/DateTimeDialog.qml</file>
- <file>qml/LichViet/AmDateTimeDialog.qml</file>s
+ <file>qml/LichViet/AmDateTimeDialog.qml</file>s
<file>qml/LichViet/NoFeatureDialog.qml</file>
-
+ <file>qml/LichViet/ChangeTheme.qml</file>
<file>qml/DatePicker/component/Button.qml</file>
<file>qml/DatePicker/component/DateReel.qml</file>
<file>qml/DatePicker/component/Reel.qml</file>
<file>LichViet.png</file>
<file>qml/LichViet/amlich-hnd.js</file>
- <file>qml/LichViet/amlich-aa98.js</file>
+ <file>qml/LichViet/amlich-aa98.js</file>
<file>qml/LichViet/Settings.js</file>
<file>qml/LichViet/Themes.js</file>
- <file>qml/LichViet/xemngaytotxau.js</file>
+ <file>qml/LichViet/xemngaytotxau.js</file>
+ <file>qml/LichViet/CacNgayLeTrongNam.js</file>
</qresource>
</RCC>
Item{
id: amdatetime
state: "switch_me"
- BorderImage { anchors.centerIn: parent;source: "./img/titlebar.sci"; width: 344+2; height: 234+14; y: +7 }
+
Rectangle {
id: rectangle1
x: 0
--- /dev/null
+/*
+Copyright (C) 2011 by Cuong Le <metacuong@gmail.com>
+
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>
+*/
+
+.pragma library
+
+/*
+ @spec : [day,month,detail]
+ */
+var DuongLich = new Array(
+ [1,1,"Tết Dương lịch"],
+ [3,2,"Thành lập ĐCS Việt Nam"],
+ [14,2,"Lễ tình nhân (Valentin day)"],
+ [27,2,"Ngày thầy thuốc Việt Nam"],
+ [8,3,"Quốc tế phụ nữ"],
+ [17,3,"Thánh Phatrick"],
+ [1,4," Cá tháng tư"],
+ [30,4,"Giải phóng miền Nam"],
+ [1,5,"Quốc tế lao động"],
+ [19,5,"Sinh nhật Bác Hồ"],
+ [1,6,"Quốc tế thiếu nhi"],
+ [5,6,"Ngày môi trường Thế giới"],
+ [28,6," Gia đình Việt Nam"],
+ [27,7,"Thương binh liệt sĩ"],
+ [1,9,"Ngày lao động"],
+ [2,9,"Quốc Khánh<br><span style='font-size:18px;'>Nước CHXH CN Việt Nam</span>"],
+ [10,10,"Giải phóng thủ đô (Hà Nội)"],
+ [13,10," Ngày doanh nhân Việt Nam"],
+ [20,10,"Phụ nữ Việt Nam"],
+ [30,10,"Halloween"],
+ [11/11,"Cựu chiến binh"],
+ [20,11,"Nhà giáo Việt Nam"],
+ [22,11,"Thành lập quân đội nhân dân VN"],
+ [25,12,"Giáng sinh (Chirstmas day)"]
+ );
+
+var AmLich = new Array(
+ [1,1,"Tết Nguyên Đán"],
+ [15,1,"Lễ Thượng Nguyên"],
+ [3,3,"Tết Hàn thực"],
+ [10,3,"Giỗ tổ Hùng Vương"],
+ [14,4,"Tết dân tộc Khmer (Nam bộ)"],
+ [15,4,"Lễ Phật Đản"],
+ [5,5,"Tết Đoan Ngọ"],
+ [15,7,"Lễ Vu Lan"],
+ [1,8,"Tết Katê (dân tộc Chăm)"],
+ [15,8,"Tết Trung Thu"],
+ [10,10,"Tết Thường Tân"],
+ [15,11,"Tết Hạ Nguyên"],
+ [23,12,"Lễ Táo Quân lên trời"],
+ [30,12,"Giao thừa"]
+ );
+
+var Loi_Hay_Y_Dep = new Array(
+ "Ái tình giống như rượu mùi,<br>càng ít tỏa hương lại càng nồng.<br><i>(Charles Duclos)</i>",
+ "Không phải lập được những kỳ công<br>thì cuộc đời mới tốt đẹp.<br><i>(Herry Bordeaux)<i>",
+ "Hãy yêu thương khi còn trẻ,<br>hãy lo cứu tế lúc về già.<br><i>(Stendhal)</i>",
+ "Mọi người đều nói đến quyền lợi,<br>không mấy ai nói đến bổn phận.<br><i>(Alfred Mortier)</i>",
+ "Con người là nô lệ vì chưa hủy diệt<br>được ý tưởng về bản ngã trong nội tâm.<br><i>(Kinh Phật)</i>",
+ "Dù đá có biến thành vàng<br>thì lòng con người vẫn không thỏa mãn.<br><i>(Ngạn ngữ Trung Hoa)</i>",
+ "Cuộc sống đơn điệu không có sự cố gắng<br>là cuộc sống vô vị.<br><i>(Amiel)</i>",
+ "Bạc kém giá trị hơn vàng,<br>vàng lại kém giá trị hơn đạo đức.<br><i>(Horace)</i>",
+ "Bí quyết để sống hạnh phúc<br>là biết chờ đợi hạnh phúc của mình.<br><i>(Rivière)</i>",
+ "Đọc sách không bằng suy gẫm.<br>Học trường học không bằng học trường đời.<br><i>(Kant)</i>",
+ "Người khôn ngoan<br>là kẻ là cái gì cũng thấy mới lạ.<br><i>(André Gide)</i>",
+ "Hãy kiêu hãnh trong khiêm tốn,<br>kiêu hãnh như vậy mới là không kiêu.<br><i>(Burton)</i>",
+ "Bạn không cần hòan hảo nhưng bạn phải biết<br>rút kinh nghiệm từ những sai lầm của mình.<br><i>(Mc Cormack)</i>",
+ "Nhan sắc chỉ làm vui thỏa đôi mắt,<br>còn nét dịu dàng lại ấm áp cõi lòng.<br><i>(Voltaire)</i>",
+ "Chớ bảo điều thiện này nhỏ mà không làm,<br>chớ bảo điều ác kia nhỏ mà cứ làm.<br><i>(Lưu Bị)</i>",
+ "Đời không tình yêu như trời không có nắng.<br><i>(Ngạn ngữ Pháp)</i>",
+ "Lạc thú ái tình trong chốc lát,<br>muộn phiền lôi kéo mãi trọn đời.<br><i>(Florian)</i>",
+ "Nhân từ, ngọt ngào<br>là dấu hiệu của tính cao thượng.<br><i>(Pythagor)</i>",
+ "Hãy giữ người bạn chân thành<br>với cả hai tay của bạn.<br><i>(Khuyết Danh)</i>",
+ "Đời dù sướng hay khổ cũng vẫn đẹp,<br>hãy chờ đón nó.<br><i>(Fernand Gregh)</i>",
+ "Hãy yêu mến lời khuyên can,<br>đừng yêu mếm lời tâng nịnh.<br><i>(Ngạn ngữ Nga)</i>"
+ );
+
+function get(obj) {
+ var day_info = "";
+
+ for (var i=0;i<AmLich.length;i++)
+ if (AmLich[i][0] == obj.lunarDay && AmLich[i][1] == obj.lunarMonth){
+ day_info+=AmLich[i][2];
+ break;
+ }
+
+ for(i=0;i<DuongLich.length;i++)
+ if (DuongLich[i][0] == obj.curDay && DuongLich[i][1] == obj.curMonth){
+ if (!day_info)
+ day_info=DuongLich[i][2];
+ else
+ day_info+="<br><span style='font-size:18px;'>("+DuongLich[i][2]+")</span>";
+ break;
+ }
+
+
+ if (!day_info){
+ var rannum=Math.floor(Math.random()*Loi_Hay_Y_Dep.length)
+ day_info = Loi_Hay_Y_Dep[rannum];
+ }
+ return day_info;
+}
+
+function is_holiday(day, month, lunar_day, lunar_month){
+ for(var i=0;i<DuongLich.length;i++)
+ if (DuongLich[i][0] == day && DuongLich[i][1] ==month)
+ return true;
+
+
+ for (i=0;i<AmLich.length;i++)
+ if (AmLich[i][0] == lunar_day && AmLich[i][1] == lunar_month)
+ return true;
+
+ return false;
+}
--- /dev/null
+/*
+Copyright (C) 2011 by Cuong Le <metacuong@gmail.com>
+
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>
+*/
+
+import QtQuick 1.0
+import "Themes.js" as Themes
+
+Item{
+
+ Rectangle {
+ id: rectangle1
+ anchors.fill: parent; anchors.bottomMargin: 0
+ visible: true
+ opacity:0.9
+ color:"black"
+ }
+
+ ToolBar { id: toolBar; height: 50;
+ y: screen.height-78
+ width: parent.width;
+ button1Label: "Đồng Ý"
+ button2Label: "Hủy Bỏ"
+ onButton1Clicked:
+ {
+ screen.state="mainscreen"
+ }
+ onButton2Clicked: {
+ screen.state="mainscreen"
+ }
+ }
+
+ transitions: [
+ Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutBack } }
+ ]
+}
Item{
id: item1
- BorderImage { anchors.centerIn: parent;source: "./img/titlebar.sci"; width: 344+2; height: 234+14; y: +7 }
+
Rectangle {
id: rectangle1
x: 0
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
Item{
id: item1
Text { color: {
if (header)
return "#000000";
- else
- return "#007070"
+ else{
+ var stemp = AmLich98.convertSolar2Lunar(txtDATEpv.currentIndex+1,curMonth,curYear,7);
+ if (CNLTN.is_holiday(day, month, stemp[0], stemp[1]))
+ return theme_manager.theme.markdate.holidays;
+ else
+ return "#007070"
+ }
}
text: name; anchors.horizontalCenter: parent.horizontalCenter
id: grid
x: -335
y: 41
- width: {
- 800
- }
-
- height: {
- 480
- }
-
+ width:800
+ height: 480
anchors.horizontalCenterOffset: 15
anchors.bottomMargin: -52
anchors.topMargin: 42
var prevmonth = get_prevmonth(startfrom)
var dayclick, monthclick, yearclick;
- console.log(lmodel.count)
while(lmodel.count>7){
lmodel.remove(lmodel.count-1);
}
+ var datas1,datas,lunarclmonth,inmonths;
+
for (var i=7;i<49;i++){
var realnumber = i - 7;
if (realnumber >= startfrom && j<= daysofthemonthyear){
var lunarcl = AmLich.getLunarDate(j,screen.curMonth,screen.curYear)
if (lunarcl.day==1){
- var lunarclmonth = "/"+lunarcl.month
+ lunarclmonth = "/"+lunarcl.month
}else{
- var lunarclmonth = ""
+ lunarclmonth = ""
}
- var datas = j+"<br><span style='font-size:18px;float:right;color:#700070;'> "+lunarcl.day+lunarclmonth+"</span>";
+ datas = j+"<br><span style='font-size:18px;float:right;color:#700070;'> "+lunarcl.day+lunarclmonth+"</span>";
dayclick = j;
monthclick = screen.curMonth;
yearclick = screen.curYear;
- var inmonths = true;
+ inmonths = true;
j++;
}else{
if (realnumber<startfrom){
- var datas1= prevmonth[realnumber];
+ datas1= prevmonth[realnumber];
}else
{
- var datas1=nextmonth[(totalslot-realnumber)-1];
+ datas1=nextmonth[(totalslot-realnumber)-1];
}
dayclick = datas1.duong;
monthclick = datas1.month;
yearclick = datas1.year;
- var datas = "<span style='color:grey;font-weight:normal;'>"+datas1.duong+"</span><br><span style='font-size:18px;float:right;color:#CCFFFF;'> "+datas1.am+"</span>";
- var inmonths=false;
+ datas = "<span style='color:grey;font-weight:normal;'>"+datas1.duong+"</span><br><span style='font-size:18px;float:right;color:#CCFFFF;'> "+datas1.am+"</span>";
+ inmonths=false;
}
lmodel.append({header:false,name:datas,inmonth:inmonths,day:dayclick,month:monthclick,year:yearclick})
ListElement {
idm:5; name: "Xem Theo Tháng";
}
+ /*ListElement {
+ idm:7; name: "Đổi Theme";
+ }*/
ListElement {
idm:6; name: "Giới Thiệu";
}
case 4: screen.state="xemngaytotxauhoangdao";break;
case 5: screen.state="xemtheothang";break;
case 6: screen.state="aboutdialog";break;
+ case 7: screen.state="changetheme";break;
default:
- screen.state="nofeaturedialog"
+ screen.state="nofeaturedialog";break;
}
}
Item{
id: item1
- BorderImage { anchors.centerIn: parent;source: "./img/titlebar.sci"; width: 344+2; height: 234+14; y: +7 }
+
Rectangle {
id: rectangle1
x: 0
id: listDelegate
Rectangle {
height:60
+
+ Rectangle {
+ width:rectangle1.width;
+ y:0;
+ x:0
+ height:1
+ border.color: "#b57e8f"
+ }
+
Text {
id: text1
text:name
onSwitched:{
listModel.setProperty(index, "selected", switchedOn);
}
- switchedOn: {
- selected
- }
-
+ switchedOn: selected
anchors.verticalCenter: parent.verticalCenter
}
+
}
+
}
ListModel {
+/**
+ * Copyright 2004 Ho Ngoc Duc [http://come.to/duc]. All Rights Reserved.<p>
+ * Permission to use, copy, modify, and redistribute this software and its
+ * documentation for personal, non-commercial use is hereby granted provided that
+ * this copyright notice appears in all copies.
+ */
+
var PI = Math.PI;
/* Discard the fractional part of a number, e.g., INT(3.2) = 3 */
-\r
+/**\r
+ * Copyright 2004 Ho Ngoc Duc [http://come.to/duc]. All Rights Reserved.<p>\r
+ * Permission to use, copy, modify, and redistribute this software and its\r
+ * documentation for personal, non-commercial use is hereby granted provided that\r
+ * this copyright notice appears in all copies.\r
+ */\r
\r
var ABOUT = "\u00C2m l\u1ECBch Vi\u1EC7t Nam - Version 0.8"+"\n\u00A9 2004 H\u1ED3 Ng\u1ECDc \u0110\u1EE9c [http://come.to/duc]";\r
var TK19 = new Array(\r
import "Settings.js" as Settings
import "Themes.js" as Themes
+import "CacNgayLeTrongNam.js" as CNLTN
Item {
id: screen
- width: 800
- height: 480
+ width: 480
+ height: 800
property int curDay: LC.curDay()
property int curMonth: LC.curMonth()
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:"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
}
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 {
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;
+ }
}
}
}
Text {
id: txtTHU
x: 151
- y: 240
+ y: 210
width: 80
height: 20
color: "#f0f0f5"
}
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
- y: 300
+ y: 330
width: 80
height: 20
color: "#f0f0f5"
anchors.horizontalCenter: parent.horizontalCenter
opacity: 0.6
font.bold: true
- font.pixelSize: 28
+ font.pixelSize: 25
}
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"
},
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 }
property alias titlebar: titlebar
property alias datepicker: datepicker
property alias toolbar: toolbar
+ property alias markdate: markdate
property string root_dir : "file:/opt/usr/share/LichViet/themes/default/"
property string background_image: root_dir+"background.jpg"
property string button_pressed: root_dir+"dp_button_pressed.png"
property string button_active: root_dir+"dp_button_active.png"
}
+
+ Item{
+ id:markdate
+ property string sunday:"red"
+ property string saturday:"blue"
+ property string otherday:"grey"
+ property string otherday_selected:"#FFFFFF"
+ property string holidays:"yellow"
+ property string not_holidays:"#FFFF99"
+ }
}