Add option to change clock separator

This commit is contained in:
qewer33 2022-01-02 12:22:42 +03:00
parent c51c4f1c43
commit feb1e5853a
3 changed files with 18 additions and 2 deletions

View file

@ -11,6 +11,10 @@
<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>true</default> <default>true</default>
</entry> </entry>
<entry name="clockSeparator" type="string">
<label>Sets the clock separator.</label>
<default>.</default>
</entry>
<entry name="clockFontColor" type="Color"> <entry name="clockFontColor" type="Color">
<label>Color of text</label> <label>Color of text</label>
<default>#ffffff</default> <default>#ffffff</default>

View file

@ -20,6 +20,7 @@ Item {
signal configurationChanged signal configurationChanged
property alias cfg_clockUse24hFormat: use24hFormat.checkState property alias cfg_clockUse24hFormat: use24hFormat.checkState
property alias cfg_clockSeparator: clockSeparatorTextField.text
property string cfg_clockFontColor property string cfg_clockFontColor
property string cfg_clockFontFamily property string cfg_clockFontFamily
property bool cfg_clockBoldText property bool cfg_clockBoldText
@ -108,6 +109,17 @@ Item {
checked: cfg_clockUse24hFormat checked: cfg_clockUse24hFormat
} }
QtLayouts.RowLayout {
QtControls.Label {
text: i18n("Separator:")
}
QtControls.TextField {
id: clockSeparatorTextField
maximumLength: 1
}
}
FontConfig { FontConfig {
fontModel: fontsModel fontModel: fontsModel

View file

@ -71,8 +71,8 @@ Item {
id: clockLabel id: clockLabel
anchors.centerIn: parent anchors.centerIn: parent
text: if (plasmoid.configuration.clockUse24hFormat) Qt.formatTime(currentDateTime, "hh.mm") text: if (plasmoid.configuration.clockUse24hFormat) Qt.formatTime(currentDateTime, "hh.mm").replace(".", plasmoid.configuration.clockSeparator)
else Qt.formatTime(currentDateTime, "hh.mm AP") else Qt.formatTime(currentDateTime, "hh.mm AP").replace(".", plasmoid.configuration.clockSeparator)
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