Sandboxie/SandboxiePlus/SandMan/Wizards/NewBoxWizard.h

170 lines
3.1 KiB
C
Raw Normal View History

2023-01-28 13:05:37 +00:00
#pragma once
#include <QWizard>
#include "../../QSbieAPI/SbieStatus.h"
QT_BEGIN_NAMESPACE
class QCheckBox;
class QLabel;
class QLineEdit;
class QRadioButton;
QT_END_NAMESPACE
2023-08-22 19:41:38 +01:00
//#define USE_COMBO
2023-01-28 13:05:37 +00:00
class CNewBoxWizard : public QWizard
{
Q_OBJECT
public:
2024-05-20 19:49:03 +01:00
enum { Page_Type, Page_Files, Page_Isolation, Page_Advanced, Page_Summary };
2023-01-28 13:05:37 +00:00
2023-01-29 10:48:28 +00:00
CNewBoxWizard(bool bAlowTemp, QWidget *parent = nullptr);
2023-01-28 13:05:37 +00:00
2023-01-29 10:48:28 +00:00
static QString CreateNewBox(bool bAlowTemp, QWidget* pParent = NULL);
2023-01-28 13:05:37 +00:00
QString GetDefaultLocation();
private slots:
void showHelp();
protected:
friend class CBoxTypePage;
friend class CSummaryPage;
SB_STATUS TryToCreateBox();
bool m_bAdvanced;
};
//////////////////////////////////////////////////////////////////////////////////////////
// CBoxTypePage
//
2023-08-22 19:41:38 +01:00
//#define USE_COMBO
2023-01-28 13:05:37 +00:00
class CBoxTypePage : public QWizardPage
{
Q_OBJECT
2023-08-22 19:41:38 +01:00
Q_PROPERTY(int currentType READ currentType WRITE setCurrentType NOTIFY typeChanged USER true)
2023-01-28 13:05:37 +00:00
public:
2023-01-29 10:48:28 +00:00
CBoxTypePage(bool bAlowTemp, QWidget *parent = nullptr);
2023-01-28 13:05:37 +00:00
2024-01-06 17:02:43 +00:00
void initializePage() override;
2023-01-28 13:05:37 +00:00
int nextId() const override;
bool isComplete() const override;
bool validatePage() override;
2023-08-22 19:41:38 +01:00
void setCurrentType(int type);
int currentType();
signals:
void typeChanged();
2023-01-28 13:05:37 +00:00
private slots:
void OnBoxTypChanged();
void OnAdvanced();
private:
2023-08-22 19:41:38 +01:00
#ifdef USE_COMBO
2023-08-25 10:59:50 +01:00
QComboBox* m_pBoxType;
2023-08-22 19:41:38 +01:00
QLabel* m_pInfoLabel;
#endif
QLineEdit* m_pBoxName;
QButtonGroup* m_TypeGroup;
QCheckBox* m_pAdvanced;
2023-01-28 13:05:37 +00:00
bool m_bInstant;
};
//////////////////////////////////////////////////////////////////////////////////////////
// CFilesPage
//
class CFilesPage : public QWizardPage
{
Q_OBJECT
public:
CFilesPage(QWidget *parent = nullptr);
int nextId() const override;
void initializePage() override;
bool validatePage() override;
private:
QComboBox* m_pBoxLocation;
};
//////////////////////////////////////////////////////////////////////////////////////////
2024-05-20 19:49:03 +01:00
// CIsolationPage
2023-01-28 13:05:37 +00:00
//
2024-05-20 19:49:03 +01:00
class CIsolationPage : public QWizardPage
2023-01-28 13:05:37 +00:00
{
Q_OBJECT
public:
2024-05-20 19:49:03 +01:00
CIsolationPage(QWidget *parent = nullptr);
2023-01-28 13:05:37 +00:00
int nextId() const override;
void initializePage() override;
bool validatePage() override;
void OnDropAdminChanged(int state);
2023-01-28 13:05:37 +00:00
private:
QCheckBox* m_pShareAccess;
QCheckBox* m_pMSIServer;
QCheckBox* m_pDropAdmin;
2023-01-28 13:05:37 +00:00
};
2024-05-20 19:49:03 +01:00
//////////////////////////////////////////////////////////////////////////////////////////
// CAdvancedPage
//
class CAdvancedPage : public QWizardPage
{
Q_OBJECT
public:
CAdvancedPage(QWidget *parent = nullptr);
int nextId() const override;
void initializePage() override;
bool validatePage() override;
private:
QCheckBox* m_pBoxToken;
};
2023-01-28 13:05:37 +00:00
//////////////////////////////////////////////////////////////////////////////////////////
// CSummaryPage
//
class CSummaryPage : public QWizardPage
{
Q_OBJECT
public:
CSummaryPage(QWidget *parent = nullptr);
int nextId() const override;
void initializePage() override;
bool validatePage() override;
private:
QTextEdit* m_pSummary;
QCheckBox* m_pSetDefault;
QCheckBox* m_pSetInstant;
};