Mgr: Flush Manager settings to Windows Registry or user prefs when closing Options dialog

This commit is contained in:
Charlie Fenton 2013-04-30 05:18:19 -07:00
parent c5368a62d9
commit 66e61912c9
4 changed files with 29 additions and 5 deletions

View File

@ -530,11 +530,8 @@ int CBOINCGUIApp::OnExit() {
m_pEventLog = NULL;
}
// Save Application State
m_pConfig->Write(wxT("AutomaticallyShutdownClient"), m_iShutdownCoreClient);
m_pConfig->Write(wxT("DisplayShutdownClientDialog"), m_iDisplayExitDialog);
m_pConfig->Write(wxT("DisableAutoStart"), m_iBOINCMGRDisableAutoStart);
SaveState();
diagnostics_finish();
@ -542,6 +539,14 @@ int CBOINCGUIApp::OnExit() {
}
void CBOINCGUIApp::SaveState() {
// Save Application State
m_pConfig->Write(wxT("AutomaticallyShutdownClient"), m_iShutdownCoreClient);
m_pConfig->Write(wxT("DisplayShutdownClientDialog"), m_iDisplayExitDialog);
m_pConfig->Write(wxT("DisableAutoStart"), m_iBOINCMGRDisableAutoStart);
}
///
/// Pass the command line parameters and discriptions to wxWidgets for displaying.
///

View File

@ -57,7 +57,7 @@ protected:
#if (defined(__WXMSW__) && !wxCHECK_VERSION(2, 9, 4))
void OnEndSession(wxCloseEvent& event);
#endif
void OnInitCmdLine(wxCmdLineParser &parser);
bool OnCmdLineParsed(wxCmdLineParser &parser);
@ -122,6 +122,7 @@ protected:
public:
bool OnInit();
void SaveState();
wxLocale* GetLocale() { return m_pLocale; }
CSkinManager* GetSkinManager() { return m_pSkinManager; }

View File

@ -76,6 +76,21 @@ CDlgOptions::CDlgOptions(wxWindow* parent, wxWindowID id, const wxString& captio
Create(parent, id, caption, pos, size, style);
}
CDlgOptions::~CDlgOptions() {
CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
wxASSERT(pDoc);
wxASSERT(pFrame);
wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame));
wxGetApp().SaveState();
pFrame->SaveState();
wxConfigBase::Get(FALSE)->Flush();
}
/*!
* CDlgToolsOptions creator
*/

View File

@ -105,6 +105,9 @@ public:
CDlgOptions( );
CDlgOptions( wxWindow* parent, wxWindowID id = SYMBOL_CDLGOPTIONS_IDNAME, const wxString& caption = SYMBOL_CDLGOPTIONS_TITLE, const wxPoint& pos = SYMBOL_CDLGOPTIONS_POSITION, const wxSize& size = SYMBOL_CDLGOPTIONS_SIZE, long style = SYMBOL_CDLGOPTIONS_STYLE );
/// Destructor
~CDlgOptions( );
/// Creation
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CDLGOPTIONS_IDNAME, const wxString& caption = SYMBOL_CDLGOPTIONS_TITLE, const wxPoint& pos = SYMBOL_CDLGOPTIONS_POSITION, const wxSize& size = SYMBOL_CDLGOPTIONS_SIZE, long style = SYMBOL_CDLGOPTIONS_STYLE );