- Manager: in grid views, don't sort unless needed (from Frank)

- client: show OS name/version in message at startup

svn path=/trunk/boinc/; revision=13161
This commit is contained in:
David Anderson 2007-07-16 18:09:54 +00:00
parent 260f3bf026
commit 0a7422f5f7
5 changed files with 57 additions and 14 deletions

View File

@ -7272,22 +7272,32 @@ David 14 July 2007
sample_index.php sample_index.php
David 14 July 2007 David 14 July 2007
- client: print time zone message at startup - client: print time zone message at startup
- Manager: removed ForceRefresh() calls in grid views; - Manager: removed ForceRefresh() calls in grid views;
reduces CPU usage, still seems to work (from Frank Weiler) reduces CPU usage, still seems to work (from Frank Weiler)
Fixes #291. Fixes #291.
client/ client/
client_state.C client_state.C
cpu_sched.C cpu_sched.C
clientgui/ clientgui/
ViewMessagesGrid.cpp ViewMessagesGrid.cpp
ViewProjectsGrid.cpp ViewProjectsGrid.cpp
ViewTransfersGrid.cpp ViewTransfersGrid.cpp
ViewWorkGrid.cpp ViewWorkGrid.cpp
Charlie 16 July 2007 Charlie 16 July 2007
- Mac client: always show UNIX error if state file rename fails. - Mac client: always show UNIX error if state file rename fails.
client/ client/
cs_statefile.C cs_statefile.C
David 16 July 2007
- Manager: in grid views, don't sort unless needed (from Frank)
- client: show OS name/version in message at startup
client/
client_state.C
clientgui/
BOINCGridCtrl.cpp,h
ViewWorkGrid.cpp

View File

@ -131,6 +131,9 @@ void CLIENT_STATE::show_host_info() {
msg_printf(NULL, MSG_INFO, msg_printf(NULL, MSG_INFO,
"Processor features: %s", host_info.p_features "Processor features: %s", host_info.p_features
); );
msg_printf(NULL, MSG_INFO,
"OS: %s: %s", host_info.os_name, host_info.os_version
);
nbytes_to_string(host_info.m_nbytes, 0, buf, sizeof(buf)); nbytes_to_string(host_info.m_nbytes, 0, buf, sizeof(buf));
nbytes_to_string(host_info.m_swap, 0, buf2, sizeof(buf2)); nbytes_to_string(host_info.m_swap, 0, buf2, sizeof(buf2));

View File

@ -129,6 +129,7 @@ CBOINCGridCtrl::CBOINCGridCtrl(wxWindow* parent, wxWindowID iGridWindowID) : wxG
//init members //init members
sortColumn=-1; sortColumn=-1;
sortAscending=true; sortAscending=true;
sortNeededByLabelClick=false;
m_pkColumnIndex=-1; m_pkColumnIndex=-1;
m_cursorcol=-1; m_cursorcol=-1;
m_cursorrow=-1; m_cursorrow=-1;
@ -556,7 +557,8 @@ void CBOINCGridCtrl::OnLabelLClick(wxGridEvent& ev) {
// Force a repaint of the label // Force a repaint of the label
SetColLabelValue(ev.GetCol(), GetColLabelValue(ev.GetCol())); SetColLabelValue(ev.GetCol(), GetColLabelValue(ev.GetCol()));
//
sortNeededByLabelClick=true;
// Update and sort data // Update and sort data
wxTimerEvent tEvent; wxTimerEvent tEvent;
wxDynamicCast(GetParent(),CBOINCBaseView)->FireOnListRender(tEvent); wxDynamicCast(GetParent(),CBOINCBaseView)->FireOnListRender(tEvent);
@ -567,6 +569,7 @@ void CBOINCGridCtrl::OnLabelLClick(wxGridEvent& ev) {
void CBOINCGridCtrl::SortData() { void CBOINCGridCtrl::SortData() {
GetTable()->SortData(sortColumn,sortAscending); GetTable()->SortData(sortColumn,sortAscending);
sortNeededByLabelClick=false;
} }
void CBOINCGridCtrl::SetColumnSortType(int col,int sortType/*=CST_STRING*/) { void CBOINCGridCtrl::SetColumnSortType(int col,int sortType/*=CST_STRING*/) {

View File

@ -107,6 +107,7 @@ public:
void Setup(); void Setup();
int sortColumn; int sortColumn;
bool sortAscending; bool sortAscending;
bool sortNeededByLabelClick;
protected: protected:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:

View File

@ -814,17 +814,26 @@ void CViewWorkGrid::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
return; return;
} }
// flag for row count changes
bool rowCountChanged=false;
// Right-size the grid so that the number of rows matches // Right-size the grid so that the number of rows matches
// the document state. // the document state.
if(GetDocCount() != m_pGridPane->GetNumberRows()) { if(GetDocCount() != m_pGridPane->GetNumberRows()) {
if (GetDocCount() > m_pGridPane->GetNumberRows()) { if (GetDocCount() > m_pGridPane->GetNumberRows()) {
m_pGridPane->AppendRows(GetDocCount() - m_pGridPane->GetNumberRows()); m_pGridPane->AppendRows(GetDocCount() - m_pGridPane->GetNumberRows());
rowCountChanged=true;
} else { } else {
m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows() - GetDocCount()); m_pGridPane->DeleteRows(0, m_pGridPane->GetNumberRows() - GetDocCount());
rowCountChanged=true;
} }
wxASSERT(GetDocCount() == m_pGridPane->GetNumberRows()); wxASSERT(GetDocCount() == m_pGridPane->GetNumberRows());
} }
//init array to detect cell value changes
wxArrayInt arrColumnDataChanged;
for(int i=0; i<= COLUMN_STATUS;i++) {
arrColumnDataChanged.Add(0);
}
//update cell values //update cell values
wxString strBuffer; wxString strBuffer;
int iMax = m_pGridPane->GetNumberRows(); int iMax = m_pGridPane->GetNumberRows();
@ -833,48 +842,65 @@ void CViewWorkGrid::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
FormatProjectName(iRow, strBuffer); FormatProjectName(iRow, strBuffer);
if (m_pGridPane->GetCellValue(iRow, COLUMN_PROJECT) != strBuffer) { if (m_pGridPane->GetCellValue(iRow, COLUMN_PROJECT) != strBuffer) {
m_pGridPane->SetCellValue(iRow, COLUMN_PROJECT, strBuffer); m_pGridPane->SetCellValue(iRow, COLUMN_PROJECT, strBuffer);
arrColumnDataChanged[COLUMN_PROJECT]=1;
} }
FormatApplicationName(iRow, strBuffer); FormatApplicationName(iRow, strBuffer);
if (m_pGridPane->GetCellValue(iRow, COLUMN_APPLICATION) != strBuffer) { if (m_pGridPane->GetCellValue(iRow, COLUMN_APPLICATION) != strBuffer) {
m_pGridPane->SetCellValue(iRow, COLUMN_APPLICATION, strBuffer); m_pGridPane->SetCellValue(iRow, COLUMN_APPLICATION, strBuffer);
arrColumnDataChanged[COLUMN_APPLICATION]=1;
} }
FormatName(iRow, strBuffer); FormatName(iRow, strBuffer);
if (m_pGridPane->GetCellValue(iRow, COLUMN_NAME) != strBuffer) { if (m_pGridPane->GetCellValue(iRow, COLUMN_NAME) != strBuffer) {
m_pGridPane->SetCellValue(iRow, COLUMN_NAME, strBuffer); m_pGridPane->SetCellValue(iRow, COLUMN_NAME, strBuffer);
arrColumnDataChanged[COLUMN_NAME]=1;
} }
FormatCPUTime(iRow, strBuffer); FormatCPUTime(iRow, strBuffer);
if (m_pGridPane->GetCellValue(iRow, COLUMN_CPUTIME) != strBuffer) { if (m_pGridPane->GetCellValue(iRow, COLUMN_CPUTIME) != strBuffer) {
m_pGridPane->SetCellValue(iRow, COLUMN_CPUTIME, strBuffer); m_pGridPane->SetCellValue(iRow, COLUMN_CPUTIME, strBuffer);
arrColumnDataChanged[COLUMN_CPUTIME]=1;
} }
FormatProgress(iRow, strBuffer); FormatProgress(iRow, strBuffer);
if (m_pGridPane->GetCellValue(iRow, COLUMN_PROGRESS) != strBuffer) { if (m_pGridPane->GetCellValue(iRow, COLUMN_PROGRESS) != strBuffer) {
m_pGridPane->SetCellValue(iRow, COLUMN_PROGRESS, strBuffer); m_pGridPane->SetCellValue(iRow, COLUMN_PROGRESS, strBuffer);
m_pGridPane->SetCellAlignment(iRow, COLUMN_PROGRESS, wxALIGN_CENTRE, wxALIGN_CENTRE); m_pGridPane->SetCellAlignment(iRow, COLUMN_PROGRESS, wxALIGN_CENTRE, wxALIGN_CENTRE);
arrColumnDataChanged[COLUMN_PROGRESS]=1;
} }
FormatTimeToCompletion(iRow, strBuffer); FormatTimeToCompletion(iRow, strBuffer);
if (m_pGridPane->GetCellValue(iRow, COLUMN_TOCOMPLETION) != strBuffer) { if (m_pGridPane->GetCellValue(iRow, COLUMN_TOCOMPLETION) != strBuffer) {
m_pGridPane->SetCellValue(iRow, COLUMN_TOCOMPLETION, strBuffer); m_pGridPane->SetCellValue(iRow, COLUMN_TOCOMPLETION, strBuffer);
arrColumnDataChanged[COLUMN_TOCOMPLETION]=1;
} }
FormatReportDeadline(iRow, strBuffer); FormatReportDeadline(iRow, strBuffer);
if (m_pGridPane->GetCellValue(iRow, COLUMN_REPORTDEADLINE) != strBuffer) { if (m_pGridPane->GetCellValue(iRow, COLUMN_REPORTDEADLINE) != strBuffer) {
m_pGridPane->SetCellValue(iRow, COLUMN_REPORTDEADLINE, strBuffer); m_pGridPane->SetCellValue(iRow, COLUMN_REPORTDEADLINE, strBuffer);
arrColumnDataChanged[COLUMN_REPORTDEADLINE]=1;
} }
strBuffer = wxEmptyString; strBuffer = wxEmptyString;
FormatStatus(iRow, strBuffer); FormatStatus(iRow, strBuffer);
if (m_pGridPane->GetCellValue(iRow, COLUMN_STATUS) != strBuffer) { if (m_pGridPane->GetCellValue(iRow, COLUMN_STATUS) != strBuffer) {
m_pGridPane->SetCellValue(iRow, COLUMN_STATUS, strBuffer); m_pGridPane->SetCellValue(iRow, COLUMN_STATUS, strBuffer);
arrColumnDataChanged[COLUMN_STATUS]=1;
} }
} }
m_pGridPane->SortData(); //sort only
//1. if row count changed
//2. if sorting column has cell value changes
//3. if sort is enforced by user through label click
if( rowCountChanged ||
(arrColumnDataChanged[m_pGridPane->sortColumn]==1) ||
m_pGridPane->sortNeededByLabelClick)
{
m_pGridPane->SortData();
}
UpdateSelection(); UpdateSelection();
} }