ResponsivePreview.qml 2.16 KB
Newer Older
1 2 3 4 5
/*
    SPDX-FileCopyrightText: 2019 Carson Black <uhhadd@gmail.com>

    SPDX-License-Identifier: GPL-2.0-or-later
*/
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

import QtQuick 2.5
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.0

import org.kde.kirigami 2.8 as Kirigami

Kirigami.GlobalDrawer {
    id: root
    edge: Qt.RightEdge

    handleOpenIcon.source: "dialog-close"
    handleClosedIcon.source: "view-preview"

    focus: false

22
    actions: cuttlefish.actions
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

    Kirigami.Heading {
        level: 1
        Layout.fillWidth: true
        wrapMode: Text.Wrap
        horizontalAlignment: Text.AlignHCenter
        elide: Text.ElideRight
        text: preview.iconName
    }
    Kirigami.FormLayout {
        Layout.fillWidth: true
        Layout.topMargin: Kirigami.Units.largeSpacing
        QQC2.Label {
            Layout.maximumWidth: Kirigami.Units.gridUnit * 10
            Kirigami.FormData.label: i18n("File name:")
            elide: Text.ElideRight
            text: preview.fileName
        }
        QQC2.Label {
            Kirigami.FormData.label: i18n("Category:")
            font.capitalization: Font.Capitalize
            text: preview.category
        }
        QQC2.Label {
            Kirigami.FormData.label: i18n("Scalable:")
            text: preview.scalable ? i18n("yes") : i18n("no")
            font.capitalization: Font.Capitalize
        }
    }
    GridLayout {
        id: grid
        columns: 2
        Layout.alignment: Qt.AlignHCenter
        Repeater {
57
            model: cuttlefish.iconSizes.slice(0, cuttlefish.iconSizes.length - 1)
58
            delegate: ColumnLayout {
59
                Layout.alignment: Qt.AlignBottom
60 61
                Kirigami.Icon {
                    source: preview.iconName
62 63
                    implicitWidth: modelData
                    implicitHeight: implicitWidth
64 65 66
                }
                QQC2.Label {
                    Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
67
                    text: modelData
68 69 70 71 72 73 74 75 76
                    Behavior on color {
                        ColorAnimation {
                            duration: Kirigami.Units.longDuration
                        }
                    }
                }
            }
        }
    }
77
}