8import QtQuick.Controls as QQC2
9import org.kde.kirigami as Kirigami
10import org.kde.kopeninghours
11import org.kde.kosmindoormap
15 required property string name
16 required property string typeName
17 required property string iconSource
18 required property string cuisine
19 required property string fallbackName
20 required property string openingHours
22 required property var mapData
24 required property int index
27 width: ListView.view.width
30 let v = OpeningHoursParser.parse(root.openingHours);
31 v.region = root.mapData.regionCode;
32 v.timeZone = root.mapData.timeZone;
33 v.setLocation(root.mapData.center.y, root.mapData.center.x);
34 if (v.error != OpeningHours.Null && v.error != OpeningHours.NoError) {
35 console.log(
"Opening hours parsing error:", v.error, root.mapData.region, root.mapData.timeZone)
40 contentItem: RowLayout {
44 Layout.minimumHeight:
Kirigami.Units.iconSizes.medium
45 Layout.maximumHeight:
Kirigami.Units.iconSizes.medium
46 Layout.minimumWidth:
Kirigami.Units.iconSizes.medium
47 Layout.maximumWidth:
Kirigami.Units.iconSizes.medium
48 source: root.iconSource
53 Layout.alignment:
Qt.AlignVCenter
54 Layout.fillWidth:
true
58 Layout.alignment:
Qt.AlignLeft |
Qt.AlignBottom
59 Layout.fillWidth:
true
60 text: root.name !==
"" ? root.name : root.typeName
61 elide:
Text.ElideRight
65 Layout.alignment:
Qt.AlignLeft |
Qt.AlignTop
66 Layout.fillWidth:
true
68 if (root.cuisine && root.name ===
"")
71 return root.typeName +
" (" + root.cuisine +
")";
72 return root.name ===
"" && root.fallbackName !==
"" ? root.fallbackName : root.typeName;
74 elide:
Text.ElideRight
80 Layout.fillWidth:
true
81 text:
Display.currentState(root.oh)
83 if (root.highlighted || root.checked || root.down)
84 return Kirigami.Theme.highlightedTextColor
85 const currentInterval = root.oh.interval(
new Date());
86 switch (currentInterval.state) {
87 case Interval.Open:
return Kirigami.Theme.positiveTextColor;
88 case Interval.Closed:
return Kirigami.Theme.negativeTextColor;
89 default:
return Kirigami.Theme.textColor;
92 elide:
Text.ElideRight