From 988d08d1ccb0e5a4ddc607895a03b922239fceb3 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 22 Jul 2010 10:59:26 +0000 Subject: [PATCH] MGR: Make Event Log Window persistent, hide it when closing main window svn path=/trunk/boinc/; revision=22028 --- checkin_notes | 14 ++++++++++++++ clientgui/BOINCBaseFrame.cpp | 5 +++++ clientgui/BOINCGUIApp.cpp | 11 ++++++++--- clientgui/BOINCGUIApp.h | 2 +- clientgui/BOINCTaskBar.cpp | 2 +- clientgui/DlgEventLog.cpp | 11 ++++++++++- clientgui/DlgEventLog.h | 2 ++ 7 files changed, 41 insertions(+), 6 deletions(-) diff --git a/checkin_notes b/checkin_notes index 2a4fd3fd25..e52c708807 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5405,3 +5405,17 @@ Charlie 22 Jul 2010 mac_build/ boinc.xcodeproj/ project.pbxproj + +Charlie 22 Jul 2010 + - MGR: If Event Log was open on Manager exit, open it on manager launch. + - MGR: Clicking main window's close box when Event Log is open also + hides the Event Log; show Event Log again if "Open BOINC Manager" is + selected from task bar icon menu. Clicking main window's Minimize + box does not affect Event Log window. + + clientgui/ + BOINCBaseFrame.cpp + BOINCGUIApp.cpp, .h + BOINCTaskBar.cpp + DlgEventLog.cpp, .h + \ No newline at end of file diff --git a/clientgui/BOINCBaseFrame.cpp b/clientgui/BOINCBaseFrame.cpp index a75c122ae2..d781497b0e 100644 --- a/clientgui/BOINCBaseFrame.cpp +++ b/clientgui/BOINCBaseFrame.cpp @@ -792,6 +792,11 @@ bool CBOINCBaseFrame::Show(bool bShow) { } } } + + CDlgEventLog* eventLog = wxGetApp().GetEventLog(); + if (eventLog) { + eventLog->Show(bShow); + } return wxFrame::Show(bShow); } diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index c4e0b2f227..d335dde36e 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -153,6 +153,7 @@ bool CBOINCGUIApp::OnInit() { // Initialize local variables int iErrorCode = 0; int iSelectedLanguage = 0; + bool bOpenEventLog = false; wxString strDesiredSkinName = wxEmptyString; wxString strDialogMessage = wxEmptyString; bool success = false; @@ -206,6 +207,7 @@ bool CBOINCGUIApp::OnInit() { m_pConfig->Read(wxT("DisableAutoStart"), &m_iBOINCMGRDisableAutoStart, 0L); m_pConfig->Read(wxT("Language"), &iSelectedLanguage, 0L); m_pConfig->Read(wxT("GUISelection"), &m_iGUISelected, BOINC_SIMPLEGUI); + m_pConfig->Read(wxT("EventLogOpen"), &bOpenEventLog); // Should we abort the BOINC Manager startup process? @@ -456,7 +458,10 @@ bool CBOINCGUIApp::OnInit() { } else { ShowApplication(false); } - + + if(bOpenEventLog) { + DisplayEventLog(m_bGUIVisible); + } return true; } @@ -793,7 +798,7 @@ int CBOINCGUIApp::StartBOINCDefaultScreensaverTest() { // Display the Event Log, it is a modeless dialog not owned by any // other UI element. -bool CBOINCGUIApp::DisplayEventLog() { +bool CBOINCGUIApp::DisplayEventLog(bool bShowWindow) { bool rc = false; if (m_pEventLog) { @@ -801,7 +806,7 @@ bool CBOINCGUIApp::DisplayEventLog() { } else { m_pEventLog = new CDlgEventLog(); if (m_pEventLog) { - rc = m_pEventLog->Show(); + rc = m_pEventLog->Show(bShowWindow); if (m_pFrame) { m_pFrame->UpdateRefreshTimerInterval(); } diff --git a/clientgui/BOINCGUIApp.h b/clientgui/BOINCGUIApp.h index 0696d64647..977b442c4f 100644 --- a/clientgui/BOINCGUIApp.h +++ b/clientgui/BOINCGUIApp.h @@ -153,7 +153,7 @@ public: wxArrayString& GetSupportedLanguages() { return m_astrLanguages; } - bool DisplayEventLog(); + bool DisplayEventLog(bool bShowWindow = true); void OnEventLogClose(); void FireReloadSkin(); diff --git a/clientgui/BOINCTaskBar.cpp b/clientgui/BOINCTaskBar.cpp index 5c07da9bae..26c3dd77c3 100644 --- a/clientgui/BOINCTaskBar.cpp +++ b/clientgui/BOINCTaskBar.cpp @@ -122,7 +122,7 @@ void CTaskBarIcon::OnClose(wxCloseEvent& event) { CDlgEventLog* pEventLog = wxGetApp().GetEventLog(); if (pEventLog) { - pEventLog->Close(); + pEventLog->Destroy(); } CBOINCBaseFrame* pFrame = wxGetApp().GetFrame(); diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp index dac6f958ef..fce2e5457f 100644 --- a/clientgui/DlgEventLog.cpp +++ b/clientgui/DlgEventLog.cpp @@ -136,6 +136,7 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt m_strFilteredProjectName.clear(); m_iFilteredIndexes.Clear(); m_bProcessingRefreshEvent = false; + m_bEventLogIsOpen = true; ////@end CDlgEventLog member initialisation CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced(); @@ -368,6 +369,7 @@ void CDlgEventLog::OnOK( wxCommandEvent& WXUNUSED(event) ) { */ void CDlgEventLog::OnClose(wxCloseEvent& WXUNUSED(event)) { + m_bEventLogIsOpen = false; // User specifically closed window Destroy(); } @@ -468,6 +470,8 @@ void CDlgEventLog::OnRefresh() { bool isConnected; static bool was_connected = false; + if (!IsShown()) return; + if (!m_bProcessingRefreshEvent) { m_bProcessingRefreshEvent = true; @@ -526,7 +530,7 @@ void CDlgEventLog::OnRefresh() { bool CDlgEventLog::SaveState() { wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::SaveState - Function Begin")); - wxString strBaseConfigLocation = wxString(wxT("/EventLog/")); + wxString strBaseConfigLocation = wxEmptyString; wxConfigBase* pConfig = wxConfigBase::Get(FALSE); wxListItem liColumnInfo; wxInt32 iIndex = 0; @@ -540,9 +544,14 @@ bool CDlgEventLog::SaveState() { // pointer, return false. if (!pConfig) return false; + strBaseConfigLocation = wxString(wxT("/")); + pConfig->SetPath(strBaseConfigLocation); + pConfig->Write(wxT("EventLogOpen"), m_bEventLogIsOpen); + // // Save Frame State // + strBaseConfigLocation = wxString(wxT("/EventLog/")); pConfig->SetPath(strBaseConfigLocation); // Convert to a zero based index diff --git a/clientgui/DlgEventLog.h b/clientgui/DlgEventLog.h index 901517e998..f2741aaa49 100644 --- a/clientgui/DlgEventLog.h +++ b/clientgui/DlgEventLog.h @@ -157,6 +157,8 @@ private: wxListItemAttr* m_pMessageErrorGrayAttr; bool m_bProcessingRefreshEvent; + + bool m_bEventLogIsOpen; bool SaveState(); bool RestoreState();