Skip to content

liangqi/kcalendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Please use UTF-8 to read this file.

There is no code for Chinese calendar, which is mostly used by people
in or from East Asia, China, Korean, Japan and so on.

I just based on the code of ccal and create KCalendarSystemChinese.
And I read some docs on line:
http://thunder.cwru.edu/ccal/index.html (dead)
http://thunder.cwru.edu/ccal/rule.htm (in Chinese)(dead)
http://ccal.chinesebay.com/ccal/
http://ccal.chinesebay.com/ccal/index.html.cn (in Chinese)
http://www.math.nus.edu.sg/aslaksen/calendar/chinese.html
http://en.wikipedia.org/wiki/Chinese_calendar

My code is in:
https://github.com/liangqi/kcalendar

cp kde4/kcalendarsystemchinese.h kde/src/KDE/kdelibs/kdecore/date
cp kde4/kcalendarsystemchinese.cpp kde/src/KDE/kdelibs/kdecore/date
cp kde4/kcalendarsystem.cpp kde/src/KDE/kdelibs/kdecore/date

cp kde4/CMakeList.txt kde/src/KDE/kdelibs/kdecore

And then build your kdelibs.

You can try two examples in example/test, example/guitest.

Some known issue or problem which you can help me:
1. for virtual bool setDate( QDate &date, int year, int month, int day
), what's it for? what's the difference between it with setYMD? Is it
my understanding(in my current code) right or not?

2. for epoch(), what's it?

3. in my example/test, if I call weekStartDay(), it will crash, do you
have any hints?

4. Just because ccal has its own calculation function, a little slow,
especially when using it with KDatePicker, then I choose to like ccal,
embed a data table for 1950-2050 in it, now speed is ok. Maybe some
one can optimize the code of ccal, or just for my case.

Valid date:
1645-1-28 -> 7303-2-5
4342-1-1  -> 9999-12-30(Chinese Calendar)

About the year difference between Gregorian and Chinese, I use 2697. 
http://en.wikipedia.org/wiki/Chinese_calendar#Continuously-numbered_years

snapshots:
http://kcalendar.googlecode.com/svn/trunk/snapshot/chinese-calendar-kde4-1.png
http://kcalendar.googlecode.com/svn/trunk/snapshot/chinese-calendar-kde4-2.png

talks:
http://lists.kde.org/?t=119817976300004

license issue:
ccal - got mail, the author released part of ccal as LGPL too, from 2.4
============================================
From: Zhuo Meng <zhuo@thunder.EEAP.CWRU.Edu>
To: Liang Qi <cavendish.qi@gmail.com>
Date: Mon, 7 Jan 2008 11:23:33 -0500
Subject: Re: hi, something about Chinese Calendar

Hi, Liang,

I rereleased 2.4 and replaced the license.

Best,
-Zhuo

On Fri, Jan 04, 2008 at 12:11:52PM +0100, Liang Qi wrote:
> Hi, Zhuo,
>
> I am ok about the files list. If you relicense all your code under
> LGPL, I think that maybe someone else will be very happy.
>
> And could you put your LGPL ccal package on your website or somewhere else?
>
> Thanks a lot.
>
> Regards,
> Liang
>
> On 04/01/2008, Zhuo Meng <zhuo@thunder.eeap.cwru.edu> wrote:
> > Hi Liang,
> >
> > Glad to know that you settled the license issue for the lunar outreach
> > code. I have no problem of relicense the part of the ccal that you use
> > under LGPL. I suppose the files included will be all from NOVAS and
> > Lunar Outreach and mphases.*, solarterm.*, lunaryear.* and yearcache.*.
> >
> > If you need additional files to be under LGPL, just let me know.
> >
> > Best,
> > -Zhuo
============================================
README in ccal 2.5.2:

Portions related to
computing of Chinese dates are distributed under the terms of the GNU
Less General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option)
any later version.
============================================

NOVAS - got mail, the author said it's ok
============================================
From: George Kaplan [Contractor] <gkaplan@usno.navy.mil>
To: Liang Qi <cavendish.qi@gmail.com>
Date: 8 Nov 2007 19:36
Subject: Re: about the license of NOVAS

Dear Mr. Liang,

The NOVAS software, both Fortran and C, is in the public domain.  That is,
there is no license and you can use it freely.  We do ask that you
acknowledge the U.S. Naval Observatory in any documentation,  papers, or
other writing about any software that uses NOVAS.

     George
============================================

============================================

Lunar Outreach Services - the author had relicensed his code
============================================
From: co149@mac.com
Date: 18 Feb 2014 16:03
To: Liang Qi <cavendish.qi@gmail.com>
Subject: Re: can't access the code of Lunar Outreach Services

Hi Liang--

I added the LGPL text to the sources, so you should be good to go.

Best,
Chris
============================================
http://www.packetgnomes.org/~chris/lunar/cgi-src/phases/ (old, dead)
http://www.muppetlabs.com/~chris/lunar/cgi-src/phases/
Backup: https://github.com/liangqi/phases/

代码主页:
https://github.com/liangqi/kcalendar

KDE 4.0已经非常临近了,但非常遗憾的是KDE系统中一直没有面向中国以及东亚用户使用的农历。

最近基于ccal的代码,做了一些封装,目前基本可用,但是效率还有待提高。

欢迎大家测试并且提出修改意见。

代码使用方法:
有关如何构建KDE 4开发环境和KDE 4应用开发,请参考:
http://techbase.kde.org/Getting_Started/Build/KDE4
http://techbase.kde.org/Development/Tutorials#Introduction_To_KDE_4_Programming

只需要kdelibs以及之前的步骤,完成后。
将kde4/kcalendarsystemchinese.h, kde4/kcalendarsystemchinese.cpp, kde4/kcalendarsystem.cpp复制到kde/src/KDE/kdelibs/kdecore/date下。

将kde4/CMakeList.txt复制到kde/src/KDE/kdelibs/kdecore下。

切换到kde/src/KDE/kdelibs下,cmakekde即可编译新的库。

有关测试用例:
example/test用来测试各API接口。
example/guitest使用KDatePicker测试,比较慢的说,请大家稍等待一下。

编译方法:
cd example/test
cmake .
make

cd example/guitest
cmake .
make

主要问题,addMonths正在改进中

加1000个月的时候
2007-12-19版本中测试信息
kde-devel@liangqi-suse103:~/tmp/test> time ./test
Chinese for 2007-12-19:  4704 - 11 - 10
addMonths: 2007-12-19, 1000:  "Sat Oct 23 2088" :  4785 - 10 - 10

real    0m23.462s
user    0m23.193s
sys     0m0.096s

2007-12-20版本中测试信息
kde-devel@liangqi-suse103:~/tmp/test> time ./test
Chinese for 2007-12-19:  4704 - 11 - 10
addMonths: 2007-12-19, 1000:  "Sat Oct 23 2088" :  4785 - 10 - 10

real    0m7.976s
user    0m7.792s
sys     0m0.084s

有效日期:
1645-1-28 -> 7303-2-5
4342-1-1  -> 9999-12-30(Chinese Calendar)

有关西历和农历的年份计算,我使用的是2697,请参考:
http://en.wikipedia.org/wiki/Chinese_calendar#Continuously-numbered_years

截屏:
http://kcalendar.googlecode.com/svn/trunk/snapshot/chinese-calendar-kde4-1.png
http://kcalendar.googlecode.com/svn/trunk/snapshot/chinese-calendar-kde4-2.png

讨论方法:
kde-core-devel邮件列表
http://lists.kde.org/?t=119817976300004
http://lists.kde.org/?t=128937569200001

kde-china邮件列表
http://mail.kde.org/mailman/listinfo/kde-china

kde-cn irc
irc://irc.freenode.net/#kde-cn

版权问题:
ccal - 已经收到邮件,作者以LGPL发布了ccal,从2.4版开始。邮件内容见上面英文部分。

NOVAS - 已经收到邮件,作者说没有问题。邮件内容见上面英文部分。

Lunar Outreach Services - 作者已经按LGPL重新发布代码了
http://www.packetgnomes.org/~chris/lunar/cgi-src/phases/ (old, dead)
http://www.muppetlabs.com/~chris/lunar/cgi-src/phases/
备份: https://github.com/liangqi/phases/

2007-12-20
最新备注,已经加入1950-2050的缓存,guitest速度已经非常理想了。欢迎大家测试。

2011-04-27
更新了一些链接和协议内容。

Liang Qi 齐亮
cavendish.qi@gmail.com