MGR: Fix more Event Log bugs

svn path=/trunk/boinc/; revision=20767
This commit is contained in:
Charlie Fenton 2010-03-02 13:09:06 +00:00
parent 7c4d87d486
commit bf7b3e552b
7 changed files with 68 additions and 37 deletions

View File

@ -1490,3 +1490,17 @@ David 1 Mar 2010
app.h
app_control.cpp
cs_prefs.cpp
Charlie 1 Mar 2010
- MGR: Fix more Event Log bugs: Exit from taskbar closes Event Log just
like exit from regular menu; enable and disable Copy Selected and Filter
buttons depending on selected messages; fix misplaced curly bracket in
CMainDocument::RunPeriodicRPCs() which caused excessive CPU usage and
other problems.
clientgui/
AdvancedFrame.cpp
BOINCBaseFrame.cpp
BOINCTaskBar.cpp
DlgEventLog.cpp, .h
MainDocument.cpp

View File

@ -2074,7 +2074,6 @@ void CAdvancedFrame::UpdateRefreshTimerInterval( wxInt32 iCurrentNotebookPage )
m_pPeriodicRPCTimer->Start(1000);
} else {
m_pPeriodicRPCTimer->Start(m_iFrameRefreshRate);
}
} else {
// Set view refresh rate to 1 second

View File

@ -310,22 +310,6 @@ void CBOINCBaseFrame::OnClose(wxCloseEvent& event) {
wxGetApp().FrameClosed();
Destroy();
} else {
#ifdef __WXMAC__
// If Event Log is currently the active (frontmost) window, just close it
wxTopLevelWindowMac* eventLog = NULL;
WindowRef macWin = NULL;
eventLog = (wxTopLevelWindowMac*)wxWindow::FindWindowById(ID_DLGEVENTLOG);
if (eventLog) {
macWin = (WindowRef)eventLog->MacGetWindowRef();
if (macWin) {
if (IsWindowActive(macWin)) {
eventLog->Close();
return;
}
}
}
#endif
Hide();
}

View File

@ -32,6 +32,7 @@
#include "BOINCBaseFrame.h"
#include "BOINCClientManager.h"
#include "DlgAbout.h"
#include "DlgEventLog.h"
#include "Events.h"
#ifdef __WXMAC__
@ -117,6 +118,11 @@ void CTaskBarIcon::OnClose(wxCloseEvent& event) {
RemoveIcon();
m_bTaskbarInitiatedShutdown = true;
CDlgEventLog* eventLog = wxGetApp().GetEventLog();
if (eventLog) {
eventLog->Close();
}
CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
if (pFrame) {
wxASSERT(wxDynamicCast(pFrame, CBOINCBaseFrame));

View File

@ -71,6 +71,8 @@ BEGIN_EVENT_TABLE( CDlgEventLog, wxDialog )
EVT_BUTTON(ID_TASK_MESSAGES_FILTERBYPROJECT, CDlgEventLog::OnMessagesFilter)
EVT_BUTTON(ID_SIMPLE_HELP, CDlgEventLog::OnButtonHelp)
EVT_CLOSE(CDlgEventLog::OnClose)
EVT_LIST_ITEM_SELECTED(ID_SIMPLE_MESSAGESVIEW, CDlgEventLog::OnListSelected)
EVT_LIST_ITEM_DESELECTED(ID_SIMPLE_MESSAGESVIEW, CDlgEventLog::OnListDeselected)
////@end CDlgEventLog event table entries
END_EVENT_TABLE()
@ -219,8 +221,8 @@ void CDlgEventLog::CreateControls()
#endif
itemBoxSizer4->Add(itemButton1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton* itemButton2 = new wxButton(this, ID_COPYSELECTED, _("Copy Selected"), wxDefaultPosition, wxDefaultSize );
itemButton2->SetHelpText(
m_pCopySelectedButton = new wxButton(this, ID_COPYSELECTED, _("Copy Selected"), wxDefaultPosition, wxDefaultSize );
m_pCopySelectedButton->SetHelpText(
#ifdef __WXMAC__
_("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.")
#else
@ -228,7 +230,7 @@ void CDlgEventLog::CreateControls()
#endif
);
#if wxUSE_TOOLTIPS
itemButton2->SetToolTip(
m_pCopySelectedButton->SetToolTip(
#ifdef __WXMAC__
_("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.")
#else
@ -236,7 +238,7 @@ void CDlgEventLog::CreateControls()
#endif
);
#endif
itemBoxSizer4->Add(itemButton2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemBoxSizer4->Add(m_pCopySelectedButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
#endif
wxButton* itemButton44 = new wxButton(this, wxID_OK, _("Close"), wxDefaultPosition, wxDefaultSize);
@ -424,7 +426,7 @@ wxInt32 CDlgEventLog::GetDocCount() {
void CDlgEventLog::OnRefresh() {
bool isConnected;
static bool was_connected = false;
if (!m_bProcessingRefreshEvent) {
m_bProcessingRefreshEvent = true;
@ -484,18 +486,7 @@ void CDlgEventLog::OnRefresh() {
m_iPreviousRowCount = iRowCount;
}
bool enableButton = m_bIsFiltered;
if ((! m_bIsFiltered) && (m_iTotalDocCount > 0)) {
int n = m_pList->GetSelectedItemCount();
if (n == 1) {
n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
MESSAGE* message = wxGetApp().GetDocument()->message(n);
if ((message->project).size() > 0) {
enableButton = true;
}
}
}
m_pFilterButton->Enable(enableButton);
UpdateButtons();
m_bProcessingRefreshEvent = false;
}
@ -772,6 +763,37 @@ void CDlgEventLog::OnButtonHelp( wxCommandEvent& event ) {
}
void CDlgEventLog::UpdateButtons() {
bool enableFilterButton = m_bIsFiltered;
bool enableCopySelectedButon = false;
if ((! m_bIsFiltered) && (m_iTotalDocCount > 0)) {
int n = m_pList->GetSelectedItemCount();
if (n > 0) {
enableCopySelectedButon = true;
}
if (n == 1) {
n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
MESSAGE* message = wxGetApp().GetDocument()->message(n);
if ((message->project).size() > 0) {
enableFilterButton = true;
}
}
}
m_pFilterButton->Enable(enableFilterButton);
m_pCopySelectedButton->Enable(enableCopySelectedButon);
}
void CDlgEventLog::OnListSelected(wxListEvent& event) {
UpdateButtons();
}
void CDlgEventLog::OnListDeselected(wxListEvent& event) {
UpdateButtons();
}
wxString CDlgEventLog::OnListGetItemText(long item, long column) const {
wxString strBuffer = wxEmptyString;
wxInt32 index = GetFilteredMessageIndex(item);

View File

@ -138,6 +138,7 @@ private:
bool m_bIsFiltered;
std::string m_strFilteredProjectName;
wxButton* m_pFilterButton;
wxButton* m_pCopySelectedButton;
wxListItemAttr* m_pMessageInfoAttr;
wxListItemAttr* m_pMessageErrorAttr;
@ -151,6 +152,10 @@ private:
bool RestoreState();
void RestoreWindowDimensions();
void UpdateButtons();
void OnListSelected(wxListEvent& event);
void OnListDeselected(wxListEvent& event);
bool EnsureLastItemVisible();
wxInt32 FormatProjectName( wxInt32 item, wxString& strBuffer ) const;
wxInt32 FormatTime( wxInt32 item, wxString& strBuffer ) const;

View File

@ -898,10 +898,11 @@ void CMainDocument::RunPeriodicRPCs(int frameRefreshRate) {
request.resultPtr = &m_iGet_messages_rpc_result;
RequestRPC(request);
ts = dtNow - m_dtCachedStateTimestamp;
if (ts.GetSeconds() >= STATERPC_INTERVAL) {
}
ts = dtNow - m_dtCachedStateTimestamp;
if (ts.GetSeconds() >= STATERPC_INTERVAL) {
// *********** RPC_GET_STATE **************
request.clear();