From 9d9b248a20a85546da55d1e4f45548945649bcdb Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Fri, 23 Jun 2006 22:30:47 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=10509 --- checkin_notes | 13 +++++++--- clientgui/BOINCBaseFrame.cpp | 46 +++++++++++++++++++++++++++++++++++- clientgui/BOINCBaseFrame.h | 22 ++++++++++------- clientgui/Events.h | 1 + clientgui/MainFrame.cpp | 18 -------------- clientgui/MainFrame.h | 4 ---- 6 files changed, 70 insertions(+), 34 deletions(-) diff --git a/checkin_notes b/checkin_notes index daed9101d1..ddcb610121 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6764,15 +6764,14 @@ David 23 June 2006 Rom 23 June 2006 - Move document initialization code to the base class so both GUI's can initialize the CC connection at startup. - - Enable the inter-component alert system. Displays dialogs if the GUI - is open, otherwise display a ballon in the taskbar. + - Enable the inter-component alert system for the simple GUI. Displays + dialogs if the GUI is open, otherwise display a ballon in the taskbar. clientgui/ BOINCBaseFrame.cpp, .h MainFrame.cpp, .h sg_BoincSimpleGUI.cpp, .h - David 23 June 2006 - core client: fiddle with messages @@ -6781,3 +6780,11 @@ David 23 June 2006 cpu_sched.C cs_scheduler.C gui_rpc_server.C + +Rom 23 June 2006 + - Enable the dialup and idle tracking systems for the simple GUI. + + clientgui/ + BOINCBaseFrame.cpp, .h + MainFrame.cpp, .h + diff --git a/clientgui/BOINCBaseFrame.cpp b/clientgui/BOINCBaseFrame.cpp index 68a0f3f751..00ca212d7b 100644 --- a/clientgui/BOINCBaseFrame.cpp +++ b/clientgui/BOINCBaseFrame.cpp @@ -25,6 +25,7 @@ #include "hyperlink.h" #include "BOINCGUIApp.h" #include "BOINCBaseFrame.h" +#include "BOINCDialupManager.h" #include "Events.h" @@ -39,6 +40,7 @@ IMPLEMENT_DYNAMIC_CLASS(CBOINCBaseFrame, wxFrame) BEGIN_EVENT_TABLE (CBOINCBaseFrame, wxFrame) EVT_TIMER(ID_DOCUMENTPOLLTIMER, CBOINCBaseFrame::OnDocumentPoll) + EVT_TIMER(ID_ALERTPOLLTIMER, CBOINCBaseFrame::OnAlertPoll) EVT_FRAME_INITIALIZED(CBOINCBaseFrame::OnInitialized) EVT_FRAME_ALERT(CBOINCBaseFrame::OnAlert) EVT_CLOSE(CBOINCBaseFrame::OnClose) @@ -67,11 +69,21 @@ CBOINCBaseFrame::CBOINCBaseFrame(wxWindow* parent, const wxWindowID id, const wx m_aSelectedComputerMRU.Clear(); + m_pDialupManager = new CBOINCDialUpManager(); + wxASSERT(m_pDialupManager->IsOk()); + + m_pDocumentPollTimer = new wxTimer(this, ID_DOCUMENTPOLLTIMER); wxASSERT(m_pDocumentPollTimer); m_pDocumentPollTimer->Start(250); // Send event every 250 milliseconds + m_pAlertPollTimer = new wxTimer(this, ID_ALERTPOLLTIMER); + wxASSERT(m_pAlertPollTimer); + + m_pAlertPollTimer->Start(1000); // Send event every 1000 milliseconds + + // Limit the number of times the UI can update itself to two times a second // NOTE: Linux and Mac were updating several times a second and eating // CPU time @@ -91,18 +103,27 @@ CBOINCBaseFrame::CBOINCBaseFrame(wxWindow* parent, const wxWindowID id, const wx CBOINCBaseFrame::~CBOINCBaseFrame() { wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::~CBOINCBaseFrame - Function Begin")); + wxASSERT(m_pAlertPollTimer); wxASSERT(m_pDocumentPollTimer); + if (m_pAlertPollTimer) { + m_pAlertPollTimer->Stop(); + delete m_pAlertPollTimer; + } + if (m_pDocumentPollTimer) { m_pDocumentPollTimer->Stop(); delete m_pDocumentPollTimer; } + if (m_pDialupManager) + delete m_pDialupManager; + wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::~CBOINCBaseFrame - Function End")); } -void CBOINCBaseFrame::OnDocumentPoll(wxTimerEvent& /*event*/) { +void CBOINCBaseFrame::OnDocumentPoll(wxTimerEvent& WXUNUSED(event)) { static bool bAlreadyRunOnce = false; CMainDocument* pDoc = wxGetApp().GetDocument(); @@ -120,6 +141,29 @@ void CBOINCBaseFrame::OnDocumentPoll(wxTimerEvent& /*event*/) { } +void CBOINCBaseFrame::OnAlertPoll(wxTimerEvent& WXUNUSED(event)) { + static bool bAlreadyRunningLoop = false; + CMainDocument* pDoc = wxGetApp().GetDocument(); + + if (!bAlreadyRunningLoop) { + bAlreadyRunningLoop = true; + + // Update idle detection if needed. + wxGetApp().UpdateSystemIdleDetection(); + + // Check to see if there is anything that we need to do from the + // dial up user perspective. + if (pDoc && m_pDialupManager) { + if (pDoc->IsConnected()) { + m_pDialupManager->poll(); + } + } + + bAlreadyRunningLoop = false; + } +} + + void CBOINCBaseFrame::OnInitialized(CFrameEvent& WXUNUSED(event)) { wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnInitialized - Function Begin")); diff --git a/clientgui/BOINCBaseFrame.h b/clientgui/BOINCBaseFrame.h index 64a1916c9e..203d5f8fcf 100644 --- a/clientgui/BOINCBaseFrame.h +++ b/clientgui/BOINCBaseFrame.h @@ -26,6 +26,7 @@ class CFrameEvent; class CFrameAlertEvent; +class CBOINCDialUpManager; enum FrameAlertEventType { AlertNormal = 0, @@ -52,6 +53,8 @@ public: ~CBOINCBaseFrame(); void OnDocumentPoll( wxTimerEvent& event ); + void OnAlertPoll( wxTimerEvent& event ); + void OnInitialized( CFrameEvent& event ); virtual void OnAlert( CFrameAlertEvent& event ); @@ -80,18 +83,21 @@ public: protected: - wxTimer* m_pDocumentPollTimer; + CBOINCDialUpManager* m_pDialupManager; - int m_iSelectedLanguage; - int m_iReminderFrequency; - int m_iDisplayExitWarning; + wxTimer* m_pDocumentPollTimer; + wxTimer* m_pAlertPollTimer; - wxString m_strNetworkDialupConnectionName; + int m_iSelectedLanguage; + int m_iReminderFrequency; + int m_iDisplayExitWarning; - wxArrayString m_aSelectedComputerMRU; + wxString m_strNetworkDialupConnectionName; - virtual bool SaveState(); - virtual bool RestoreState(); + wxArrayString m_aSelectedComputerMRU; + + virtual bool SaveState(); + virtual bool RestoreState(); DECLARE_EVENT_TABLE() }; diff --git a/clientgui/Events.h b/clientgui/Events.h index 19fbab35f7..9602797c7a 100644 --- a/clientgui/Events.h +++ b/clientgui/Events.h @@ -47,6 +47,7 @@ #define ID_ADVANCEDAMDEFECT 6030 #define ID_OPENWEBSITE 6031 #define ID_FILESWITCHGUI 6032 +#define ID_ALERTPOLLTIMER 6033 #define ID_SIMPLEFRAME 6100 #define ID_TB_TIMER 6800 #define ID_TB_SUSPEND 6801 diff --git a/clientgui/MainFrame.cpp b/clientgui/MainFrame.cpp index 145490362f..9493801dd1 100644 --- a/clientgui/MainFrame.cpp +++ b/clientgui/MainFrame.cpp @@ -215,9 +215,6 @@ CMainFrame::CMainFrame(wxString title, wxIcon* icon) : SetStatusBarPane(0); - m_pDialupManager = new CBOINCDialUpManager(); - wxASSERT(m_pDialupManager->IsOk()); - m_pRefreshStateTimer = new wxTimer(this, ID_REFRESHSTATETIMER); wxASSERT(m_pRefreshStateTimer); @@ -276,11 +273,6 @@ CMainFrame::~CMainFrame() { if (m_pMenubar) wxCHECK_RET(DeleteMenu(), _T("Failed to delete menu bar.")); -#ifdef __WXMSW__ - if (m_pDialupManager) - delete m_pDialupManager; -#endif - wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::~CMainFrame - Function End")); } @@ -1655,16 +1647,6 @@ void CMainFrame::OnFrameRender(wxTimerEvent &event) { if (!bAlreadyRunningLoop) { bAlreadyRunningLoop = true; - wxGetApp().UpdateSystemIdleDetection(); - - // Check to see if there is anything that we need to do from the - // dial up user perspective. - if (pDoc->IsConnected()) { - if (m_pDialupManager) { - m_pDialupManager->poll(); - } - } - if (IsShown()) { if (pDoc) { wxASSERT(wxDynamicCast(pDoc, CMainDocument)); diff --git a/clientgui/MainFrame.h b/clientgui/MainFrame.h index 82de0bdc29..f60951df46 100644 --- a/clientgui/MainFrame.h +++ b/clientgui/MainFrame.h @@ -46,9 +46,6 @@ private: }; -class CBOINCDialUpManager; - - class CMainFrame : public CBOINCBaseFrame { DECLARE_DYNAMIC_CLASS(CMainFrame) @@ -113,7 +110,6 @@ private: wxMenuBar* m_pMenubar; wxNotebook* m_pNotebook; CStatusBar* m_pStatusbar; - CBOINCDialUpManager* m_pDialupManager; wxString m_strBaseTitle;