RestaurantDelegate.qml 2.39 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
    Copyright (C) 2018 Volker Krause <vkrause@kde.org>

    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published by
    the Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
    License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1 as QQC2
21
import org.kde.kirigami 2.4 as Kirigami
22
import org.kde.itinerary 1.0
23 24 25 26 27
import "." as App

App.TimelineDelegate {
    id: root

28 29 30 31 32 33 34 35 36
    header: Rectangle {
        id: headerBackground
        Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
        Kirigami.Theme.inherit: false
        color: Kirigami.Theme.backgroundColor
        implicitHeight: headerLayout.implicitHeight + Kirigami.Units.largeSpacing * 2
        anchors.leftMargin: -root.leftPadding
        anchors.topMargin: -root.topPadding
        anchors.rightMargin: -root.rightPadding
37

38 39 40 41
        RowLayout {
            id: headerLayout
            anchors.fill: parent
            anchors.margins: Kirigami.Units.largeSpacing
42

43 44
            QQC2.Label {
                text: qsTr("🍴 %1").arg(reservation.reservationFor.name)
45
                color: Kirigami.Theme.textColor
46 47 48 49 50
                font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale
                Layout.fillWidth: true
            }
            QQC2.Label {
                text: Localizer.formatTime(reservation, "startTime")
51
                color: Kirigami.Theme.textColor
52
                font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale
53 54
            }
        }
55 56 57 58
    }

    contentItem: ColumnLayout {
        id: topLayout
59

Volker Krause's avatar
Volker Krause committed
60 61 62
        App.PlaceDelegate {
            place: reservation.reservationFor
            Layout.fillWidth: true
63
        }
64 65 66 67 68 69
    }

    Component {
        id: detailsComponent
        App.RestaurantPage {
            reservation: root.reservation
70 71 72
        }
    }

73 74
    onClicked: applicationWindow().pageStack.push(detailsComponent);
}