diff options
author | Charles Yin <charles.yin@nokia.com> | 2010-12-02 10:44:12 +1000 |
---|---|---|
committer | Charles Yin <charles.yin@nokia.com> | 2010-12-02 14:04:34 +1000 |
commit | aba14e6ddc01747de6ef43b6d57b4e44068308fb (patch) | |
tree | 248854e3c44220df44678de03c2bdc070c6b70fa | |
parent | 471c35323a07f9aa048c02a8f763b1f0c1d35601 (diff) |
more work on qmlorganizer
1. disable agender view button
2. link month, week, day view together
Change-Id: I923036fabe813206d78b3eface0967081abeb52e
-rw-r--r-- | examples/qmlorganizer/contents/MenuBar.qml | 2 | ||||
-rw-r--r-- | examples/qmlorganizer/contents/MonthView.qml | 88 | ||||
-rw-r--r-- | examples/qmlorganizer/contents/WeekView.qml | 11 | ||||
-rw-r--r-- | examples/qmlorganizer/organizer.qml | 9 |
4 files changed, 93 insertions, 17 deletions
diff --git a/examples/qmlorganizer/contents/MenuBar.qml b/examples/qmlorganizer/contents/MenuBar.qml index 095f2d2bb2..d7d315978d 100644 --- a/examples/qmlorganizer/contents/MenuBar.qml +++ b/examples/qmlorganizer/contents/MenuBar.qml @@ -65,7 +65,7 @@ Rectangle { Button { id: monthButton; text: "Month"; onClicked: topItem.state="MonthView";} Button { id: weekButton; text: "Week";onClicked: topItem.state="WeekView";} Button { id: dayButton; text: "Day";onClicked: topItem.state="DayView";} - Button { id: agenderButton; text: "Agender";onClicked: topItem.state="AgenderView";} + //Button { id: agenderButton; text: "Agender";onClicked: topItem.state="AgenderView";} Button { id: timelineButton; text: "Timeline";onClicked: topItem.state="TimelineView";} } } diff --git a/examples/qmlorganizer/contents/MonthView.qml b/examples/qmlorganizer/contents/MonthView.qml index 177016e337..0cf7d72614 100644 --- a/examples/qmlorganizer/contents/MonthView.qml +++ b/examples/qmlorganizer/contents/MonthView.qml @@ -61,7 +61,41 @@ Rectangle { } anchors.fill: parent + // GridView { + // id:container + // anchors.fill: parent + // cellHeight: container.height/7 + // cellWidth: container.width/7 + // clip: true + // focus: true + // opacity : parent.opacity + // property variant weekDays:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] + // preferredHighlightBegin: cellHeight.height * 0.5 + // preferredHighlightEnd: preferredHighlightBegin + // highlightFollowsCurrentItem : true + // highlightMoveDuration: 200 + // keyNavigationWraps : true + + // highlight:Rectangle { + // width: container.cellWidth + // height: container.cellHeight + // color: "lightsteelblue" + // radius: 5 + // } + + // model: 49 + // delegate:Rectangle { + // width: container.width / 7 + // height: container.height / 7 + // color: index <=7? "lightgray" : Month.getColorOfDay(startDay, index - startWeekday +1) + // border.color: index <=7? "#3f4947" : "black" + // Text { text: index <=7? container.weekDays[index] : Month.getDayOfMonth(startDay, index - 7 - startWeekday +1) + // font.pointSize: 10 + // anchors.centerIn: parent + // } + // } + // } Grid { id:container anchors.fill: parent @@ -69,25 +103,57 @@ Rectangle { Repeater { model:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] Rectangle { width: container.width / 7 - height: container.height / 7 + height: 35 color: "lightgray" border.color: "#3f4947" Text { text: modelData - font.pointSize: 10 - anchors.centerIn: parent + font.bold: true + verticalAlignment: Text.AlignVCenter + style: Text.Sunken + styleColor: "#1365f3" + font.pointSize: 14 + anchors.centerIn: parent + } + MouseArea { + anchors.fill: parent + onClicked: { + topItem.state = "WeekView"; + } } } } Repeater { model: 42 - Rectangle { width: container.width / 7 - height: container.height / 7 - color: Month.getColorOfDay(startDay, index - startWeekday +1) - border.color: "black" - Text { text: Month.getDayOfMonth(startDay, index - startWeekday +1) - font.pointSize: 10 - anchors.centerIn: parent - } + Rectangle { + id:dayContainer + width: container.width / 7 + height: (container.height - 35) / 6 + color: Month.getColorOfDay(startDay, index - startWeekday +1) + border.color: "black" + Text { + color: "#6ba24b"; + text: Month.getDayOfMonth(startDay, index - startWeekday +1) + font.bold: true + style: Text.Raised + font.pointSize: 12 + anchors.centerIn: parent + } + MouseArea { + hoverEnabled:true + anchors.fill: parent + onEntered: { + dayContainer.border.color = "#1365f3"; + dayContainer.border.width = 2; + } + onExited: { + dayContainer.border.color = "black"; + dayContainer.border.width = 1; + } + onClicked: { + topItem.day = new Date(topItem.day.getFullYear(), topItem.day.getMonth(), index - startWeekday +1); + topItem.state = "DayView"; + } + } } } } diff --git a/examples/qmlorganizer/contents/WeekView.qml b/examples/qmlorganizer/contents/WeekView.qml index a3c58e12d6..25c5bab188 100644 --- a/examples/qmlorganizer/contents/WeekView.qml +++ b/examples/qmlorganizer/contents/WeekView.qml @@ -45,7 +45,7 @@ Rectangle { id:weekView anchors.fill: parent - + property int day:0 ListView { id : dayList anchors.fill: parent @@ -57,6 +57,13 @@ Rectangle highlightFollowsCurrentItem : true highlightMoveSpeed : 2000 keyNavigationWraps : true + Component.onCompleted : positionViewAtIndex(currentIndex, ListView.Beginning) + currentIndex: day + onOpacityChanged: { + //when back to week view, select the current day. + if (opacity != 0) + currentIndex = day; + } model : ListModel { ListElement {day : "Sunday"} @@ -86,6 +93,7 @@ Rectangle anchors.fill: parent onClicked : dayList.currentIndex = index onDoubleClicked: { + topItem.day = new Date(topItem.day.getFullYear(), topItem.day.getMonth(), topItem.day.getDate() + dayList.currentIndex - weekView.day); topItem.state = "DayView" } } @@ -102,7 +110,6 @@ Rectangle } } - Component.onCompleted : positionViewAtIndex(currentIndex, ListView.Beginning) } } diff --git a/examples/qmlorganizer/organizer.qml b/examples/qmlorganizer/organizer.qml index d8b235fc38..e9c3061908 100644 --- a/examples/qmlorganizer/organizer.qml +++ b/examples/qmlorganizer/organizer.qml @@ -48,6 +48,9 @@ Rectangle { height: 640 property date day: new Date() property string status:day.toDateString() + onDayChanged: { + topItem.status = day.toDateString(); + } color: "#343434"; Image { source: "contents/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 1 } @@ -68,7 +71,7 @@ Rectangle { } else if (topItem.state == "DayView" || topItem.state == "TimelineView") { topItem.day = new Date(topItem.day.getFullYear(), topItem.day.getMonth() , topItem.day.getDate() - 1); } - topItem.status = day.toDateString(); + } onRightClicked: { if (topItem.state == "MonthView") { @@ -78,7 +81,6 @@ Rectangle { } else if (topItem.state == "DayView" || topItem.state == "TimelineView") { topItem.day = new Date(topItem.day.getFullYear(), topItem.day.getMonth() , topItem.day.getDate() + 1); } - topItem.status = day.toDateString(); } //rightClick } @@ -95,7 +97,7 @@ Rectangle { NumberAnimation { properties: "opacity" easing.type: "Linear" - duration: 100 + duration: 10 } } ] @@ -128,6 +130,7 @@ Rectangle { height: topItem.height - menuBar.height - statusBar.height; opacity: 0; anchors.fill: contentArea; + day: topItem.day.getDay(); } DayView { id: dayView; |