2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-05-17 22:15:10 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// 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.
|
2004-04-10 09:11:03 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// 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.
|
2004-05-17 22:15:10 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
2007-10-09 11:35:47 +00:00
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
2004-09-21 01:30:29 +00:00
|
|
|
#pragma implementation "ViewWork.h"
|
2004-04-11 04:37:10 +00:00
|
|
|
#endif
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
#include "stdwx.h"
|
2004-07-13 05:56:03 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "BOINCBaseFrame.h"
|
2004-07-13 05:56:03 +00:00
|
|
|
#include "MainDocument.h"
|
2006-06-24 05:00:57 +00:00
|
|
|
#include "AdvancedFrame.h"
|
2004-09-24 22:19:02 +00:00
|
|
|
#include "BOINCTaskCtrl.h"
|
|
|
|
#include "BOINCListCtrl.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "ViewWork.h"
|
2004-07-13 05:56:03 +00:00
|
|
|
#include "Events.h"
|
2006-04-10 20:08:50 +00:00
|
|
|
#include "error_numbers.h"
|
2007-06-18 11:46:01 +00:00
|
|
|
#include "app_ipc.h"
|
|
|
|
#include "util.h"
|
2004-12-02 07:43:47 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
#include "res/result.xpm"
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
|
2004-08-11 23:52:22 +00:00
|
|
|
#define COLUMN_PROJECT 0
|
|
|
|
#define COLUMN_APPLICATION 1
|
|
|
|
#define COLUMN_NAME 2
|
|
|
|
#define COLUMN_CPUTIME 3
|
|
|
|
#define COLUMN_PROGRESS 4
|
2005-03-23 22:30:16 +00:00
|
|
|
#define COLUMN_TOCOMPLETION 5
|
2004-08-11 23:52:22 +00:00
|
|
|
#define COLUMN_REPORTDEADLINE 6
|
|
|
|
#define COLUMN_STATUS 7
|
|
|
|
|
2006-01-09 14:03:13 +00:00
|
|
|
// groups that contain buttons
|
|
|
|
#define GRP_TASKS 0
|
|
|
|
#define GRP_WEBSITES 1
|
|
|
|
|
2005-04-22 06:06:22 +00:00
|
|
|
// buttons in the "tasks" area
|
2006-01-09 14:03:13 +00:00
|
|
|
#define BTN_GRAPHICS 0
|
|
|
|
#define BTN_SUSPEND 1
|
|
|
|
#define BTN_ABORT 2
|
2004-08-11 23:52:22 +00:00
|
|
|
|
2005-04-22 06:06:22 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CWork::CWork() {
|
2004-12-02 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CWork::~CWork() {
|
2004-12-02 07:43:47 +00:00
|
|
|
m_strProjectName.Clear();
|
|
|
|
m_strApplicationName.Clear();
|
|
|
|
m_strName.Clear();
|
|
|
|
m_strCPUTime.Clear();
|
|
|
|
m_strProgress.Clear();
|
|
|
|
m_strTimeToCompletion.Clear();
|
|
|
|
m_strReportDeadline.Clear();
|
|
|
|
m_strStatus.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CViewWork, CBOINCBaseView)
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
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)
|
2006-01-09 14:03:13 +00:00
|
|
|
EVT_CUSTOM_RANGE(wxEVT_COMMAND_BUTTON_CLICKED, ID_TASK_PROJECT_WEB_PROJDEF_MIN, ID_TASK_PROJECT_WEB_PROJDEF_MAX, CViewWork::OnProjectWebsiteClicked)
|
2005-04-21 23:14:10 +00:00
|
|
|
EVT_LIST_ITEM_SELECTED(ID_LIST_WORKVIEW, CViewWork::OnListSelected)
|
|
|
|
EVT_LIST_ITEM_DESELECTED(ID_LIST_WORKVIEW, CViewWork::OnListDeselected)
|
2005-04-21 06:04:26 +00:00
|
|
|
END_EVENT_TABLE ()
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-09-02 18:40:06 +00:00
|
|
|
CViewWork::CViewWork()
|
|
|
|
{}
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
CViewWork::CViewWork(wxNotebook* pNotebook) :
|
2005-09-06 06:18:36 +00:00
|
|
|
CBOINCBaseView(pNotebook, ID_TASK_WORKVIEW, DEFAULT_TASK_FLAGS, ID_LIST_WORKVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS)
|
2005-04-21 06:04:26 +00:00
|
|
|
{
|
|
|
|
CTaskItemGroup* pGroup = NULL;
|
|
|
|
CTaskItem* pItem = NULL;
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-12-23 01:06:41 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Setup View
|
|
|
|
//
|
2006-02-08 06:56:34 +00:00
|
|
|
pGroup = new CTaskItemGroup( _("Commands") );
|
2005-04-21 06:04:26 +00:00
|
|
|
m_TaskGroups.push_back( pGroup );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
2006-01-09 14:03:13 +00:00
|
|
|
_("Show graphics"),
|
|
|
|
_("Show application graphics in a window."),
|
|
|
|
ID_TASK_WORK_SHOWGRAPHICS
|
2005-04-21 06:04:26 +00:00
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
2006-01-09 14:03:13 +00:00
|
|
|
_("Suspend"),
|
|
|
|
_("Suspend work for this result."),
|
|
|
|
ID_TASK_WORK_SUSPEND
|
2005-04-21 06:04:26 +00:00
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
2005-04-21 23:53:39 +00:00
|
|
|
_("Abort"),
|
|
|
|
_("Abandon work on the result. "
|
|
|
|
"You will get no credit for it."),
|
2005-04-21 06:04:26 +00:00
|
|
|
ID_TASK_WORK_ABORT
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
|
|
|
// Create Task Pane Items
|
2005-04-21 23:14:10 +00:00
|
|
|
m_pTaskPane->UpdateControls();
|
2005-04-21 06:04:26 +00:00
|
|
|
|
|
|
|
// Create List Pane Items
|
2004-10-19 19:41:29 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 125);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_APPLICATION, _("Application"), wxLIST_FORMAT_LEFT, 95);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_NAME, _("Name"), wxLIST_FORMAT_LEFT, 285);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_CPUTIME, _("CPU time"), wxLIST_FORMAT_RIGHT, 80);
|
2006-04-04 04:39:40 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_PROGRESS, _("Progress"), wxLIST_FORMAT_RIGHT, 60);
|
2005-03-23 22:30:16 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_TOCOMPLETION, _("To completion"), wxLIST_FORMAT_RIGHT, 100);
|
2004-11-22 19:17:13 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_REPORTDEADLINE, _("Report deadline"), wxLIST_FORMAT_LEFT, 150);
|
2004-10-19 19:41:29 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_STATUS, _("Status"), wxLIST_FORMAT_LEFT, 135);
|
2005-04-21 23:53:39 +00:00
|
|
|
|
|
|
|
UpdateSelection();
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CViewWork::~CViewWork() {
|
2005-02-01 00:54:06 +00:00
|
|
|
EmptyCache();
|
2005-04-21 06:04:26 +00:00
|
|
|
EmptyTasks();
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-02 21:03:36 +00:00
|
|
|
wxString& CViewWork::GetViewName() {
|
2006-01-23 11:30:25 +00:00
|
|
|
static wxString strViewName(_("Tasks"));
|
2005-09-02 20:56:08 +00:00
|
|
|
return strViewName;
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
2004-04-11 05:09:18 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
|
- fixes #207 - HTML entities in BOINC Manager have to be decoded
BOINC Manager can now properly decode HTML entites for the
following elements:
Projects Tab:
Project Name
User Name
Team Name
Work Tab:
Project Name
Application Name
Transfers Tab:
Project Name
Messages Tab:
Project Name
Disk Tab:
Project Name
- fixes #212 - Info in columns misaligned on switching views
- Properly restore which tab view the user left from when going
to the advanced view from the simple view
- Fix the problem that caused the manager to wait for 7 seconds
to display anything on initial startup.
- Store the various Grid/List persisted data seperately so that
the different header sizes don't cause problems.
clientgui/
AdvancedFrame.cpp
BOINCBaseView.cpp, .h
BOINCGridCtrl.cpp
ViewMessages.cpp, .h
ViewMessagesGrid.cpp, .h
ViewProjects.cpp, .h
ViewProjectsGrid.cpp, .h
ViewResources.cpp, .h
ViewStatistics.cpp, .h
ViewTransfers.cpp, .h
ViewTransfersGrid.cpp, .h
ViewWork.cpp, .h
ViewWorkGrid.cpp, .h
lib/
gui_rpc_client_ops.C
svn path=/trunk/boinc/; revision=12761
2007-05-29 05:07:35 +00:00
|
|
|
wxString& CViewWork::GetViewDisplayName() {
|
|
|
|
static wxString strViewName(_("Tasks"));
|
|
|
|
return strViewName;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
const char** CViewWork::GetViewIcon() {
|
2004-04-13 00:33:40 +00:00
|
|
|
return result_xpm;
|
|
|
|
}
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewWork::OnWorkSuspend( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkSuspend - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-07-21 08:23:26 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-21 06:04:26 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2005-04-21 23:53:39 +00:00
|
|
|
RESULT* result = pDoc->result(m_pListPane->GetFirstSelected());
|
|
|
|
if (result->suspended_via_gui) {
|
2006-01-23 11:30:25 +00:00
|
|
|
pFrame->UpdateStatusText(_("Resuming task..."));
|
2006-07-21 08:23:26 +00:00
|
|
|
pDoc->WorkResume(result->project_url, result->name);
|
2005-04-21 23:53:39 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
} else {
|
2006-01-23 11:30:25 +00:00
|
|
|
pFrame->UpdateStatusText(_("Suspending task..."));
|
2006-07-21 08:23:26 +00:00
|
|
|
pDoc->WorkSuspend(result->project_url, result->name);
|
2005-04-21 23:53:39 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
}
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
2005-05-05 06:07:14 +00:00
|
|
|
pFrame->FireRefreshView();
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkSuspend - Function End"));
|
|
|
|
}
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewWork::OnWorkShowGraphics( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkShowGraphics - Function Begin"));
|
|
|
|
|
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxString strMachineName = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2007-09-20 00:32:16 +00:00
|
|
|
|
2006-07-21 08:23:26 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-21 06:04:26 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pListPane);
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2006-01-23 11:30:25 +00:00
|
|
|
pFrame->UpdateStatusText(_("Showing graphics for task..."));
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2007-06-18 11:46:01 +00:00
|
|
|
// TODO: implement hide as well as show
|
|
|
|
#if (defined(_WIN32) || defined(__WXMAC__))
|
|
|
|
pDoc->GetConnectedComputerName(strMachineName);
|
|
|
|
if (!pDoc->IsComputerNameLocal(strMachineName)) {
|
|
|
|
iAnswer = ::wxMessageBox(
|
|
|
|
_("Are you sure you want to display graphics on a remote machine?"),
|
|
|
|
_("Show graphics"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
iAnswer = wxYES;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
iAnswer = wxYES;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (wxYES == iAnswer) {
|
|
|
|
RESULT* result = pDoc->result(m_pListPane->GetFirstSelected());
|
2007-09-20 00:32:16 +00:00
|
|
|
pDoc->WorkShowGraphics(result);
|
2007-06-18 11:46:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkShowGraphics - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewWork::OnWorkAbort( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkAbort - Function Begin"));
|
|
|
|
|
2006-03-27 06:59:57 +00:00
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxInt32 iResult = 0;
|
2005-04-21 06:04:26 +00:00
|
|
|
wxString strMessage = wxEmptyString;
|
2006-03-27 06:59:57 +00:00
|
|
|
wxString strName = wxEmptyString;
|
|
|
|
wxString strProgress = wxEmptyString;
|
|
|
|
wxString strStatus = wxEmptyString;
|
2005-04-21 06:04:26 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-07-21 08:23:26 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(pFrame);
|
2005-06-13 08:47:51 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
if (!pDoc->IsUserAuthorized())
|
|
|
|
return;
|
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
pFrame->UpdateStatusText(_("Aborting result..."));
|
|
|
|
|
2006-03-27 06:59:57 +00:00
|
|
|
iResult = m_pListPane->GetFirstSelected();
|
|
|
|
FormatName(iResult, strName);
|
|
|
|
FormatProgress(iResult, strProgress);
|
|
|
|
FormatStatus(iResult, strStatus);
|
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
strMessage.Printf(
|
2006-03-27 06:59:57 +00:00
|
|
|
_("Are you sure you want to abort this task '%s'?\n"
|
|
|
|
"(Progress: %s, Status: %s)"),
|
|
|
|
strName.c_str(),
|
|
|
|
strProgress.c_str(),
|
|
|
|
strStatus.c_str()
|
2005-06-13 08:47:51 +00:00
|
|
|
);
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2005-06-24 10:49:42 +00:00
|
|
|
iAnswer = ::wxMessageBox(
|
2005-04-21 06:04:26 +00:00
|
|
|
strMessage,
|
2006-01-23 11:30:25 +00:00
|
|
|
_("Abort task"),
|
2005-06-24 10:49:42 +00:00
|
|
|
wxYES_NO | wxICON_QUESTION,
|
2005-04-21 06:04:26 +00:00
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
if (wxYES == iAnswer) {
|
2006-07-21 08:23:26 +00:00
|
|
|
RESULT* result = pDoc->result(m_pListPane->GetFirstSelected());
|
|
|
|
pDoc->WorkAbort(result->project_url, result->name);
|
2005-04-21 06:04:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
2005-05-05 06:07:14 +00:00
|
|
|
pFrame->FireRefreshView();
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-21 06:04:26 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkAbort - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-09 14:03:13 +00:00
|
|
|
void CViewWork::OnProjectWebsiteClicked( wxEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnProjectWebsiteClicked - Function Begin"));
|
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2006-01-09 14:03:13 +00:00
|
|
|
|
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2006-01-09 14:03:13 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Launching browser..."));
|
|
|
|
|
|
|
|
int website_task_index = event.GetId() - ID_TASK_PROJECT_WEB_PROJDEF_MIN;
|
|
|
|
pFrame->ExecuteBrowserLink(
|
|
|
|
m_TaskGroups[1]->m_Tasks[website_task_index]->m_strWebSiteLink
|
|
|
|
);
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnProjectWebsiteClicked - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::GetDocCount() {
|
2006-04-17 20:26:59 +00:00
|
|
|
return wxGetApp().GetDocument()->GetWorkCount();
|
2004-10-26 08:41:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxString CViewWork::OnListGetItemText(long item, long column) const {
|
2005-11-02 18:28:45 +00:00
|
|
|
CWork* work = NULL;
|
2004-12-02 07:43:47 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
|
|
|
|
2005-11-02 18:28:45 +00:00
|
|
|
try {
|
|
|
|
work = m_WorkCache.at(item);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
work = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (work) {
|
|
|
|
switch(column) {
|
|
|
|
case COLUMN_PROJECT:
|
|
|
|
strBuffer = work->m_strProjectName;
|
|
|
|
break;
|
|
|
|
case COLUMN_APPLICATION:
|
|
|
|
strBuffer = work->m_strApplicationName;
|
|
|
|
break;
|
|
|
|
case COLUMN_NAME:
|
|
|
|
strBuffer = work->m_strName;
|
|
|
|
break;
|
|
|
|
case COLUMN_CPUTIME:
|
|
|
|
strBuffer = work->m_strCPUTime;
|
|
|
|
break;
|
|
|
|
case COLUMN_PROGRESS:
|
|
|
|
strBuffer = work->m_strProgress;
|
|
|
|
break;
|
|
|
|
case COLUMN_TOCOMPLETION:
|
|
|
|
strBuffer = work->m_strTimeToCompletion;
|
|
|
|
break;
|
|
|
|
case COLUMN_REPORTDEADLINE:
|
|
|
|
strBuffer = work->m_strReportDeadline;
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
|
|
|
strBuffer = work->m_strStatus;
|
|
|
|
break;
|
|
|
|
}
|
2004-12-02 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return strBuffer;
|
|
|
|
}
|
2004-10-21 21:19:49 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxString CViewWork::OnDocGetItemText(long item, long column) const {
|
2004-12-02 07:43:47 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
switch(column) {
|
2004-08-11 23:52:22 +00:00
|
|
|
case COLUMN_PROJECT:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatProjectName(item, strBuffer);
|
2004-07-13 05:56:03 +00:00
|
|
|
break;
|
2004-08-11 23:52:22 +00:00
|
|
|
case COLUMN_APPLICATION:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatApplicationName(item, strBuffer);
|
2004-07-13 05:56:03 +00:00
|
|
|
break;
|
2004-08-11 23:52:22 +00:00
|
|
|
case COLUMN_NAME:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatName(item, strBuffer);
|
2004-07-13 05:56:03 +00:00
|
|
|
break;
|
2004-08-11 23:52:22 +00:00
|
|
|
case COLUMN_CPUTIME:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatCPUTime(item, strBuffer);
|
2004-07-13 05:56:03 +00:00
|
|
|
break;
|
2004-08-11 23:52:22 +00:00
|
|
|
case COLUMN_PROGRESS:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatProgress(item, strBuffer);
|
2004-07-13 05:56:03 +00:00
|
|
|
break;
|
2005-03-23 22:30:16 +00:00
|
|
|
case COLUMN_TOCOMPLETION:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatTimeToCompletion(item, strBuffer);
|
2004-07-13 05:56:03 +00:00
|
|
|
break;
|
2004-08-11 23:52:22 +00:00
|
|
|
case COLUMN_REPORTDEADLINE:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatReportDeadline(item, strBuffer);
|
2004-07-13 05:56:03 +00:00
|
|
|
break;
|
2004-08-11 23:52:22 +00:00
|
|
|
case COLUMN_STATUS:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatStatus(item, strBuffer);
|
2004-07-13 05:56:03 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2004-07-13 05:56:03 +00:00
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::AddCacheElement() {
|
2004-12-02 07:43:47 +00:00
|
|
|
CWork* pItem = new CWork();
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pItem);
|
|
|
|
if (pItem) {
|
2005-04-07 07:04:50 +00:00
|
|
|
m_WorkCache.push_back(pItem);
|
2004-12-02 07:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::EmptyCache() {
|
2005-01-29 19:59:39 +00:00
|
|
|
unsigned int i;
|
|
|
|
for (i=0; i<m_WorkCache.size(); i++) {
|
|
|
|
delete m_WorkCache[i];
|
|
|
|
}
|
2005-01-29 00:58:43 +00:00
|
|
|
m_WorkCache.clear();
|
2004-12-02 07:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::GetCacheCount() {
|
2006-07-21 08:23:26 +00:00
|
|
|
return (wxInt32)m_WorkCache.size();
|
2004-12-02 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::RemoveCacheElement() {
|
2005-01-29 21:30:45 +00:00
|
|
|
delete m_WorkCache.back();
|
2005-04-07 07:04:50 +00:00
|
|
|
m_WorkCache.erase(m_WorkCache.end() - 1);
|
2004-12-02 07:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::UpdateCache(long item, long column, wxString& strNewData) {
|
|
|
|
CWork* work = m_WorkCache.at(item);
|
2004-12-02 07:43:47 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
switch(column) {
|
2004-12-02 07:43:47 +00:00
|
|
|
case COLUMN_PROJECT:
|
2005-03-15 23:44:48 +00:00
|
|
|
work->m_strProjectName = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_APPLICATION:
|
2005-03-15 23:44:48 +00:00
|
|
|
work->m_strApplicationName = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_NAME:
|
2005-03-15 23:44:48 +00:00
|
|
|
work->m_strName = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_CPUTIME:
|
2005-03-15 23:44:48 +00:00
|
|
|
work->m_strCPUTime = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_PROGRESS:
|
2005-03-15 23:44:48 +00:00
|
|
|
work->m_strProgress = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
2005-03-23 22:30:16 +00:00
|
|
|
case COLUMN_TOCOMPLETION:
|
2005-03-15 23:44:48 +00:00
|
|
|
work->m_strTimeToCompletion = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_REPORTDEADLINE:
|
2005-03-15 23:44:48 +00:00
|
|
|
work->m_strReportDeadline = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2005-03-15 23:44:48 +00:00
|
|
|
work->m_strStatus = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CViewWork::UpdateSelection() {
|
2005-04-27 06:32:40 +00:00
|
|
|
CTaskItemGroup* pGroup = NULL;
|
2006-01-09 14:03:13 +00:00
|
|
|
RESULT* result = NULL;
|
|
|
|
PROJECT* project = NULL;
|
2005-04-27 06:32:40 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-04-21 23:53:39 +00:00
|
|
|
|
2005-04-27 06:32:40 +00:00
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
|
2006-01-09 14:03:13 +00:00
|
|
|
|
|
|
|
CBOINCBaseView::PreUpdateSelection();
|
|
|
|
|
|
|
|
|
2005-04-27 06:32:40 +00:00
|
|
|
pGroup = m_TaskGroups[0];
|
|
|
|
if (m_pListPane->GetSelectedItemCount()) {
|
2006-01-09 14:03:13 +00:00
|
|
|
result = pDoc->result(m_pListPane->GetFirstSelected());
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_SUSPEND]);
|
2005-08-26 06:50:46 +00:00
|
|
|
if (result) {
|
|
|
|
if (result->suspended_via_gui) {
|
|
|
|
m_pTaskPane->UpdateTask(
|
2006-03-27 03:44:13 +00:00
|
|
|
pGroup->m_Tasks[BTN_SUSPEND],
|
|
|
|
_("Resume"),
|
|
|
|
_("Resume work for this task.")
|
2005-08-26 06:50:46 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
m_pTaskPane->UpdateTask(
|
2006-03-27 03:44:13 +00:00
|
|
|
pGroup->m_Tasks[BTN_SUSPEND],
|
|
|
|
_("Suspend"),
|
|
|
|
_("Suspend work for this task.")
|
2005-08-26 06:50:46 +00:00
|
|
|
);
|
|
|
|
}
|
2007-05-10 16:14:04 +00:00
|
|
|
|
2007-06-19 17:33:48 +00:00
|
|
|
if (result->supports_graphics || !result->graphics_exec_path.empty()) {
|
2005-08-26 06:50:46 +00:00
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_GRAPHICS]);
|
|
|
|
} else {
|
|
|
|
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_GRAPHICS]);
|
2007-05-10 16:14:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
2007-05-21 14:20:09 +00:00
|
|
|
result->active_task_state != PROCESS_ABORT_PENDING &&
|
|
|
|
result->active_task_state != PROCESS_ABORTED &&
|
|
|
|
result->state != RESULT_ABORTED
|
2007-05-10 16:14:04 +00:00
|
|
|
) {
|
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_ABORT]);
|
|
|
|
} else {
|
|
|
|
m_pTaskPane->DisableTask(pGroup->m_Tasks[BTN_ABORT]);
|
2005-08-26 06:50:46 +00:00
|
|
|
}
|
2006-01-09 14:03:13 +00:00
|
|
|
|
2006-04-10 20:08:50 +00:00
|
|
|
project = pDoc->state.lookup_project(result->project_url);
|
|
|
|
CBOINCBaseView::UpdateWebsiteSelection(GRP_WEBSITES, project);
|
|
|
|
} else {
|
|
|
|
CBOINCBaseView::UpdateWebsiteSelection(GRP_WEBSITES, NULL);
|
|
|
|
}
|
2005-04-27 06:32:40 +00:00
|
|
|
} else {
|
|
|
|
m_pTaskPane->DisableTaskGroupTasks(pGroup);
|
2005-04-21 23:53:39 +00:00
|
|
|
}
|
2006-01-09 14:03:13 +00:00
|
|
|
|
|
|
|
CBOINCBaseView::PostUpdateSelection();
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatProjectName(wxInt32 item, wxString& strBuffer) const {
|
2005-06-13 08:47:51 +00:00
|
|
|
CMainDocument* doc = wxGetApp().GetDocument();
|
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2006-08-28 20:28:56 +00:00
|
|
|
PROJECT* state_project = NULL;
|
2005-06-13 08:47:51 +00:00
|
|
|
std::string project_name;
|
|
|
|
|
|
|
|
wxASSERT(doc);
|
|
|
|
wxASSERT(wxDynamicCast(doc, CMainDocument));
|
|
|
|
|
|
|
|
if (result) {
|
2006-08-28 20:28:56 +00:00
|
|
|
state_project = doc->state.lookup_project(result->project_url);
|
|
|
|
if (state_project) {
|
|
|
|
state_project->get_name(project_name);
|
- fixes #207 - HTML entities in BOINC Manager have to be decoded
BOINC Manager can now properly decode HTML entites for the
following elements:
Projects Tab:
Project Name
User Name
Team Name
Work Tab:
Project Name
Application Name
Transfers Tab:
Project Name
Messages Tab:
Project Name
Disk Tab:
Project Name
- fixes #212 - Info in columns misaligned on switching views
- Properly restore which tab view the user left from when going
to the advanced view from the simple view
- Fix the problem that caused the manager to wait for 7 seconds
to display anything on initial startup.
- Store the various Grid/List persisted data seperately so that
the different header sizes don't cause problems.
clientgui/
AdvancedFrame.cpp
BOINCBaseView.cpp, .h
BOINCGridCtrl.cpp
ViewMessages.cpp, .h
ViewMessagesGrid.cpp, .h
ViewProjects.cpp, .h
ViewProjectsGrid.cpp, .h
ViewResources.cpp, .h
ViewStatistics.cpp, .h
ViewTransfers.cpp, .h
ViewTransfersGrid.cpp, .h
ViewWork.cpp, .h
ViewWorkGrid.cpp, .h
lib/
gui_rpc_client_ops.C
svn path=/trunk/boinc/; revision=12761
2007-05-29 05:07:35 +00:00
|
|
|
strBuffer = HtmlEntityDecode(wxString(project_name.c_str(), wxConvUTF8));
|
2005-06-13 08:47:51 +00:00
|
|
|
} else {
|
|
|
|
doc->ForceCacheUpdate();
|
|
|
|
}
|
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatApplicationName(wxInt32 item, wxString& strBuffer) const {
|
2006-09-01 04:24:25 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-06-13 08:47:51 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
|
|
|
RESULT* state_result = NULL;
|
2007-01-11 23:20:42 +00:00
|
|
|
wxString strLocalBuffer;
|
2005-06-13 08:47:51 +00:00
|
|
|
|
2006-09-01 04:24:25 +00:00
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-06-13 08:47:51 +00:00
|
|
|
|
|
|
|
if (result) {
|
2006-09-01 04:24:25 +00:00
|
|
|
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);
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2006-09-01 04:24:25 +00:00
|
|
|
wxASSERT(state_result);
|
|
|
|
|
|
|
|
wxString strLocale = wxString(setlocale(LC_NUMERIC, NULL), wxConvUTF8);
|
|
|
|
setlocale(LC_NUMERIC, "C");
|
2007-01-11 23:20:42 +00:00
|
|
|
if (state_result->wup->app->user_friendly_name.size()) {
|
- fixes #207 - HTML entities in BOINC Manager have to be decoded
BOINC Manager can now properly decode HTML entites for the
following elements:
Projects Tab:
Project Name
User Name
Team Name
Work Tab:
Project Name
Application Name
Transfers Tab:
Project Name
Messages Tab:
Project Name
Disk Tab:
Project Name
- fixes #212 - Info in columns misaligned on switching views
- Properly restore which tab view the user left from when going
to the advanced view from the simple view
- Fix the problem that caused the manager to wait for 7 seconds
to display anything on initial startup.
- Store the various Grid/List persisted data seperately so that
the different header sizes don't cause problems.
clientgui/
AdvancedFrame.cpp
BOINCBaseView.cpp, .h
BOINCGridCtrl.cpp
ViewMessages.cpp, .h
ViewMessagesGrid.cpp, .h
ViewProjects.cpp, .h
ViewProjectsGrid.cpp, .h
ViewResources.cpp, .h
ViewStatistics.cpp, .h
ViewTransfers.cpp, .h
ViewTransfersGrid.cpp, .h
ViewWork.cpp, .h
ViewWorkGrid.cpp, .h
lib/
gui_rpc_client_ops.C
svn path=/trunk/boinc/; revision=12761
2007-05-29 05:07:35 +00:00
|
|
|
strLocalBuffer = HtmlEntityDecode(wxString(state_result->app->user_friendly_name.c_str(), wxConvUTF8));
|
2007-01-11 23:20:42 +00:00
|
|
|
} else {
|
- fixes #207 - HTML entities in BOINC Manager have to be decoded
BOINC Manager can now properly decode HTML entites for the
following elements:
Projects Tab:
Project Name
User Name
Team Name
Work Tab:
Project Name
Application Name
Transfers Tab:
Project Name
Messages Tab:
Project Name
Disk Tab:
Project Name
- fixes #212 - Info in columns misaligned on switching views
- Properly restore which tab view the user left from when going
to the advanced view from the simple view
- Fix the problem that caused the manager to wait for 7 seconds
to display anything on initial startup.
- Store the various Grid/List persisted data seperately so that
the different header sizes don't cause problems.
clientgui/
AdvancedFrame.cpp
BOINCBaseView.cpp, .h
BOINCGridCtrl.cpp
ViewMessages.cpp, .h
ViewMessagesGrid.cpp, .h
ViewProjects.cpp, .h
ViewProjectsGrid.cpp, .h
ViewResources.cpp, .h
ViewStatistics.cpp, .h
ViewTransfers.cpp, .h
ViewTransfersGrid.cpp, .h
ViewWork.cpp, .h
ViewWorkGrid.cpp, .h
lib/
gui_rpc_client_ops.C
svn path=/trunk/boinc/; revision=12761
2007-05-29 05:07:35 +00:00
|
|
|
strLocalBuffer = HtmlEntityDecode(wxString(state_result->wup->avp->app_name.c_str(), wxConvUTF8));
|
2007-01-11 21:46:18 +00:00
|
|
|
}
|
2006-09-01 04:24:25 +00:00
|
|
|
strBuffer.Printf(
|
|
|
|
wxT("%s %.2f"),
|
2007-01-11 23:20:42 +00:00
|
|
|
strLocalBuffer.c_str(),
|
2006-09-01 04:24:25 +00:00
|
|
|
state_result->wup->avp->version_num/100.0
|
|
|
|
);
|
|
|
|
setlocale(LC_NUMERIC, (const char*)strLocale.mb_str());
|
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatName(wxInt32 item, wxString& strBuffer) const {
|
2005-06-13 08:47:51 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
wxASSERT(result);
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (result) {
|
2006-03-23 01:17:07 +00:00
|
|
|
strBuffer = wxString(result->name.c_str(), wxConvUTF8);
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatCPUTime(wxInt32 item, wxString& strBuffer) const {
|
2004-10-11 04:38:00 +00:00
|
|
|
float fBuffer = 0;
|
2004-10-22 19:23:09 +00:00
|
|
|
wxInt32 iHour = 0;
|
|
|
|
wxInt32 iMin = 0;
|
|
|
|
wxInt32 iSec = 0;
|
|
|
|
wxTimeSpan ts;
|
2005-06-13 08:47:51 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (result) {
|
|
|
|
if (result->active_task) {
|
|
|
|
fBuffer = result->current_cpu_time;
|
|
|
|
} else {
|
2006-05-25 20:10:08 +00:00
|
|
|
if(result->state < RESULT_COMPUTE_ERROR) {
|
2005-06-13 08:47:51 +00:00
|
|
|
fBuffer = 0;
|
2006-05-25 20:10:08 +00:00
|
|
|
} else {
|
2005-06-13 08:47:51 +00:00
|
|
|
fBuffer = result->final_cpu_time;
|
2006-05-25 20:10:08 +00:00
|
|
|
}
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (0 == fBuffer) {
|
2004-10-11 04:38:00 +00:00
|
|
|
strBuffer = wxT("---");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-22 19:23:09 +00:00
|
|
|
iHour = (wxInt32)(fBuffer / (60 * 60));
|
|
|
|
iMin = (wxInt32)(fBuffer / 60) % 60;
|
|
|
|
iSec = (wxInt32)(fBuffer) % 60;
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
ts = wxTimeSpan(iHour, iMin, iSec);
|
2004-10-22 19:23:09 +00:00
|
|
|
|
|
|
|
strBuffer = ts.Format();
|
2004-10-11 04:38:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatProgress(wxInt32 item, wxString& strBuffer) const {
|
2004-10-11 04:38:00 +00:00
|
|
|
float fBuffer = 0;
|
2005-06-13 08:47:51 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (result) {
|
|
|
|
if (result->active_task) {
|
2006-04-06 03:46:16 +00:00
|
|
|
fBuffer = floor(result->fraction_done * 100000)/1000;
|
2005-06-06 21:49:37 +00:00
|
|
|
} else {
|
2005-06-13 08:47:51 +00:00
|
|
|
if(result->state < RESULT_COMPUTE_ERROR) {
|
|
|
|
fBuffer = 0.0;
|
|
|
|
} else {
|
|
|
|
fBuffer = 100.0;
|
|
|
|
}
|
2005-06-06 21:49:37 +00:00
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
}
|
|
|
|
|
2006-04-06 03:46:16 +00:00
|
|
|
strBuffer.Printf(wxT("%.3f%%"), fBuffer);
|
2005-06-13 08:47:51 +00:00
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
wxInt32 CViewWork::FormatTimeToCompletion(wxInt32 item, wxString& strBuffer) const {
|
2004-10-19 18:14:40 +00:00
|
|
|
float fBuffer = 0;
|
2004-10-22 19:23:09 +00:00
|
|
|
wxInt32 iHour = 0;
|
|
|
|
wxInt32 iMin = 0;
|
|
|
|
wxInt32 iSec = 0;
|
|
|
|
wxTimeSpan ts;
|
2005-06-13 08:47:51 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (result) {
|
|
|
|
fBuffer = result->estimated_cpu_time_remaining;
|
|
|
|
}
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (0 >= fBuffer) {
|
2004-10-20 21:50:28 +00:00
|
|
|
strBuffer = wxT("---");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-22 19:23:09 +00:00
|
|
|
iHour = (wxInt32)(fBuffer / (60 * 60));
|
|
|
|
iMin = (wxInt32)(fBuffer / 60) % 60;
|
|
|
|
iSec = (wxInt32)(fBuffer) % 60;
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
ts = wxTimeSpan(iHour, iMin, iSec);
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2004-10-22 19:23:09 +00:00
|
|
|
strBuffer = ts.Format();
|
2004-10-20 21:50:28 +00:00
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatReportDeadline(wxInt32 item, wxString& strBuffer) const {
|
2004-10-11 04:38:00 +00:00
|
|
|
wxDateTime dtTemp;
|
2005-06-13 08:47:51 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (result) {
|
|
|
|
dtTemp.Set((time_t)result->report_deadline);
|
|
|
|
strBuffer = dtTemp.Format();
|
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatStatus(wxInt32 item, wxString& strBuffer) const {
|
2005-06-13 08:47:51 +00:00
|
|
|
CMainDocument* doc = wxGetApp().GetDocument();
|
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2006-08-31 19:24:38 +00:00
|
|
|
CC_STATUS status;
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
wxASSERT(doc);
|
|
|
|
wxASSERT(wxDynamicCast(doc, CMainDocument));
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2006-08-31 19:24:38 +00:00
|
|
|
doc->GetCoreClientStatus(status);
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2007-01-23 19:14:56 +00:00
|
|
|
if (!result) return 0;
|
|
|
|
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");
|
2005-08-26 18:13:36 +00:00
|
|
|
}
|
2007-01-23 19:14:56 +00:00
|
|
|
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");
|
2007-06-25 11:46:15 +00:00
|
|
|
} else if (result->needs_shmem) {
|
|
|
|
strBuffer = _("Waiting for shared memory");
|
2007-01-23 19:14:56 +00:00
|
|
|
} else if (result->scheduler_state == CPU_SCHED_SCHEDULED) {
|
2007-06-25 19:05:29 +00:00
|
|
|
if (result->edf_scheduled) {
|
|
|
|
strBuffer = _("Running, high priority");
|
|
|
|
} else {
|
|
|
|
strBuffer = _("Running");
|
|
|
|
}
|
2007-07-27 18:22:52 +00:00
|
|
|
#if 0
|
|
|
|
// doesn't work - result pointer not there
|
|
|
|
if (result->project->non_cpu_intensive) {
|
|
|
|
strBuffer += _(" (non-CPU-intensive)");
|
|
|
|
}
|
|
|
|
#endif
|
2007-01-23 19:14:56 +00:00
|
|
|
} 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;
|
2004-10-19 18:14:40 +00:00
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-12-08 00:40:19 +00:00
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_34f860f736 = "$Id$";
|