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

+45
View File
@@ -0,0 +1,45 @@
#pragma once
#include "core/disk-node.h"
#include "core/disk-scanner.h"
#include <QDir>
#include <QFile>
#include <memory>
// Test helpers only: they keep the fixtures readable without hiding behaviour.
namespace test_helpers {
inline bool writeFile(const QString &path, int bytes)
{
QFile file(path);
if (!file.open(QIODevice::WriteOnly)) {
return false;
}
return file.write(QByteArray(bytes, 'x')) == bytes;
}
inline DiskNode *childNamed(const DiskNode &node, const QString &name)
{
for (const auto &child : node.children) {
if (child->name == name) {
return child.get();
}
}
return nullptr;
}
inline std::shared_ptr<DiskNode> scan(const QString &path, ScanStats *stats = nullptr)
{
DiskScanner scanner(path);
scanner.start();
if (!scanner.wait(30000)) {
return nullptr;
}
if (stats) {
*stats = scanner.stats();
}
return scanner.takeTree();
}
} // namespace test_helpers