96.2.1
by Kunal Parmar
initial version |
1 |
import QtQuick 2.0 |
2 |
import Ubuntu.Components 0.1 |
|
3 |
||
96.2.5
by Kunal Parmar
Theme and some other modification |
4 |
Item{ |
96.2.1
by Kunal Parmar
initial version |
5 |
id: infoBubble
|
6 |
||
96.2.6
by Kunal Parmar
unused property removed |
7 |
property var event; |
8 |
||
96.2.1
by Kunal Parmar
initial version |
9 |
property int type: narrowType |
10 |
property int wideType: 1; |
|
11 |
property int narrowType: 2; |
|
12 |
||
96.2.5
by Kunal Parmar
Theme and some other modification |
13 |
signal clicked(var event); |
14 |
||
15 |
UbuntuShape{ |
|
16 |
id: bg
|
|
17 |
anchors.fill: parent |
|
18 |
color: "white" |
|
19 |
}
|
|
96.2.1
by Kunal Parmar
initial version |
20 |
|
21 |
onEventChanged: { |
|
96.2.2
by Kunal Parmar
final weekview and dayview |
22 |
setDetails(); |
23 |
}
|
|
24 |
||
25 |
Component.onCompleted: { |
|
26 |
setDetails(); |
|
27 |
}
|
|
28 |
||
29 |
function setDetails() { |
|
96.2.1
by Kunal Parmar
initial version |
30 |
if(event === null || event === undefined) { |
31 |
return; |
|
32 |
}
|
|
33 |
||
96.2.7
by Kunal Parmar
internationalized the time string |
34 |
// TRANSLATORS: this is a time formatting string,
|
35 |
// see http://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-date.html#details for valid expressions
|
|
36 |
var timeFormat = i18n.tr("hh:mm"); |
|
124.3.4
by Kunal Parmar
EventDetails to OrganizerModel |
37 |
var startTime = event.startDateTime.toLocaleTimeString(Qt.locale(), timeFormat) |
38 |
var endTime = event.endDateTime.toLocaleTimeString(Qt.locale(), timeFormat) |
|
122.1.1
by David Planella
Updated translatable strings, a couple of small fixes to ease translations |
39 |
// TRANSLATORS: the first argument (%1) refers to a start time for an event,
|
40 |
// while the second one (%2) refers to the end time
|
|
96.2.7
by Kunal Parmar
internationalized the time string |
41 |
var timeString = i18n.tr("%1 - %2").arg(startTime).arg(endTime) |
96.2.1
by Kunal Parmar
initial version |
42 |
|
96.2.2
by Kunal Parmar
final weekview and dayview |
43 |
timeLabel.text = "" |
44 |
titleLabel.text = "" |
|
96.2.5
by Kunal Parmar
Theme and some other modification |
45 |
descriptionLabel.text = "" |
96.2.2
by Kunal Parmar
final weekview and dayview |
46 |
|
96.2.1
by Kunal Parmar
initial version |
47 |
if( type == wideType) { |
96.2.7
by Kunal Parmar
internationalized the time string |
48 |
timeLabel.text = timeString |
96.2.5
by Kunal Parmar
Theme and some other modification |
49 |
|
124.3.4
by Kunal Parmar
EventDetails to OrganizerModel |
50 |
if( event.displayLabel) |
51 |
titleLabel.text = event.displayLabel; |
|
96.2.5
by Kunal Parmar
Theme and some other modification |
52 |
|
124.3.4
by Kunal Parmar
EventDetails to OrganizerModel |
53 |
if( event.description) |
54 |
descriptionLabel.text = event.description |
|
96.2.1
by Kunal Parmar
initial version |
55 |
} else { |
56 |
timeLabel.text = startTime |
|
57 |
}
|
|
58 |
}
|
|
59 |
||
60 |
Column{ |
|
61 |
width: parent.width |
|
62 |
Row{ |
|
63 |
width: parent.width |
|
64 |
||
65 |
Rectangle{ |
|
66 |
width: units.gu(1) |
|
67 |
radius: width/2 |
|
68 |
height: width |
|
69 |
color: "#715772" |
|
70 |
anchors.verticalCenter: parent.verticalCenter |
|
71 |
antialiasing: true |
|
72 |
}
|
|
73 |
||
74 |
Label{ |
|
75 |
id: timeLabel
|
|
76 |
fontSize:"small"; |
|
96.2.5
by Kunal Parmar
Theme and some other modification |
77 |
color:"gray" |
96.2.1
by Kunal Parmar
initial version |
78 |
width: parent.width |
79 |
}
|
|
80 |
}
|
|
81 |
||
82 |
Label{ |
|
83 |
id: titleLabel
|
|
84 |
x: units.gu(1) |
|
85 |
fontSize:"small"; |
|
96.2.5
by Kunal Parmar
Theme and some other modification |
86 |
color:"black" |
87 |
wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
|
88 |
width: parent.width |
|
89 |
visible: type == wideType |
|
90 |
}
|
|
91 |
||
92 |
Label{ |
|
93 |
id: descriptionLabel
|
|
94 |
x: units.gu(1) |
|
95 |
fontSize:"small"; |
|
96 |
color:"gray" |
|
96.2.1
by Kunal Parmar
initial version |
97 |
wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
98 |
width: parent.width |
|
99 |
visible: type == wideType |
|
100 |
}
|
|
101 |
}
|
|
102 |
||
103 |
MouseArea{ |
|
104 |
anchors.fill: parent |
|
105 |
onClicked: { |
|
96.2.5
by Kunal Parmar
Theme and some other modification |
106 |
infoBubble.clicked(event); |
96.2.1
by Kunal Parmar
initial version |
107 |
}
|
108 |
}
|
|
109 |
}
|