File: BottomEdgeIndicators.qml

package info (click to toggle)
lomiri-camera-app 4.0.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,092 kB
  • sloc: cpp: 1,671; javascript: 27; makefile: 16; sh: 12
file content (108 lines) | stat: -rw-r--r-- 3,557 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
 * Copyright 2015-2016 Canonical Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * 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 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.12
import Lomiri.Components 1.3

Item {
    id: bottomEdgeIndicators

    property var options
    width: indicatorsRow.width + units.gu(2) + emptyIndicatorsHint.width
    height: units.gu(3)

    Image {
        anchors {
            left: parent.left
            right: parent.right
            top: parent.top
        }
        height: parent.height * 2
        opacity: 0.3
        source: "assets/lomiri_shape.svg"
        sourceSize.width: width
        sourceSize.height: height
        cache: false
        asynchronous: true
    }

    Icon {
        id: emptyIndicatorsHint
        objectName: "emptyIndicatorsHint"
        name: "go-up"
        opacity: 0.5
        color: "white"
        visible: indicatorsRow.visibleChildren.length <= 1
        anchors {
            top: parent.top
            topMargin: units.gu(0.5)
            bottom: parent.bottom
            bottomMargin: units.gu(0.5)
            horizontalCenter: parent.horizontalCenter
        }
        width: visible ? height * 1.5 : 0
        asynchronous: true
    }

    Row {
        id: indicatorsRow
        objectName: "indicatorsRow"

        anchors {
            top: parent.top
            bottom: parent.bottom
            horizontalCenter: parent.horizontalCenter
        }
        spacing: units.gu(1)

        Repeater {
            model: bottomEdgeIndicators.options
            delegate: Item {
                anchors {
                    top: parent.top
                    topMargin: units.gu(0.5)
                    bottom: parent.bottom
                    bottomMargin: units.gu(0.5)
                }
                width: units.gu(2)
                visible: modelData.showInIndicators && modelData.available && modelData.visible ? (modelData.isToggle ? modelData.get(model.selectedIndex).value : true) : false
                opacity: 0.5

                Icon {
                    id: indicatorIcon
                    anchors.fill: parent
                    color: modelData.colorize ? "red" : "white"
                    name: modelData && modelData.isToggle ?
                                                        modelData.icon :
                                                        (modelData.get(model.selectedIndex) && modelData.get(model.selectedIndex).icon ? modelData.get(model.selectedIndex).icon : "")
                    source: name ? "image://theme/%1".arg(name) : (modelData.iconSource || "")
                    visible: source != ""
                    asynchronous: true
                }

                Label {
                    id: indicatorLabel
                    anchors.fill: parent
                    fontSize: "xx-small"
                    color: "white"
                    text: modelData.label
                    verticalAlignment: Text.AlignVCenter
                    visible: indicatorIcon.name === ""
                }
            }
        }
    }
}