move cpu core consumer tracking into applet, move mpris art caching into service
This commit is contained in:
parent
baf4fd8bd1
commit
c96856581d
5 changed files with 27 additions and 32 deletions
|
|
@ -12,6 +12,19 @@ Column {
|
|||
|
||||
property bool active: true
|
||||
|
||||
property bool _coreActive: false
|
||||
onActiveChanged: {
|
||||
if (active && !_coreActive) {
|
||||
_coreActive = true;
|
||||
S.SystemStats.coreConsumers++;
|
||||
} else if (!active && _coreActive) {
|
||||
_coreActive = false;
|
||||
S.SystemStats.coreConsumers--;
|
||||
}
|
||||
}
|
||||
Component.onDestruction: if (_coreActive)
|
||||
S.SystemStats.coreConsumers--
|
||||
|
||||
// Per-core rows
|
||||
Repeater {
|
||||
model: root.cores.length
|
||||
|
|
|
|||
|
|
@ -374,6 +374,7 @@ PanelWindow {
|
|||
players: S.MprisService.players
|
||||
playing: S.MprisService.playing
|
||||
accentColor: root._accent
|
||||
cachedArt: S.MprisService.cachedArt
|
||||
playerIdx: S.MprisService.playerIdx
|
||||
onPlayerSwitched: idx => S.MprisService.switchPlayer(idx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,18 +27,6 @@ M.BarModule {
|
|||
readonly property var _coreMaxFreq: S.SystemStats.cpuCoreMaxFreq
|
||||
readonly property var _coreTypes: S.SystemStats.cpuCoreTypes
|
||||
|
||||
property bool _coreConsumerActive: false
|
||||
|
||||
on_ShowPanelChanged: {
|
||||
if (_showPanel && !_coreConsumerActive) {
|
||||
_coreConsumerActive = true;
|
||||
S.SystemStats.coreConsumers++;
|
||||
} else if (!_showPanel && _coreConsumerActive) {
|
||||
_coreConsumerActive = false;
|
||||
S.SystemStats.coreConsumers--;
|
||||
}
|
||||
}
|
||||
|
||||
property M.ProcessList _procs: M.ProcessList {
|
||||
sortBy: "cpu"
|
||||
active: root._showPanel
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ M.BarModule {
|
|||
players: root._players
|
||||
playing: root.playing
|
||||
accentColor: root.accentColor
|
||||
cachedArt: root._cachedArt
|
||||
cachedArt: S.MprisService.cachedArt
|
||||
cavaBars: root._cavaBars
|
||||
playerIdx: S.MprisService.playerIdx
|
||||
onPlayerSwitched: idx => {
|
||||
|
|
@ -35,25 +35,6 @@ M.BarModule {
|
|||
readonly property var _players: S.MprisService.players
|
||||
readonly property MprisPlayer player: S.MprisService.player
|
||||
readonly property bool playing: S.MprisService.playing
|
||||
property string _cachedArt: ""
|
||||
property string _artTrack: ""
|
||||
|
||||
readonly property string _artUrl: player?.trackArtUrl ?? ""
|
||||
readonly property string _currentTrack: player?.trackTitle ?? ""
|
||||
on_ArtUrlChanged: if (_artUrl)
|
||||
_cachedArt = _artUrl
|
||||
on_CurrentTrackChanged: if (_currentTrack !== _artTrack) {
|
||||
_artTrack = _currentTrack;
|
||||
_cachedArt = _artUrl || "";
|
||||
}
|
||||
|
||||
// Preload art while panel is hidden
|
||||
Image {
|
||||
visible: false
|
||||
source: root._cachedArt
|
||||
asynchronous: true
|
||||
}
|
||||
|
||||
// Cava visualizer - 16 bars, raw output mode
|
||||
property var _cavaBars: Array(16).fill(0)
|
||||
property bool _cavaActive: false
|
||||
|
|
|
|||
|
|
@ -118,6 +118,18 @@ QtObject {
|
|||
_selectedIdentity = players[chosen].identity ?? "";
|
||||
}
|
||||
|
||||
// Album art caching - persists across panel/dock collapse
|
||||
property string cachedArt: ""
|
||||
property string _artTrack: ""
|
||||
readonly property string _artUrl: player?.trackArtUrl ?? ""
|
||||
readonly property string _currentTrack: player?.trackTitle ?? ""
|
||||
on_ArtUrlChanged: if (_artUrl)
|
||||
cachedArt = _artUrl
|
||||
on_CurrentTrackChanged: if (_currentTrack !== _artTrack) {
|
||||
_artTrack = _currentTrack;
|
||||
cachedArt = _artUrl || "";
|
||||
}
|
||||
|
||||
function switchPlayer(idx) {
|
||||
playerIdx = idx;
|
||||
if (players[idx])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue