File indexing completed on 2024-06-23 04:26:30

0001 /*
0002  *  SPDX-FileCopyrightText: 2020 Dmitrii Utkin <loentar@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.1-only
0005  */
0006 
0007 #ifndef WIDGET_H
0008 #define WIDGET_H
0009 
0010 #include "recorder_snapshots_scanner.h"
0011 
0012 #include <QDialog>
0013 
0014 namespace Ui {
0015 class RecorderSnapshotsManager;
0016 }
0017 
0018 class QItemSelection;
0019 class RecorderDirectoryCleaner;
0020 
0021 class RecorderSnapshotsManager : public QDialog
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     RecorderSnapshotsManager(QWidget *parent = nullptr);
0027     ~RecorderSnapshotsManager();
0028 
0029     void execFor(const QString &snapshotsDirectory);
0030 
0031 protected:
0032     void closeEvent(QCloseEvent *event) override;
0033 
0034 private Q_SLOTS:
0035     void reject() override;
0036 
0037     void onScanningFinished(SnapshotDirInfoList snapshots);
0038     void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
0039     void onButtonSelectAllClicked();
0040     void onButtonCleanUpClicked();
0041     void onButtonCancelCleanUpClicked();
0042     void onCleanUpFinished();
0043 
0044 private:
0045     void startScanning();
0046     void updateSpaceToBeFreed();
0047     void abortCleanUp();
0048 
0049 private:
0050     Ui::RecorderSnapshotsManager *ui;
0051     RecorderSnapshotsScanner *scanner;
0052     RecorderDirectoryCleaner* cleaner;
0053 };
0054 
0055 #endif // WIDGET_H