mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-26 14:32:52 -05:00
meta cleanup and refactors
This commit is contained in:
@@ -31,10 +31,6 @@ Column {
|
||||
loadEventsForMonth();
|
||||
}
|
||||
Component.onCompleted: {
|
||||
console.log("CalendarWidget: Component completed, CalendarService available:", !!CalendarService);
|
||||
if (CalendarService)
|
||||
console.log("CalendarWidget: khal available:", CalendarService.khalAvailable);
|
||||
|
||||
loadEventsForMonth();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,11 @@ PanelWindow {
|
||||
property bool calendarVisible: false
|
||||
|
||||
visible: calendarVisible
|
||||
onVisibleChanged: {
|
||||
if (visible && CalendarService) {
|
||||
CalendarService.loadCurrentMonth();
|
||||
}
|
||||
}
|
||||
implicitWidth: 480
|
||||
implicitHeight: 600
|
||||
WlrLayershell.layer: WlrLayershell.Overlay
|
||||
|
||||
@@ -23,9 +23,9 @@ Rectangle {
|
||||
|
||||
onActivePlayerChanged: {
|
||||
if (!activePlayer)
|
||||
clearCacheTimer.restart();
|
||||
updateTimer.start();
|
||||
else
|
||||
clearCacheTimer.stop();
|
||||
updateTimer.stop();
|
||||
}
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
@@ -36,30 +36,28 @@ Rectangle {
|
||||
layer.enabled: true
|
||||
|
||||
Timer {
|
||||
id: clearCacheTimer
|
||||
id: updateTimer
|
||||
|
||||
interval: 2000
|
||||
running: {
|
||||
// Run when no active player (for cache clearing) OR when playing (for position updates)
|
||||
return (!activePlayer) ||
|
||||
(activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing &&
|
||||
activePlayer.length > 0 && !progressMouseArea.isSeeking);
|
||||
}
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (!activePlayer) {
|
||||
// Clear cache when no player
|
||||
lastValidTitle = "";
|
||||
lastValidArtist = "";
|
||||
lastValidAlbum = "";
|
||||
lastValidArtUrl = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Updates progress bar every 2 seconds when playing
|
||||
Timer {
|
||||
id: positionTimer
|
||||
|
||||
interval: 2000
|
||||
running: activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing && activePlayer.length > 0 && !progressMouseArea.isSeeking
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (activePlayer && activePlayer.playbackState === MprisPlaybackState.Playing && !progressMouseArea.isSeeking)
|
||||
stop(); // Stop after clearing cache
|
||||
} else if (activePlayer.playbackState === MprisPlaybackState.Playing && !progressMouseArea.isSeeking) {
|
||||
// Update position when playing
|
||||
currentPosition = activePlayer.position;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user