Sandboxie/SandboxiePlus/SandMan/Windows/RecoveryWindow.h

97 lines
2.0 KiB
C
Raw Normal View History

2021-10-16 16:19:51 +01:00
#pragma once
#include <QtWidgets/QMainWindow>
#include <QFileIconProvider>
#include "ui_RecoveryWindow.h"
#include "SbiePlusAPI.h"
class CSimpleTreeModel;
class CRecoveryCounter : public QThread
{
Q_OBJECT
public:
CRecoveryCounter(const QString& BoxPath, QWidget* parent = Q_NULLPTR) : QThread(parent) {
m_BoxPath = BoxPath;
m_run = true;
start(QThread::LowPriority);
}
~CRecoveryCounter() {
m_run = false;
wait(2000);
terminate();
}
signals:
void Count(quint32 fileCount, quint32 folderCount, quint64 totalSize);
protected:
void run();
QString m_BoxPath;
bool m_run;
};
class CRecoveryWindow : public QDialog
{
Q_OBJECT
public:
CRecoveryWindow(const CSandBoxPtr& pBox, QWidget *parent = Q_NULLPTR);
~CRecoveryWindow();
2022-01-30 14:53:37 +00:00
bool IsDeleteShapshots() { return m_DeleteShapshots; }
2021-10-16 16:19:51 +01:00
virtual void accept() {}
virtual void reject() { this->close(); }
signals:
void Closed();
public slots:
int exec();
int FindFiles();
void AddFile(const QString& FilePath, const QString& BoxPath);
private slots:
void OnAddFolder();
void OnRecover();
void OnTargetChanged();
void OnDeleteAll();
2022-01-30 14:53:37 +00:00
void OnDeleteEverything();
2021-10-16 16:19:51 +01:00
void OnCloseUntil();
void OnCount(quint32 fileCount, quint32 folderCount, quint64 totalSize);
protected:
void closeEvent(QCloseEvent *e);
int FindFiles(const QString& Folder);
int FindBoxFiles(const QString& Folder);
QPair<int, quint64> FindFiles(const QString& BoxedFolder, const QString& RealFolder, const QString& Name, const QString& ParentID = QString());
void RecoverFiles(bool bBrowse, QString RecoveryFolder = QString());
CSandBoxPtr m_pBox;
QMap<QVariant, QVariantMap> m_FileMap;
QSet<QString> m_NewFiles;
QStringList m_RecoveryFolders;
CRecoveryCounter* m_pCounter;
int m_LastTargetIndex;
bool m_bTargetsChanged;
bool m_bReloadPending;
2022-01-30 14:53:37 +00:00
bool m_DeleteShapshots;
2021-10-16 16:19:51 +01:00
private:
Ui::RecoveryWindow ui;
QAction* m_pRemember;
CSimpleTreeModel* m_pFileModel;
QSortFilterProxyModel* m_pSortProxy;
QFileIconProvider m_IconProvider;
};