mirror of
https://github.com/NohamR/xovi-qmd-extensions.git
synced 2026-07-11 22:42:39 +00:00
Add 3.27.3.0 QMD extensions and README
This commit is contained in:
62
3.27.3.0/clock.qmd
Normal file
62
3.27.3.0/clock.qmd
Normal file
@@ -0,0 +1,62 @@
|
||||
; credit for the original clock implementation: https://github.com/StarNumber12046/xovi-qmd-extensions/blob/main/clock.qmd
|
||||
AFFECT /qml/device/view/navigator/Sidebar.qml
|
||||
TRAVERSE DeviceKeyboardNavigationHandler > ColumnLayout#filterColumn
|
||||
LOCATE BEFORE SidebarFilterItem#filterMyFiles
|
||||
INSERT {
|
||||
SidebarFilterItem {
|
||||
id: clockSidebarItem
|
||||
objectName: "clockSidebarObject"
|
||||
title: Qt.formatDateTime(getCestTime(), set_Format_Date)
|
||||
iconSource: "qrc:/ark/icons/system_clock"
|
||||
active: false
|
||||
enabled: true
|
||||
|
||||
/* 1000 = 1 second / 60000 = 1 minute */
|
||||
property int set_Timer: 60000
|
||||
property string set_Format_Date: "dd/MM hh:mm"
|
||||
|
||||
function getCestTime() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
title = Qt.formatDateTime(getCestTime(), set_Format_Date);
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
|
||||
if (clockSidebarItem.set_Timer === 60000) {
|
||||
clockSidebarItem.set_Timer = 1000;
|
||||
clockSidebarItem.set_Format_Date = "dd/MM hh:mm:ss";
|
||||
} else {
|
||||
clockSidebarItem.set_Timer = 60000;
|
||||
clockSidebarItem.set_Format_Date = "dd/MM hh:mm";
|
||||
}
|
||||
|
||||
timer.interval = clockSidebarItem.set_Timer
|
||||
clockSidebarItem.title = Qt.formatDateTime(clockSidebarItem.getCestTime(), clockSidebarItem.set_Format_Date);
|
||||
}
|
||||
|
||||
/* Timer for update time */
|
||||
Timer {
|
||||
id: timer
|
||||
interval: clockSidebarItem.set_Timer
|
||||
repeat: true
|
||||
running: true
|
||||
|
||||
onTriggered: {
|
||||
clockSidebarItem.title = Qt.formatDateTime(clockSidebarItem.getCestTime(), clockSidebarItem.set_Format_Date);
|
||||
}
|
||||
}
|
||||
|
||||
Layout.preferredHeight: Values.navigatorSidebarItemHeight
|
||||
Layout.preferredWidth: parent.width
|
||||
navigationHandler: root
|
||||
|
||||
function activate() {
|
||||
toggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
END TRAVERSE
|
||||
END AFFECT
|
||||
Reference in New Issue
Block a user