File indexing completed on 2024-05-05 17:56:54

0001 /*
0002     SPDX-FileCopyrightText: 2004 Csaba Karai <krusader@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef DULINES_H
0009 #define DULINES_H
0010 
0011 // QtGui
0012 #include <QKeyEvent>
0013 #include <QMouseEvent>
0014 #include <QPixmap>
0015 #include <QResizeEvent>
0016 
0017 #include "../GUI/krtreewidget.h"
0018 #include "diskusage.h"
0019 
0020 class DULinesToolTip;
0021 class DULinesItemDelegate;
0022 
0023 class DULines : public KrTreeWidget
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     explicit DULines(DiskUsage *usage);
0029     ~DULines() override;
0030 
0031     File *getCurrentFile();
0032 
0033 public slots:
0034     void slotDirChanged(Directory *dirEntry);
0035     void sectionResized(int);
0036     void slotRightClicked(QTreeWidgetItem *, const QPoint &);
0037     void slotChanged(File *);
0038     void slotDeleted(File *);
0039     void slotShowFileSizes();
0040     void slotRefresh();
0041 
0042 protected:
0043     DiskUsage *diskUsage;
0044 
0045     bool event(QEvent *event) override;
0046     void mouseDoubleClickEvent(QMouseEvent *e) override;
0047     void keyPressEvent(QKeyEvent *e) override;
0048     void resizeEvent(QResizeEvent *) override;
0049 
0050 private:
0051     QPixmap createPixmap(int percent, int maxPercent, int maxWidth);
0052 
0053     bool doubleClicked(QTreeWidgetItem *item);
0054 
0055     bool refreshNeeded;
0056     bool started;
0057 
0058     bool showFileSize;
0059 
0060     DULinesToolTip *toolTip;
0061     DULinesItemDelegate *itemDelegate;
0062 };
0063 
0064 #endif /* __DU_LINES_H__ */