Debian Codegraph @

tests/unit/i18n13/RelativeTime/src/RelativeTime.qml

raw
1 /*
2 * Copyright 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 Lesser 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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser 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 Lomiri.Components 1.3
19
20 MainView {
21 width: units.gu(48)
22 height: units.gu(60)
23 applicationName: "lomiri-ui-toolkit"
24
25 Page {
26 objectName: 'page'
27
28 Label {
29 id: timeNow
30 objectName: 'timeNow'
31 anchors.top: parent.top
32 anchors.horizontalCenter: parent.horizontalCenter
33 text: i18n.relativeDateTime(new Date())
34 }
35 Label {
36 id: timeMinuteBefore
37 objectName: 'timeMinuteBefore'
38 anchors.top: timeNow.bottom
39 anchors.horizontalCenter: timeNow.horizontalCenter
40 text: i18n.relativeDateTime(new Date(new Date().getTime() - 60000))
41 }
42 Label {
43 id: timeMinuteAfter
44 objectName: 'timeMinuteAfter'
45 anchors.top: timeMinuteBefore.bottom
46 anchors.horizontalCenter: timeMinuteBefore.horizontalCenter
47 text: i18n.relativeDateTime(new Date(new Date().getTime() + 60000))
48 }
49 Label {
50 id: tenMinutesBefore
51 objectName: 'tenMinutesBefore'
52 anchors.top: timeMinuteAfter.bottom
53 anchors.horizontalCenter: timeMinuteAfter.horizontalCenter
54 text: i18n.relativeDateTime(new Date(new Date().getTime() - 600000))
55 }
56 Label {
57 id: tenMinutesAfter
58 objectName: 'tenMinutesAfter'
59 anchors.top: tenMinutesBefore.bottom
60 anchors.horizontalCenter: tenMinutesBefore.horizontalCenter
61 text: i18n.relativeDateTime(new Date(new Date().getTime() + 600000))
62 }
63 Label {
64 id: timeFarAway
65 objectName: 'timeFarAway'
66 anchors.top: tenMinutesAfter.bottom
67 anchors.horizontalCenter: tenMinutesAfter.horizontalCenter
68 text: i18n.relativeDateTime(new Date(2000, 0, 1, 0, 0, 0, 0))
69 }
70 }
71 }