pragma Singleton import QtQuick import NovaStats as NS import "." as M QtObject { id: root // ── Temperature ────────────────────────────────────────────────────── readonly property int tempCelsius: NS.SystemStatsService.tempCelsius readonly property var tempHistory: NS.SystemStatsService.tempHistory // tempDevices arrives as QList JSON; parse into [{name, celsius}] readonly property var tempDevices: { let raw = NS.SystemStatsService.tempDevices; let out = []; for (let i = 0; i < raw.length; i++) out.push(JSON.parse(raw[i])); return out; } // ── GPU ────────────────────────────────────────────────────────────── readonly property bool gpuAvailable: NS.SystemStatsService.gpuAvailable readonly property string gpuVendor: NS.SystemStatsService.gpuVendor readonly property int gpuUsage: NS.SystemStatsService.gpuUsage readonly property real gpuVramUsedGb: NS.SystemStatsService.gpuVramUsedGb readonly property real gpuVramTotalGb: NS.SystemStatsService.gpuVramTotalGb readonly property int gpuTempC: NS.SystemStatsService.gpuTempC readonly property var gpuHistory: NS.SystemStatsService.gpuHistory // ── Memory ─────────────────────────────────────────────────────────── readonly property int memPercent: NS.SystemStatsService.memPercent readonly property real memUsedGb: NS.SystemStatsService.memUsedGb readonly property real memTotalGb: NS.SystemStatsService.memTotalGb readonly property real memAvailGb: NS.SystemStatsService.memAvailGb readonly property real memCachedGb: NS.SystemStatsService.memCachedGb readonly property real memBuffersGb: NS.SystemStatsService.memBuffersGb readonly property var memHistory: NS.SystemStatsService.memHistory // ── Disk ───────────────────────────────────────────────────────────── // diskMounts arrives as QList JSON; parse into [{target, pct, usedBytes, totalBytes}] readonly property var diskMounts: { let raw = NS.SystemStatsService.diskMounts; let out = []; for (let i = 0; i < raw.length; i++) out.push(JSON.parse(raw[i])); return out; } readonly property int diskRootPct: NS.SystemStatsService.diskRootPct // ── Polling ────────────────────────────────────────────────────────── // Drive the Rust service from QML timers; both intervals read from Modules config. property Timer _statsTimer: Timer { interval: { const ms = M.Modules.statsDaemon.interval; return ms > 0 ? ms : 4000; } running: true repeat: true triggeredOnStart: true onTriggered: NS.SystemStatsService.poll() } property Timer _diskTimer: Timer { interval: M.Modules.disk.interval || 30000 running: true repeat: true triggeredOnStart: true onTriggered: NS.SystemStatsService.pollDisk() } }