8import QtQuick.Controls as QQC2
 
    9import QtQuick.Templates as T
 
   10import org.kde.kirigami as Kirigami
 
   11import org.kde.kosmindoormap
 
   20    required property var model
 
   22    required property string regionCode
 
   24    required property string timeZone
 
   26    width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
 
   27    height: Math.min(applicationWindow().height, Kirigami.Units.gridUnit * 32)
 
 
   31        implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
 
   32                                implicitContentWidth + leftPadding + rightPadding)
 
   33        implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
 
   34                                implicitContentHeight + topPadding + bottomPadding)
 
   36        padding: Kirigami.Units.largeSpacing
 
   37        bottomPadding: verticalPadding + headerSeparator.implicitHeight 
 
   39        Kirigami.Theme.colorSet: Kirigami.Theme.Header
 
   41        contentItem: GridLayout {
 
   42            rowSpacing: Kirigami.Units.smallSpacing
 
   43            columnSpacing: Kirigami.Units.smallSpacing
 
   48                Layout.fillWidth: true
 
   49                Layout.alignment: Qt.AlignVCenter
 
   51                elide: Text.ElideRight
 
   53                QQC2.ToolTip.visible: truncated && titleHoverHandler.hovered
 
   54                QQC2.ToolTip.text: root.model.name
 
   55                HoverHandler { id: titleHoverHandler }
 
   61                Layout.fillWidth: true
 
   62                Layout.alignment: Qt.AlignVCenter
 
   63                text: root.model.category
 
   64                elide: Text.ElideRight
 
   65                visible: root.model.category.length > 0
 
   68                QQC2.ToolTip.visible: truncated && subtitleHoverHandler.hovered
 
   69                QQC2.ToolTip.text: root.model.category
 
   70                HoverHandler { id: subtitleHoverHandler }
 
   78                Layout.alignment: Qt.AlignRight | Qt.AlignTop
 
   80                visible: root.showCloseButton
 
   81                icon.name: closeIcon.hovered ? "window-close" : 
"window-close-symbolic" 
   82                text: 
i18ndc(
"kosmindoormap", 
"@action:button close dialog", 
"Close")
 
   83                onClicked: root.reject()
 
   84                display: QQC2.AbstractButton.IconOnly
 
   93                anchors.bottom: parent.bottom
 
   94                visible: contentItem.contentHeight > contentItem.implicitHeight
 
   99    contentItem: ListView {
 
  103        Layout.preferredWidth: 
Kirigami.Units.gridUnit * 25
 
  106            visible: contentView.count === 0
 
  107            text: 
i18nc(
"@info", 
"No information available")
 
  108            anchors.centerIn: parent
 
  112            id: infoStringDelegate
 
  115                width: parent.ListView.view.width - 2 * x
 
  116                keyLabel: row?.keyLabel ?? 
"" 
  117                value: row?.value ?? 
"" 
  126                width: parent.ListView.view.width - 2 * x
 
  127                keyLabel: row?.keyLabel ?? 
"" 
  128                value: row?.value ?? 
"" 
  135            id: infoAddressDelegate
 
  138                width: parent.ListView.view.width - 2 * x
 
  144            id: infoOpeningHoursDelegate
 
  147                width: parent.ListView.view.width - 2 * x
 
  148                regionCode: root.regionCode
 
  149                timeZoneId: root.timeZone
 
  150                latitude: root.model.element?.center.y ?? NaN
 
  151                longitude: root.model.element?.center.x ?? NaN
 
  152                openingHours: row?.value ?? 
"" 
  157            id: infoImageDelegate
 
  160                x: (row?.key === OSMElementInformationModel.Logo ?? 
false) ? 
Kirigami.Units.largeSpacing : 0
 
  161                width: parent.ListView.view.width - 2 * x
 
  162                source: row?.value ?? 
"" 
  164                maximumHeight: (row?.key === OSMElementInformationModel.Logo ?? false) ? 
Kirigami.
Units.gridUnit * 6 : implicitHeight
 
  170        section.property: 
"categoryLabel" 
  172            required property string section
 
  176            color: section == 
"Debug" ? 
Kirigami.Theme.disabledTextColor : 
Kirigami.Theme.textColor
 
  180        section.criteria: ViewSection.FullString
 
  181        section.labelPositioning: ViewSection.InlineLabels
 
  184            property var row: model
 
  187                    case OSMElementInformationModel.Link:
 
  188                        return infoLinkDelegate;
 
  189                    case OSMElementInformationModel.PostalAddress:
 
  190                        return infoAddressDelegate;
 
  191                    case OSMElementInformationModel.OpeningHoursType:
 
  192                        return infoOpeningHoursDelegate;
 
  193                    case OSMElementInformationModel.ImageType:
 
  194                        return infoImageDelegate;
 
  195                    case OSMElementInformationModel.String:
 
  197                        return infoStringDelegate;
 
  203    onClosed: root.model.clear()
 
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
 
QString i18nc(const char *context, const char *text, const TYPE &arg...)
 
PostalAddress address(const QVariant &location)
 
QStringView level(QStringView ifopt)
 
Category category(StandardShortcut id)