Files
BlackAngelTV 3e85db87b2 refactor(pages): group the screens by what the user is doing
pages/ was a flat row of eight screens, so a change to one meant scanning
the whole folder to see what else was in it. The screens now sit in
packages/ (browse, cleanup), overview/ (dashboard, history), system/
(logs, settings) and extensions/ (plugins), with the scaffolding they
all build on — the Page base and the shared widgets — in base/.
2026-09-29 21:26:51 +02:00

53 lines
1.7 KiB
C++

#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;
};