2021-10-16 16:19:51 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
|
#include "ui_SettingsWindow.h"
|
2022-08-15 12:18:26 +01:00
|
|
|
#include "../../MiscHelpers/Common/SettingsWidgets.h"
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-08-10 19:14:37 +01:00
|
|
|
void FixTriStateBoxPallete(QWidget* pWidget);
|
|
|
|
|
2022-07-01 07:37:29 +01:00
|
|
|
class CSecretCheckBox : public QCheckBox
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
CSecretCheckBox(const QString& Text) : QCheckBox(Text)
|
|
|
|
{
|
|
|
|
setTristate(false);
|
|
|
|
m_SecretMode = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsSecretSet() const { return m_SecretMode && this->checkState() == Qt::PartiallyChecked; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent* e)
|
|
|
|
{
|
|
|
|
if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
|
|
|
|
setTristate();
|
|
|
|
m_SecretMode = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool m_SecretMode;
|
|
|
|
};
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-09-29 17:28:48 +01:00
|
|
|
void AddIconToLabel(QLabel* pLabel, const QPixmap& Pixmap);
|
|
|
|
|
2022-08-15 12:18:26 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// CSettingsWindow
|
|
|
|
|
|
|
|
class CSettingsWindow : public CConfigDialog
|
2021-10-16 16:19:51 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CSettingsWindow(QWidget *parent = Q_NULLPTR);
|
|
|
|
~CSettingsWindow();
|
|
|
|
|
|
|
|
virtual void accept() {}
|
|
|
|
virtual void reject();
|
|
|
|
|
2023-07-01 17:54:53 +01:00
|
|
|
static Qt::CheckState IsContextMenu();
|
|
|
|
static void AddContextMenu(bool bAlwaysClassic = false);
|
|
|
|
static void RemoveContextMenu();
|
|
|
|
static bool AddBrowserIcon();
|
|
|
|
|
2022-05-15 14:02:58 +01:00
|
|
|
static bool ApplyCertificate(const QByteArray &Certificate, QWidget* widget);
|
|
|
|
|
2022-07-09 10:46:07 +01:00
|
|
|
static void LoadCertificate(QString CertPath = QString());
|
|
|
|
|
2023-08-15 08:49:03 +01:00
|
|
|
static QString GetCertType();
|
|
|
|
static QColor GetCertColor();
|
|
|
|
static QString GetCertLevel();
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
signals:
|
2022-07-09 10:46:07 +01:00
|
|
|
void OptionsChanged(bool bRebuildUI = false);
|
2021-10-16 16:19:51 +01:00
|
|
|
void Closed();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void ok();
|
|
|
|
void apply();
|
|
|
|
|
2023-07-08 10:46:29 +01:00
|
|
|
void showTab(const QString& Name, bool bExclusive = false);
|
2021-10-16 16:19:51 +01:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void OnTab();
|
2023-07-01 17:54:53 +01:00
|
|
|
void OnCompat();
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnAddMessage();
|
|
|
|
void OnDelMessage();
|
|
|
|
void OnMessageChanged() { m_MessagesChanged = true; OnOptChanged(); }
|
|
|
|
|
|
|
|
void OnRootChanged();
|
|
|
|
|
2022-11-29 17:26:51 +00:00
|
|
|
void OnBrowsePath();
|
|
|
|
void OnAddCommand();
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnCommandUp();
|
|
|
|
void OnCommandDown();
|
2022-11-29 17:26:51 +00:00
|
|
|
void OnDelCommand();
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnRunChanged() { m_RunChanged = true; OnOptChanged(); }
|
|
|
|
|
|
|
|
void OnOptChanged();
|
2022-11-29 17:26:51 +00:00
|
|
|
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnChangeGUI() { m_bRebuildUI = true; OnOptChanged(); }
|
2023-05-21 16:57:53 +01:00
|
|
|
void OnFeaturesChanged() { m_FeaturesChanged = true; OnGeneralChanged(); }
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnGeneralChanged() { m_GeneralChanged = true; OnOptChanged(); }
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2023-07-01 17:54:53 +01:00
|
|
|
void OnLoadAddon();
|
|
|
|
void OnInstallAddon();
|
|
|
|
void OnRemoveAddon();
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnBrowse();
|
|
|
|
|
2023-08-24 17:39:00 +01:00
|
|
|
void OnRamDiskChange();
|
|
|
|
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnProtectionChange();
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnSetPassword();
|
|
|
|
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnWarnChanged() { m_WarnProgsChanged = true; OnOptChanged(); }
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnAddWarnProg();
|
|
|
|
void OnAddWarnFolder();
|
|
|
|
void OnDelWarnProg();
|
|
|
|
|
2023-10-19 17:34:09 +01:00
|
|
|
void OnVolumeChanged();
|
|
|
|
void UpdateDrives();
|
|
|
|
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnCompatChanged() { m_CompatChanged = true; OnOptChanged(); }
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnTemplateClicked(QTreeWidgetItem* pItem, int Column);
|
2022-05-29 07:07:17 +01:00
|
|
|
void OnTemplateDoubleClicked(QTreeWidgetItem* pItem, int Column);
|
2021-10-16 16:19:51 +01:00
|
|
|
void OnAddCompat();
|
|
|
|
void OnDelCompat();
|
|
|
|
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnFilterTemplates() { LoadTemplates(); }
|
|
|
|
void OnAddTemplates();
|
|
|
|
void OnTemplateWizard();
|
2024-04-20 13:43:30 +01:00
|
|
|
void OnOpenTemplate();
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnDelTemplates();
|
|
|
|
|
2022-01-13 22:52:58 +00:00
|
|
|
void SetIniEdit(bool bEnable);
|
|
|
|
void OnEditIni();
|
|
|
|
void OnSaveIni();
|
2023-04-13 18:46:51 +01:00
|
|
|
void OnIniChanged();
|
2022-01-13 22:52:58 +00:00
|
|
|
void OnCancelEdit();
|
|
|
|
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
void CertChanged();
|
2024-04-14 11:30:27 +01:00
|
|
|
void KeyChanged();
|
2022-01-13 22:52:58 +00:00
|
|
|
void UpdateCert();
|
2023-08-15 08:49:03 +01:00
|
|
|
void OnGetCert();
|
|
|
|
void OnCertData(const QByteArray& Certificate, const QVariantMap& Params);
|
|
|
|
void ApplyCert();
|
2022-11-20 16:23:15 +00:00
|
|
|
void UpdateUpdater();
|
2021-10-16 16:19:51 +01:00
|
|
|
|
2022-08-11 23:09:35 +01:00
|
|
|
void GetUpdates();
|
|
|
|
void OnUpdateData(const QVariantMap& Data, const QVariantMap& Params);
|
|
|
|
void OnUpdate(const QString& Channel);
|
|
|
|
|
2022-08-15 12:18:26 +01:00
|
|
|
void OnSetTree();
|
|
|
|
|
2023-06-09 09:47:09 +01:00
|
|
|
void OnSelectIniEditFont();
|
|
|
|
void OnResetIniEditFont();
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
|
2022-08-15 12:18:26 +01:00
|
|
|
bool eventFilter(QObject *watched, QEvent *e);
|
|
|
|
|
2022-09-29 17:28:48 +01:00
|
|
|
void OnTab(QWidget* pTab);
|
2022-08-15 12:18:26 +01:00
|
|
|
|
2023-04-13 18:46:51 +01:00
|
|
|
void AddMessageItem(const QString& ID, const QString& Text = QString());
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
void AddWarnEntry(const QString& Name, int type);
|
|
|
|
|
|
|
|
void LoadSettings();
|
|
|
|
void SaveSettings();
|
|
|
|
|
2023-04-13 18:46:51 +01:00
|
|
|
void LoadTemplates();
|
|
|
|
|
2022-01-13 22:52:58 +00:00
|
|
|
void LoadIniSection();
|
|
|
|
void SaveIniSection();
|
2023-06-09 09:47:09 +01:00
|
|
|
void ApplyIniEditFont();
|
2022-01-13 22:52:58 +00:00
|
|
|
|
2022-07-09 10:46:07 +01:00
|
|
|
bool m_bRebuildUI;
|
2023-04-13 18:46:51 +01:00
|
|
|
bool m_HoldChange;
|
2021-10-16 16:19:51 +01:00
|
|
|
int m_CompatLoaded;
|
|
|
|
QString m_NewPassword;
|
2023-04-13 18:46:51 +01:00
|
|
|
bool m_MessagesChanged;
|
2021-10-16 16:19:51 +01:00
|
|
|
bool m_WarnProgsChanged;
|
2023-10-19 17:34:09 +01:00
|
|
|
bool m_VolumeChanged;
|
2021-10-16 16:19:51 +01:00
|
|
|
bool m_CompatChanged;
|
2023-04-13 18:46:51 +01:00
|
|
|
bool m_RunChanged;
|
|
|
|
bool m_ProtectionChanged;
|
|
|
|
bool m_GeneralChanged;
|
2021-10-16 16:19:51 +01:00
|
|
|
bool m_FeaturesChanged;
|
|
|
|
bool m_CertChanged;
|
2022-08-11 23:09:35 +01:00
|
|
|
QVariantMap m_UpdateData;
|
2022-07-24 14:30:54 +01:00
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
private:
|
2022-07-24 14:30:54 +01:00
|
|
|
|
|
|
|
void WriteAdvancedCheck(QCheckBox* pCheck, const QString& Name, const QString& OnValue, const QString& OffValue);
|
|
|
|
void WriteText(const QString& Name, const QString& Value);
|
|
|
|
void WriteTextList(const QString& Setting, const QStringList& List);
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
Ui::SettingsWindow ui;
|
|
|
|
};
|
|
|
|
|
2023-07-19 20:15:18 +01:00
|
|
|
QVariantMap GetRunEntry(const QString& sEntry);
|
|
|
|
void AddRunItem(QTreeWidget* treeRun, const QVariantMap& Entry);
|
|
|
|
QString MakeRunEntry(QTreeWidgetItem* pItem);
|
|
|
|
QString MakeRunEntry(const QVariantMap& Entry);
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
void WindowsMoveFile(const QString& from, const QString& to);
|
|
|
|
|
2022-01-13 22:52:58 +00:00
|
|
|
extern quint32 g_FeatureFlags;
|
|
|
|
|
2021-10-16 16:19:51 +01:00
|
|
|
extern QByteArray g_Certificate;
|
2023-07-11 21:35:59 +01:00
|
|
|
|
|
|
|
#include "..\..\Sandboxie\core\drv\verify.h"
|
|
|
|
|
2022-12-07 16:32:40 +00:00
|
|
|
extern SCertInfo g_CertInfo;
|