Ticket #347: boincmgr_347.patch

File boincmgr_347.patch, 5.6 kB (added by Der Meister, 7 months ago)

Patch implementing the dynamic refresh rate

  • ../clientgui/BOINCBaseView.cpp

    old new  
    2424#include "stdwx.h" 
    2525#include "BOINCGUIApp.h" 
    2626#include "MainDocument.h" 
     27#include "BOINCBaseFrame.h" 
     28#include "AdvancedFrame.h" 
    2729#include "BOINCBaseView.h" 
    2830#include "BOINCTaskCtrl.h" 
    2931#include "BOINCListCtrl.h" 
     
    533535    return false; 
    534536} 
    535537 
     538void CBOINCBaseView::UpdateRefreshTimer(const int rowCount) { 
     539    CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame); 
    536540 
     541    wxASSERT(pFrame); 
     542    wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame)); 
     543 
     544    int newInterval; 
     545    if (rowCount <= 10) { 
     546        newInterval = 1000; 
     547    } else if (rowCount <= 300) { 
     548        newInterval = 100 * rowCount; 
     549    } else { 
     550        newInterval = 30000; 
     551    } 
     552 
     553    pFrame->UpdateListPanelRenderTimerInterval(GetViewRefreshRate() * newInterval); 
     554} 
     555 
     556 
    537557void CBOINCBaseView::append_to_status(wxString& existing, const wxChar* additional) { 
    538558    if (existing.size() == 0) { 
    539559        existing = additional; 
  • ../clientgui/BOINCBaseView.h

    old new  
    146146    bool                    _EnsureLastItemVisible(); 
    147147    virtual bool            EnsureLastItemVisible(); 
    148148 
     149    virtual void            UpdateRefreshTimer(const int rowCount); 
     150 
    149151    static  void            append_to_status(wxString& existing, const wxChar* additional); 
    150152        static  wxString        HtmlEntityEncode(wxString strRaw); 
    151153        static  wxString        HtmlEntityDecode(wxString strRaw); 
  • ../clientgui/ViewMessagesGrid.cpp

    old new  
    281281        if ( m_pGridPane->GetNumberRows() ) { 
    282282            m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows()); 
    283283        } 
     284        UpdateRefreshTimer(0); 
    284285        return; 
    285286    } 
    286287 
     
    298299        //update cell values (unsorted, like delivered from core client) 
    299300        wxString strBuffer; 
    300301    int iMax = m_pGridPane->GetNumberRows(); 
     302    UpdateRefreshTimer(iMax); 
    301303        for(int iRow = 0; iRow < iMax; iRow++) { 
    302304 
    303305        FormatProjectName(iRow, strBuffer); 
  • ../clientgui/ViewProjectsGrid.cpp

    old new  
    740740        if ( m_pGridPane->GetNumberRows() ) { 
    741741            m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows()); 
    742742        } 
     743        UpdateRefreshTimer(0); 
    743744        return; 
    744745    } 
    745746 
     
    756757 
    757758        wxString strBuffer; 
    758759        int iMax = m_pGridPane->GetNumberRows(); 
     760    UpdateRefreshTimer(iMax); 
    759761        for(int iRow = 0; iRow < iMax; iRow++) { 
    760762                 
    761763        FormatProjectName(iRow, strBuffer); 
  • ../clientgui/ViewTransfersGrid.cpp

    old new  
    476476        if ( m_pGridPane->GetNumberRows() ) { 
    477477            m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows()); 
    478478        } 
     479        UpdateRefreshTimer(0); 
    479480        return; 
    480481    } 
    481482     
     
    493494        //update cell values 
    494495        wxString strBuffer; 
    495496    int iMax = m_pGridPane->GetNumberRows(); 
     497    UpdateRefreshTimer(iMax); 
    496498        for(int iRow = 0; iRow < iMax; iRow++) { 
    497499 
    498500                FormatProjectName(iRow, strBuffer); 
  • ../clientgui/ViewWorkGrid.cpp

    old new  
    818818        if ( m_pGridPane->GetNumberRows() ) { 
    819819            m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows()); 
    820820        } 
     821        UpdateRefreshTimer(0); 
    821822        return; 
    822823    } 
    823824     
     
    844845    //update cell values         
    845846    wxString strBuffer; 
    846847    int iMax = m_pGridPane->GetNumberRows(); 
     848    UpdateRefreshTimer(iMax); 
    847849 
    848850    if (rowCountChanged) { 
    849851        for(int iRow = 0; iRow < iMax; iRow++) { 
  • ../clientgui/AdvancedFrame.cpp

    old new  
    20392039#endif 
    20402040} 
    20412041 
     2042void CAdvancedFrame::UpdateListPanelRenderTimerInterval( const int newInterval) { 
     2043    if (newInterval != m_pFrameListPanelRenderTimer->GetInterval()) 
     2044        m_pFrameListPanelRenderTimer->Start(newInterval); 
     2045} 
    20422046 
    20432047void CAdvancedFrame::UpdateActivityModeControls( CC_STATUS& status ) { 
    20442048    wxMenuBar* pMenuBar      = GetMenuBar(); 
  • ../clientgui/AdvancedFrame.h

    old new  
    9494 
    9595    void ResetReminderTimers(); 
    9696 
     97    void UpdateListPanelRenderTimerInterval( const int newInterval ); 
     98 
     99private: 
    97100    wxTimer*        m_pRefreshStateTimer; 
    98101    wxTimer*        m_pFrameRenderTimer; 
    99102    wxTimer*        m_pFrameListPanelRenderTimer; 
    100103 
    101 private: 
    102  
    103104    wxMenuBar*      m_pMenubar; 
    104105    wxNotebook*     m_pNotebook; 
    105106    CStatusBar*     m_pStatusbar; 

If this page is incomplete or incorrect, please edit it or add it to the wiki to-do list. To do this, you must be logged in; click Login or Register above.