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

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 DISKUSAGEGUI_H
0009 #define DISKUSAGEGUI_H
0010 
0011 // QtCore
0012 #include <QUrl>
0013 // QtGui
0014 #include <QResizeEvent>
0015 // QtWidgets
0016 #include <QDialog>
0017 #include <QLayout>
0018 #include <QToolButton>
0019 
0020 #include <KWidgetsAddons/KSqueezedTextLabel>
0021 
0022 #include "diskusage.h"
0023 
0024 class DiskUsageGUI : public QDialog
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     explicit DiskUsageGUI(const QUrl &openDir);
0030     ~DiskUsageGUI() override = default;
0031     void askDirAndShow();
0032 
0033 protected slots:
0034     void closeEvent(QCloseEvent *event) override;
0035 
0036 protected:
0037     void resizeEvent(QResizeEvent *e) override;
0038 
0039 private slots:
0040     bool askDir();
0041     void slotLoadUsageInfo();
0042     void slotStatus(const QString &);
0043 
0044     void slotSelectLinesView()
0045     {
0046         diskUsage->setView(VIEW_LINES);
0047     }
0048     void slotSelectListView()
0049     {
0050         diskUsage->setView(VIEW_DETAILED);
0051     }
0052     void slotSelectFilelightView()
0053     {
0054         diskUsage->setView(VIEW_FILELIGHT);
0055     }
0056 
0057     void slotViewChanged(int view);
0058     void slotLoadFinished(bool);
0059 
0060 private:
0061     void enableButtons(bool);
0062 
0063     DiskUsage *diskUsage;
0064     QUrl baseDirectory;
0065 
0066     KSqueezedTextLabel *status;
0067 
0068     QToolButton *btnNewSearch;
0069     QToolButton *btnRefresh;
0070     QToolButton *btnDirUp;
0071 
0072     QToolButton *btnLines;
0073     QToolButton *btnDetailed;
0074     QToolButton *btnFilelight;
0075 
0076     int sizeX;
0077     int sizeY;
0078 
0079     bool exitAtFailure;
0080 };
0081 
0082 #endif /* __DISK_USAGE_GUI_H__ */