mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 02:04:45 +00:00
time
This commit is contained in:
parent
3380134a97
commit
21afca51f1
1 changed files with 64 additions and 0 deletions
|
|
@ -17,6 +17,45 @@ Leaves {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: dataSource
|
||||||
|
engine: "time"
|
||||||
|
connectedSources: "Local"
|
||||||
|
interval: 30000
|
||||||
|
|
||||||
|
onDataChanged: {
|
||||||
|
var date = new Date(data["Local"]["DateTime"]);
|
||||||
|
hour.text = date.getHours();
|
||||||
|
minute.text = date.getMinutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
onDataChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: hour
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
if (text.length < 2) {
|
||||||
|
minute.text = "0" + text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: stripe.top
|
||||||
|
}
|
||||||
|
color: "white" // FIXME: base on wallpaper?
|
||||||
|
text: "00"
|
||||||
|
font.pixelSize: Math.floor((width - (units.largeSpacing)) / 2)
|
||||||
|
horizontalAlignment: Qt.AlignCenter
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
SatelliteStripe {
|
SatelliteStripe {
|
||||||
id: stripe
|
id: stripe
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
@ -24,6 +63,7 @@ Leaves {
|
||||||
function lockKeyPressed(id) {
|
function lockKeyPressed(id) {
|
||||||
hideTimer.stop();
|
hideTimer.stop();
|
||||||
console.log(id);
|
console.log(id);
|
||||||
|
console.log((width - (units.largeSpacing * 3)) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function lockKeyReleased(id) {
|
function lockKeyReleased(id) {
|
||||||
|
|
@ -92,4 +132,28 @@ Leaves {
|
||||||
elementId: "triangle"
|
elementId: "triangle"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: minute
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
if (text.length < 2) {
|
||||||
|
minute.text = "0" + text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: stripe.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
color: "white" // FIXME: base on wallpaper?
|
||||||
|
text: "00"
|
||||||
|
font.pixelSize: Math.floor((width - (units.largeSpacing)) / 2)
|
||||||
|
horizontalAlignment: Qt.AlignCenter
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue