From a9ccfecd7cb5d3033fa04a718dc75234db15e445 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Mon, 4 Jan 2010 21:10:05 +0000 Subject: [PATCH] - MGR: Display each notice in the notices tab. clientgui/ MainDocument.cpp ViewNotifications.cpp, .h svn path=/trunk/boinc/; revision=20070 --- checkin_notes | 7 ++++ clientgui/MainDocument.cpp | 7 +++- clientgui/ViewNotifications.cpp | 67 +++++++++++++++++++++++++++------ clientgui/ViewNotifications.h | 1 + 4 files changed, 69 insertions(+), 13 deletions(-) diff --git a/checkin_notes b/checkin_notes index 680a67d9e2..ea7938b9ad 100644 --- a/checkin_notes +++ b/checkin_notes @@ -40,3 +40,10 @@ Rom 4 Jan 2010 clientgui/ ViewNotifications.cpp, .h + +Rom 4 Jan 2010 + - MGR: Display each notice in the notices tab. + + clientgui/ + MainDocument.cpp + ViewNotifications.cpp, .h diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 76ac141779..8b94dcdf01 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -1818,8 +1818,11 @@ int CMainDocument::CachedNoticeUpdate() { goto done; } if (notices.notices.size() != 0) { - size_t last_ind = notices.notices.size()-1; - m_iNoticeSequenceNumber = notices.notices[last_ind]->seqno; + for (unsigned int i = 0; i < notices.notices.size(); i++) { + if (notices.notices[i]->seqno > m_iNoticeSequenceNumber) { + m_iNoticeSequenceNumber = notices.notices[i]->seqno; + } + } } } done: diff --git a/clientgui/ViewNotifications.cpp b/clientgui/ViewNotifications.cpp index 6f4e8da069..ff434a272a 100644 --- a/clientgui/ViewNotifications.cpp +++ b/clientgui/ViewNotifications.cpp @@ -109,6 +109,10 @@ const char** CViewNotifications::GetViewIcon() { } +const int CViewNotifications::GetViewRefreshRate() { + return 10; +} + const int CViewNotifications::GetViewCurrentViewPage() { return VW_NOTIF; } @@ -129,9 +133,13 @@ void CViewNotifications::OnListRender( wxTimerEvent& WXUNUSED(event) ) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxString strHTML; - wxString strPage; + wxString strItems; wxString strTemp; + wxDateTime dtBuffer; + NOTICE* pNotice = NULL; int iNoticeCount = 0; + unsigned int iNoticeIndex = 0; + wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); @@ -141,22 +149,59 @@ void CViewNotifications::OnListRender( wxTimerEvent& WXUNUSED(event) ) { if (iNoticeCount == -1) { - strPage += _("Retrieving notices now..."); + strItems += _("Retrieving notices now..."); } else { - strTemp.Printf(_("%d notices detected"), iNoticeCount); - strPage += strTemp; + // Pre-allocate buffer size so string concat is much faster + strItems.Alloc(4096*iNoticeCount); + for (iNoticeIndex = 0; iNoticeIndex < (unsigned int)iNoticeCount; iNoticeIndex++) { + pNotice = pDoc->notice(iNoticeIndex); + + if (pNotice) { + + strItems += wxT("

"); + strItems += wxT(""); + strItems += wxT(" "); + strItems += wxT(" "); + strItems += wxT(" "); + strItems += wxT(" "); + strItems += wxT(" "); + strItems += wxT(" "); + strItems += wxT("
"); + + strItems += _("Diag: "); + strTemp.Printf(wxT("index(%d)/seqno(%d)"), iNoticeIndex, pNotice->seqno); + strItems += strTemp; + + strItems += wxT("
"); + strItems += _("Title: "); + + strItems += wxString(pNotice->title, wxConvUTF8); + + strItems += wxT("
"); + strItems += _("Date: "); + + dtBuffer.Set((time_t)pNotice->arrival_time); + strItems += dtBuffer.Format(); + + strItems += wxT("
"); + strItems += wxString(pNotice->description.c_str(), wxConvUTF8); + strItems += wxT("
"); + strItems += wxT("

"); + + } + } } - strHTML = wxT(""); - strHTML += wxT(""); - strHTML += wxT(""); - strHTML += wxT(""); - strHTML += strPage; - strHTML += wxT(""); - strHTML += wxT(""); + strHTML = wxT(""); + strHTML += wxT(""); + strHTML += wxT(""); + strHTML += wxT(""); + strHTML += strItems; + strHTML += wxT(""); + strHTML += wxT(""); m_pHtmlPane->SetPage( strHTML ); diff --git a/clientgui/ViewNotifications.h b/clientgui/ViewNotifications.h index 6734dcaa52..2b60690989 100644 --- a/clientgui/ViewNotifications.h +++ b/clientgui/ViewNotifications.h @@ -38,6 +38,7 @@ public: virtual wxString& GetViewName(); virtual wxString& GetViewDisplayName(); virtual const char** GetViewIcon(); + virtual const int GetViewRefreshRate(); virtual const int GetViewCurrentViewPage(); protected: