diff --git a/applets/binary-clock/package/contents/config/config.qml b/applets/binary-clock/package/contents/config/config.qml --- a/applets/binary-clock/package/contents/config/config.qml +++ b/applets/binary-clock/package/contents/config/config.qml @@ -1,9 +1,9 @@ /* - * Copyright 2014 Joseph Wenninger + * Copyright 2014 Joseph Wenninger + * Copyright 2018 Piotr Kąkol * * Based on analog-clock config.qml: * Copyright 2013 Marco Martin - * Copyright 2018 Piotr Kąkol * * 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 diff --git a/applets/binary-clock/package/contents/ui/BinaryClock.qml b/applets/binary-clock/package/contents/ui/BinaryClock.qml --- a/applets/binary-clock/package/contents/ui/BinaryClock.qml +++ b/applets/binary-clock/package/contents/ui/BinaryClock.qml @@ -37,7 +37,8 @@ Item { id: main - readonly property real w1: (main.height-5*units.smallSpacing)*dots/4 + readonly property int squares: showSeconds ? 6 : 4 + readonly property real w1: (main.height-5*units.smallSpacing)*squares/4 Layout.minimumWidth: w1 < 20 ? 20 : w1 Layout.maximumWidth: Infinity @@ -62,15 +63,13 @@ readonly property int base: plasmoid.configuration.showBcdFormat ? 10 : 16 - readonly property int dots: showSeconds ? 6 : 4 - readonly property color onColor: plasmoid.configuration.useCustomColorForActive ? plasmoid.configuration.customColorForActive : theme.textColor readonly property color offColor: plasmoid.configuration.useCustomColorForInactive ? plasmoid.configuration.customColorForInactive : Qt.rgba(onColor.r, onColor.g, onColor.b, 0.4) readonly property color gridColor: plasmoid.configuration.useCustomColorForGrid ? plasmoid.configuration.customColorForGrid : Qt.rgba(onColor.r, onColor.g, onColor.b, 0.6) - readonly property int dotSize: Math.min((height-5*units.smallSpacing)/4, (width-(dots+1)*units.smallSpacing)/dots) - readonly property real displayTop: (height - 4*dotSize-3*units.smallSpacing)/2 - readonly property real displayLeft: (width - dots*dotSize-(dots-1)*units.smallSpacing)/2 + readonly property int squareSize: Math.min((height-5*units.smallSpacing)/4, (width-(squares+1)*units.smallSpacing)/squares) + readonly property real displayTop: (height - 4*squareSize-3*units.smallSpacing)/2 + readonly property real displayLeft: (width - squares*squareSize-(squares-1)*units.smallSpacing)/2 /* displaying calendar after clicking binary clock applet */ MouseArea { @@ -81,38 +80,38 @@ } /* hours */ - DotColumn { + SquareColumn { x: displayLeft y: displayTop val: hours/base } - DotColumn { - x: displayLeft+(dotSize+units.smallSpacing) + SquareColumn { + x: displayLeft+(squareSize+units.smallSpacing) y: displayTop val: hours%base } /* minutes */ - DotColumn { - x: displayLeft+(dotSize+units.smallSpacing)*2 + SquareColumn { + x: displayLeft+(squareSize+units.smallSpacing)*2 y: displayTop val: minutes/base } - DotColumn { - x: displayLeft+(dotSize+units.smallSpacing)*3 + SquareColumn { + x: displayLeft+(squareSize+units.smallSpacing)*3 y: displayTop val: minutes%base } /* seconds */ - DotColumn { - x: displayLeft+(dotSize+units.smallSpacing)*4 + SquareColumn { + x: displayLeft+(squareSize+units.smallSpacing)*4 y: displayTop val: seconds/base visible: showSeconds } - DotColumn { - x: displayLeft+(dotSize+units.smallSpacing)*5 + SquareColumn { + x: displayLeft+(squareSize+units.smallSpacing)*5 y: displayTop val: seconds%base visible: showSeconds @@ -122,7 +121,7 @@ Rectangle { x: displayLeft-units.smallSpacing y: displayTop-units.smallSpacing - width: dots*(dotSize+units.smallSpacing)+units.smallSpacing + width: squares*(squareSize+units.smallSpacing)+units.smallSpacing height: units.smallSpacing visible: showGrid color: gridColor @@ -133,8 +132,8 @@ x: displayLeft-units.smallSpacing y: displayTop width: units.smallSpacing - height: 4*(dotSize+units.smallSpacing) + height: 4*(squareSize+units.smallSpacing) visible: showGrid color: gridColor } -} +} \ No newline at end of file diff --git a/applets/binary-clock/package/contents/ui/Dot.qml b/applets/binary-clock/package/contents/ui/Square.qml rename from applets/binary-clock/package/contents/ui/Dot.qml rename to applets/binary-clock/package/contents/ui/Square.qml --- a/applets/binary-clock/package/contents/ui/Dot.qml +++ b/applets/binary-clock/package/contents/ui/Square.qml @@ -30,7 +30,7 @@ /* both active and inactive squares */ Rectangle { - width: main.dotSize + width: main.squareSize height: width color: (val & bit) ? main.onColor : main.offColor x: 0 @@ -42,19 +42,19 @@ Rectangle { visible: main.showGrid x: 0 - y: main.dotSize - width: main.dotSize + y: main.squareSize + width: main.squareSize height: units.smallSpacing color: main.gridColor } /* right border for each square */ Rectangle { visible: main.showGrid - x: main.dotSize + x: main.squareSize y: 0 width: units.smallSpacing - height: main.dotSize+units.smallSpacing + height: main.squareSize+units.smallSpacing color: main.gridColor } } \ No newline at end of file diff --git a/applets/binary-clock/package/contents/ui/DotColumn.qml b/applets/binary-clock/package/contents/ui/SquareColumn.qml rename from applets/binary-clock/package/contents/ui/DotColumn.qml rename to applets/binary-clock/package/contents/ui/SquareColumn.qml --- a/applets/binary-clock/package/contents/ui/DotColumn.qml +++ b/applets/binary-clock/package/contents/ui/SquareColumn.qml @@ -2,11 +2,11 @@ * Rewrite of the KDE4-Plasma Binary Clock for KF5/Plasma/QML * * Copyright 2014 Joseph Wenninger + * Copyright 2018 Piotr Kąkol * * Original code (KDE4): * Copyright 2007 by Riccardo Iaconelli * Copyright 2007 by Davide Bettio - * Copyright 2018 Piotr Kąkol * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -26,28 +26,28 @@ Item { property int val - Dot { + Square { x: 0 y: 0 val: parent.val bit: 8 } - Dot { + Square { x: 0 - y: (dotSize+units.smallSpacing) + y: (squareSize+units.smallSpacing) val: parent.val bit: 4 } - Dot { + Square { x: 0 - y: 2*(dotSize+units.smallSpacing) + y: 2*(squareSize+units.smallSpacing) val: parent.val bit: 2 } - Dot { + Square { x: 0 - y: 3*(dotSize+units.smallSpacing) + y: 3*(squareSize+units.smallSpacing) val: parent.val bit: 1 } } \ No newline at end of file diff --git a/applets/binary-clock/package/contents/ui/configGeneral.qml b/applets/binary-clock/package/contents/ui/configGeneral.qml --- a/applets/binary-clock/package/contents/ui/configGeneral.qml +++ b/applets/binary-clock/package/contents/ui/configGeneral.qml @@ -1,9 +1,9 @@ /* * Copyright 2014 Joseph Wenninger + * Copyright 2018 Piotr Kąkol * * Based on analog-clock configGeneral.qml: * Copyright 2013 David Edmundson - * Copyright 2018 Piotr Kąkol * * 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 diff --git a/applets/binary-clock/package/contents/ui/main.qml b/applets/binary-clock/package/contents/ui/main.qml --- a/applets/binary-clock/package/contents/ui/main.qml +++ b/applets/binary-clock/package/contents/ui/main.qml @@ -1,11 +1,11 @@ /* * Copyright 2014 Joseph Wenninger + * Copyright 2018 Piotr Kąkol * * Based on fuzzy-clock main.qml: * Copyright 2013 Heena Mahour * Copyright 2013 Sebastian Kügler * Copyright 2014 Kai Uwe Broulik - * Copyright 2018 Piotr Kąkol * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as