This commit is contained in:
DavidXanatos 2022-02-02 21:04:37 +01:00
parent c4b8508778
commit 5c03eb2ef8
4 changed files with 53 additions and 0 deletions

View File

@ -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);

View File

@ -100,6 +100,7 @@ public:
CSettings(const QString& AppName, bool bShared = false, QMap<QString, SSetting> DefaultValues = QMap<QString, SSetting>(), 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());

View File

@ -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))

View File

@ -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;