From 0527c61e3bdd3540dbe553e87e24081fe54f6b15 Mon Sep 17 00:00:00 2001 From: Cuong Le Date: Tue, 13 Sep 2011 22:14:26 +0700 Subject: [PATCH] Know bugs fixed. --- LichViet.pro | 20 ++ qml/LichViet/About.qml | 2 +- qml/LichViet/CacNgayLeTrongNam.js | 4 + qml/LichViet/FullMonth.qml | 461 ++++++++++++++++-------------- qml/LichViet/main.qml | 3 +- qml/themes/default/default.qml | 1 + qtc_packaging/debian_fremantle/changelog | 6 +- qtc_packaging/debian_fremantle/control | 2 +- 8 files changed, 278 insertions(+), 221 deletions(-) diff --git a/LichViet.pro b/LichViet.pro index 4fc68cc..bf3543a 100644 --- a/LichViet.pro +++ b/LichViet.pro @@ -76,3 +76,23 @@ OTHER_FILES += \ qml/LichViet/MenuButton.qml \ qml/LichViet/ScrollBar.qml \ qml/LichViet/FileBrowser.qml + +unix:!symbian:!maemo5 { + target.path = /opt/LichViet/bin + INSTALLS += target +} + +unix:!symbian:!maemo5 { + target.path = /opt/LichViet/bin + INSTALLS += target +} + +unix:!symbian:!maemo5 { + target.path = /opt/LichViet/bin + INSTALLS += target +} + +maemo5 { + target.path = /opt/LichViet/bin + INSTALLS += target +} diff --git a/qml/LichViet/About.qml b/qml/LichViet/About.qml index af36f5b..c8cdd66 100644 --- a/qml/LichViet/About.qml +++ b/qml/LichViet/About.qml @@ -70,7 +70,7 @@ Item{ y: 234 width: 80 height: 20 - text: "Phiên bản : 1.0.2-3 (25/08/2011)
\ + text: "Phiên bản : 1.0.2-4 (13/09/2011)
\ Phát triển bởi : metacuong@gmail.com" anchors.horizontalCenterOffset: 0 wrapMode: Text.NoWrap diff --git a/qml/LichViet/CacNgayLeTrongNam.js b/qml/LichViet/CacNgayLeTrongNam.js index 0af4c81..fff991a 100644 --- a/qml/LichViet/CacNgayLeTrongNam.js +++ b/qml/LichViet/CacNgayLeTrongNam.js @@ -115,6 +115,10 @@ function get(obj) { } function is_holiday(day, month, lunar_day, lunar_month){ + + if (day === 0 || month === 0) + return false; + for(var i=0;i= 7){ - LC.reset(day,month,year) - screen.calculateLunar(day,month,year) - screen.state="mainscreen" - screen.refresh() - maindatemodel.reset() - txtDATEpv.currentIndex = day-1; - } - } + Item { + width: cellWidth + height: cellHeight -onPressed:{ - if (index >= 7) - parent.color="#F0F0F0" -} + Rectangle { + width: parent.width - 4 + height: parent.height - 4 -onReleased:{ - if (index >= 7){ - if (inmonth){ - if (day==initcurDay && month==initcurMonth && year==initcurYear) - parent.color="#00EBEB"; - else - parent.color="lightsteelblue"; - }else - parent.color="#AAAAAA"; - } -} + anchors.centerIn: parent + + radius: 4 + color: "#FAFAFF" + } -onCanceled:{ - if (index >= 7){ - if (inmonth) - {if (day==initcurDay && month==initcurMonth && year==initcurYear) parent.color="#00EBEB"; else parent.color="lightsteelblue";} - else - parent.color="#AAAAAA"; + Text { + width: cellWidth + height: cellHeight + + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + + text: model.modelData + font.bold: true + font.pointSize: width ? width / 6 : 1 + } + } } -} - } - } - } + property Component daysRenderer: + Component { + Item { + width: cellWidth + height: cellHeight + + Rectangle { + id:recms + width: parent.width - 4 + height: parent.height - 4 + + anchors.centerIn: parent + + radius: 4 + color: model ? model.inmonth ? (model.current ? "blue" : "lightsteelblue") : "#AAAAAA" : "black" } - GridView { - id: grid - x: -335 - y: 41 - - anchors.horizontalCenterOffset: 15 - anchors.bottomMargin: -52 - anchors.topMargin: 42 - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - anchors.top: parent.top - cellWidth: 110; cellHeight: 50 - - boundsBehavior:Flickable.DragAndOvershootBounds - flickableDirection:Flickable.VerticalFlick - - model:lmodel - delegate: contactDelegate - focus: true - - onMovementStarted:{ - /* var newMonth = screen.curMonth+1; - LC.reset(screen.curDay,newMonth,screen.curYear) - screen.calculateLunar(screen.curDay,newMonth,screen.curYear) - screen.refresh() - reset()*/ - } + Text { + id:txt_solar_day + anchors.fill: parent + anchors.leftMargin: 10 + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignLeft + + text: model ? model.day : "" + color: model ? model.inmonth ? (model.current ? "red" : model.inholiday ? theme_manager.theme.markdate.holidays : "black") : "grey" : "red" + font.pointSize: parent.width ? parent.width / 6 : 1 + font.bold: true } - ListModel { - id:lmodel + Text { + anchors.fill: parent + anchors.leftMargin: txt_solar_day.anchors.leftMargin+40 + anchors.topMargin: 20 - Component.onCompleted: { - reset() - } + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignBottom - function reset(){ - for(var i=0;i<42;i++){ - append({header:false,name:"",inmonths:false,day:0,month:0,year:0}) - } - } + text: model ? model.lunar_day : "" + color: model ? model.inmonth ? (model.current ? "red" : "#700070") : "grey" : "red" + font.pointSize: parent.width ? parent.width / 8 : 1 + } - ListElement { - header:true;inmonth:false;day:0;month:0;year:0 - name: "CN" - } + MouseArea { + anchors.fill: parent - ListElement { - header:true;inmonth:false;day:0;month:0;year:0 - name: "Hai" - } + property real mX + property real mY + property bool hold: false - ListElement { - header:true;inmonth:false;day:0;month:0;year:0 - name: "Ba" + onClicked: { + LC.reset(model.day,m_month,m_year) + screen.calculateLunar(model.day,m_month,m_year) + screen.state="mainscreen" + screen.refresh() + maindatemodel.reset() + txtDATEpv.currentIndex = model.day-1; } - ListElement { - header:true;inmonth:false;day:0;month:0;year:0 - name: "Tư" + + onPositionChanged: { + mX = mouseX; + mY = mouseY; + hold=true; } - ListElement { - header:true;inmonth:false;day:0;month:0;year:0 - name: "Năm" + + onPressed: { + recms.color="#F0F0F0" } - ListElement { - header:true;inmonth:false;day:0;month:0;year:0 - name: "Sáu" + + onReleased: { + if (hold){ + if (mouseY+mY<0){ + if (Math.abs(mouseY) >= 30){ + m_month+=1; + if (m_month >=13){ + m_month=1; + m_year++; + } + } + } + else + { + if (mouseY >= 50){ + m_month-=1; + if(m_month<=0){ + m_month=12; + m_year--; + } + } + } + reset(); + hold=false; + } } - ListElement { - header:true;inmonth:false;day:0;month:0;year:0 - name: "Bảy" + } + } + } + + Rectangle{ + id: fullmonthREC + anchors.fill: parent; anchors.bottomMargin: 0 + opacity:0.9 + + ListModel { + id: monthModel + } + + Grid { + id: grid + + anchors.bottomMargin: -52 + anchors.topMargin: 78 + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.top: parent.top + + columns: 7 + rows: 7 + + Repeater { + model: ["CN", "Hai", "Ba", "Tư", "Năm", "Sáu", "Bảy"] + + delegate: Item { + id: headerDelegate + + width: fullmonthREC.width / grid.columns + height: (fullmonthREC.height-92) / grid.rows + + property int theIndex: index + property variant theModel: model + + Loader { + property alias model: headerDelegate.theModel + property alias index: headerDelegate.theIndex + property alias cellWidth: headerDelegate.width + property alias cellHeight: headerDelegate.height + + anchors.fill: parent + + sourceComponent: headerRenderer + } } } - Component.onCompleted: { + Repeater { + model: monthModel + + delegate: Item { + id: daysDelegate + + property int theIndex: index + property variant theModel: model + + width: fullmonthREC.width / grid.columns + height: (fullmonthREC.height-92) / grid.rows + + Loader { + property alias model: daysDelegate.theModel + property alias index: daysDelegate.theIndex + property alias cellWidth: daysDelegate.width + property alias cellHeight: daysDelegate.height + + anchors.fill: parent + + sourceComponent: daysRenderer + } + + } } + + } + + Text { + id: txt_caption + y: 40 + width:parent.width + text: "Tháng "+m_month+", "+m_year + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 24 + font.bold: true + } + } ToolBarSingle { id: toolBar; height: 50; @@ -210,26 +258,61 @@ onCanceled:{ } } - states: [ - State { - name: "xemtheothang" - PropertyChanges { - target: grid - width : screen.width - height: screen.height - cellWidth: { - if (screen.width>=800) - return 110; - else - return 64; - } + function reset() { + monthModel.clear() + + var firstdayofthemonthyear = AmLich.getLunarDate(1,m_month,m_year).jd; + var startfrom = (firstdayofthemonthyear+1)%7; + var daysofthemonthyear = LC.calDays(m_month,m_year); + var j=1; + var totalslot = 42; + + var nextmonth = get_nextmonth(totalslot - (startfrom+daysofthemonthyear)) + var prevmonth = get_prevmonth(startfrom) + + var dayclick, monthclick, yearclick; + var datas1,datas,lunarclmonth,inmonth; + + for (var i=0;i<42;i++){ + if (i >= startfrom && j<= daysofthemonthyear){ + dayclick = j; + monthclick = m_month; + yearclick = m_year; + inmonth = true; + j++; + }else{ + if (i7){ - 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){ - lunarclmonth = "/"+lunarcl.month - }else{ - lunarclmonth = "" - } - - datas = j+"
  "+lunarcl.day+lunarclmonth+""; - dayclick = j; - monthclick = screen.curMonth; - yearclick = screen.curYear; - inmonths = true; - j++; - }else{ - if (realnumber
  "+datas1.am+""; - inmonths=false; - } - - lmodel.append({header:false,name:datas,inmonth:inmonths,day:dayclick,month:monthclick,year:yearclick}) - } - } } diff --git a/qml/LichViet/main.qml b/qml/LichViet/main.qml index 0670532..bf570b4 100644 --- a/qml/LichViet/main.qml +++ b/qml/LichViet/main.qml @@ -65,7 +65,8 @@ Item { state:"jumptodate" Image { - source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent; opacity: 0.3 + source: theme_manager.theme.background_image; fillMode: Image.Stretch; anchors.fill: parent + opacity: theme_manager.theme.background_opacity } diff --git a/qml/themes/default/default.qml b/qml/themes/default/default.qml index c9e2466..2033f36 100644 --- a/qml/themes/default/default.qml +++ b/qml/themes/default/default.qml @@ -9,6 +9,7 @@ Item { property string root_dir : "file:/opt/usr/share/LichViet/themes/default/" property string background_image: root_dir+"background.jpg" + property real background_opacity: 0.3 property string switch_on: root_dir+"switch_on.png" property string switch_off: root_dir+"switch_off.png" diff --git a/qtc_packaging/debian_fremantle/changelog b/qtc_packaging/debian_fremantle/changelog index 9ccfe2a..d31866f 100755 --- a/qtc_packaging/debian_fremantle/changelog +++ b/qtc_packaging/debian_fremantle/changelog @@ -1,5 +1,5 @@ -lichviet (1.0.2-3) unstable-develop; urgency=low +lichviet (1.0.2-4) unstable-develop; urgency=low - * Fixes for pathview date component (slowly in date switching) + * Fixes for month view - -- Cuong Le Thu, 27 Aug 2011 14:40:37 +0700 + -- Cuong Le Thu, 13 Sep 2011 14:40:37 +0700 diff --git a/qtc_packaging/debian_fremantle/control b/qtc_packaging/debian_fremantle/control index 3b9f7b3..fccfa3a 100755 --- a/qtc_packaging/debian_fremantle/control +++ b/qtc_packaging/debian_fremantle/control @@ -8,7 +8,7 @@ Homepage: http://lichviet.garage.maemo.org Package: lichviet Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, mcsp, qtquickcompat +Depends: ${shlibs:Depends}, ${misc:Depends} Description: VietNamese Lunar Calendar XSBC-Maemo-Display-Name: Lich Viet XSBC-Bugtracker: https://garage.maemo.org/tracker/?group_id=2235 -- 1.7.9.5