diff --git a/applets/binary-clock/package/contents/config/main.xml b/applets/binary-clock/package/contents/config/main.xml index 86bc47bfc..68dd12a00 100644 --- a/applets/binary-clock/package/contents/config/main.xml +++ b/applets/binary-clock/package/contents/config/main.xml @@ -1,38 +1,41 @@ true true true + + false + false green false red false blue diff --git a/applets/binary-clock/package/contents/ui/BinaryClock.qml b/applets/binary-clock/package/contents/ui/BinaryClock.qml index b8f0befff..21270924a 100644 --- a/applets/binary-clock/package/contents/ui/BinaryClock.qml +++ b/applets/binary-clock/package/contents/ui/BinaryClock.qml @@ -1,146 +1,142 @@ /* * Rewrite of the KDE4-Plasma Binary Clock for KF5/Plasma/QML * * Copyright 2014 Joseph Wenninger * * Original code (KDE4): * Copyright 2007 by Riccardo Iaconelli * * Copyright 2007 by Davide Bettio * * Based on FuzzyClock.qml: * Copyright 2013 Heena Mahour * Copyright 2013 Sebastian Kügler * Copyright 2013 Martin Klapetek * Copyright 2014 David Edmundson * Copyright 2014 Kai Uwe Broulik * * 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; either version 2 of * the License, or (at your option) any later version. * * 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 . */ import QtQuick 2.0 import QtQuick.Layouts 1.1 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as Components Item { id: main property real w1: (main.height-5*units.smallSpacing)*dots/4 Layout.minimumWidth: w1 < 20 ? 20 : w1 Layout.maximumWidth: Infinity Layout.preferredWidth: Layout.minimumWidth Layout.minimumHeight: 16+(units.smallSpacing * 5) // Layout.maximumHeight: vertical ? Layout.minimumHeight : Infinity //Layout.preferredHeight: Layout.minimumHeight property int formFactor: plasmoid.formFactor property int timePixelSize: theme.defaultFont.pixelSize property bool constrained: formFactor == PlasmaCore.Types.Vertical || formFactor == PlasmaCore.Types.Horizontal property bool showSeconds: root.showSeconds property int hours:root.hours property int minutes:root.minutes property int seconds:root.seconds property bool showOffLeds: plasmoid.configuration.showOffLeds property bool showGrid: plasmoid.configuration.showGrid + + property int base: plasmoid.configuration.showBcdFormat? 10:16 property int dots: showSeconds? 6:4 property color onColor: plasmoid.configuration.useCustomColorForActive?plasmoid.configuration.customColorForActive: theme.textColor property color offColor: plasmoid.configuration.useCustomColorForInactive?plasmoid.configuration.customColorForInactive:Qt.rgba(onColor.r,onColor.g,onColor.b,0.4) property color gridColor: plasmoid.configuration.useCustomColorForGrid?plasmoid.configuration.customColorForGrid:Qt.rgba(onColor.r,onColor.g,onColor.b,0.6) property real dotSize: Math.min((height-5*units.smallSpacing)/4,(width-(dots+1)*units.smallSpacing)/dots) property real displayTop: (height - 4*dotSize-3*units.smallSpacing) /2 property real displayLeft: (width - dots*dotSize-(dots-1)*units.smallSpacing) /2 MouseArea { id: mouseArea anchors.fill: parent hoverEnabled: true onClicked: plasmoid.expanded = !plasmoid.expanded } /*hours*/ DotColumn { x:displayLeft y:displayTop - val:hours - startbit:4 + val:hours/base } DotColumn { x:displayLeft+(dotSize+units.smallSpacing) y:displayTop - val:hours - startbit:0 + val:hours%base } /*minutes*/ DotColumn { x:displayLeft+(dotSize+units.smallSpacing)*2 y:displayTop - val:minutes - startbit:4 + val:minutes/base } DotColumn { x:displayLeft+(dotSize+units.smallSpacing)*3 y:displayTop - val:minutes - startbit:0 + val:minutes%base } /* seconds */ DotColumn { x:displayLeft+(dotSize+units.smallSpacing)*4 y:displayTop - val:seconds - startbit:4 + val:seconds/base visible:showSeconds } DotColumn { x:displayLeft+(dotSize+units.smallSpacing)*5 y:displayTop - val:seconds - startbit:0 + val:seconds%base visible:showSeconds } Rectangle { x:displayLeft-units.smallSpacing y:displayTop-units.smallSpacing width:dots*(dotSize+units.smallSpacing)+units.smallSpacing height:units.smallSpacing visible:showGrid color:gridColor } Rectangle { x:displayLeft-units.smallSpacing y:displayTop width:units.smallSpacing height:4*(dotSize+units.smallSpacing) visible:showGrid color:gridColor } } diff --git a/applets/binary-clock/package/contents/ui/DotColumn.qml b/applets/binary-clock/package/contents/ui/DotColumn.qml index 3e32c6ab0..43ef130d8 100644 --- a/applets/binary-clock/package/contents/ui/DotColumn.qml +++ b/applets/binary-clock/package/contents/ui/DotColumn.qml @@ -1,54 +1,53 @@ /* * Rewrite of the KDE4-Plasma Binary Clock for KF5/Plasma/QML * * Copyright 2014 Joseph Wenninger * * Original code (KDE4): * Copyright 2007 by Riccardo Iaconelli * * Copyright 2007 by Davide Bettio * * 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; either version 2 of * the License, or (at your option) any later version. * * 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 . */ import QtQuick 2.0 Item { property int val - property int startbit Dot { x:0 y:0 val:parent.val - bit:1<<(startbit+3) + bit:8 } Dot { x:0 y:(dotSize+units.smallSpacing) val:parent.val - bit:1<<(startbit+2) + bit:4 } Dot { x:0 y:2*(dotSize+units.smallSpacing) val:parent.val - bit:1<<(startbit+1) + bit:2 } Dot { x:0 y:3*(dotSize+units.smallSpacing) val:parent.val - bit:1< * * Based on analog-clock configGeneral.qml: * Copyright 2013 David Edmundson * * 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; either version 2 of the License, or * (at your option) any later version. * * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 2.0 import QtQuick.Controls 1.0 as QtControls import QtQuick.Dialogs 1.1 import QtQuick.Layouts 1.1 QtControls.GroupBox { width: childrenRect.width height: childrenRect.height flat: true title: i18n("Appearance") property alias cfg_showGrid: showGridCheckBox.checked property alias cfg_showOffLeds: showOffLedsCheckBox.checked property alias cfg_showSeconds: showSecondsCheckBox.checked + property alias cfg_showBcdFormat: showBcdFormatCheckBox.checked property alias cfg_useCustomColorForActive: useCustomColorForActiveCheckBox.checked property alias cfg_customColorForActive: customColorForActive.color property alias cfg_useCustomColorForInactive: useCustomColorForInactiveCheckBox.checked property alias cfg_customColorForInactive: customColorForInactive.color property alias cfg_useCustomColorForGrid: useCustomColorForGridCheckBox.checked property alias cfg_customColorForGrid: customColorForGrid.color ColorDialog { property var element; id: colorDialog visible: false modality: Qt.WindowModal title: "Choose a color" showAlphaChannel: true onAccepted: { element.color=color } onRejected: { } } ColumnLayout { QtControls.CheckBox { id: showGridCheckBox text: i18n("Draw grid") } QtControls.CheckBox { id: showOffLedsCheckBox text: i18n("Show inactive LEDs:") } QtControls.CheckBox { id: showSecondsCheckBox text: i18n("Display seconds") } + QtControls.CheckBox { + id: showBcdFormatCheckBox + text: i18n("Display in BCD format (decimal)") + } QtControls.Label { text: i18n("Colors:") } GridLayout { columns: 2; QtControls.CheckBox { id: useCustomColorForActiveCheckBox text: i18n("Use custom color for active LEDs") } Rectangle { width:20 height:20 id:customColorForActive MouseArea { anchors.fill: parent onClicked: { colorDialog.element=parent; colorDialog.color=parent.color; colorDialog.open(); } } } QtControls.CheckBox { id: useCustomColorForInactiveCheckBox text: i18n("Use custom color for inactive LEDs") } Rectangle { width:20 height:20 id:customColorForInactive MouseArea { anchors.fill: parent onClicked: { colorDialog.element=parent; colorDialog.color=parent.color; colorDialog.open(); } } } QtControls.CheckBox { id: useCustomColorForGridCheckBox text: i18n("Use custom color for grid") } Rectangle { width:20 height:20 id:customColorForGrid MouseArea { anchors.fill: parent onClicked: { colorDialog.element=parent; colorDialog.color=parent.color; colorDialog.open(); } } } } } }