This repository was archived by the owner on Jan 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRssItemDelegate.qml
77 lines (58 loc) · 2.06 KB
/
RssItemDelegate.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import QtQuick 2.0
import "Theme.js" as Theme
BackgroundItem {
id: delegate
property string title: ""
property string description: ""
property int date;
property url link;
property alias img: avatarImage.source;
height: Math.max(rssDateLabel.paintedHeight + rssDescriptionLabel.paintedHeight + 2 * Theme.paddingLarge, 2 * Theme.paddingLarge + avatarImage.height)
Image {
id: dummyImage;
z: avatarImage.z -1;
anchors.fill: avatarImage;
source: "qrc:/images/blank_boy.png"
visible: avatarImage.status !== Image.Ready;
}
Image {
id: avatarImage;
z: delegate.z+2
anchors.left: parent.left
anchors.top: parent.top;
width: 0.8 * dpix;
height: 0.8 * dpiy;
anchors.margins: Theme.paddingMedium;
fillMode: Image.PreserveAspectCrop;
}
Text {
id: rssDescriptionLabel
anchors.top: parent.top;
anchors.left: avatarImage.right;
anchors.right: parent.right;
anchors.margins: Theme.paddingLarge;
color: delegate.highlighted ? Theme.secondary_color_highlight : Theme.secondary_color;
wrapMode: Text.Wrap;
font.pointSize: Theme.secondary_pointSize
textFormat: Text.RichText;
text: "<b>" + delegate.title + "</b> " + delegate.description
}
Text {
id: rssDateLabel
anchors.top: rssDescriptionLabel.bottom;
anchors.left: avatarImage.right;
anchors.right: parent.right;
anchors.topMargin: Theme.paddingLarge
anchors.leftMargin: Theme.paddingLarge;
anchors.rightMargin: Theme.paddingLarge;
horizontalAlignment: Text.AlignRight
color: delegate.highlighted ? Theme.secondary_color_highlight : Theme.secondary_color;
wrapMode: Text.Wrap;
font.pointSize: Theme.tertiary_pointSize
// text: Format.formatDate(new Date(date*1000), Formatter.TimepointRelative)
text: new Date(date*1000).toLocaleDateString()
}
onClicked: {
Qt.openUrlExternally(link)
}
}