~pkunal-parmar/ubuntu-calendar-app/Minor-Performance

« back to all changes in this revision

Viewing changes to HeaderDateComponent.qml

  • Committer: Kunal Parmar
  • Date: 2014-09-28 11:49:35 UTC
  • mfrom: (478 ubuntu-calendar-app)
  • mto: This revision was merged to the branch mainline in revision 480.
  • Revision ID: pkunal.parmar@gmail.com-20140928114935-scs25xpajdxn358p
mergeĀ fromĀ trunk

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
19
 
import Ubuntu.Components 0.1
 
18
 
 
19
import QtQuick 2.3
 
20
import Ubuntu.Components 1.1
20
21
 
21
22
Item {
22
23
    id: root
23
24
 
 
25
    // Property to set the day and date
24
26
    property var date;
25
27
 
26
 
    property alias dateColor: dateLabel.color
 
28
    // Property to set the font color of the day label
27
29
    property alias dayColor: dayLabel.color
28
30
 
29
 
    property int dayFormat: Locale.ShortFormat;
30
 
 
31
 
    signal dateSelected(var date);
32
 
 
33
 
    width: parent.width
34
 
    height: innerColumn.height
 
31
    // Property to set the time format of the day label
 
32
    property int dayFormat: Locale.ShortFormat
 
33
 
 
34
    // Signal fired when pressing on the date
 
35
    signal dateSelected(var date)
 
36
 
 
37
    width: dayLabel.paintedWidth
 
38
    height: dateContainer.height
35
39
 
36
40
    Column {
37
 
        id: innerColumn
38
 
        width: parent.width
39
 
        spacing: units.gu(2)
 
41
        id: dateContainer
 
42
 
 
43
        width: dayLabel.paintedWidth
 
44
        spacing: units.gu(0.2)
 
45
 
 
46
        anchors.centerIn: parent
40
47
 
41
48
        Label{
42
49
            id: dayLabel
43
 
            property var day: Qt.locale().standaloneDayName(date.getDay(), dayFormat)
44
 
            text: day.toUpperCase();
45
 
            fontSize: "medium"
46
 
            horizontalAlignment: Text.AlignHCenter
47
 
            color: "white"
48
 
            width: parent.width
 
50
            objectName: "dayLabel"
 
51
            text: Qt.locale().standaloneDayName(date.getDay(), dayFormat)
49
52
        }
50
53
 
51
54
        Label{
52
55
            id: dateLabel
53
56
            objectName: "dateLabel"
54
57
            text: date.getDate();
55
 
            fontSize: "large"
56
 
            horizontalAlignment: Text.AlignHCenter
57
 
            width: parent.width
 
58
            color: dayLabel.color
 
59
            anchors.horizontalCenter: dayLabel.horizontalCenter
58
60
        }
59
61
    }
60
62