refactor(arch): split the app into a logic core and per-screen pages
All the business logic now lives in AppCore (providers, workers, history, plugins, sudo and pacman-lock handling), freed from any widget so it runs headless and is testable on its own. The Qt window becomes a thin frame around one file per screen under pages/, wired through a common Page contract and a shared ui-kit. CMake gains the app-core-test target, which links Qt Core only to enforce the headless guarantee. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
1 parent
576daf2fae
commit
897c174925
24 files changed
+4322
-3056
No files matched your search
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "page.h"
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QStackedWidget;
|
||||
class QTableWidget;
|
||||
|
||||
// Nettoyage: lists what a cleanup can reclaim (orphans and legacy packages
|
||||
// reported by every provider) and frees the disk space the providers hold in
|
||||
// their caches. Nothing runs until the user asks for it: the candidate list is
|
||||
// only built on demand, since both queries cost a pacman call.
|
||||
class CleanupPage : public Page {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CleanupPage(AppCore* core, QWidget* parent = nullptr);
|
||||
|
||||
QString navTitle() const override { return QStringLiteral("Nettoyage"); }
|
||||
QString navSubtitle() const override {
|
||||
return QStringLiteral(
|
||||
"Purger les paquets inutilisés ou legacy et libérer de l'espace");
|
||||
}
|
||||
|
||||
void refresh() override;
|
||||
|
||||
private:
|
||||
void scan();
|
||||
void populate(const std::vector<PackageInfo>& candidates);
|
||||
void onSelectionChanged(int row);
|
||||
void removeOrphans();
|
||||
void removeSelection();
|
||||
void cleanCaches();
|
||||
// Confirms the removal, then hands the selection to the core (grouping the
|
||||
// packages per provider and running the groups in sequence are core rules).
|
||||
void removePackages(const std::vector<PackageInfo>& packages,
|
||||
const QString& description);
|
||||
|
||||
QTableWidget* m_table = nullptr;
|
||||
QStackedWidget* m_tableStack = nullptr;
|
||||
QLabel* m_count = nullptr;
|
||||
QPushButton* m_removeOrphansButton = nullptr;
|
||||
QPushButton* m_removeSelectionButton = nullptr;
|
||||
QPushButton* m_cacheButton = nullptr;
|
||||
// Last listing shown, kept so a row can be mapped back to its package when
|
||||
// the user asks to remove it.
|
||||
std::vector<PackageInfo> m_candidates;
|
||||
};
|
||||
Reference in new issue
Block a user