mirror of https://github.com/BOINC/boinc.git
MGR: New tasks and projects properties displays from Frank Weiler
svn path=/trunk/boinc/; revision=15537
This commit is contained in:
commit
2950cc0ece
|
@ -5347,3 +5347,13 @@ David 1 July 2008
|
|||
kill_wu.C
|
||||
make_project
|
||||
poll_wu.C
|
||||
|
||||
Charlie 1 July 2008
|
||||
- MGR: New tasks and projects properties displays from Frank Weiler.
|
||||
|
||||
clientgui/
|
||||
DlgItemProperties.cpp,.h (new)
|
||||
Events.h
|
||||
ViewProjects.cpp,.h
|
||||
ViewWork.cpp,..h
|
||||
Makefile.am
|
||||
|
|
|
@ -0,0 +1,361 @@
|
|||
// Berkeley Open Infrastructure for Network Computing
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2005 University of California
|
||||
//
|
||||
// This is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation;
|
||||
// either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This software is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// To view the GNU Lesser General Public License visit
|
||||
// http://www.gnu.org/copyleft/lesser.html
|
||||
// or write to the Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma implementation "DlgItemProperties.h"
|
||||
#endif
|
||||
|
||||
#include "stdwx.h"
|
||||
#include "DlgItemProperties.h"
|
||||
#include "BOINCGUIApp.h"
|
||||
#include "Events.h"
|
||||
#include "error_numbers.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(CDlgItemProperties, wxDialog)
|
||||
|
||||
/* Constructor */
|
||||
CDlgItemProperties::CDlgItemProperties(wxWindow* parent) :
|
||||
wxDialog( parent, ID_ANYDIALOG, wxEmptyString, wxDefaultPosition,
|
||||
wxSize( 503,480 ), wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ) {
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
this->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY );
|
||||
|
||||
m_bSizer1 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_scrolledWindow->SetScrollRate( 5, 5 );
|
||||
wxBoxSizer* m_bSizer2;
|
||||
m_bSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_gbSizer = new wxGridBagSizer( 0, 0 );
|
||||
m_gbSizer->AddGrowableCol( 1 );
|
||||
m_gbSizer->SetFlexibleDirection( wxBOTH );
|
||||
m_gbSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_bSizer2->Add( m_gbSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
m_scrolledWindow->SetSizer( m_bSizer2 );
|
||||
m_scrolledWindow->Layout();
|
||||
m_bSizer2->Fit( m_scrolledWindow );
|
||||
m_bSizer1->Add( m_scrolledWindow, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_btnClose = new wxButton( this, wxID_OK, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_btnClose->SetDefault();
|
||||
m_bSizer1->Add( m_btnClose, 0, wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
|
||||
|
||||
this->SetSizer( m_bSizer1 );
|
||||
this->Layout();
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
this->m_current_row=0;
|
||||
}
|
||||
|
||||
// destructor
|
||||
CDlgItemProperties::~CDlgItemProperties() {
|
||||
}
|
||||
|
||||
// renders infos for a project
|
||||
void CDlgItemProperties::renderInfos(PROJECT* project) {
|
||||
std::string projectname;
|
||||
//collecting infos
|
||||
project->get_name(projectname);
|
||||
//disk usage needs additional lookups
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
pDoc->CachedDiskUsageUpdate();
|
||||
std::vector<PROJECT*> dp = pDoc->disk_usage.projects;
|
||||
double diskusage=0.0;
|
||||
for (unsigned int i=0; i< dp.size(); i++) {
|
||||
PROJECT* tp = dp[i];
|
||||
std::string tname;
|
||||
tp->get_name(tname);
|
||||
wxString t1(tname.c_str());
|
||||
if(t1.IsSameAs(projectname.c_str()) || t1.IsSameAs(project->master_url.c_str())) {
|
||||
diskusage =tp->disk_usage;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//set dialog title
|
||||
wxString wxTitle = _("Properties for ");
|
||||
wxTitle.append(projectname.c_str());
|
||||
this->SetTitle(wxTitle);
|
||||
//layout controls
|
||||
this->addSection(_("general infos"));
|
||||
this->addProperty(_("master url:"),wxT(project->master_url.c_str()));
|
||||
this->addProperty(_("user name:"),wxT(project->user_name.c_str()));
|
||||
this->addProperty(_("team name:"),wxT(project->team_name.c_str()));
|
||||
this->addProperty(_("resource share:"),wxString::Format(wxT("%0.0f"),project->resource_share));
|
||||
this->addSection(_("credit infos"));
|
||||
this->addProperty(_("user total credit:"),wxString::Format(wxT("%0.2f"),project->user_total_credit));
|
||||
this->addProperty(_("user avg. credit:"),wxString::Format(wxT("%0.2f"),project->user_expavg_credit));
|
||||
this->addProperty(_("host total credit:"),wxString::Format(wxT("%0.2f"),project->host_total_credit));
|
||||
this->addProperty(_("host avg. credit:"),wxString::Format(wxT("%0.2f"),project->host_expavg_credit));
|
||||
this->addSection(_("disk usage infos"));
|
||||
|
||||
this->addProperty(_("disk usage:"),this->FormatDiskSpace(diskusage));
|
||||
this->addSection(_("scheduling infos"));
|
||||
this->addProperty(_("short term debt:"),wxString::Format(wxT("%0.2f"),project->short_term_debt));
|
||||
this->addProperty(_("long term debt:"),wxString::Format(wxT("%0.2f"),project->long_term_debt));
|
||||
this->addProperty(_("duration corr. factor:"),wxString::Format(wxT("%0.4f"),project->duration_correction_factor));
|
||||
this->addSection(_("diverse infos"));
|
||||
this->addProperty(_("non cpu intensive:"),project->non_cpu_intensive ? _("yes") : _("no"));
|
||||
this->addProperty(_("suspended via gui:"),project->suspended_via_gui ? _("yes") : _("no"));
|
||||
this->addProperty(_("don't request more work:"),project->dont_request_more_work ? _("yes") : _("no"));
|
||||
this->addProperty(_("scheduler call in progress:"),project->scheduler_rpc_in_progress ? _("yes") : _("no"));
|
||||
this->addProperty(_("attached via account mgr.:"),project->attached_via_acct_mgr ? _("yes") : _("no"));
|
||||
this->addProperty(_("detach when done:"),project->detach_when_done ? _("yes") : _("no"));
|
||||
this->addProperty(_("ended:"),project->ended ? _("yes") : _("no"));
|
||||
this->m_gbSizer->Layout();
|
||||
this->m_scrolledWindow->FitInside();
|
||||
}
|
||||
|
||||
// renders infos for a task/result
|
||||
void CDlgItemProperties::renderInfos(RESULT* result) {
|
||||
wxString wxTitle = _("Properties for ");
|
||||
wxTitle.append(result->name.c_str());
|
||||
this->SetTitle(wxTitle);
|
||||
|
||||
this->addSection(_("general infos"));
|
||||
this->addProperty(_("application name:"),this->FormatApplicationName(result));
|
||||
this->addProperty(_("workunit name:"),result->wu_name.c_str());
|
||||
this->addSection(_("state infos"));
|
||||
this->addProperty(_("state:"),this->FormatStatus(result));
|
||||
if(result->active_task) {
|
||||
this->addSection(_("calculation infos"));
|
||||
this->addProperty(_("checkpoint cpu time:"),FormatTime(result->checkpoint_cpu_time));
|
||||
this->addProperty(_("current cpu time:"),FormatTime(result->current_cpu_time));
|
||||
this->addProperty(_("est. cpu time remaining:"),FormatTime(result->estimated_cpu_time_remaining));
|
||||
this->addProperty(_("fraction done:"),wxString::Format(wxT("%.3f %%"),floor(result->fraction_done * 100000)/1000));
|
||||
}
|
||||
this->m_gbSizer->Layout();
|
||||
this->m_scrolledWindow->FitInside();
|
||||
}
|
||||
|
||||
//
|
||||
wxString CDlgItemProperties::FormatDiskSpace(double bytes) {
|
||||
double xTera = 1099511627776.0;
|
||||
double xGiga = 1073741824.0;
|
||||
double xMega = 1048576.0;
|
||||
double xKilo = 1024.0;
|
||||
wxString strBuffer= wxEmptyString;
|
||||
|
||||
if (bytes >= xTera) {
|
||||
strBuffer.Printf(wxT("%0.2f TB"), bytes/xTera);
|
||||
} else if (bytes >= xGiga) {
|
||||
strBuffer.Printf(wxT("%0.2f GB"), bytes/xGiga);
|
||||
} else if (bytes >= xMega) {
|
||||
strBuffer.Printf(wxT("%0.2f MB"), bytes/xMega);
|
||||
} else if (bytes >= xKilo) {
|
||||
strBuffer.Printf(wxT("%0.2f KB"), bytes/xKilo);
|
||||
} else {
|
||||
strBuffer.Printf(wxT("%0.0f bytes"), bytes);
|
||||
}
|
||||
return strBuffer;
|
||||
}
|
||||
|
||||
//
|
||||
wxString CDlgItemProperties::FormatApplicationName(RESULT* result ) {
|
||||
wxString strBuffer = wxEmptyString;
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
RESULT* state_result = NULL;
|
||||
wxString strLocalBuffer;
|
||||
|
||||
wxASSERT(pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
|
||||
if (result) {
|
||||
state_result = pDoc->state.lookup_result(result->project_url, result->name);
|
||||
if (!state_result) {
|
||||
pDoc->ForceCacheUpdate();
|
||||
state_result = pDoc->state.lookup_result(result->project_url, result->name);
|
||||
}
|
||||
wxASSERT(state_result);
|
||||
|
||||
wxString strLocale = wxString(setlocale(LC_NUMERIC, NULL), wxConvUTF8);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
if (state_result->wup->app->user_friendly_name.size()) {
|
||||
strLocalBuffer = wxString(state_result->app->user_friendly_name.c_str(), wxConvUTF8);
|
||||
} else {
|
||||
strLocalBuffer = wxString(state_result->wup->avp->app_name.c_str(), wxConvUTF8);
|
||||
}
|
||||
char buf[256];
|
||||
if (state_result->wup->avp->plan_class.size()) {
|
||||
sprintf(buf, " (%s)", state_result->wup->avp->plan_class.c_str());
|
||||
} else {
|
||||
strcpy(buf, "");
|
||||
}
|
||||
strBuffer.Printf(
|
||||
wxT("%s %.2f%s"),
|
||||
strLocalBuffer.c_str(),
|
||||
state_result->wup->avp->version_num/100.0,
|
||||
buf
|
||||
);
|
||||
setlocale(LC_NUMERIC, (const char*)strLocale.mb_str());
|
||||
}
|
||||
return strBuffer;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
wxString CDlgItemProperties::FormatStatus(RESULT* result) {
|
||||
wxString strBuffer= wxEmptyString;
|
||||
CMainDocument* doc = wxGetApp().GetDocument();
|
||||
CC_STATUS status;
|
||||
|
||||
wxASSERT(doc);
|
||||
wxASSERT(wxDynamicCast(doc, CMainDocument));
|
||||
|
||||
doc->GetCoreClientStatus(status);
|
||||
|
||||
int throttled = status.task_suspend_reason & SUSPEND_REASON_CPU_USAGE_LIMIT;
|
||||
switch(result->state) {
|
||||
case RESULT_NEW:
|
||||
strBuffer = _("New");
|
||||
break;
|
||||
case RESULT_FILES_DOWNLOADING:
|
||||
if (result->ready_to_report) {
|
||||
strBuffer = _("Download failed");
|
||||
} else {
|
||||
strBuffer = _("Downloading");
|
||||
}
|
||||
break;
|
||||
case RESULT_FILES_DOWNLOADED:
|
||||
if (result->project_suspended_via_gui) {
|
||||
strBuffer = _("Project suspended by user");
|
||||
} else if (result->suspended_via_gui) {
|
||||
strBuffer = _("Task suspended by user");
|
||||
} else if (status.task_suspend_reason && !throttled) {
|
||||
strBuffer = _("Suspended");
|
||||
if (status.task_suspend_reason & SUSPEND_REASON_BATTERIES) {
|
||||
strBuffer += _(" - on batteries");
|
||||
}
|
||||
if (status.task_suspend_reason & SUSPEND_REASON_USER_ACTIVE) {
|
||||
strBuffer += _(" - user active");
|
||||
}
|
||||
if (status.task_suspend_reason & SUSPEND_REASON_USER_REQ) {
|
||||
strBuffer += _(" - computation suspended");
|
||||
}
|
||||
if (status.task_suspend_reason & SUSPEND_REASON_TIME_OF_DAY) {
|
||||
strBuffer += _(" - time of day");
|
||||
}
|
||||
if (status.task_suspend_reason & SUSPEND_REASON_BENCHMARKS) {
|
||||
strBuffer += _(" - CPU benchmarks");
|
||||
}
|
||||
if (status.task_suspend_reason & SUSPEND_REASON_DISK_SIZE) {
|
||||
strBuffer += _(" - need disk space");
|
||||
}
|
||||
} else if (result->active_task) {
|
||||
if (result->too_large) {
|
||||
strBuffer = _("Waiting for memory");
|
||||
} else if (result->needs_shmem) {
|
||||
strBuffer = _("Waiting for shared memory");
|
||||
} else if (result->scheduler_state == CPU_SCHED_SCHEDULED) {
|
||||
if (result->edf_scheduled) {
|
||||
strBuffer = _("Running, high priority");
|
||||
} else {
|
||||
strBuffer = _("Running");
|
||||
}
|
||||
} else if (result->scheduler_state == CPU_SCHED_PREEMPTED) {
|
||||
strBuffer = _("Waiting to run");
|
||||
} else if (result->scheduler_state == CPU_SCHED_UNINITIALIZED) {
|
||||
strBuffer = _("Ready to start");
|
||||
}
|
||||
} else {
|
||||
strBuffer = _("Ready to start");
|
||||
}
|
||||
break;
|
||||
case RESULT_COMPUTE_ERROR:
|
||||
strBuffer = _("Computation error");
|
||||
break;
|
||||
case RESULT_FILES_UPLOADING:
|
||||
if (result->ready_to_report) {
|
||||
strBuffer = _("Upload failed");
|
||||
} else {
|
||||
strBuffer = _("Uploading");
|
||||
}
|
||||
break;
|
||||
case RESULT_ABORTED:
|
||||
switch(result->exit_status) {
|
||||
case ERR_ABORTED_VIA_GUI:
|
||||
strBuffer = _("Aborted by user");
|
||||
break;
|
||||
case ERR_ABORTED_BY_PROJECT:
|
||||
strBuffer = _("Aborted by project");
|
||||
break;
|
||||
default:
|
||||
strBuffer = _("Aborted");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (result->got_server_ack) {
|
||||
strBuffer = _("Acknowledged");
|
||||
} else if (result->ready_to_report) {
|
||||
strBuffer = _("Ready to report");
|
||||
} else {
|
||||
strBuffer.Format(_("Error: invalid state '%d'"), result->state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return strBuffer;
|
||||
}
|
||||
|
||||
//
|
||||
wxString CDlgItemProperties::FormatTime(float fBuffer) {
|
||||
wxInt32 iHour = 0;
|
||||
wxInt32 iMin = 0;
|
||||
wxInt32 iSec = 0;
|
||||
wxTimeSpan ts;
|
||||
wxString strBuffer= wxEmptyString;
|
||||
|
||||
if (0 >= fBuffer) {
|
||||
strBuffer = wxT("---");
|
||||
} else {
|
||||
iHour = (wxInt32)(fBuffer / (60 * 60));
|
||||
iMin = (wxInt32)(fBuffer / 60) % 60;
|
||||
iSec = (wxInt32)(fBuffer) % 60;
|
||||
|
||||
ts = wxTimeSpan(iHour, iMin, iSec);
|
||||
|
||||
strBuffer = ts.Format();
|
||||
}
|
||||
|
||||
return strBuffer;
|
||||
}
|
||||
|
||||
// adds a title section label to the dialog
|
||||
void CDlgItemProperties::addSection(const wxString& title) {
|
||||
wxStaticText* staticText = new wxStaticText( m_scrolledWindow, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, 0);
|
||||
staticText->Wrap( -1 );
|
||||
staticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
|
||||
m_gbSizer->Add( staticText, wxGBPosition( m_current_row, 0 ), wxGBSpan( 1, 2 ), wxALL|wxEXPAND, 3);
|
||||
m_current_row++;
|
||||
}
|
||||
|
||||
// adds a property row to the dialog
|
||||
void CDlgItemProperties::addProperty(const wxString& name, const wxString& value) {
|
||||
|
||||
wxStaticText* staticText = new wxStaticText( m_scrolledWindow, wxID_ANY, name, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
staticText->Wrap( -1 );
|
||||
m_gbSizer->Add( staticText, wxGBPosition( m_current_row, 0 ), wxGBSpan( 1, 1 ), wxALL, 3 );
|
||||
|
||||
staticText = new wxStaticText( m_scrolledWindow, wxID_ANY, value, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
staticText->Wrap( -1 );
|
||||
m_gbSizer->Add( staticText, wxGBPosition( m_current_row, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 3 );
|
||||
m_current_row++;
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
// Berkeley Open Infrastructure for Network Computing
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2005 University of California
|
||||
//
|
||||
// This is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation;
|
||||
// either version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This software is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// To view the GNU Lesser General Public License visit
|
||||
// http://www.gnu.org/copyleft/lesser.html
|
||||
// or write to the Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
//
|
||||
#ifndef _DLGITEMPROPERTIES_H_
|
||||
#define _DLGITEMPROPERTIES_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "DlgItemProperties.cpp"
|
||||
#endif
|
||||
|
||||
#include <wx/intl.h>
|
||||
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
#include "MainDocument.h"
|
||||
|
||||
class CDlgItemProperties : public wxDialog {
|
||||
DECLARE_DYNAMIC_CLASS( CDlgItemProperties )
|
||||
public:
|
||||
CDlgItemProperties(wxWindow* parent=NULL);//to act as standard constructor set a default value
|
||||
virtual ~CDlgItemProperties();
|
||||
//
|
||||
void renderInfos(PROJECT* project);
|
||||
void renderInfos(RESULT* result);
|
||||
private:
|
||||
int m_current_row;
|
||||
//formatting methods
|
||||
wxString FormatDiskSpace(double bytes);
|
||||
wxString FormatApplicationName(RESULT* result );
|
||||
wxString FormatStatus(RESULT* result);
|
||||
wxString FormatTime(float fBuffer);
|
||||
//generic layout methods
|
||||
void addSection(const wxString& title);
|
||||
void addProperty(const wxString& name, const wxString& value);
|
||||
protected:
|
||||
wxBoxSizer* m_bSizer1;
|
||||
wxScrolledWindow* m_scrolledWindow;
|
||||
wxGridBagSizer* m_gbSizer;
|
||||
wxButton* m_btnClose;
|
||||
};
|
||||
|
||||
#endif // _DLGITEMPROPERTIES_H_
|
||||
|
|
@ -102,12 +102,14 @@
|
|||
#define ID_TASK_PROJECT_ALLOWNEWWORK 9005
|
||||
#define ID_TASK_PROJECT_RESET 9006
|
||||
#define ID_TASK_PROJECT_DETACH 9007
|
||||
#define ID_TASK_PROJECT_SHOW_PROPERTIES 9008
|
||||
#define ID_TASK_PROJECT_WEB_PROJDEF_MIN 9100
|
||||
#define ID_TASK_PROJECT_WEB_PROJDEF_MAX 9150
|
||||
#define ID_TASK_WORK_SUSPEND 9200
|
||||
#define ID_TASK_WORK_RESUME 9201
|
||||
#define ID_TASK_WORK_SHOWGRAPHICS 9202
|
||||
#define ID_TASK_WORK_ABORT 9203
|
||||
#define ID_TASK_SHOW_PROPERTIES 9204
|
||||
#define ID_TASK_TRANSFERS_RETRYNOW 9300
|
||||
#define ID_TASK_TRANSFERS_ABORT 9301
|
||||
#define ID_TASK_MESSAGES_COPYALL 9400
|
||||
|
|
|
@ -54,6 +54,7 @@ boinc_gui_SOURCES = \
|
|||
DlgAdvPreferences.cpp \
|
||||
DlgAdvPreferencesBase.cpp \
|
||||
DlgGenericMessage.cpp \
|
||||
DlgItemProperties \
|
||||
DlgOptions.cpp \
|
||||
DlgSelectComputer.cpp \
|
||||
hyperlink.cpp \
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "BOINCListCtrl.h"
|
||||
#include "ViewProjects.h"
|
||||
#include "Events.h"
|
||||
#include "DlgItemProperties.h"
|
||||
|
||||
|
||||
#include "res/proj.xpm"
|
||||
|
@ -54,6 +55,7 @@
|
|||
#define BTN_NOWORK 2
|
||||
#define BTN_RESET 3
|
||||
#define BTN_DETACH 4
|
||||
#define BTN_PROPERTIES 5
|
||||
|
||||
|
||||
CProject::CProject() {
|
||||
|
@ -79,6 +81,7 @@ BEGIN_EVENT_TABLE (CViewProjects, CBOINCBaseView)
|
|||
EVT_BUTTON(ID_TASK_PROJECT_NONEWWORK, CViewProjects::OnProjectNoNewWork)
|
||||
EVT_BUTTON(ID_TASK_PROJECT_RESET, CViewProjects::OnProjectReset)
|
||||
EVT_BUTTON(ID_TASK_PROJECT_DETACH, CViewProjects::OnProjectDetach)
|
||||
EVT_BUTTON(ID_TASK_PROJECT_SHOW_PROPERTIES, CViewProjects::OnShowItemProperties)
|
||||
EVT_CUSTOM_RANGE(wxEVT_COMMAND_BUTTON_CLICKED, ID_TASK_PROJECT_WEB_PROJDEF_MIN, ID_TASK_PROJECT_WEB_PROJDEF_MAX, CViewProjects::OnProjectWebsiteClicked)
|
||||
EVT_LIST_ITEM_SELECTED(ID_LIST_PROJECTSVIEW, CViewProjects::OnListSelected)
|
||||
EVT_LIST_ITEM_DESELECTED(ID_LIST_PROJECTSVIEW, CViewProjects::OnListDeselected)
|
||||
|
@ -193,6 +196,13 @@ CViewProjects::CViewProjects(wxNotebook* pNotebook) :
|
|||
"(use 'Update' first to report any completed tasks)."),
|
||||
ID_TASK_PROJECT_DETACH
|
||||
);
|
||||
pGroup->m_Tasks.push_back( pItem );
|
||||
|
||||
pItem = new CTaskItem(
|
||||
_("Properties"),
|
||||
_("Show project details."),
|
||||
ID_TASK_PROJECT_SHOW_PROPERTIES
|
||||
);
|
||||
pGroup->m_Tasks.push_back( pItem );
|
||||
|
||||
// Create Task Pane Items
|
||||
|
@ -466,6 +476,18 @@ void CViewProjects::OnProjectDetach( wxCommandEvent& WXUNUSED(event) ) {
|
|||
}
|
||||
|
||||
|
||||
void CViewProjects::OnShowItemProperties( wxCommandEvent& WXUNUSED(event) ) {
|
||||
long item = m_pListPane->GetFirstSelected();
|
||||
PROJECT* project = wxGetApp().GetDocument()->project(m_iSortedIndexes[item]);
|
||||
|
||||
if(!project) return;
|
||||
//displaying the infos on a dialog
|
||||
CDlgItemProperties dlg(this);
|
||||
dlg.renderInfos(project);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void CViewProjects::OnProjectWebsiteClicked( wxEvent& event ) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectWebsiteClicked - Function Begin"));
|
||||
|
||||
|
@ -589,6 +611,7 @@ void CViewProjects::UpdateSelection() {
|
|||
n = m_pListPane->GetSelectedItemCount();
|
||||
if (n > 0) {
|
||||
m_pTaskPane->EnableTaskGroupTasks(pGroup);
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_PROPERTIES]);
|
||||
} else {
|
||||
m_pTaskPane->DisableTaskGroupTasks(pGroup);
|
||||
UpdateWebsiteSelection(GRP_WEBSITES, NULL);
|
||||
|
@ -655,6 +678,8 @@ void CViewProjects::UpdateSelection() {
|
|||
}
|
||||
|
||||
if (n == 1) {
|
||||
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_PROPERTIES]);
|
||||
|
||||
UpdateWebsiteSelection(GRP_WEBSITES, project);
|
||||
if(m_TaskGroups.size()>1) {
|
||||
m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[1]);
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
void OnProjectNoNewWork( wxCommandEvent& event );
|
||||
void OnProjectReset( wxCommandEvent& event );
|
||||
void OnProjectDetach( wxCommandEvent& event );
|
||||
void OnShowItemProperties( wxCommandEvent& event );
|
||||
|
||||
void OnProjectWebsiteClicked( wxEvent& event );
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "error_numbers.h"
|
||||
#include "app_ipc.h"
|
||||
#include "util.h"
|
||||
#include "DlgItemProperties.h"
|
||||
|
||||
#include "res/result.xpm"
|
||||
|
||||
|
@ -54,6 +55,7 @@
|
|||
#define BTN_GRAPHICS 0
|
||||
#define BTN_SUSPEND 1
|
||||
#define BTN_ABORT 2
|
||||
#define BTN_PROPERTIES 3
|
||||
|
||||
|
||||
CWork::CWork() {
|
||||
|
@ -78,6 +80,7 @@ BEGIN_EVENT_TABLE (CViewWork, CBOINCBaseView)
|
|||
EVT_BUTTON(ID_TASK_WORK_SUSPEND, CViewWork::OnWorkSuspend)
|
||||
EVT_BUTTON(ID_TASK_WORK_SHOWGRAPHICS, CViewWork::OnWorkShowGraphics)
|
||||
EVT_BUTTON(ID_TASK_WORK_ABORT, CViewWork::OnWorkAbort)
|
||||
EVT_BUTTON(ID_TASK_SHOW_PROPERTIES, CViewWork::OnShowItemProperties)
|
||||
EVT_CUSTOM_RANGE(wxEVT_COMMAND_BUTTON_CLICKED, ID_TASK_PROJECT_WEB_PROJDEF_MIN, ID_TASK_PROJECT_WEB_PROJDEF_MAX, CViewWork::OnProjectWebsiteClicked)
|
||||
EVT_LIST_ITEM_SELECTED(ID_LIST_WORKVIEW, CViewWork::OnListSelected)
|
||||
EVT_LIST_ITEM_DESELECTED(ID_LIST_WORKVIEW, CViewWork::OnListDeselected)
|
||||
|
@ -180,6 +183,13 @@ CViewWork::CViewWork(wxNotebook* pNotebook) :
|
|||
"You will get no credit for it."),
|
||||
ID_TASK_WORK_ABORT
|
||||
);
|
||||
pGroup->m_Tasks.push_back( pItem );
|
||||
|
||||
pItem = new CTaskItem(
|
||||
_("Properties"),
|
||||
_("Show task details."),
|
||||
ID_TASK_SHOW_PROPERTIES
|
||||
);
|
||||
pGroup->m_Tasks.push_back( pItem );
|
||||
|
||||
// Create Task Pane Items
|
||||
|
@ -392,6 +402,18 @@ void CViewWork::OnWorkAbort( wxCommandEvent& WXUNUSED(event) ) {
|
|||
}
|
||||
|
||||
|
||||
void CViewWork::OnShowItemProperties( wxCommandEvent& WXUNUSED(event) ) {
|
||||
long item = m_pListPane->GetFirstSelected();
|
||||
RESULT* result = wxGetApp().GetDocument()->result(m_iSortedIndexes[item]);
|
||||
|
||||
if(!result) return;
|
||||
//displaying the infos on a dialog
|
||||
CDlgItemProperties dlg(this);
|
||||
dlg.renderInfos(result);
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void CViewWork::OnProjectWebsiteClicked( wxEvent& event ) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnProjectWebsiteClicked - Function Begin"));
|
||||
|
||||
|
@ -522,6 +544,7 @@ void CViewWork::UpdateSelection() {
|
|||
if (status.task_suspend_reason & ~(SUSPEND_REASON_CPU_USAGE_LIMIT)) {
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_GRAPHICS]);
|
||||
}
|
||||
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_PROPERTIES]);
|
||||
} else {
|
||||
m_pTaskPane->DisableTaskGroupTasks(pGroup);
|
||||
}
|
||||
|
@ -585,6 +608,10 @@ void CViewWork::UpdateSelection() {
|
|||
all_same_project = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 1) {
|
||||
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_PROPERTIES]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
void OnWorkSuspend( wxCommandEvent& event );
|
||||
void OnWorkShowGraphics( wxCommandEvent& event );
|
||||
void OnWorkAbort( wxCommandEvent& event );
|
||||
void OnShowItemProperties( wxCommandEvent& event );
|
||||
|
||||
void OnProjectWebsiteClicked( wxEvent& event );
|
||||
|
||||
|
|
Loading…
Reference in New Issue