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.
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
#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;
|
|
};
|