On main: cline checkpoint session=1789145782869_xv3bv run=1
This commit is contained in:
commit
253dd21464
11 files changed
+700
-112
No files matched your search
+33
-1
@@ -10,6 +10,7 @@
|
||||
#include <QComboBox>
|
||||
#include <QThread>
|
||||
#include <QSettings>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -28,6 +29,7 @@ class QListWidgetItem;
|
||||
class QButtonGroup;
|
||||
class QFrame;
|
||||
class QAction;
|
||||
class QSystemTrayIcon;
|
||||
|
||||
// Runs a package search off the UI thread. Queries every given provider and
|
||||
// merges the results, tagging each package with its provider id.
|
||||
@@ -104,6 +106,11 @@ private slots:
|
||||
void onNavChanged(int id);
|
||||
void onClearHistory();
|
||||
void onRefreshLogs();
|
||||
void onExportHistory();
|
||||
void onExportPackageList();
|
||||
void onLogsFilterChanged();
|
||||
void onPreviewUpdates();
|
||||
void onTrayActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
void onHistoryFilterChanged();
|
||||
void onInstalledFilterChanged(const QString& text);
|
||||
void onRecentActivityClicked(QListWidgetItem* item);
|
||||
@@ -133,7 +140,16 @@ private:
|
||||
|
||||
// Show the provider's last error in a dialog when one is available, so a
|
||||
// failed operation explains itself instead of failing silently.
|
||||
void showProviderError(const QString& title, IPackageManager* provider);
|
||||
// Returns true when the error was a locked pacman DB (caller may offer
|
||||
// a retry once the lock is gone).
|
||||
bool showProviderError(const QString& title, IPackageManager* provider);
|
||||
|
||||
// Re-runs the given privileged action. Used by the "Réessayer" button
|
||||
// on db-lock errors: the lock (other manager / stale db.lck) is often
|
||||
// gone by the time the user retries.
|
||||
void retryPrivilegedAction(const QString& action);
|
||||
|
||||
QString m_pendingRetryAction;
|
||||
|
||||
void setupUI();
|
||||
void setupSidebar();
|
||||
@@ -150,6 +166,7 @@ private:
|
||||
void refreshRecentActivity();
|
||||
void refreshPluginsTable();
|
||||
void updatePackageInfo(const PackageInfo& pkg);
|
||||
std::string richDetails(const PackageInfo& pkg);
|
||||
void resetDetailsPanel();
|
||||
void setBrowseMode(BrowseMode mode);
|
||||
void performInstall(const std::string& package);
|
||||
@@ -158,11 +175,18 @@ private:
|
||||
void appendPackageRows(const std::vector<PackageInfo>& results);
|
||||
void addPackageRow(int row, const PackageInfo& pkg);
|
||||
void setBusy(bool busy);
|
||||
// Single privileged op at a time (pacman DB lock). Returns false + a
|
||||
// status message when an operation already runs.
|
||||
bool tryAcquireOp();
|
||||
void reloadCurrentView();
|
||||
void loadInstalled();
|
||||
void loadUpdates();
|
||||
void refreshHistoryTable();
|
||||
void loadLogs();
|
||||
void applyLogsFilter();
|
||||
void setupTray();
|
||||
void setupShortcuts();
|
||||
void notifyUpdatesAvailable(int count);
|
||||
QFrame* makeCard();
|
||||
QFrame* makeStatCard(const QString& iconName, const QString& title, QLabel** valueOut);
|
||||
|
||||
@@ -217,6 +241,11 @@ private:
|
||||
|
||||
// Logs page
|
||||
QTextEdit* m_logsText = nullptr;
|
||||
QLineEdit* m_logsFilter = nullptr;
|
||||
QString m_logsRaw;
|
||||
|
||||
// Tray (optional: hidden when the desktop has no system tray)
|
||||
QSystemTrayIcon* m_tray = nullptr;
|
||||
|
||||
// Plugins page
|
||||
QTableWidget* m_pluginTable = nullptr;
|
||||
@@ -231,6 +260,9 @@ private:
|
||||
HistoryManager* m_historyManager = nullptr;
|
||||
UpdateManager* m_updateManager = nullptr; // checks Gitea releases (owned)
|
||||
BrowseMode m_browseMode = ModeSearch;
|
||||
// True while a privileged op (or blocking load) runs; guards the pacman
|
||||
// DB lock against concurrent operations from double-clicks.
|
||||
bool m_busy = false;
|
||||
|
||||
// Settings
|
||||
QSettings m_settings;
|
||||
|
||||
@@ -48,6 +48,19 @@ public:
|
||||
// unit-tested without invoking sudo.
|
||||
static bool authFailed(const std::string& output);
|
||||
|
||||
// Detect a locked pacman database (db.lck) in the output, either because
|
||||
// another manager runs concurrently or because a stale lock file remains.
|
||||
// Exposed as static so it can be unit-tested without invoking pacman.
|
||||
static bool dbLocked(const std::string& output);
|
||||
|
||||
// User-facing hint explaining the lock and how to recover. Checks the
|
||||
// lock file and other running managers on the live system.
|
||||
static std::string dbLockHint();
|
||||
|
||||
// Last error detail of the most recent failed privileged operation
|
||||
// (e.g. db lock hint), surfaced in the UI instead of a generic message.
|
||||
std::string lastError() const override { return m_lastError; }
|
||||
|
||||
// Credential handling for privileged (sudo) operations. The password is
|
||||
// kept in memory only for the session (never persisted) and piped to
|
||||
// `sudo -S` for each privileged command.
|
||||
@@ -70,4 +83,5 @@ private:
|
||||
bool isPackageInstalled(const std::string& name);
|
||||
|
||||
std::string m_password;
|
||||
std::string m_lastError;
|
||||
};
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QProcess>
|
||||
|
||||
// Checks the Gitea repository for new releases and tracks the last check
|
||||
@@ -49,6 +50,15 @@ public:
|
||||
QString tarballUrl() const;
|
||||
QString releasePageUrl() const;
|
||||
|
||||
// Prebuilt binary archive attached to the release
|
||||
// (PacManager-<version>-x86_64.tar.gz), when the release workflow
|
||||
// uploaded one. Preferred over the source tarball: no compiler needed.
|
||||
QString prebuiltUrl() const;
|
||||
|
||||
// True when the pending update can be applied by unpacking a prebuilt
|
||||
// archive instead of recompiling from source.
|
||||
bool hasPrebuiltUpdate() const;
|
||||
|
||||
// Install prefix the running binary was installed to (e.g. ~/.local,
|
||||
// /usr/local, /usr). Used to reinstall the fresh build at the same place.
|
||||
QString installPrefix() const;
|
||||
@@ -62,6 +72,11 @@ public:
|
||||
// `sudo` will prompt on its own if needed). Emits selfUpdateFinished.
|
||||
void performSelfUpdate(const QString& sudoPassword = QString());
|
||||
|
||||
// Pre-flight: missing tools that would make the source path fail
|
||||
// (e.g. "cmake", "g++"). Empty when a prebuilt archive is available
|
||||
// (no compiler needed) or every tool is present.
|
||||
QStringList missingSelfUpdateTools() const;
|
||||
|
||||
signals:
|
||||
// Emitted after a check completes. hasUpdate is true when a newer
|
||||
// release exists; errorMessage is non-empty when the request failed.
|
||||
@@ -76,6 +91,12 @@ private:
|
||||
void saveState(const QString& remoteVersion);
|
||||
void loadState();
|
||||
void runShell(const QString& script, const QString& workingDir);
|
||||
void performPrebuiltUpdate(const QString& sudoPassword);
|
||||
void performTarballUpdate(const QString& sudoPassword);
|
||||
QString installCommand(const QString& quotedPassword,
|
||||
const QString& action) const;
|
||||
static QString quoteShell(const QString& s);
|
||||
static QString quotedPassword(const QString& sudoPassword);
|
||||
|
||||
QNetworkAccessManager m_network;
|
||||
QProcess m_process; // runs the git pull + build script
|
||||
@@ -83,6 +104,7 @@ private:
|
||||
QString m_lastKnownRemoteVersion; // latest version seen on the server
|
||||
QString m_latestVersion; // version of the pending update
|
||||
QString m_tarballUrl; // source tarball for the pending update
|
||||
QString m_prebuiltUrl; // prebuilt binary archive, when attached
|
||||
QString m_releasePageUrl; // human-readable release page
|
||||
QString m_repoPath; // source repo dir when found
|
||||
};
|
||||
Reference in new issue
Block a user