feat: add treemap disk space analyzer
version / print-version (push) Successful in 2s

Users need to see at a glance what fills a disk and to remove the largest
entries without digging through a file manager. The treemap makes sizes
comparable, the scan runs off the UI thread, and removing an entry updates
the tree in place instead of rescanning.
This commit is contained in:
BlackAngelTV committed 2026-11-26 18:56:07 +01:00
1 parent 26c9658f0b
commit 6a85eed786
15 files changed
+1461

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
#pragma once
#include <QMainWindow>
#include <QPoint>
#include <QString>
#include <memory>
struct DiskNode;
class DiskScanner;
class QLabel;
class QLineEdit;
class QProgressBar;
class QPushButton;
class QToolButton;
class TreemapWidget;
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(const QString &startPath = QString(), QWidget *parent = nullptr);
~MainWindow() override;
private:
void buildUi();
void startScan(const QString &path);
void stopScanning();
void handleScanFinished();
void setBusy(bool busy);
void showDirectory(DiskNode *node);
void updateSelection(DiskNode *node);
void updateHeader();
void chooseFolder();
void showContextMenu(DiskNode *node, const QPoint &globalPos);
void removeNode(DiskNode *node, bool toTrash);
bool canRemove(const DiskNode *node) const;
std::shared_ptr<DiskNode> m_tree;
QString m_scanRoot;
DiskScanner *m_scanner = nullptr;
DiskNode *m_current = nullptr;
DiskNode *m_selected = nullptr;
TreemapWidget *m_treemap = nullptr;
QToolButton *m_upButton = nullptr;
QLineEdit *m_pathEdit = nullptr;
QPushButton *m_chooseButton = nullptr;
QPushButton *m_rescanButton = nullptr;
QLabel *m_nameLabel = nullptr;
QLabel *m_pathLabel = nullptr;
QLabel *m_sizeLabel = nullptr;
QLabel *m_shareLabel = nullptr;
QLabel *m_kindLabel = nullptr;
QPushButton *m_openButton = nullptr;
QPushButton *m_trashButton = nullptr;
QPushButton *m_deleteButton = nullptr;
QLabel *m_statusLabel = nullptr;
QProgressBar *m_progress = nullptr;
QPushButton *m_cancelButton = nullptr;
};