Made 24 hour setting work

This commit is contained in:
qewer33 2021-12-20 21:16:14 +03:00
parent 4c69469ebe
commit 6ff1f2450e
3 changed files with 6 additions and 3 deletions

View file

@ -7,9 +7,9 @@
<group name="Appearance"> <group name="Appearance">
<!-- Clock Display Settings --> <!-- Clock Display Settings -->
<entry name="clockUse24hFormat" type="UInt"> <entry name="clockUse24hFormat" type="Bool">
<label>Force the clock to use 12/24 hour time, instead of following the user locale.</label> <label>Force the clock to use 12/24 hour time, instead of following the user locale.</label>
<default>1</default> <default>true</default>
</entry> </entry>
<entry name="clockFontColor" type="Color"> <entry name="clockFontColor" type="Color">
<label>Color of text</label> <label>Color of text</label>

View file

@ -104,6 +104,8 @@ Item {
QtControls.CheckBox { QtControls.CheckBox {
id: use24hFormat id: use24hFormat
text: i18n("Use 24-hour clock") text: i18n("Use 24-hour clock")
tristate: false
checked: cfg_clockUse24hFormat
} }
QtLayouts.RowLayout { QtLayouts.RowLayout {

View file

@ -71,7 +71,8 @@ Item {
id: clockLabel id: clockLabel
anchors.centerIn: parent anchors.centerIn: parent
text: Qt.formatTime(currentDateTime).replace(":", ".") text: if (plasmoid.configuration.clockUse24hFormat) Qt.formatTime(currentDateTime, "hh.mm")
else Qt.formatTime(currentDateTime, "hh.mm AP")
color: plasmoid.configuration.clockFontColor color: plasmoid.configuration.clockFontColor
font.family: if (plasmoid.configuration.clockFontFamily === "ccdefault") fontOutfitBold.name font.family: if (plasmoid.configuration.clockFontFamily === "ccdefault") fontOutfitBold.name