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 @@ -3,6 +3,7 @@ * * 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 @@ -29,4 +30,4 @@ icon: "preferences-desktop-color" source: "configGeneral.qml" } -} +} \ No newline at end of file diff --git a/applets/binary-clock/package/contents/config/main.xml b/applets/binary-clock/package/contents/config/main.xml --- a/applets/binary-clock/package/contents/config/main.xml +++ b/applets/binary-clock/package/contents/config/main.xml @@ -37,5 +37,4 @@ blue - - + \ No newline at end of file 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 @@ -2,9 +2,10 @@ * 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 Riccardo Iaconelli * Copyright 2007 by Davide Bettio * * Based on FuzzyClock.qml: @@ -42,11 +43,10 @@ Layout.maximumWidth: Infinity Layout.preferredWidth: Layout.minimumWidth - Layout.minimumHeight: 16+(units.smallSpacing * 5) - // Layout.maximumHeight: vertical ? Layout.minimumHeight : Infinity + Layout.minimumHeight: 16+(units.smallSpacing*5) + //Layout.maximumHeight: vertical ? Layout.minimumHeight : Infinity //Layout.preferredHeight: Layout.minimumHeight - readonly property int formFactor: plasmoid.formFactor readonly property bool constrained: formFactor == PlasmaCore.Types.Vertical || formFactor == PlasmaCore.Types.Horizontal @@ -60,82 +60,81 @@ readonly property bool showOffLeds: plasmoid.configuration.showOffLeds readonly property bool showGrid: plasmoid.configuration.showGrid - readonly property int base: plasmoid.configuration.showBcdFormat? 10:16 + readonly property int base: plasmoid.configuration.showBcdFormat ? 10 : 16 - readonly property int dots: showSeconds? 6:4 + 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 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 real 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 real 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 + /* displaying calendar after clicking binary clock applet */ MouseArea { - id: mouseArea + id: mouseArea anchors.fill: parent hoverEnabled: true - onClicked: plasmoid.expanded = !plasmoid.expanded + onClicked: plasmoid.expanded = !plasmoid.expanded } - - /*hours*/ + /* hours */ DotColumn { - x:displayLeft - y:displayTop - val:hours/base + x: displayLeft + y: displayTop + val: hours/base } DotColumn { - x:displayLeft+(dotSize+units.smallSpacing) - y:displayTop - val:hours%base + x: displayLeft+(dotSize+units.smallSpacing) + y: displayTop + val: hours%base } - - /*minutes*/ + /* minutes */ DotColumn { - x:displayLeft+(dotSize+units.smallSpacing)*2 - y:displayTop - val:minutes/base + x: displayLeft+(dotSize+units.smallSpacing)*2 + y: displayTop + val: minutes/base } DotColumn { - x:displayLeft+(dotSize+units.smallSpacing)*3 - y:displayTop - val:minutes%base + x: displayLeft+(dotSize+units.smallSpacing)*3 + y: displayTop + val: minutes%base } /* seconds */ DotColumn { - x:displayLeft+(dotSize+units.smallSpacing)*4 - y:displayTop - val:seconds/base - visible:showSeconds + x: displayLeft+(dotSize+units.smallSpacing)*4 + y: displayTop + val: seconds/base + visible: showSeconds } - DotColumn { - x:displayLeft+(dotSize+units.smallSpacing)*5 - y:displayTop - val:seconds%base - visible:showSeconds + x: displayLeft+(dotSize+units.smallSpacing)*5 + y: displayTop + val: seconds%base + visible: showSeconds } + /* upper grid border */ Rectangle { - x:displayLeft-units.smallSpacing - y:displayTop-units.smallSpacing - width:dots*(dotSize+units.smallSpacing)+units.smallSpacing - height:units.smallSpacing - visible:showGrid - color:gridColor + x: displayLeft-units.smallSpacing + y: displayTop-units.smallSpacing + width: dots*(dotSize+units.smallSpacing)+units.smallSpacing + height: units.smallSpacing + visible: showGrid + color: gridColor } + /* left grid border */ Rectangle { - x:displayLeft-units.smallSpacing - y:displayTop - width:units.smallSpacing - height:4*(dotSize+units.smallSpacing) - visible:showGrid - color:gridColor + x: displayLeft-units.smallSpacing + y: displayTop + width: units.smallSpacing + height: 4*(dotSize+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/Dot.qml --- a/applets/binary-clock/package/contents/ui/Dot.qml +++ b/applets/binary-clock/package/contents/ui/Dot.qml @@ -2,9 +2,10 @@ * 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 Riccardo Iaconelli * Copyright 2007 by Davide Bettio * * This program is free software; you can redistribute it and/or @@ -27,28 +28,33 @@ property int val property int bit + /* both active and inactive squares */ Rectangle { - width: main.dotSize - height: width - color: (val & bit) ? main.onColor:main.offColor - x:0 - y:0 - visible:main.showOffLeds || color!=main.offColor + width: main.dotSize + height: width + color: (val & bit) ? main.onColor : main.offColor + x: 0 + y: 0 + visible: main.showOffLeds || color != main.offColor } + + /* bottom border for each square */ Rectangle { - visible:main.showGrid - x:0 - y:main.dotSize - width:main.dotSize - height:units.smallSpacing - color:main.gridColor; + visible: main.showGrid + x: 0 + y: main.dotSize + width: main.dotSize + height: units.smallSpacing + color: main.gridColor } + + /* right border for each square */ Rectangle { - visible:main.showGrid - x:main.dotSize - y:0 - width:units.smallSpacing - height:main.dotSize+units.smallSpacing - color:main.gridColor + visible: main.showGrid + x: main.dotSize + y: 0 + width: units.smallSpacing + height: main.dotSize+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/DotColumn.qml --- a/applets/binary-clock/package/contents/ui/DotColumn.qml +++ b/applets/binary-clock/package/contents/ui/DotColumn.qml @@ -4,8 +4,9 @@ * Copyright 2014 Joseph Wenninger * * Original code (KDE4): - * Copyright 2007 by Riccardo Iaconelli * + * 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 @@ -23,31 +24,30 @@ import QtQuick 2.0 - Item { property int val Dot { - x:0 - y:0 - val:parent.val - bit:8 + x: 0 + y: 0 + val: parent.val + bit: 8 } Dot { - x:0 - y:(dotSize+units.smallSpacing) - val:parent.val - bit:4 + x: 0 + y: (dotSize+units.smallSpacing) + val: parent.val + bit: 4 } Dot { - x:0 - y:2*(dotSize+units.smallSpacing) - val:parent.val - bit:2 + x: 0 + y: 2*(dotSize+units.smallSpacing) + val: parent.val + bit: 2 } Dot { - x:0 - y:3*(dotSize+units.smallSpacing) - val:parent.val - bit:1 + x: 0 + y: 3*(dotSize+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 @@ -3,6 +3,7 @@ * * 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 @@ -24,7 +25,6 @@ import QtQuick.Layouts 1.1 import org.kde.kquickcontrols 2.0 as KQuickControls - ColumnLayout { id: generalConfigPage @@ -74,7 +74,7 @@ title: i18nc("@title:group", "Colors") GridLayout { - columns: 2; + columns: 2 QtControls.CheckBox { id: useCustomColorForActiveCheckBox text: i18nc("@option:check", "Use custom color for active LEDs") @@ -107,4 +107,4 @@ Item { // tighten layout Layout.fillHeight: true } -} +} \ No newline at end of file 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 @@ -5,6 +5,7 @@ * 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 @@ -19,6 +20,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + import QtQuick 2.0 import QtQuick.Layouts 1.1 @@ -31,23 +33,23 @@ Item { id: root - property bool showSeconds:plasmoid.configuration.showSeconds + property bool showSeconds: plasmoid.configuration.showSeconds property int hours property int minutes property int seconds width: units.gridUnit * 10 height: units.gridUnit * 4 Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation - Plasmoid.toolTipMainText: Qt.formatDate(dataSource.data["Local"]["DateTime"],"dddd") + Plasmoid.toolTipMainText: Qt.formatDate(dataSource.data["Local"]["DateTime"], "dddd") Plasmoid.toolTipSubText: Qt.formatDate(dataSource.data["Local"]["DateTime"], Qt.locale().dateFormat(Locale.LongFormat).replace(/(^dddd.?\s)|(,?\sdddd$)/, "")) PlasmaCore.DataSource { id: dataSource engine: "time" connectedSources: ["Local"] - interval: showSeconds?1000:30000 + interval: showSeconds ? 1000 : 30000 onDataChanged: { var date = new Date(data["Local"]["DateTime"]); hours = date.getHours(); @@ -67,4 +69,4 @@ today: dataSource.data["Local"]["DateTime"] } -} +} \ No newline at end of file diff --git a/applets/binary-clock/package/metadata.desktop b/applets/binary-clock/package/metadata.desktop --- a/applets/binary-clock/package/metadata.desktop +++ b/applets/binary-clock/package/metadata.desktop @@ -113,8 +113,8 @@ Type=Service X-KDE-ServiceTypes=Plasma/Applet -X-KDE-PluginInfo-Author=Joseph Wenninger,Davide Bettio -X-KDE-PluginInfo-Email=jowenn@kde.org, davide.bettio@kdemail.net +X-KDE-PluginInfo-Author=Joseph Wenninger,Davide Bettio,Piotr Kąkol +X-KDE-PluginInfo-Email=jowenn@kde.org, davide.bettio@kdemail.net, piotrkakol@protonmail.com X-KDE-PluginInfo-Name=org.kde.plasma.binaryclock X-KDE-PluginInfo-Version=2.0 X-KDE-PluginInfo-Website=plasma.kde.org