Skip to content

Commit

Permalink
boincmgr: add command button "show tasks from only this project"
Browse files Browse the repository at this point in the history
  • Loading branch information
winkies committed Oct 3, 2020
1 parent d317f2f commit 0797187
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 14 deletions.
1 change: 1 addition & 0 deletions clientgui/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
#define ID_TASK_WORK_ABORT 9203
#define ID_TASK_SHOW_PROPERTIES 9204
#define ID_TASK_WORK_VMCONSOLE 9205
#define ID_TASK_FILTERBY_PROJECT 9206
#define ID_TASK_TRANSFERS_RETRYNOW 9300
#define ID_TASK_TRANSFERS_ABORT 9301
#define ID_TASK_MESSAGES_COPYALL 9400
Expand Down
65 changes: 52 additions & 13 deletions clientgui/ViewWork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ static int DefaultShownColumns[] = { COLUMN_PROJECT, COLUMN_PROGRESS, COLUMN_STA

// buttons in the "tasks" area
#define BTN_ACTIVE_ONLY 0
#define BTN_GRAPHICS 1
#define BTN_VMCONSOLE 2
#define BTN_SUSPEND 3
#define BTN_ABORT 4
#define BTN_PROPERTIES 5
#define BTN_FILTER_BY 1
#define BTN_GRAPHICS 2
#define BTN_VMCONSOLE 3
#define BTN_SUSPEND 4
#define BTN_ABORT 5
#define BTN_PROPERTIES 6


CWork::CWork() {
Expand Down Expand Up @@ -211,42 +212,49 @@ CViewWork::CViewWork(wxNotebook* pNotebook) :
pItem = new CTaskItem(
_("Show active tasks"),
_("Show only active tasks."),
ID_TASK_ACTIVE_ONLY
ID_TASK_ACTIVE_ONLY
);
pGroup->m_Tasks.push_back( pItem );

pItem = new CTaskItem(
_("Show this project"),
_("Show all tasks from this project."),
ID_TASK_FILTERBY_PROJECT
);
pGroup->m_Tasks.push_back( pItem );

pItem = new CTaskItem(
_("Show graphics"),
_("Show application graphics in a window."),
ID_TASK_WORK_SHOWGRAPHICS
ID_TASK_WORK_SHOWGRAPHICS
);
pGroup->m_Tasks.push_back( pItem );

pItem = new CTaskItem(
_("Show VM Console"),
_("Show VM Console in a window."),
ID_TASK_WORK_VMCONSOLE
ID_TASK_WORK_VMCONSOLE
);
pGroup->m_Tasks.push_back( pItem );

pItem = new CTaskItem(
_("Suspend"),
_("Suspend work for this result."),
ID_TASK_WORK_SUSPEND
ID_TASK_WORK_SUSPEND
);
pGroup->m_Tasks.push_back( pItem );

pItem = new CTaskItem(
_("Abort"),
_("Abandon work on the result. You will get no credit for it."),
ID_TASK_WORK_ABORT
ID_TASK_WORK_ABORT
);
pGroup->m_Tasks.push_back( pItem );

pItem = new CTaskItem(
_("Properties"),
_("Show task details."),
ID_TASK_SHOW_PROPERTIES
ID_TASK_SHOW_PROPERTIES
);
pGroup->m_Tasks.push_back( pItem );

Expand Down Expand Up @@ -429,6 +437,34 @@ void CViewWork::OnActiveTasksOnly( wxCommandEvent& WXUNUSED(event) ) {
}


void CViewWork::OnTasksByProject( wxCommandEvent& WXUNUSED(event)) {
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnTasksByProject - Function Begin"));

CMainDocument* pDoc = wxGetApp().GetDocument();
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
int row;
MESSAGE* message;

wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
wxASSERT(pFrame);
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
wxASSERT(m_pTaskPane);
wxASSERT(m_pListPane);

// Get row selected
row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);

// Get message or result ?
message = wxGetApp().GetDocument()->message(row);
fprintf(stdout, "Project == %s", message->project);
syslog(LOG_INFO|LOG_ERR, "%s", message->project);

// loop on all row to get only selected project
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnTasksByProject - Function End"));
}


void CViewWork::OnWorkSuspend( wxCommandEvent& WXUNUSED(event) ) {
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkSuspend - Function Begin"));

Expand Down Expand Up @@ -816,6 +852,7 @@ void CViewWork::UpdateSelection() {
bool enableSuspendResume = false;
bool enableAbort = false;
bool enableProperties = false;
bool enableFilterBy = false;

wxASSERT(NULL != pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
Expand All @@ -824,14 +861,15 @@ void CViewWork::UpdateSelection() {
CBOINCBaseView::PreUpdateSelection();

pGroup = m_TaskGroups[0];

n = m_pListPane->GetSelectedItemCount();
if (n > 0) {
enableShowGraphics = true;
enableShowVMConsole = true;
enableSuspendResume = true;
enableAbort = true;

enableFilterBy = true;

pDoc->GetCoreClientStatus(status);
if (status.task_suspend_reason & ~(SUSPEND_REASON_CPU_THROTTLE)) {
enableShowGraphics = false;
Expand Down Expand Up @@ -972,6 +1010,7 @@ void CViewWork::UpdateSelection() {
m_pTaskPane->FitInside();
};
}
pGroup->m_Tasks[BTN_FILTER_BY]->m_pButton->Enable(enableFilterBy);
pGroup->m_Tasks[BTN_SUSPEND]->m_pButton->Enable(enableSuspendResume);
pGroup->m_Tasks[BTN_ABORT]->m_pButton->Enable(enableAbort);
pGroup->m_Tasks[BTN_PROPERTIES]->m_pButton->Enable(enableProperties);
Expand Down
3 changes: 2 additions & 1 deletion clientgui/ViewWork.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ class CViewWork : public CBOINCBaseView
void OnWorkAbort( wxCommandEvent& event );
void OnShowItemProperties( wxCommandEvent& event );
void OnActiveTasksOnly( wxCommandEvent& event );
void OnTasksByProject( wxCommandEvent& event );

void OnProjectWebsiteClicked( wxEvent& event );
void OnColResize( wxListEvent& event);

std::vector<CWork*> m_WorkCache;

protected:
Expand Down

0 comments on commit 0797187

Please sign in to comment.