Dot.qml 1.33 KB
Newer Older
Joseph Wenninger's avatar
Joseph Wenninger committed
1 2 3
/*
 * Rewrite of the KDE4-Plasma Binary Clock for KF5/Plasma/QML
 *
4 5
 * SPDX-FileCopyrightText: 2014 Joseph Wenninger <jowenn@kde.org>
 * SPDX-FileCopyrightText: 2018 Piotr Kąkol <piotrkakol@protonmail.com>
Joseph Wenninger's avatar
Joseph Wenninger committed
6 7
 *
 * Original code (KDE4):
8 9
 * SPDX-FileCopyrightText: 2007 Riccardo Iaconelli <riccardo@kde.org>
 * SPDX-FileCopyrightText: 2007 Davide Bettio <davide.bettio@kdemail.net>
Joseph Wenninger's avatar
Joseph Wenninger committed
10
 *
11
 * SPDX-License-Identifier: GPL-2.0-or-later
Joseph Wenninger's avatar
Joseph Wenninger committed
12 13 14
 */

import QtQuick 2.0
15
import org.kde.plasma.core 2.0 as PlasmaCore
Joseph Wenninger's avatar
Joseph Wenninger committed
16 17 18 19 20

Item {
    property int val
    property int bit

21
    /* both active and inactive squares */
Joseph Wenninger's avatar
Joseph Wenninger committed
22
    Rectangle {
23 24 25 26 27 28
        width:   main.dotSize
        height:  width
        color:   (val & bit) ? main.onColor : main.offColor
        x:       0
        y:       0
        visible: main.showOffLeds || color != main.offColor
Joseph Wenninger's avatar
Joseph Wenninger committed
29
    }
30 31

    /* bottom border for each square */
Joseph Wenninger's avatar
Joseph Wenninger committed
32
    Rectangle {
33 34 35 36
        visible: main.showGrid
        x:       0
        y:       main.dotSize
        width:   main.dotSize
37
        height:  PlasmaCore.Units.smallSpacing
38
        color:   main.gridColor
Joseph Wenninger's avatar
Joseph Wenninger committed
39
    }
40 41

    /* right border for each square */
Joseph Wenninger's avatar
Joseph Wenninger committed
42
    Rectangle {
43 44 45
        visible: main.showGrid
        x:       main.dotSize
        y:       0
46 47
        width:   PlasmaCore.Units.smallSpacing
        height:  main.dotSize+PlasmaCore.Units.smallSpacing
48
        color:   main.gridColor
Joseph Wenninger's avatar
Joseph Wenninger committed
49
    }
50
}