Commit be06f0b7 authored by Piotr Kąkol's avatar Piotr Kąkol Committed by David Edmundson
Browse files

Allow users to change the format to BCD (decimal) in Binary Clock widget

Hours, minutes and seconds are in hexadecimal system. This is sexagesimal format according to Wikipedia. In Plasma4 the format was BCD (Binary-coded decimal) which means that each digit was encoded separately in decimal system.

My fix allows users to choose the format in config. By default the sexagesimal format is used since that was the format after porting the widget to Plasma5.

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10434
parent 4af3ad01
......@@ -15,6 +15,9 @@
<entry name="showSeconds" type="Bool">
<default>true</default>
</entry>
<entry name="showBcdFormat" type="Bool">
<default>false</default>
</entry>
<entry name="useCustomColorForActive" type="Bool">
<default>false</default>
</entry>
......
......@@ -60,6 +60,8 @@ Item {
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
......@@ -83,14 +85,12 @@ Item {
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
}
......@@ -98,30 +98,26 @@ Item {
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
}
......
......@@ -26,29 +26,28 @@ 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<<startbit
bit:1
}
}
......@@ -35,6 +35,7 @@ QtControls.GroupBox {
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
......@@ -67,6 +68,10 @@ QtControls.GroupBox {
id: showSecondsCheckBox
text: i18n("Display seconds")
}
QtControls.CheckBox {
id: showBcdFormatCheckBox
text: i18n("Display in BCD format (decimal)")
}
QtControls.Label {
text: i18n("Colors:")
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment