mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 18:24:46 +00:00
Apply settings 12/24 hour time format to lockscreen and panel time
This commit is contained in:
parent
a857dbc299
commit
cd4bf8d7c3
4 changed files with 7 additions and 3 deletions
|
|
@ -217,8 +217,10 @@ Item {
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: clock
|
id: clock
|
||||||
|
property bool is24HourTime: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().indexOf("ap") === -1
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm")
|
text: Qt.formatTime(timeSource.data.Local.DateTime, is24HourTime ? "h:mm" : "h:mm ap")
|
||||||
color: PlasmaCore.ColorScope.textColor
|
color: PlasmaCore.ColorScope.textColor
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ ColumnLayout {
|
||||||
spacing: units.gridUnit
|
spacing: units.gridUnit
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: Qt.formatTime(timeSource.data["Local"]["DateTime"], "h:mm ap")
|
text: Qt.formatTime(timeSource.data["Local"]["DateTime"], root.is24HourTime ? "h:mm" : "h:mm ap")
|
||||||
color: ColorScope.textColor
|
color: ColorScope.textColor
|
||||||
style: softwareRendering ? Text.Outline : Text.Normal
|
style: softwareRendering ? Text.Outline : Text.Normal
|
||||||
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" // no outline, doesn't matter
|
styleColor: softwareRendering ? ColorScope.backgroundColor : "transparent" // no outline, doesn't matter
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ PlasmaCore.ColorScope {
|
||||||
property bool isWidescreen: root.height < root.width * 0.75
|
property bool isWidescreen: root.height < root.width * 0.75
|
||||||
property bool notificationsShown: phoneNotificationsList.count !== 0
|
property bool notificationsShown: phoneNotificationsList.count !== 0
|
||||||
|
|
||||||
|
property bool is24HourTime: Qt.locale().timeFormat(Locale.ShortFormat).toLowerCase().indexOf("ap") === -1
|
||||||
|
|
||||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ PlasmaCore.ColorScope {
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: clock
|
id: clock
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm")
|
text: Qt.formatTime(timeSource.data.Local.DateTime, root.is24HourTime ? "h:mm" : "h:mm ap")
|
||||||
color: PlasmaCore.ColorScope.textColor
|
color: PlasmaCore.ColorScope.textColor
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue