diff --git a/SandboxiePlus/MiscHelpers/Common/Settings.cpp b/SandboxiePlus/MiscHelpers/Common/Settings.cpp index 7f38e1a5..55365a31 100644 --- a/SandboxiePlus/MiscHelpers/Common/Settings.cpp +++ b/SandboxiePlus/MiscHelpers/Common/Settings.cpp @@ -57,6 +57,15 @@ CSettings::~CSettings() m_pConf->sync(); } +void CSettings::DelValue(const QString& key) +{ + QMutexLocker Locker(&m_Mutex); + + m_pConf->remove(key); + + m_ValueCache.clear(); +} + bool CSettings::SetValue(const QString &key, const QVariant &value) { QMutexLocker Locker(&m_Mutex); diff --git a/SandboxiePlus/MiscHelpers/Common/Settings.h b/SandboxiePlus/MiscHelpers/Common/Settings.h index ddf0241b..d404767d 100644 --- a/SandboxiePlus/MiscHelpers/Common/Settings.h +++ b/SandboxiePlus/MiscHelpers/Common/Settings.h @@ -100,6 +100,7 @@ public: CSettings(const QString& AppName, bool bShared = false, QMap DefaultValues = QMap(), QObject* qObject = NULL); virtual ~CSettings(); + void DelValue(const QString& key); bool SetValue(const QString& key, const QVariant& value); QVariant GetValue(const QString& key, const QVariant& preset = QVariant()); diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index c851d4f7..93ec2467 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -463,6 +463,7 @@ void CSandMan::CreateMenus() m_pMenuOptions = menuBar()->addMenu(tr("&Options")); m_pMenuSettings = m_pMenuOptions->addAction(CSandMan::GetIcon("Settings"), tr("Global Settings"), this, SLOT(OnSettings())); m_pMenuResetMsgs = m_pMenuOptions->addAction(tr("Reset all hidden messages"), this, SLOT(OnResetMsgs())); + m_pMenuResetGUI = m_pMenuOptions->addAction(tr("Reset all GUI elements"), this, SLOT(OnResetGUI())); m_pMenuOptions->addSeparator(); m_pEditIni = m_pMenuOptions->addAction(CSandMan::GetIcon("EditIni"), tr("Edit ini file"), this, SLOT(OnEditIni())); m_pReloadIni = m_pMenuOptions->addAction(CSandMan::GetIcon("ReloadIni"), tr("Reload ini file"), this, SLOT(OnReloadIni())); @@ -1747,6 +1748,46 @@ void CSandMan::OnResetMsgs() m_pPopUpWindow->ReloadHiddenMessages(); } +void CSandMan::OnResetGUI() +{ + hide(); + + theConf->DelValue("ErrorWindow/Window_Geometry"); + theConf->DelValue("MainWindow/Window_Geometry"); + theConf->DelValue("MainWindow/Window_State"); + theConf->DelValue("MainWindow/BoxTree_Columns"); + theConf->DelValue("MainWindow/LogList_Columns"); + theConf->DelValue("MainWindow/Log_Splitter"); + theConf->DelValue("MainWindow/Panel_Splitter"); + theConf->DelValue("MainWindow/BoxTree_Columns"); + theConf->DelValue("MainWindow/TraceLog_Columns"); + theConf->DelValue("FileBrowserWindow/Window_Geometry"); + theConf->DelValue("FileBrowserWindow/FileTree_Columns"); + theConf->DelValue("NewBoxWindow/Window_Geometry"); + theConf->DelValue("OptionsWindow/Window_Geometry"); + theConf->DelValue("OptionsWindow/Run_Columns"); + theConf->DelValue("OptionsWindow/AutoRun_Columns"); + theConf->DelValue("OptionsWindow/Groups_Columns"); + theConf->DelValue("OptionsWindow/Forced_Columns"); + theConf->DelValue("OptionsWindow/Stop_Columns"); + theConf->DelValue("OptionsWindow/Start_Columns"); + theConf->DelValue("OptionsWindow/INet_Columns"); + theConf->DelValue("OptionsWindow/NetFw_Columns"); + theConf->DelValue("OptionsWindow/Access_Columns"); + theConf->DelValue("OptionsWindow/Recovery_Columns"); + theConf->DelValue("OptionsWindow/Templates_Columns"); + theConf->DelValue("PopUpWindow/Window_Geometry"); + theConf->DelValue("RecoveryWindow/Window_Geometry"); + theConf->DelValue("RecoveryWindow/TreeView_Columns"); + theConf->DelValue("SelectBoxWindow/Window_Geometry"); + theConf->DelValue("SettingsWindow/Window_Geometry"); + theConf->DelValue("SnapshotsWindow/Window_Geometry"); + + LoadState(); + + show(); +} + void CSandMan::OnEditIni() { if (theConf->GetBool("Options/NoEditInfo", true)) diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index 29874e75..9c9d3a00 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -169,6 +169,7 @@ private slots: void OnSettings(); void OnResetMsgs(); + void OnResetGUI(); void OnEditIni(); void OnReloadIni(); void OnSetMonitoring(); @@ -256,6 +257,7 @@ private: QMenu* m_pMenuOptions; QAction* m_pMenuSettings; QAction* m_pMenuResetMsgs; + QAction* m_pMenuResetGUI; QAction* m_pEditIni; QAction* m_pReloadIni; QAction* m_pEnableMonitoring;