~macslow/unity8/fix-1475678

« back to all changes in this revision

Viewing changes to Dash/People/Preview/Status.qml

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 0.1
 
19
import "../../../Components/Time.js" as Time
 
20
 
 
21
Base {
 
22
    id: root
 
23
 
 
24
    Item {
 
25
        anchors {
 
26
            left: parent.left
 
27
            right: parent.right
 
28
            leftMargin: units.gu(2)
 
29
            rightMargin: units.gu(4)
 
30
        }
 
31
        height: childrenRect.height
 
32
 
 
33
        Label {
 
34
            id: typeLabel
 
35
            anchors {
 
36
                top: parent.top
 
37
                topMargin: units.gu(1)
 
38
            }
 
39
            text: "Status"
 
40
            elide: Text.ElideRight
 
41
            color: "#f3f3e7"
 
42
            style: Text.Raised
 
43
            styleColor: "black"
 
44
            font.capitalization: Font.Capitalize
 
45
            opacity: 0.7;
 
46
            fontSize: "small"
 
47
        }
 
48
 
 
49
        Label {
 
50
            id: contentLabel
 
51
            anchors {
 
52
                left: parent.left
 
53
                right: parent.right
 
54
                top: typeLabel.bottom
 
55
                topMargin: units.gu(0.5)
 
56
            }
 
57
            text: root.model ? root.model.status : ""
 
58
            elide: Text.ElideRight
 
59
            color: "#f3f3e7"
 
60
            style: Text.Raised
 
61
            styleColor: "black"
 
62
            opacity: 0.9;
 
63
            fontSize: "large"
 
64
            wrapMode: Text.WordWrap
 
65
            maximumLineCount: 6
 
66
            font.weight: Font.Light
 
67
        }
 
68
 
 
69
        Row {
 
70
            anchors {
 
71
                top: contentLabel.bottom
 
72
                topMargin: units.gu(1)
 
73
            }
 
74
            height: statusText.height + units.gu(2.5)
 
75
            spacing: units.gu(1)
 
76
            Image {
 
77
                width: units.gu(2)
 
78
                height: units.gu(2)
 
79
                fillMode: Image.PreserveAspectFit
 
80
                source: root.model ? root.model.statusServiceIcon : ""
 
81
            }
 
82
            Label {
 
83
                id: statusText
 
84
                text: if (root.model) {
 
85
                    var time = Time.readableFromNow(root.model.statusTime);
 
86
                    return time ? time : root.model.statusTime;
 
87
                } else return "";
 
88
                elide: Text.ElideRight
 
89
                color: "#f3f3e7"
 
90
                style: Text.Raised
 
91
                styleColor: "black"
 
92
                opacity: 0.7;
 
93
                fontSize: "small"
 
94
            }
 
95
        }
 
96
    }
 
97
}