2011-02-04 18:52:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC 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 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC 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.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "DlgItemProperties.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "DlgItemProperties.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "BOINCBaseFrame.h"
|
|
|
|
#include "Events.h"
|
|
|
|
#include "error_numbers.h"
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CDlgItemProperties, wxDialog)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CDlgItemProperties, wxDialog)
|
|
|
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
/* Constructor */
|
|
|
|
CDlgItemProperties::CDlgItemProperties(wxWindow* parent) :
|
|
|
|
wxDialog( parent, ID_ANYDIALOG, wxEmptyString, wxDefaultPosition,
|
|
|
|
wxSize( 503,480 ), wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ) {
|
|
|
|
CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
wxASSERT(pFrame);
|
|
|
|
if (!pFrame) return;
|
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
SetSizeHints( wxDefaultSize, wxDefaultSize );
|
|
|
|
SetExtraStyle( GetExtraStyle() | 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 );
|
2013-11-21 13:28:40 +00:00
|
|
|
m_gbSizer->SetCols(2);
|
2011-02-11 17:35:37 +00:00
|
|
|
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 );
|
|
|
|
|
|
|
|
SetSizer( m_bSizer1 );
|
|
|
|
Layout();
|
|
|
|
|
|
|
|
Centre( wxBOTH );
|
|
|
|
|
|
|
|
m_current_row=0;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
int currentTabView = pFrame->GetCurrentViewPage();
|
|
|
|
switch(currentTabView) {
|
2011-02-11 17:35:37 +00:00
|
|
|
case VW_PROJ:
|
2011-02-04 18:52:14 +00:00
|
|
|
m_strBaseConfigLocation = wxString(wxT("/DlgProjectProperties/"));
|
|
|
|
break;
|
2011-02-11 17:35:37 +00:00
|
|
|
case VW_TASK:
|
2011-02-04 18:52:14 +00:00
|
|
|
m_strBaseConfigLocation = wxString(wxT("/DlgTaskProperties/"));
|
|
|
|
break;
|
2011-02-11 17:35:37 +00:00
|
|
|
default:
|
2011-02-04 18:52:14 +00:00
|
|
|
m_strBaseConfigLocation = wxString(wxT("/DlgProperties/"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
RestoreState();
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// destructor
|
|
|
|
CDlgItemProperties::~CDlgItemProperties() {
|
2011-02-11 17:35:37 +00:00
|
|
|
SaveState();
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* saves dialog size and (on Mac) position */
|
|
|
|
bool CDlgItemProperties::SaveState() {
|
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
|
|
|
|
|
|
|
wxASSERT(pConfig);
|
2011-02-11 17:35:37 +00:00
|
|
|
if (!pConfig) return false;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
pConfig->SetPath(m_strBaseConfigLocation);
|
|
|
|
pConfig->Write(wxT("Width"), GetSize().GetWidth());
|
|
|
|
pConfig->Write(wxT("Height"), GetSize().GetHeight());
|
2011-02-04 18:52:14 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
pConfig->Write(wxT("XPos"), GetPosition().x);
|
|
|
|
pConfig->Write(wxT("YPos"), GetPosition().y);
|
|
|
|
#endif
|
2013-04-30 11:35:45 +00:00
|
|
|
|
|
|
|
pConfig->Flush();
|
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
return true;
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* restores former dialog size and (on Mac) position */
|
|
|
|
bool CDlgItemProperties::RestoreState() {
|
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
2011-02-11 17:35:37 +00:00
|
|
|
int iWidth, iHeight;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
wxASSERT(pConfig);
|
2011-02-04 18:52:14 +00:00
|
|
|
if (!pConfig) return false;
|
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
pConfig->SetPath(m_strBaseConfigLocation);
|
2011-02-04 18:52:14 +00:00
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
pConfig->Read(wxT("Width"), &iWidth, wxDefaultCoord);
|
|
|
|
pConfig->Read(wxT("Height"), &iHeight, wxDefaultCoord);
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
#ifndef __WXMAC__
|
|
|
|
// Set size to saved values or defaults if no saved values
|
2011-02-11 17:35:37 +00:00
|
|
|
SetSize(iWidth, iHeight);
|
2011-02-04 18:52:14 +00:00
|
|
|
#else
|
2011-02-11 17:35:37 +00:00
|
|
|
int iTop, iLeft;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
pConfig->Read(wxT("YPos"), &iTop, wxDefaultCoord);
|
|
|
|
pConfig->Read(wxT("XPos"), &iLeft, wxDefaultCoord);
|
|
|
|
|
|
|
|
// If either co-ordinate is less then 0 then set it equal to 0 to ensure
|
|
|
|
// it displays on the screen.
|
|
|
|
if ((iLeft < 0) && (iLeft != wxDefaultCoord)) iLeft = 30;
|
|
|
|
if ((iTop < 0) && (iTop != wxDefaultCoord)) iTop = 30;
|
|
|
|
|
|
|
|
// Set size and position to saved values or defaults if no saved values
|
|
|
|
SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING);
|
|
|
|
|
|
|
|
// Now make sure window is on screen
|
|
|
|
GetScreenPosition(&iLeft, &iTop);
|
|
|
|
GetSize(&iWidth, &iHeight);
|
2012-05-10 08:56:58 +00:00
|
|
|
|
|
|
|
if (!IsWindowOnScreen(iLeft, iTop, iWidth, iHeight)) {
|
2011-02-04 18:52:14 +00:00
|
|
|
iTop = iLeft = 30;
|
|
|
|
SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
return true;
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
2012-03-04 04:50:40 +00:00
|
|
|
|
|
|
|
void CDlgItemProperties::show_rsc(wxString rsc_name, RSC_DESC rsc_desc) {
|
|
|
|
if (rsc_desc.no_rsc_pref) {
|
|
|
|
addProperty(_("Don't fetch tasks for ") + rsc_name, _("Project preference"));
|
|
|
|
}
|
|
|
|
if (rsc_desc.no_rsc_ams) {
|
|
|
|
addProperty(_("Don't fetch tasks for ") + rsc_name, _("Account manager preference"));
|
|
|
|
}
|
|
|
|
if (rsc_desc.no_rsc_apps) {
|
2012-03-04 04:58:41 +00:00
|
|
|
addProperty(_("Don't fetch tasks for ") + rsc_name, _("Project has no apps for ") + rsc_name);
|
|
|
|
}
|
|
|
|
if (rsc_desc.no_rsc_config) {
|
|
|
|
addProperty(_("Don't fetch tasks for ") + rsc_name, _("Client configuration excludes ") + rsc_name);
|
2012-03-04 04:50:40 +00:00
|
|
|
}
|
|
|
|
double x = rsc_desc.backoff_time - dtime();
|
|
|
|
if (x<0) x = 0;
|
|
|
|
addProperty(rsc_name + _(" work fetch deferred for"), FormatTime(x));
|
|
|
|
addProperty(rsc_name + _(" work fetch deferral interval"), FormatTime(rsc_desc.backoff_interval));
|
|
|
|
}
|
|
|
|
|
2011-02-04 18:52:14 +00:00
|
|
|
// show project properties
|
|
|
|
//
|
|
|
|
void CDlgItemProperties::renderInfos(PROJECT* project_in) {
|
2011-02-11 17:35:37 +00:00
|
|
|
std::string projectname;
|
|
|
|
//collecting infos
|
|
|
|
project_in->get_name(projectname);
|
|
|
|
//disk usage needs additional lookups
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
pDoc->CachedDiskUsageUpdate();
|
2011-02-04 18:52:14 +00:00
|
|
|
|
2011-02-11 17:35:37 +00:00
|
|
|
// CachedDiskUsageUpdate() may have invalidated our project
|
|
|
|
// pointer, so get an updated pointer to this project
|
|
|
|
PROJECT* project = pDoc->project(project_in->master_url);
|
2012-04-12 02:50:53 +00:00
|
|
|
if (!project) return; // TODO: display some sort of error alert?
|
2011-02-11 17:35:37 +00:00
|
|
|
|
|
|
|
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);
|
2012-04-12 02:50:53 +00:00
|
|
|
wxString t1(wxString(tname.c_str(), wxConvUTF8));
|
|
|
|
if(t1.IsSameAs(wxString(projectname.c_str(), wxConvUTF8)) || t1.IsSameAs(wxString(project->master_url, wxConvUTF8))) {
|
|
|
|
diskusage = tp->disk_usage;
|
2011-02-11 17:35:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//set dialog title
|
|
|
|
wxString wxTitle = _("Properties of project ");
|
|
|
|
wxTitle.append(wxString(projectname.c_str(),wxConvUTF8));
|
|
|
|
SetTitle(wxTitle);
|
|
|
|
//layout controls
|
|
|
|
addSection(_("General"));
|
2012-04-12 02:50:53 +00:00
|
|
|
addProperty(_("Master URL"), wxString(project->master_url, wxConvUTF8));
|
|
|
|
addProperty(_("User name"), wxString(project->user_name.c_str(), wxConvUTF8));
|
|
|
|
addProperty(_("Team name"), wxString(project->team_name.c_str(), wxConvUTF8));
|
|
|
|
addProperty(_("Resource share"), wxString::Format(wxT("%0.0f"), project->resource_share));
|
2011-02-04 18:52:14 +00:00
|
|
|
if (project->min_rpc_time > dtime()) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Scheduler RPC deferred for"), FormatTime(project->min_rpc_time - dtime()));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
if (project->download_backoff) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("File downloads deferred for"), FormatTime(project->download_backoff));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
if (project->upload_backoff) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("File uploads deferred for"), FormatTime(project->upload_backoff));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
2012-04-12 02:50:53 +00:00
|
|
|
addProperty(_("Disk usage"), FormatDiskSpace(diskusage));
|
2011-02-04 18:52:14 +00:00
|
|
|
addProperty(_("Computer ID"), wxString::Format(wxT("%d"), project->hostid));
|
2011-04-14 01:04:10 +00:00
|
|
|
if (project->non_cpu_intensive) {
|
|
|
|
addProperty(_("Non CPU intensive"), _("yes"));
|
|
|
|
}
|
2012-04-12 02:50:53 +00:00
|
|
|
addProperty(_("Suspended via GUI"), project->suspended_via_gui ? _("yes") : _("no"));
|
|
|
|
addProperty(_("Don't request more work"), project->dont_request_more_work ? _("yes") : _("no"));
|
2011-04-14 01:04:10 +00:00
|
|
|
if (project->scheduler_rpc_in_progress) {
|
|
|
|
addProperty(_("Scheduler call in progress"), _("yes"));
|
|
|
|
}
|
|
|
|
if (project->trickle_up_pending) {
|
|
|
|
addProperty(_("Trickle-up pending"), _("yes"));
|
|
|
|
}
|
2011-02-04 18:52:14 +00:00
|
|
|
if (strlen(project->venue)) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Host location"), wxString(project->venue, wxConvUTF8));
|
|
|
|
} else {
|
|
|
|
addProperty(_("Host location"), _("default"));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
2011-04-14 01:04:10 +00:00
|
|
|
if (project->attached_via_acct_mgr) {
|
|
|
|
addProperty(_("Added via account manager"), _("yes"));
|
|
|
|
}
|
|
|
|
if (project->detach_when_done) {
|
|
|
|
addProperty(_("Remove when tasks done"), _("yes"));
|
|
|
|
}
|
|
|
|
if (project->ended) {
|
|
|
|
addProperty(_("Ended"), _("yes"));
|
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
addSection(_("Credit"));
|
|
|
|
addProperty(_("User"),
|
2011-02-04 18:52:14 +00:00
|
|
|
wxString::Format(
|
|
|
|
wxT("%0.2f total, %0.2f average"),
|
|
|
|
project->user_total_credit,
|
|
|
|
project->user_expavg_credit
|
|
|
|
)
|
|
|
|
);
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Host"),
|
2011-02-04 18:52:14 +00:00
|
|
|
wxString::Format(
|
|
|
|
wxT("%0.2f total, %0.2f average"),
|
|
|
|
project->host_total_credit,
|
|
|
|
project->host_expavg_credit
|
|
|
|
)
|
|
|
|
);
|
2011-02-11 17:35:37 +00:00
|
|
|
|
2011-02-04 18:52:14 +00:00
|
|
|
if (!project->non_cpu_intensive) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addSection(_("Scheduling"));
|
2012-04-12 02:50:53 +00:00
|
|
|
addProperty(_("Scheduling priority"), wxString::Format(wxT("%0.2f"), project->sched_priority));
|
2012-03-04 04:50:40 +00:00
|
|
|
show_rsc(_("CPU"), project->rsc_desc_cpu);
|
2013-01-19 19:16:44 +00:00
|
|
|
if (pDoc->state.host_info.coprocs.have_nvidia()) {
|
2012-08-10 19:54:17 +00:00
|
|
|
show_rsc(
|
|
|
|
wxString(proc_type_name(PROC_TYPE_NVIDIA_GPU), wxConvUTF8),
|
|
|
|
project->rsc_desc_nvidia
|
|
|
|
);
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
2013-01-19 19:16:44 +00:00
|
|
|
if (pDoc->state.host_info.coprocs.have_ati()) {
|
2012-08-10 19:54:17 +00:00
|
|
|
show_rsc(
|
|
|
|
wxString(proc_type_name(PROC_TYPE_AMD_GPU), wxConvUTF8),
|
|
|
|
project->rsc_desc_ati
|
|
|
|
);
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
2013-01-19 19:16:44 +00:00
|
|
|
if (pDoc->state.host_info.coprocs.have_intel_gpu()) {
|
2012-12-05 13:11:20 +00:00
|
|
|
show_rsc(
|
|
|
|
wxString(proc_type_name(PROC_TYPE_INTEL_GPU), wxConvUTF8),
|
|
|
|
project->rsc_desc_intel_gpu
|
|
|
|
);
|
|
|
|
}
|
2013-03-05 18:51:50 +00:00
|
|
|
double dcf = project->duration_correction_factor;
|
|
|
|
// if it's exactly 1, it's not being used
|
|
|
|
//
|
|
|
|
if (dcf != 1) {
|
|
|
|
addProperty(
|
|
|
|
_("Duration correction factor"),
|
|
|
|
wxString::Format(wxT("%0.4f"), dcf)
|
|
|
|
);
|
|
|
|
}
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
m_gbSizer->Layout();
|
2011-02-11 17:35:37 +00:00
|
|
|
m_scrolledWindow->FitInside();
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// show task properties
|
|
|
|
//
|
|
|
|
void CDlgItemProperties::renderInfos(RESULT* result) {
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxDateTime dt;
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString wxTitle = _("Properties of task ");
|
|
|
|
wxTitle.append(wxString(result->name, wxConvUTF8));
|
|
|
|
SetTitle(wxTitle);
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
APP_VERSION* avp = NULL;
|
|
|
|
WORKUNIT* wup = NULL;
|
|
|
|
RESULT* r = pDoc->state.lookup_result(result->project_url, result->name);
|
|
|
|
if (r) {
|
|
|
|
avp = r->avp;
|
|
|
|
wup = r->wup;
|
|
|
|
}
|
|
|
|
|
|
|
|
addProperty(_("Application"), FormatApplicationName(result));
|
2012-04-12 02:50:53 +00:00
|
|
|
addProperty(_("Workunit name"), wxString(result->wu_name, wxConvUTF8));
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("State"), result_description(result, false));
|
2011-02-04 18:52:14 +00:00
|
|
|
if (result->received_time) {
|
|
|
|
dt.Set((time_t)result->received_time);
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Received"), dt.Format());
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
dt.Set((time_t)result->report_deadline);
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Report deadline"), dt.Format());
|
|
|
|
if (strlen(result->resources)) {
|
|
|
|
addProperty(_("Resources"), wxString(result->resources, wxConvUTF8));
|
|
|
|
}
|
2011-02-04 18:52:14 +00:00
|
|
|
if (wup) {
|
2011-05-31 23:39:50 +00:00
|
|
|
addProperty(_("Estimated computation size"), wxString::Format(wxT("%.0f GFLOPs"), wup->rsc_fpops_est/1e9));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
if (result->active_task) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("CPU time at last checkpoint"), FormatTime(result->checkpoint_cpu_time));
|
|
|
|
addProperty(_("CPU time"), FormatTime(result->current_cpu_time));
|
2011-02-04 18:52:14 +00:00
|
|
|
if (result->elapsed_time >= 0) {
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Elapsed time"), FormatTime(result->elapsed_time));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
addProperty(_("Estimated time remaining"), FormatTime(result->estimated_cpu_time_remaining));
|
|
|
|
addProperty(_("Fraction done"), wxString::Format(wxT("%.3f %%"), result->fraction_done*100));
|
|
|
|
addProperty(_("Virtual memory size"), FormatDiskSpace(result->swap_size));
|
|
|
|
addProperty(_("Working set size"), FormatDiskSpace(result->working_set_size_smoothed));
|
2011-02-04 18:52:14 +00:00
|
|
|
if (result->slot >= 0) {
|
|
|
|
addProperty(_("Directory"), wxString::Format(wxT("slots/%d"), result->slot));
|
|
|
|
}
|
|
|
|
if (result->pid) {
|
|
|
|
addProperty(_("Process ID"), wxString::Format(wxT("%d"), result->pid));
|
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
} else if (result->state >= RESULT_COMPUTE_ERROR) {
|
|
|
|
addProperty(_("CPU time"), FormatTime(result->final_cpu_time));
|
|
|
|
addProperty(_("Elapsed time"), FormatTime(result->final_elapsed_time));
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
2011-02-11 17:35:37 +00:00
|
|
|
m_gbSizer->Layout();
|
|
|
|
m_scrolledWindow->FitInside();
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString CDlgItemProperties::FormatDiskSpace(double bytes) {
|
2011-02-04 18:52:14 +00:00
|
|
|
double xTera = 1099511627776.0;
|
|
|
|
double xGiga = 1073741824.0;
|
|
|
|
double xMega = 1048576.0;
|
|
|
|
double xKilo = 1024.0;
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString strBuffer= wxEmptyString;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
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 ) {
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
2011-02-04 18:52:14 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
RESULT* state_result = NULL;
|
|
|
|
wxString strAppBuffer = wxEmptyString;
|
|
|
|
wxString strClassBuffer = wxEmptyString;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (!state_result) return strBuffer;
|
|
|
|
WORKUNIT* wup = state_result->wup;
|
|
|
|
if (!wup) return strBuffer;
|
|
|
|
APP* app = wup->app;
|
|
|
|
if (!app) return strBuffer;
|
|
|
|
APP_VERSION* avp = state_result->avp;
|
|
|
|
if (!avp) return strBuffer;
|
|
|
|
|
|
|
|
if (strlen(app->user_friendly_name)) {
|
|
|
|
strAppBuffer = wxString(state_result->app->user_friendly_name, wxConvUTF8);
|
|
|
|
} else {
|
|
|
|
strAppBuffer = wxString(state_result->avp->app_name, wxConvUTF8);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strlen(avp->plan_class)) {
|
|
|
|
strClassBuffer.Printf(
|
|
|
|
wxT(" (%s)"),
|
|
|
|
wxString(avp->plan_class, wxConvUTF8).c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
strBuffer.Printf(
|
|
|
|
wxT("%s%s %d.%02d %s"),
|
|
|
|
state_result->project->anonymous_platform?_("Local: "):wxT(""),
|
|
|
|
strAppBuffer.c_str(),
|
|
|
|
state_result->avp->version_num / 100,
|
|
|
|
state_result->avp->version_num % 100,
|
|
|
|
strClassBuffer.c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
wxString CDlgItemProperties::FormatTime(float fBuffer) {
|
|
|
|
wxInt32 iHour = 0;
|
|
|
|
wxInt32 iMin = 0;
|
|
|
|
wxInt32 iSec = 0;
|
|
|
|
wxTimeSpan ts;
|
2011-02-11 17:35:37 +00:00
|
|
|
wxString strBuffer= wxEmptyString;
|
2011-02-04 18:52:14 +00:00
|
|
|
|
|
|
|
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) {
|
2012-04-12 02:50:53 +00:00
|
|
|
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);
|
2011-02-11 17:35:37 +00:00
|
|
|
m_current_row++;
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// adds a property row to the dialog
|
|
|
|
void CDlgItemProperties::addProperty(const wxString& name, const wxString& value) {
|
2011-02-11 17:35:37 +00:00
|
|
|
|
|
|
|
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++;
|
2011-02-04 18:52:14 +00:00
|
|
|
}
|