From 6deb03990684c2fad136512b201cafc7d4ecf841 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Sun, 31 Aug 2025 07:34:59 +0200 Subject: [PATCH] Autoformat --- Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml | 20 +++++++++---------- Services/ArchUpdaterService.qml | 19 +++++++++--------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml b/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml index f0594e6..1e3ad5f 100644 --- a/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml +++ b/Modules/ArchUpdaterPanel/ArchUpdaterPanel.qml @@ -13,8 +13,6 @@ NPanel { panelHeight: 500 * scaling panelAnchorRight: true - - panelContent: Rectangle { color: Color.mSurface radius: Style.radiusL * scaling @@ -70,7 +68,8 @@ NPanel { // Update summary (only show when packages are available) NText { - visible: !ArchUpdaterService.updateInProgress && !ArchUpdaterService.updateFailed && !ArchUpdaterService.aurBusy && ArchUpdaterService.totalUpdates > 0 + visible: !ArchUpdaterService.updateInProgress && !ArchUpdaterService.updateFailed && !ArchUpdaterService.aurBusy + && ArchUpdaterService.totalUpdates > 0 text: ArchUpdaterService.totalUpdates + " package" + (ArchUpdaterService.totalUpdates !== 1 ? "s" : "") + " can be updated" font.pointSize: Style.fontSizeL * scaling font.weight: Style.fontWeightMedium @@ -80,7 +79,8 @@ NPanel { // Package selection info (only show when not updating and have packages) NText { - visible: !ArchUpdaterService.updateInProgress && !ArchUpdaterService.updateFailed && !ArchUpdaterService.aurBusy && ArchUpdaterService.totalUpdates > 0 + visible: !ArchUpdaterService.updateInProgress && !ArchUpdaterService.updateFailed && !ArchUpdaterService.aurBusy + && ArchUpdaterService.totalUpdates > 0 text: ArchUpdaterService.selectedPackagesCount + " of " + ArchUpdaterService.totalUpdates + " packages selected" font.pointSize: Style.fontSizeS * scaling color: Color.mOnSurfaceVariant @@ -181,7 +181,8 @@ NPanel { Item { Layout.fillWidth: true Layout.fillHeight: true - visible: !ArchUpdaterService.updateInProgress && !ArchUpdaterService.updateFailed && !ArchUpdaterService.aurBusy && ArchUpdaterService.totalUpdates === 0 + visible: !ArchUpdaterService.updateInProgress && !ArchUpdaterService.updateFailed && !ArchUpdaterService.aurBusy + && ArchUpdaterService.totalUpdates === 0 ColumnLayout { anchors.centerIn: parent @@ -217,8 +218,7 @@ NPanel { Item { Layout.fillWidth: true Layout.fillHeight: true - visible: ArchUpdaterService.aurBusy && !ArchUpdaterService.updateInProgress - && !ArchUpdaterService.updateFailed + visible: ArchUpdaterService.aurBusy && !ArchUpdaterService.updateInProgress && !ArchUpdaterService.updateFailed ColumnLayout { anchors.centerIn: parent @@ -251,7 +251,8 @@ NPanel { // Package list (only show when not in any special state) NBox { - visible: !ArchUpdaterService.updateInProgress && !ArchUpdaterService.updateFailed && !ArchUpdaterService.aurBusy && ArchUpdaterService.totalUpdates > 0 + visible: !ArchUpdaterService.updateInProgress && !ArchUpdaterService.updateFailed && !ArchUpdaterService.aurBusy + && ArchUpdaterService.totalUpdates > 0 Layout.fillWidth: true Layout.fillHeight: true @@ -344,8 +345,7 @@ NPanel { NIconButton { icon: "refresh" - tooltipText: ArchUpdaterService.aurBusy ? "Checking for updates..." : - (!ArchUpdaterService.canPoll ? "Refresh available soon" : "Refresh package lists") + tooltipText: ArchUpdaterService.aurBusy ? "Checking for updates..." : (!ArchUpdaterService.canPoll ? "Refresh available soon" : "Refresh package lists") onClicked: { ArchUpdaterService.forceRefresh() } diff --git a/Services/ArchUpdaterService.qml b/Services/ArchUpdaterService.qml index 427163e..0afd3d7 100644 --- a/Services/ArchUpdaterService.qml +++ b/Services/ArchUpdaterService.qml @@ -29,7 +29,7 @@ Singleton { readonly property int updates: repoPackages.length readonly property int aurUpdates: aurPackages.length readonly property int totalUpdates: updates + aurUpdates - + // Polling cooldown (prevent excessive polling) property int lastPollTime: 0 readonly property int pollCooldownMs: 5 * 60 * 1000 // 5 minutes @@ -224,8 +224,6 @@ Singleton { // PACKAGE CHECKING PROCESSES // ============================================================================ - - // Process for checking all updates with AUR helper (repo + AUR) Process { id: checkAurUpdatesProcess @@ -260,7 +258,8 @@ Singleton { stdout: StdioCollector { onStreamFinished: { parseAllUpdatesOutput(allUpdatesOutput, text) - Logger.log("ArchUpdater", "found", repoPackages.length, "repo package(s) and", aurPackages.length, "AUR package(s) to upgrade") + Logger.log("ArchUpdater", "found", repoPackages.length, "repo package(s) and", aurPackages.length, + "AUR package(s) to upgrade") } } } @@ -301,7 +300,7 @@ Singleton { function parseAllUpdatesOutput(allOutput, aurOnlyOutput) { const allLines = allOutput.trim().split('\n').filter(line => line.trim()) const aurOnlyLines = aurOnlyOutput.trim().split('\n').filter(line => line.trim()) - + // Create a set of AUR package names for quick lookup const aurPackageNames = new Set() for (const line of aurOnlyLines) { @@ -310,7 +309,7 @@ Singleton { aurPackageNames.add(m[1]) } } - + const repoPackages = [] const aurPackages = [] @@ -323,7 +322,7 @@ Singleton { "newVersion": m[3], "description": `${m[1]} ${m[2]} -> ${m[3]}` } - + // Check if this package is in the AUR-only list if (aurPackageNames.has(m[1])) { packageInfo.source = "aur" @@ -347,13 +346,13 @@ Singleton { if (aurBusy || !canPoll) { return } - + // Get the AUR helper and set commands const aurHelper = getAurHelper() if (aurHelper) { checkAurUpdatesProcess.command = [aurHelper, "-Qu"] checkAurOnlyProcess.command = [aurHelper, "-Qua"] - + // Start AUR updates check (includes both repo and AUR packages) checkAurUpdatesProcess.running = true lastPollTime = Date.now() @@ -491,7 +490,7 @@ Singleton { if (aurHelper) { checkAurUpdatesProcess.command = [aurHelper, "-Qu"] checkAurOnlyProcess.command = [aurHelper, "-Qua"] - + // Force refresh by bypassing cooldown checkAurUpdatesProcess.running = true lastPollTime = Date.now()