CountryInfoDelegate.qml 3.28 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
    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
15
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
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
*/

import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1 as QQC2
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kitinerary 1.0 as KItinerary
import org.kde.itinerary 1.0
import "." as App

Kirigami.AbstractCard {
    id: root
    property var countryInfo;

   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

        RowLayout {
            id: headerLayout
            anchors.fill: parent
            anchors.margins: Kirigami.Units.largeSpacing

45 46 47 48 49 50 51
            Kirigami.Icon {
                source: "documentinfo"
                width: Kirigami.Units.iconSizes.smallMedium
                height: width
                color: Kirigami.Theme.neutralTextColor
                isMask: true
            }
52
            QQC2.Label {
53
                text: i18n("Entering %1", Localizer.countryName(countryInfo.isoCode))
54
                color: Kirigami.Theme.neutralTextColor
55
                Layout.fillWidth: true
56 57 58 59 60 61 62 63 64
            }
        }
    }

    contentItem: ColumnLayout {
        id: topLayout

        QQC2.Label {
            text: countryInfo.drivingSide == KItinerary.KnowledgeDb.DrivingSide.Right ?
Volker Krause's avatar
Volker Krause committed
65 66
                i18n("People are driving on the right side.") :
                i18n("People are driving on the wrong side.")
67 68 69
            color: Kirigami.Theme.negativeTextColor
            visible: countryInfo.drivingSideDiffers
        }
70 71

        QQC2.Label {
Volker Krause's avatar
Volker Krause committed
72
            text: i18n("No compatible power sockets: %1", countryInfo.powerSocketTypes)
73
            color: Kirigami.Theme.negativeTextColor
74 75 76
            visible: countryInfo.powerPlugCompatibility == CountryInformation.Incompatible
        }
        QQC2.Label {
Volker Krause's avatar
Volker Krause committed
77
            text: i18n("Some incompatible power sockets: %1", countryInfo.powerSocketTypes)
78
            color: Kirigami.Theme.neutralTextColor
Volker Krause's avatar
Volker Krause committed
79
            visible: countryInfo.powerPlugCompatibility == CountryInformation.PartiallyCompatible && countryInfo.powerSocketTypes != ""
80 81
        }
        QQC2.Label {
Volker Krause's avatar
Volker Krause committed
82
            text: i18n("Some incompatible power plugs: %1", countryInfo.powerPlugTypes)
83
            color: Kirigami.Theme.neutralTextColor
84
            visible: countryInfo.powerPlugCompatibility == CountryInformation.PartiallyCompatible && countryInfo.powerPlugTypes != ""
85
        }
86 87 88
    }
}