diff --git a/checkin_notes b/checkin_notes index 1f5ec2ba93..a92419023f 100755 --- a/checkin_notes +++ b/checkin_notes @@ -9633,4 +9633,14 @@ Walt 31 Aug 2006 client app.C lib/ - procinfo_unix.C \ No newline at end of file + procinfo_unix.C + +Rom 31 Aug 2006 + - Bug Fix: Forcing a global state refresh now causes the client to update the + state right then and there. This should fix the app version friendly name + flicker problem. + + clientgui/ + MainDocument.cpp, .h + sg_BoincSimpleGUI.cpp + ViewWork.cpp diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 7560f7edd4..19a4a73633 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -288,8 +288,6 @@ CMainDocument::CMainDocument() { m_iMessageSequenceNumber = 0; - m_bCachedStateLocked = false; - m_dtCachedStateLockTimestamp = wxDateTime::Now(); m_dtCachedStateTimestamp = wxDateTime((time_t)0); m_dtCachedCCStatusTimestamp = wxDateTime((time_t)0); m_dtProjecStatusTimestamp = wxDateTime((time_t)0); @@ -309,20 +307,24 @@ CMainDocument::~CMainDocument() { int CMainDocument::CachedStateUpdate() { + wxLogTrace(wxT("Function Start/End"), wxT("CMainDocument::CachedStateUpdate - Function Begin")); + CBOINCBaseFrame* pFrame = wxGetApp().GetFrame(); int retval = 0; - wxTimeSpan ts(m_dtCachedStateLockTimestamp - m_dtCachedStateTimestamp); - if (!m_bCachedStateLocked && IsConnected() && (ts.GetSeconds() > 3600)) { + wxTimeSpan ts(wxDateTime::Now() - m_dtCachedStateTimestamp); + if (IsConnected() && (ts.GetSeconds() > 3600)) { wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame)); pFrame->UpdateStatusText(_("Retrieving system state; please wait...")); - m_dtCachedStateTimestamp = m_dtCachedStateLockTimestamp; + m_dtCachedStateTimestamp = wxDateTime::Now(); retval = rpc.get_state(state); if (retval) { wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedStateUpdate - Get State Failed '%d'"), retval); m_pNetworkConnection->SetStateDisconnected(); } + wxTimeSpan tsStateParseDuration(wxDateTime::Now() - m_dtCachedStateTimestamp); + wxLogTrace(wxT("Function Status"), wxT("CMainDocument::CachedStateUpdate - State Update Time (Milliseconds) '%d'"), tsStateParseDuration.GetMilliseconds()); pFrame->UpdateStatusText(_("Retrieving host information; please wait...")); @@ -335,6 +337,7 @@ int CMainDocument::CachedStateUpdate() { pFrame->UpdateStatusText(wxEmptyString); } + wxLogTrace(wxT("Function Start/End"), wxT("CMainDocument::CachedStateUpdate - Function End")); return retval; } @@ -391,8 +394,7 @@ int CMainDocument::ResetState() { resource_status.clear(); proxy_info.clear(); - m_dtCachedStateLockTimestamp = wxDateTime::Now(); - m_dtCachedStateTimestamp = wxDateTime((time_t)0); + ForceCacheUpdate(); m_iMessageSequenceNumber = 0; return 0; @@ -444,19 +446,6 @@ bool CMainDocument::IsReconnecting() { } -int CMainDocument::CachedStateLock() { - m_bCachedStateLocked = true; - m_dtCachedStateLockTimestamp = wxDateTime::Now(); - return 0; -} - - -int CMainDocument::CachedStateUnlock() { - m_bCachedStateLocked = false; - return 0; -} - - int CMainDocument::FrameShutdownDetected() { return m_pNetworkConnection->FrameShutdownDetected(); } @@ -514,8 +503,8 @@ int CMainDocument::SetNetworkRunMode(int iMode) { int CMainDocument::ForceCacheUpdate() { - m_dtCachedStateLockTimestamp = wxDateTime::Now(); m_dtCachedStateTimestamp = wxDateTime((time_t)0); + CachedStateUpdate(); return 0; } diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index 7c9c58fea4..d8d88c21a1 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -79,14 +79,7 @@ public: // private: - bool m_bCachedStateLocked; - - wxDateTime m_dtCachedActivityRunModeTimestamp; - wxDateTime m_dtCachedNetworkRunModeTimestamp; wxDateTime m_dtCachedCCStatusTimestamp; - int m_iCachedActivityRunMode; - int m_iCachedNetworkRunMode; - CC_STATUS status; int CachedStateUpdate(); @@ -132,9 +125,9 @@ public: RPC_CLIENT rpc; CC_STATE state; + CC_STATUS status; HOST_INFO host; wxDateTime m_dtCachedStateTimestamp; - wxDateTime m_dtCachedStateLockTimestamp; // diff --git a/clientgui/ViewWork.cpp b/clientgui/ViewWork.cpp index ee637e2c9e..7220a31b78 100644 --- a/clientgui/ViewWork.cpp +++ b/clientgui/ViewWork.cpp @@ -578,27 +578,30 @@ wxInt32 CViewWork::FormatProjectName(wxInt32 item, wxString& strBuffer) const { wxInt32 CViewWork::FormatApplicationName(wxInt32 item, wxString& strBuffer) const { - CMainDocument* doc = wxGetApp().GetDocument(); + CMainDocument* pDoc = wxGetApp().GetDocument(); RESULT* result = wxGetApp().GetDocument()->result(item); RESULT* state_result = NULL; - wxASSERT(doc); - wxASSERT(wxDynamicCast(doc, CMainDocument)); + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); if (result) { - state_result = doc->state.lookup_result(result->project_url, result->name); - if (state_result) { - wxString strLocale = wxString(setlocale(LC_NUMERIC, NULL), wxConvUTF8); - setlocale(LC_NUMERIC, "C"); - strBuffer.Printf( - wxT("%s %.2f"), - wxString(state_result->wup->avp->app_name.c_str(), wxConvUTF8).c_str(), - state_result->wup->avp->version_num/100.0 - ); - setlocale(LC_NUMERIC, (const char*)strLocale.mb_str()); - } else { - doc->ForceCacheUpdate(); + state_result = pDoc->state.lookup_result(result->project_url, result->name); + if (!state_result) { + pDoc->ForceCacheUpdate(); + state_result = pDoc->state.lookup_result(result->project_url, result->name); } + wxASSERT(state_result); + + wxString strLocale = wxString(setlocale(LC_NUMERIC, NULL), wxConvUTF8); + setlocale(LC_NUMERIC, "C"); + strBuffer.Printf( + wxT("%s %.2f"), + wxString(state_result->wup->avp->app_name.c_str(), wxConvUTF8).c_str(), + state_result->wup->avp->version_num/100.0 + ); + setlocale(LC_NUMERIC, (const char*)strLocale.mb_str()); + } return 0; diff --git a/clientgui/sg_BoincSimpleGUI.cpp b/clientgui/sg_BoincSimpleGUI.cpp index 186f27496f..dd7fb73cbf 100644 --- a/clientgui/sg_BoincSimpleGUI.cpp +++ b/clientgui/sg_BoincSimpleGUI.cpp @@ -372,14 +372,14 @@ void CSimpleFrame::UpdateResultView(){ // create one and add it to notebook std::string projUrl = result->project_url; std::string nme = result->name; - RESULT* resState = pDoc->state.lookup_result(projUrl, nme); - wxString friendlyName; - - if(resState!=0){ - friendlyName = wxString(resState->app->name.c_str(), wxConvUTF8 ); - }else{ - friendlyName = wxString("na"); + RESULT* resState = NULL; + wxString friendlyName; + + resState = pDoc->state.lookup_result(projUrl, nme); + if(!resState){ + pDoc->ForceCacheUpdate(); } + friendlyName = wxString(resState->app->name.c_str(), wxConvUTF8 ); std::string index = " "; //index += i; friendlyName += wxString(index.c_str(), wxConvUTF8 );