mirror of https://github.com/BOINC/boinc.git
MGR: preserve message filtering by project if Event Log is closed and reopened, but not when selecting a different host or exiting Manager
svn path=/trunk/boinc/; revision=22184
This commit is contained in:
parent
d79ca6a9f2
commit
f039bf4bd8
|
@ -5868,3 +5868,10 @@ David 10 Aug 2010
|
||||||
sched/
|
sched/
|
||||||
sched_config.cpp,h
|
sched_config.cpp,h
|
||||||
sched_version.cpp
|
sched_version.cpp
|
||||||
|
|
||||||
|
Charlie 11 Aug 2010
|
||||||
|
- MGR: preserve message filtering by project if Event Log is closed and
|
||||||
|
reopened, but not when selecting a different host or exiting Manager.
|
||||||
|
|
||||||
|
clientgui/
|
||||||
|
DlgEventLog.cpp, .h
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
#define COLUMN_MESSAGE 2
|
#define COLUMN_MESSAGE 2
|
||||||
|
|
||||||
|
|
||||||
|
static bool s_bIsFiltered = false;
|
||||||
|
static std::string s_strFilteredProjectName;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* CDlgEventLog type definition
|
* CDlgEventLog type definition
|
||||||
*/
|
*/
|
||||||
|
@ -113,7 +116,6 @@ CDlgEventLog::~CDlgEventLog() {
|
||||||
m_pMessageErrorGrayAttr = NULL;
|
m_pMessageErrorGrayAttr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_strFilteredProjectName.clear();
|
|
||||||
m_iFilteredIndexes.Clear();
|
m_iFilteredIndexes.Clear();
|
||||||
|
|
||||||
wxGetApp().OnEventLogClose();
|
wxGetApp().OnEventLogClose();
|
||||||
|
@ -132,8 +134,9 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt
|
||||||
m_iPreviousRowCount = 0;
|
m_iPreviousRowCount = 0;
|
||||||
m_iTotalDocCount = 0;
|
m_iTotalDocCount = 0;
|
||||||
m_iPreviousTotalDocCount = 0;
|
m_iPreviousTotalDocCount = 0;
|
||||||
m_bIsFiltered = false;
|
if (!s_bIsFiltered) {
|
||||||
m_strFilteredProjectName.clear();
|
s_strFilteredProjectName.clear();
|
||||||
|
}
|
||||||
m_iFilteredIndexes.Clear();
|
m_iFilteredIndexes.Clear();
|
||||||
m_bProcessingRefreshEvent = false;
|
m_bProcessingRefreshEvent = false;
|
||||||
m_bEventLogIsOpen = true;
|
m_bEventLogIsOpen = true;
|
||||||
|
@ -197,6 +200,7 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt
|
||||||
SetIcons(icons);
|
SetIcons(icons);
|
||||||
|
|
||||||
CreateControls();
|
CreateControls();
|
||||||
|
// SetFilterButtonText();
|
||||||
|
|
||||||
// Create List Pane Items
|
// Create List Pane Items
|
||||||
m_pList->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 109);
|
m_pList->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 109);
|
||||||
|
@ -252,9 +256,9 @@ void CDlgEventLog::CreateControls()
|
||||||
|
|
||||||
m_pFilterButton = new wxButton(this, ID_TASK_MESSAGES_FILTERBYPROJECT, _("Show only this project"), wxDefaultPosition, wxDefaultSize);
|
m_pFilterButton = new wxButton(this, ID_TASK_MESSAGES_FILTERBYPROJECT, _("Show only this project"), wxDefaultPosition, wxDefaultSize);
|
||||||
itemBoxSizer4->Add(m_pFilterButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
itemBoxSizer4->Add(m_pFilterButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||||
#ifdef wxUSE_TOOLTIPS
|
// Initially draw button with longer test but disabled.
|
||||||
m_pFilterButton->SetToolTip(_("Show only the messages for the selected project"));
|
// See comment in CDlgEventLog::UpdateButtons().
|
||||||
#endif
|
m_pFilterButton->Disable();
|
||||||
|
|
||||||
#ifdef wxUSE_CLIPBOARD
|
#ifdef wxUSE_CLIPBOARD
|
||||||
wxButton* itemButton1 = new wxButton(this, ID_COPYAll, _("Copy All"), wxDefaultPosition, wxDefaultSize );
|
wxButton* itemButton1 = new wxButton(this, ID_COPYAll, _("Copy All"), wxDefaultPosition, wxDefaultSize );
|
||||||
|
@ -307,6 +311,23 @@ void CDlgEventLog::CreateControls()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CDlgEventLog::SetFilterButtonText() {
|
||||||
|
if (s_bIsFiltered) {
|
||||||
|
m_pFilterButton->SetLabel( _("Show all messages") );
|
||||||
|
m_pFilterButton->SetHelpText( _("Show messages for all projects") );
|
||||||
|
#ifdef wxUSE_TOOLTIPS
|
||||||
|
m_pFilterButton->SetToolTip(_("Show messages for all projects"));
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
m_pFilterButton->SetLabel( _("Show only this project") );
|
||||||
|
m_pFilterButton->SetHelpText( _("Show only the messages for the selected project") );
|
||||||
|
#ifdef wxUSE_TOOLTIPS
|
||||||
|
m_pFilterButton->SetToolTip(_("Show only the messages for the selected project"));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Text color selection for CDlgEventLog
|
* Text color selection for CDlgEventLog
|
||||||
*/
|
*/
|
||||||
|
@ -381,31 +402,21 @@ void CDlgEventLog::OnMessagesFilter( wxCommandEvent& WXUNUSED(event) ) {
|
||||||
wxASSERT(m_pList);
|
wxASSERT(m_pList);
|
||||||
|
|
||||||
m_iFilteredIndexes.Clear();
|
m_iFilteredIndexes.Clear();
|
||||||
m_strFilteredProjectName.clear();
|
s_strFilteredProjectName.clear();
|
||||||
|
|
||||||
if (m_bIsFiltered) {
|
if (s_bIsFiltered) {
|
||||||
m_bIsFiltered = false;
|
s_bIsFiltered = false;
|
||||||
m_pFilterButton->SetLabel( _("Show only this project") );
|
|
||||||
m_pFilterButton->SetHelpText( _("Show only the messages for the selected project") );
|
|
||||||
#ifdef wxUSE_TOOLTIPS
|
|
||||||
m_pFilterButton->SetToolTip(_("Show only the messages for the selected project"));
|
|
||||||
#endif
|
|
||||||
m_iFilteredDocCount = m_iTotalDocCount;
|
m_iFilteredDocCount = m_iTotalDocCount;
|
||||||
} else {
|
} else {
|
||||||
iIndex = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
iIndex = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||||
if (iIndex >= 0) {
|
if (iIndex >= 0) {
|
||||||
message = wxGetApp().GetDocument()->message(iIndex);
|
message = wxGetApp().GetDocument()->message(iIndex);
|
||||||
if ((message->project).size() > 0) {
|
if ((message->project).size() > 0) {
|
||||||
m_strFilteredProjectName = message->project;
|
s_strFilteredProjectName = message->project;
|
||||||
m_bIsFiltered = true;
|
s_bIsFiltered = true;
|
||||||
m_pFilterButton->SetLabel( _("Show all messages") );
|
|
||||||
m_pFilterButton->SetHelpText( _("Show messages for all projects") );
|
|
||||||
#ifdef wxUSE_TOOLTIPS
|
|
||||||
m_pFilterButton->SetToolTip(_("Show messages for all projects"));
|
|
||||||
#endif
|
|
||||||
for (iIndex = 0; iIndex < m_iTotalDocCount; iIndex++) {
|
for (iIndex = 0; iIndex < m_iTotalDocCount; iIndex++) {
|
||||||
message = wxGetApp().GetDocument()->message(iIndex);
|
message = wxGetApp().GetDocument()->message(iIndex);
|
||||||
if (message->project.empty() || (message->project == m_strFilteredProjectName)) {
|
if (message->project.empty() || (message->project == s_strFilteredProjectName)) {
|
||||||
m_iFilteredIndexes.Add(iIndex);
|
m_iFilteredIndexes.Add(iIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,6 +426,8 @@ void CDlgEventLog::OnMessagesFilter( wxCommandEvent& WXUNUSED(event) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetFilterButtonText();
|
||||||
|
|
||||||
// Force a complete update
|
// Force a complete update
|
||||||
m_iPreviousRowCount = 0;
|
m_iPreviousRowCount = 0;
|
||||||
m_pList->DeleteAllItems();
|
m_pList->DeleteAllItems();
|
||||||
|
@ -426,7 +439,7 @@ void CDlgEventLog::OnMessagesFilter( wxCommandEvent& WXUNUSED(event) ) {
|
||||||
|
|
||||||
|
|
||||||
wxInt32 CDlgEventLog::GetFilteredMessageIndex( wxInt32 iRow) const {
|
wxInt32 CDlgEventLog::GetFilteredMessageIndex( wxInt32 iRow) const {
|
||||||
if (m_bIsFiltered) return m_iFilteredIndexes[iRow];
|
if (s_bIsFiltered) return m_iFilteredIndexes[iRow];
|
||||||
return iRow;
|
return iRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,15 +451,16 @@ wxInt32 CDlgEventLog::GetDocCount() {
|
||||||
m_iTotalDocCount = wxGetApp().GetDocument()->GetMessageCount();
|
m_iTotalDocCount = wxGetApp().GetDocument()->GetMessageCount();
|
||||||
if (m_iTotalDocCount < m_iPreviousTotalDocCount) {
|
if (m_iTotalDocCount < m_iPreviousTotalDocCount) {
|
||||||
// Usually due to a disconnect from client
|
// Usually due to a disconnect from client
|
||||||
m_bIsFiltered = false;
|
s_bIsFiltered = false;
|
||||||
m_strFilteredProjectName.clear();
|
s_strFilteredProjectName.clear();
|
||||||
m_iFilteredIndexes.Clear();
|
m_iFilteredIndexes.Clear();
|
||||||
|
SetFilterButtonText();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bIsFiltered) {
|
if (s_bIsFiltered) {
|
||||||
for (i = m_iPreviousTotalDocCount; i < m_iTotalDocCount; i++) {
|
for (i = m_iPreviousTotalDocCount; i < m_iTotalDocCount; i++) {
|
||||||
MESSAGE* message = wxGetApp().GetDocument()->message(i);
|
MESSAGE* message = wxGetApp().GetDocument()->message(i);
|
||||||
if (message->project.empty() || (message->project == m_strFilteredProjectName)) {
|
if (message->project.empty() || (message->project == s_strFilteredProjectName)) {
|
||||||
m_iFilteredIndexes.Add(i);
|
m_iFilteredIndexes.Add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -467,7 +481,12 @@ wxInt32 CDlgEventLog::GetDocCount() {
|
||||||
void CDlgEventLog::OnRefresh() {
|
void CDlgEventLog::OnRefresh() {
|
||||||
bool isConnected;
|
bool isConnected;
|
||||||
static bool was_connected = false;
|
static bool was_connected = false;
|
||||||
|
static wxString strLastMachineName = wxEmptyString;
|
||||||
|
wxString strNewMachineName = wxEmptyString;
|
||||||
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||||
|
wxASSERT(pDoc);
|
||||||
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||||
|
|
||||||
if (!IsShown()) return;
|
if (!IsShown()) return;
|
||||||
|
|
||||||
if (!m_bProcessingRefreshEvent) {
|
if (!m_bProcessingRefreshEvent) {
|
||||||
|
@ -478,9 +497,26 @@ void CDlgEventLog::OnRefresh() {
|
||||||
wxInt32 iRowCount = GetDocCount();
|
wxInt32 iRowCount = GetDocCount();
|
||||||
if (0 >= iRowCount) {
|
if (0 >= iRowCount) {
|
||||||
m_pList->DeleteAllItems();
|
m_pList->DeleteAllItems();
|
||||||
|
s_bIsFiltered = false;
|
||||||
|
s_strFilteredProjectName.clear();
|
||||||
|
m_iFilteredIndexes.Clear();
|
||||||
|
SetFilterButtonText();
|
||||||
} else {
|
} else {
|
||||||
// If connection status changed, adjust color of messages display
|
// If connected computer changed, reset message filtering
|
||||||
isConnected = wxGetApp().GetDocument()->IsConnected();
|
isConnected = wxGetApp().GetDocument()->IsConnected();
|
||||||
|
if (isConnected) {
|
||||||
|
pDoc->GetConnectedComputerName(strNewMachineName);
|
||||||
|
if (strLastMachineName != strNewMachineName) {
|
||||||
|
strLastMachineName = strNewMachineName;
|
||||||
|
was_connected = false;
|
||||||
|
s_bIsFiltered = false;
|
||||||
|
s_strFilteredProjectName.clear();
|
||||||
|
m_iFilteredIndexes.Clear();
|
||||||
|
SetFilterButtonText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If connection status changed, adjust color of messages display
|
||||||
if (was_connected != isConnected) {
|
if (was_connected != isConnected) {
|
||||||
was_connected = isConnected;
|
was_connected = isConnected;
|
||||||
SetTextColor();
|
SetTextColor();
|
||||||
|
@ -502,18 +538,6 @@ void CDlgEventLog::OnRefresh() {
|
||||||
m_pList->EnsureVisible(iRowCount - 1);
|
m_pList->EnsureVisible(iRowCount - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // This was in ViewMessages.cpp; is it needed herre?
|
|
||||||
if (isConnected) {
|
|
||||||
pDoc->GetConnectedComputerName(strNewMachineName);
|
|
||||||
if (strLastMachineName != strNewMachineName) {
|
|
||||||
strLastMachineName = strNewMachineName;
|
|
||||||
if (iRowCount) {
|
|
||||||
m_pList->EnsureVisible(iRowCount - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (m_iPreviousRowCount != iRowCount) {
|
if (m_iPreviousRowCount != iRowCount) {
|
||||||
m_iPreviousRowCount = iRowCount;
|
m_iPreviousRowCount = iRowCount;
|
||||||
}
|
}
|
||||||
|
@ -758,7 +782,7 @@ void CDlgEventLog::OnButtonHelp( wxCommandEvent& event ) {
|
||||||
|
|
||||||
|
|
||||||
void CDlgEventLog::UpdateButtons() {
|
void CDlgEventLog::UpdateButtons() {
|
||||||
bool enableFilterButton = m_bIsFiltered;
|
bool enableFilterButton = s_bIsFiltered;
|
||||||
bool enableCopySelectedButon = false;
|
bool enableCopySelectedButon = false;
|
||||||
if (m_iTotalDocCount > 0) {
|
if (m_iTotalDocCount > 0) {
|
||||||
int n = m_pList->GetSelectedItemCount();
|
int n = m_pList->GetSelectedItemCount();
|
||||||
|
@ -766,7 +790,7 @@ void CDlgEventLog::UpdateButtons() {
|
||||||
enableCopySelectedButon = true;
|
enableCopySelectedButon = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n == 1) && (! m_bIsFiltered)) {
|
if ((n == 1) && (! s_bIsFiltered)) {
|
||||||
n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||||
MESSAGE* message = wxGetApp().GetDocument()->message(n);
|
MESSAGE* message = wxGetApp().GetDocument()->message(n);
|
||||||
if ((message->project).size() > 0) {
|
if ((message->project).size() > 0) {
|
||||||
|
@ -774,6 +798,14 @@ void CDlgEventLog::UpdateButtons() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To ensure that the button is large enough to fit the longer label,
|
||||||
|
// don't change the button text (possibly to the shorter label) until
|
||||||
|
// after the button has been drawn (disabled) with the longer text,
|
||||||
|
// and don't enable the button until it has the correct label.
|
||||||
|
if (m_pFilterButton->IsEnabled() != enableFilterButton) {
|
||||||
|
SetFilterButtonText();
|
||||||
|
}
|
||||||
m_pFilterButton->Enable(enableFilterButton);
|
m_pFilterButton->Enable(enableFilterButton);
|
||||||
m_pCopySelectedButton->Enable(enableCopySelectedButon);
|
m_pCopySelectedButton->Enable(enableCopySelectedButon);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,9 @@ public:
|
||||||
/// Creates the controls and sizers
|
/// Creates the controls and sizers
|
||||||
void CreateControls();
|
void CreateControls();
|
||||||
|
|
||||||
|
/// Sets text for m_pFilterButton
|
||||||
|
void SetFilterButtonText();
|
||||||
|
|
||||||
/// Text color selection
|
/// Text color selection
|
||||||
void SetTextColor();
|
void SetTextColor();
|
||||||
|
|
||||||
|
@ -146,8 +149,6 @@ private:
|
||||||
wxInt32 m_iFilteredDocCount;
|
wxInt32 m_iFilteredDocCount;
|
||||||
wxInt32 m_iPreviousTotalDocCount;
|
wxInt32 m_iPreviousTotalDocCount;
|
||||||
wxInt32 m_iPreviousRowCount;
|
wxInt32 m_iPreviousRowCount;
|
||||||
bool m_bIsFiltered;
|
|
||||||
std::string m_strFilteredProjectName;
|
|
||||||
wxButton* m_pFilterButton;
|
wxButton* m_pFilterButton;
|
||||||
wxButton* m_pCopySelectedButton;
|
wxButton* m_pCopySelectedButton;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue