#pragma once #include #include #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& 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& 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 m_candidates; };