~ubuntu-calendar-dev/ubuntu-calendar-app/ViewRedisign

« back to all changes in this revision

Viewing changes to HeaderDateComponent.qml

  • Committer: Nekhelesh Ramananthan
  • Date: 2014-09-17 18:18:12 UTC
  • Revision ID: krnekhelesh@gmail.com-20140917181812-o0ivrqzs0z1l3t96
Fixed week view

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
17
 */
18
 
import QtQuick 2.0
 
18
 
 
19
import QtQuick 2.3
19
20
import Ubuntu.Components 1.1
20
21
 
21
22
Item {
22
 
    id: root
23
 
 
24
 
    property var date;
25
 
 
 
23
    id: headerDateComponent
 
24
 
 
25
    // Property to set the day and date
 
26
    property var date
 
27
 
 
28
    // Property to set the font color of the day label
26
29
    property alias dayColor: dayLabel.color
27
30
 
28
 
    property int dayFormat: Locale.ShortFormat;
29
 
 
30
 
    signal dateSelected(var date);
31
 
 
32
 
    width: parent.width
33
 
    height: innerColumn.height
 
31
    // Property to set the time format of the day label
 
32
    property int dayFormat: Locale.ShortFormat
 
33
 
 
34
    // Signal which is fired when pressing on the date
 
35
    signal dateSelected(var date)
 
36
 
 
37
    width: dayLabel.paintedWidth
 
38
    height: dateContainer.height
34
39
 
35
40
    Column {
36
 
        id: innerColumn
37
 
        width: parent.width
38
 
        spacing: units.gu(1)
39
 
        anchors{
40
 
            left: parent.left
41
 
            leftMargin: units.gu(4)
42
 
            top :parent.top
43
 
            topMargin: units.gu(0.5)
44
 
        }
 
41
        id: dateContainer
 
42
 
 
43
        width: dayLabel.paintedWidth
 
44
        spacing: units.gu(0.2)
 
45
 
 
46
        anchors.centerIn: parent
 
47
 
45
48
        Label{
46
49
            id: dayLabel
 
50
            objectName: "dayLabel"
 
51
            color: "white"
 
52
            horizontalAlignment: Text.horizontalCenter
 
53
            text: Qt.locale().standaloneDayName(date.getDay(), dayFormat)
 
54
        }
 
55
 
 
56
        Label {
 
57
            id: dateLabel
47
58
            objectName: "dateLabel"
48
 
            property var day: Qt.locale().standaloneDayName(date.getDay(), dayFormat)
49
 
            text: day + " \n " + date.getDate();
50
 
            fontSize: "medium"
51
 
            horizontalAlignment: Text.horizontalCenter
52
 
            color: "white"
53
 
            width: parent.width
 
59
            text: date.getDate();
 
60
            color: dayLabel.color
 
61
            anchors.horizontalCenter: dayLabel.horizontalCenter
54
62
        }
55
63
    }
56
64
 
57
65
    MouseArea {
58
66
        anchors.fill: parent
59
67
        onClicked: {
60
 
            root.dateSelected(date);
 
68
            headerDateComponent.dateSelected(date);
61
69
        }
62
70
    }
63
71
}