From 93fc7ff404a347efdbe8de58cde042bf1d19a6b2 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 3 May 2007 16:17:54 +0000 Subject: [PATCH] - fixes #5: Include the version number of the client next to it's name, so people can see if they need to upgrade a remote client. - fixes #149: Change the parsing function for the CBOINCGridCellProgressRenderer so that we don't have to update the docs or screenshots. Display the progress bar as a resource share fraction. clientgui/ AdvancedFrame.cpp BOINCGridCtrl.cpp MainDocument.cpp, .h ViewProjectsGrid.cpp svn path=/trunk/boinc/; revision=12541 --- checkin_notes | 16 ++++++++++++++++ clientgui/AdvancedFrame.cpp | 8 +++++++- clientgui/BOINCGridCtrl.cpp | 23 ++++++++++++++++------- clientgui/MainDocument.cpp | 20 ++++++++++++++++++++ clientgui/MainDocument.h | 3 +++ clientgui/ViewProjectsGrid.cpp | 5 +---- 6 files changed, 63 insertions(+), 12 deletions(-) diff --git a/checkin_notes b/checkin_notes index a2f7f69ffe..6c423cddf7 100755 --- a/checkin_notes +++ b/checkin_notes @@ -4282,3 +4282,19 @@ Charlie 2 May 2007 mac_build/ boinc.xcodeproj/ project.pbxproj + +Rom 3 May 2007 + - fixes #5: Include the version number of the client next to it's + name, so people can see if they need to upgrade a remote client. + - fixes #149: Change the parsing function for the + CBOINCGridCellProgressRenderer so that we don't have to update + the docs or screenshots. Display the progress bar as a resource + share fraction. + + clientgui/ + AdvancedFrame.cpp + BOINCGridCtrl.cpp + MainDocument.cpp, .h + ViewProjectsGrid.cpp + + \ No newline at end of file diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index 02fca9699f..5f7934637d 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -1770,6 +1770,7 @@ void CAdvancedFrame::OnFrameRender(wxTimerEvent &event) { wxString strBuffer = wxEmptyString; wxString strComputerName = wxEmptyString; + wxString strComputerVersion = wxEmptyString; wxString strStatusText = wxEmptyString; wxString strTitle = m_strBaseTitle; wxString strLocale = wxString(setlocale(LC_NUMERIC, NULL), wxConvUTF8); @@ -1778,6 +1779,7 @@ void CAdvancedFrame::OnFrameRender(wxTimerEvent &event) { pDoc->GetConnectingComputerName(strComputerName); } else { pDoc->GetConnectedComputerName(strComputerName); + pDoc->GetConnectedComputerVersion(strComputerVersion); } if (pDoc->IsComputerNameLocal(strComputerName)) { @@ -1789,7 +1791,11 @@ void CAdvancedFrame::OnFrameRender(wxTimerEvent &event) { strStatusText.Printf(_("Connecting to %s"), strComputerName.c_str()); } else { strTitle.Printf(_("%s - (%s)"), m_strBaseTitle.c_str(), strComputerName.c_str()); - strStatusText.Printf(_("Connected to %s"), strComputerName.c_str()); + strStatusText.Printf( + _("Connected to %s (%s)"), + strComputerName.c_str(), + strComputerVersion.c_str() + ); } // The Mac takes a huge performance hit redrawing this window, diff --git a/clientgui/BOINCGridCtrl.cpp b/clientgui/BOINCGridCtrl.cpp index 804e8b777b..fb8482196f 100644 --- a/clientgui/BOINCGridCtrl.cpp +++ b/clientgui/BOINCGridCtrl.cpp @@ -717,7 +717,7 @@ CBOINCGridCellMessageRenderer::CBOINCGridCellMessageRenderer(int priocol){ } void CBOINCGridCellMessageRenderer::Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rect, int row, int col, bool isSelected) { - wxString szError("Error",wxConvUTF8); + wxString szError("Error"); if(grid.GetCellValue(row,column).Trim(false).IsSameAs(szError)) { attr.SetTextColour(*wxRED); } @@ -756,13 +756,22 @@ void CBOINCGridCellProgressRenderer::DoProgressDrawing(wxGrid& grid, wxGridCellA SetTextColoursAndFont(grid, attr, dc, isSelected); //calculate the two parts of the progress rect - wxString value = grid.GetCellValue(row,col); - wxString strValue = value; + // + double dv = 0.0; + wxString strValue = grid.GetCellValue(row,col); if(m_bDoPercentAppending) { - strValue = strValue + wxString(" %",wxConvUTF8); + strValue = strValue + wxString(" %"); } - double dv; - value.ToDouble ( &dv ); // NOTE: we should do error-checking/reporting here!! + + // Project view uses the format: %0.0f (%0.2f%%) + // Everyone else uses: %.3f%% + if (strValue.Find("(") != wxNOT_FOUND) { + strValue.SubString(strValue.Find("(") + 1, strValue.Find(")") - 1).ToDouble( &dv ); + } else { + strValue.ToDouble ( &dv ); // NOTE: we should do error-checking/reporting here!! + } + + wxRect p1(rect); wxRect p2(rect); int r = (int)((rect.GetRight()-rect.GetLeft())*dv / 100.0); @@ -772,7 +781,7 @@ void CBOINCGridCellProgressRenderer::DoProgressDrawing(wxGrid& grid, wxGridCellA //start drawing dc.SetClippingRegion(rect); wxBrush old = dc.GetBrush(); - wxColour progressColour = wxTheColourDatabase->Find(wxString("LIGHT BLUE",wxConvUTF8)); + wxColour progressColour = wxTheColourDatabase->Find(wxString("LIGHT BLUE")); wxBrush* progressBrush = wxTheBrushList->FindOrCreateBrush(progressColour); wxPen* progressPen = wxThePenList->FindOrCreatePen(progressColour,1,wxSOLID); //draw the outline rectangle diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index c3b136b60c..400232e02a 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -169,6 +169,12 @@ int CNetworkConnection::GetConnectedComputerName(wxString& strMachine) { } +int CNetworkConnection::GetConnectedComputerVersion(wxString& strVersion) { + strVersion = m_strConnectedComputerVersion; + return 0; +} + + int CNetworkConnection::GetConnectingComputerName(wxString& strMachine) { strMachine = m_strNewComputerName; return 0; @@ -263,6 +269,14 @@ void CNetworkConnection::SetStateSuccess(wxString& strComputer, wxString& strCom m_strNewComputerPassword = wxEmptyString; m_bNewConnection = false; + // Get the version of the client and cache it + VERSION_INFO vi; + m_pDocument->rpc.exchange_versions(vi); + m_strConnectedComputerVersion.Printf( + wxT("%d.%d.%d"), + vi.major, vi.minor, vi.release + ); + m_bConnectEvent = false; pFrame->FireConnect(); @@ -432,6 +446,12 @@ int CMainDocument::GetConnectedComputerName(wxString& strMachine) { } +int CMainDocument::GetConnectedComputerVersion(wxString& strVersion) { + m_pNetworkConnection->GetConnectedComputerVersion(strVersion); + return 0; +} + + int CMainDocument::GetConnectingComputerName(wxString& strMachine) { m_pNetworkConnection->GetConnectingComputerName(strMachine); return 0; diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index c216a3dcd0..ee557f1ad8 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -39,6 +39,7 @@ public: void ForceReconnect() { m_bForceReconnect = true; SetStateDisconnected(); }; int FrameShutdownDetected(); int GetConnectedComputerName(wxString& strMachine); + int GetConnectedComputerVersion(wxString& strVersion); int GetConnectingComputerName(wxString& strMachine); bool IsComputerNameLocal(const wxString& strMachine); void GetLocalPassword(wxString& strPassword); @@ -67,6 +68,7 @@ private: wxString m_strNewComputerPassword; wxString m_strConnectedComputerName; wxString m_strConnectedComputerPassword; + wxString m_strConnectedComputerVersion; }; @@ -112,6 +114,7 @@ public: int CoreClientQuit(); int GetConnectedComputerName(wxString& strMachine); + int GetConnectedComputerVersion(wxString& strVersion); int GetConnectingComputerName(wxString& strMachine); bool IsComputerNameLocal(const wxString strMachine); bool IsConnected(); diff --git a/clientgui/ViewProjectsGrid.cpp b/clientgui/ViewProjectsGrid.cpp index b2570d91b0..4290978720 100644 --- a/clientgui/ViewProjectsGrid.cpp +++ b/clientgui/ViewProjectsGrid.cpp @@ -586,10 +586,7 @@ void CViewProjectsGrid::FormatAVGCredit(wxInt32 item, wxString& strBuffer) { void CViewProjectsGrid::FormatResourceShare(wxInt32 item, wxString& strBuffer){ CMainDocument* pDoc = wxGetApp().GetDocument(); - PROJECT* project = wxGetApp().GetDocument()->project(item); - - wxASSERT(pDoc); - wxASSERT(wxDynamicCast(pDoc, CMainDocument)); + PROJECT* project = pDoc->project(item); if (project && pDoc) { strBuffer.Printf(wxT(" %0.0f (%0.2f%%)"),