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.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 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"
|
|
|
|
#include "MainDocument.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"
|
2004-04-10 09:11:03 +00:00
|
|
|
|
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
|
|
|
#include "res/task.xpm"
|
|
|
|
#include "res/tips.xpm"
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CWork::CWork() {
|
2004-12-02 07:43:47 +00:00
|
|
|
m_strProjectName = wxEmptyString;
|
|
|
|
m_strApplicationName = wxEmptyString;
|
|
|
|
m_strName = wxEmptyString;
|
|
|
|
m_strCPUTime = wxEmptyString;
|
|
|
|
m_strProgress = wxEmptyString;
|
|
|
|
m_strTimeToCompletion = wxEmptyString;
|
|
|
|
m_strReportDeadline = wxEmptyString;
|
|
|
|
m_strStatus = wxEmptyString;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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-07 07:04:50 +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-04-07 07:04:50 +00:00
|
|
|
CBOINCBaseView(pNotebook, ID_HTML_WORKVIEW, DEFAULT_HTML_FLAGS, ID_LIST_WORKVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS) {
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-12-23 01:06:41 +00:00
|
|
|
//
|
|
|
|
// Globalization/Localization
|
|
|
|
//
|
|
|
|
VIEW_HEADER = wxT("result");
|
|
|
|
|
|
|
|
SECTION_TASK = VIEW_HEADER + wxT("task");
|
|
|
|
SECTION_TIPS = VIEW_HEADER + wxT("tips");
|
|
|
|
|
|
|
|
BITMAP_RESULTS = VIEW_HEADER + wxT(".xpm");
|
|
|
|
BITMAP_TASKHEADER = SECTION_TASK + wxT(".xpm");
|
|
|
|
BITMAP_TIPSHEADER = SECTION_TIPS + wxT(".xpm");
|
|
|
|
|
|
|
|
LINKDESC_DEFAULT =
|
|
|
|
_("Click a result to see additional options.");
|
|
|
|
|
|
|
|
LINK_TASKSUSPEND = SECTION_TASK + wxT("suspend");
|
|
|
|
LINKDESC_TASKSUSPEND =
|
|
|
|
_("<b>Suspend</b><br>"
|
|
|
|
"Suspend the result.");
|
|
|
|
|
|
|
|
LINK_TASKRESUME = SECTION_TASK + wxT("resume");
|
|
|
|
LINKDESC_TASKRESUME =
|
|
|
|
_("<b>Resume</b><br>"
|
|
|
|
"Resume a suspended result.");
|
|
|
|
|
|
|
|
LINK_TASKSHOWGRAPHICS = SECTION_TASK + wxT("showgraphics");
|
|
|
|
LINKDESC_TASKSHOWGRAPHICS=
|
|
|
|
_("<b>Show graphics</b><br>"
|
|
|
|
"Show application graphics in a window.");
|
|
|
|
|
|
|
|
LINK_TASKABORT = SECTION_TASK + wxT("abort");
|
|
|
|
LINKDESC_TASKABORT =
|
|
|
|
_("<b>Abort result</b><br>"
|
|
|
|
"Delete the result from the work queue. "
|
|
|
|
"This will prevent you from being granted credit for the result.");
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setup View
|
|
|
|
//
|
2004-09-24 02:01:53 +00:00
|
|
|
wxBitmap bmpResult(result_xpm);
|
|
|
|
wxBitmap bmpTask(task_xpm);
|
|
|
|
wxBitmap bmpTips(tips_xpm);
|
|
|
|
|
|
|
|
bmpResult.SetMask(new wxMask(bmpResult, wxColour(255, 0, 255)));
|
|
|
|
bmpTask.SetMask(new wxMask(bmpTask, wxColour(255, 0, 255)));
|
|
|
|
bmpTips.SetMask(new wxMask(bmpTips, wxColour(255, 0, 255)));
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
m_pTaskPane->AddVirtualFile(BITMAP_RESULTS, bmpResult, wxBITMAP_TYPE_XPM);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TASKHEADER, bmpTask, _("Tasks"));
|
2005-02-03 22:20:48 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TIPSHEADER, bmpTips, _("Tips"));
|
2004-09-24 02:01:53 +00:00
|
|
|
|
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);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_PROGRESS, _("Progress"), wxLIST_FORMAT_CENTRE, 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);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
m_bTipsHeaderHidden = false;
|
2004-10-26 17:12:58 +00:00
|
|
|
m_bItemSelected = false;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
SetCurrentQuickTip(
|
2004-10-09 03:05:01 +00:00
|
|
|
LINK_DEFAULT,
|
2004-10-19 19:41:29 +00:00
|
|
|
LINKDESC_DEFAULT
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +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();
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxString CViewWork::GetViewName() {
|
2004-04-10 09:11:03 +00:00
|
|
|
return wxString(_("Work"));
|
|
|
|
}
|
2004-04-11 05:09:18 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
|
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-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::GetDocCount() {
|
2004-10-26 08:41:02 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
return pDoc->GetWorkCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxString CViewWork::OnListGetItemText(long item, long column) const {
|
|
|
|
CWork* work = m_WorkCache.at(item);
|
2004-12-02 07:43:47 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
|
|
|
|
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
|
|
|
strBuffer = work->m_strProjectName;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_APPLICATION:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = work->m_strApplicationName;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_NAME:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = work->m_strName;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_CPUTIME:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = work->m_strCPUTime;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_PROGRESS:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = work->m_strProgress;
|
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
|
|
|
strBuffer = work->m_strTimeToCompletion;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_REPORTDEADLINE:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = work->m_strReportDeadline;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = work->m_strStatus;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
void CViewWork::OnTaskLinkClicked(const wxHtmlLinkInfo& link) {
|
2004-10-19 18:14:40 +00:00
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxString strProjectURL = wxEmptyString;
|
|
|
|
wxString strResultName = wxEmptyString;
|
2004-11-04 06:13:22 +00:00
|
|
|
wxString strMachineName = wxEmptyString;
|
2004-10-19 18:14:40 +00:00
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-04-08 06:24:58 +00:00
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
2004-10-19 18:14:40 +00:00
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-04-08 06:24:58 +00:00
|
|
|
wxASSERT(NULL != pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
2004-09-24 02:01:53 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_bTaskHeaderHidden = false;
|
|
|
|
m_bTipsHeaderHidden = false;
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (link.GetHref() == LINK_TASKSUSPEND) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Suspending result..."));
|
|
|
|
|
2004-10-19 18:14:40 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
|
|
|
|
pDoc->WorkSuspend(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
|
|
|
} else if (link.GetHref() == LINK_TASKRESUME) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Resuming result..."));
|
|
|
|
|
2004-10-19 18:14:40 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
|
|
|
|
pDoc->WorkResume(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
|
|
|
} else if (link.GetHref() == LINK_TASKSHOWGRAPHICS) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Showing graphics for result..."));
|
|
|
|
|
2004-10-19 18:14:40 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2005-04-07 07:04:50 +00:00
|
|
|
pDoc->GetConnectedComputerName(strMachineName);
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2005-02-15 19:57:03 +00:00
|
|
|
#ifdef _WIN32
|
2005-04-07 07:04:50 +00:00
|
|
|
if (!strMachineName.empty()) {
|
2004-11-04 06:13:22 +00:00
|
|
|
iAnswer = wxMessageBox(
|
|
|
|
_("Are you sure you wish to display graphics on a remote machine?"),
|
2004-11-22 19:39:56 +00:00
|
|
|
_("Show graphics"),
|
2004-11-04 06:13:22 +00:00
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2005-02-15 19:57:03 +00:00
|
|
|
} else {
|
2004-11-04 06:13:22 +00:00
|
|
|
iAnswer = wxYES;
|
|
|
|
}
|
2005-02-15 19:57:03 +00:00
|
|
|
#else
|
2005-04-07 07:04:50 +00:00
|
|
|
iAnswer = wxYES;
|
2005-02-15 19:57:03 +00:00
|
|
|
#endif
|
2004-11-04 06:13:22 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (wxYES == iAnswer) {
|
2004-11-18 01:30:37 +00:00
|
|
|
int foo = iProjectIndex;
|
2004-11-04 06:13:22 +00:00
|
|
|
pDoc->WorkShowGraphics(
|
2004-11-18 01:30:37 +00:00
|
|
|
foo,
|
2004-11-17 09:27:06 +00:00
|
|
|
false,
|
2005-02-15 06:32:43 +00:00
|
|
|
wxGetApp().m_strDefaultWindowStation,
|
|
|
|
wxGetApp().m_strDefaultDesktop,
|
|
|
|
wxGetApp().m_strDefaultDisplay
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-11-04 06:13:22 +00:00
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (link.GetHref() == LINK_TASKABORT) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Aborting result..."));
|
|
|
|
|
2004-10-19 18:14:40 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetWorkName(iProjectIndex, strResultName);
|
|
|
|
|
|
|
|
strMessage.Printf(
|
2004-11-22 19:17:13 +00:00
|
|
|
_("Are you sure you want to abort this result '%s'?"),
|
2004-10-19 18:14:40 +00:00
|
|
|
strResultName.c_str());
|
|
|
|
|
|
|
|
iAnswer = wxMessageBox(
|
|
|
|
strMessage,
|
2004-11-22 19:17:13 +00:00
|
|
|
_("Abort result"),
|
2004-10-19 18:14:40 +00:00
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (wxYES == iAnswer) {
|
2004-10-19 18:14:40 +00:00
|
|
|
pDoc->WorkAbort(
|
2004-10-22 08:51:50 +00:00
|
|
|
iProjectIndex
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-10-19 18:14:40 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
UpdateSelection();
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->ProcessRefreshView();
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText( wxEmptyString );
|
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CViewWork::OnTaskCellMouseHover(wxHtmlCell* cell, wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) {
|
|
|
|
if (NULL != cell->GetLink()) {
|
2004-09-24 22:19:02 +00:00
|
|
|
bool bUpdateSelection = false;
|
2004-09-24 02:01:53 +00:00
|
|
|
wxString strLink;
|
|
|
|
|
|
|
|
strLink = cell->GetLink()->GetHref();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (UpdateQuickTip(strLink, LINK_TASKSUSPEND, LINKDESC_TASKSUSPEND))
|
2004-10-09 03:05:01 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKRESUME, LINKDESC_TASKRESUME))
|
2004-10-09 03:05:01 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKSHOWGRAPHICS, LINKDESC_TASKSHOWGRAPHICS))
|
2004-10-09 03:05:01 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKABORT, LINKDESC_TASKABORT))
|
2004-10-09 03:05:01 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else {
|
|
|
|
if (0 == m_pListPane->GetSelectedItemCount()) {
|
|
|
|
if (LINK_DEFAULT != GetCurrentQuickTip()) {
|
2004-09-24 02:01:53 +00:00
|
|
|
SetCurrentQuickTip(
|
2004-10-09 03:05:01 +00:00
|
|
|
LINK_DEFAULT,
|
2004-10-19 19:41:29 +00:00
|
|
|
LINKDESC_DEFAULT
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-09-24 22:19:02 +00:00
|
|
|
bUpdateSelection = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (bUpdateSelection)
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
2004-09-24 22:19:02 +00:00
|
|
|
UpdateSelection();
|
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-07 07:04:50 +00:00
|
|
|
wxASSERT(NULL != pItem);
|
|
|
|
if (NULL != pItem) {
|
|
|
|
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() {
|
2005-01-29 00:58:43 +00:00
|
|
|
return 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() {
|
2004-10-19 18:14:40 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2004-11-04 06:13:22 +00:00
|
|
|
wxInt32 iSelectedRow = -1;
|
2004-10-19 18:14:40 +00:00
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-24 02:01:53 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (0 == m_pListPane->GetSelectedItemCount()) {
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bTaskHeaderHidden = true;
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskSuspendHidden = true;
|
|
|
|
m_bTaskResumeHidden = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bTaskShowGraphicsHidden = true;
|
|
|
|
m_bTaskAbortHidden = true;
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_bItemSelected) {
|
2004-10-09 03:05:01 +00:00
|
|
|
SetCurrentQuickTip(
|
|
|
|
LINK_DEFAULT,
|
|
|
|
wxT("")
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-10-09 03:05:01 +00:00
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bItemSelected = false;
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-26 23:37:19 +00:00
|
|
|
iSelectedRow = m_pListPane->GetFirstSelected();
|
2004-11-04 06:13:22 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bTaskHeaderHidden = false;
|
2005-02-01 21:58:47 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsWorkSuspended(iSelectedRow)) {
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskSuspendHidden = true;
|
|
|
|
m_bTaskResumeHidden = false;
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskSuspendHidden = false;
|
|
|
|
m_bTaskResumeHidden = true;
|
|
|
|
}
|
2005-02-01 21:58:47 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsWorkGraphicsSupported(iSelectedRow) && !pDoc->IsWorkSuspended(iSelectedRow))
|
2004-10-26 23:37:19 +00:00
|
|
|
m_bTaskShowGraphicsHidden = false;
|
|
|
|
else
|
|
|
|
m_bTaskShowGraphicsHidden = true;
|
2005-02-01 21:58:47 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (!pDoc->IsWorkAborted(iSelectedRow)) {
|
2005-02-01 21:58:47 +00:00
|
|
|
m_bTaskAbortHidden = false;
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2005-02-01 21:58:47 +00:00
|
|
|
m_bTaskAbortHidden = true;
|
2005-02-09 23:41:14 +00:00
|
|
|
m_bTaskSuspendHidden = true;
|
|
|
|
m_bTaskResumeHidden = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
UpdateQuickTip(LINK_TASKABORT, LINK_TASKABORT, LINKDESC_TASKABORT);
|
2005-02-09 23:41:14 +00:00
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_bTaskSuspendHidden && m_bTaskResumeHidden && m_bTaskShowGraphicsHidden && m_bTaskAbortHidden)
|
2005-02-09 23:41:14 +00:00
|
|
|
m_bTaskHeaderHidden = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
m_bItemSelected = true;
|
|
|
|
}
|
|
|
|
UpdateTaskPane();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CViewWork::UpdateTaskPane() {
|
2004-09-24 02:01:53 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
|
|
|
|
m_pTaskPane->BeginTaskPage();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->BeginTaskSection(BITMAP_TASKHEADER, m_bTaskHeaderHidden);
|
|
|
|
if (!m_bTaskHeaderHidden) {
|
|
|
|
m_pTaskPane->CreateTask(LINK_TASKSUSPEND, _("Suspend"), m_bTaskSuspendHidden);
|
|
|
|
m_pTaskPane->CreateTask(LINK_TASKRESUME, _("Resume"), m_bTaskResumeHidden);
|
|
|
|
m_pTaskPane->CreateTask(LINK_TASKSHOWGRAPHICS, _("Show graphics"), m_bTaskShowGraphicsHidden);
|
|
|
|
m_pTaskPane->CreateTask(LINK_TASKABORT, _("Abort result"), m_bTaskAbortHidden);
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->EndTaskSection(m_bTaskHeaderHidden);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->UpdateQuickTip(BITMAP_TIPSHEADER, GetCurrentQuickTipText(), m_bTipsHeaderHidden);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
m_pTaskPane->EndTaskPage();
|
|
|
|
}
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatProjectName(wxInt32 item, wxString& strBuffer) const {
|
2004-10-11 04:38:00 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
|
|
|
pDoc->GetWorkProjectName(item, strBuffer);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatApplicationName(wxInt32 item, wxString& strBuffer) const {
|
2004-10-11 04:38:00 +00:00
|
|
|
wxInt32 iBuffer = 0;
|
2005-02-03 18:53:20 +00:00
|
|
|
wxString strTempName = wxEmptyString;
|
2004-10-11 04:38:00 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2005-02-03 18:53:20 +00:00
|
|
|
pDoc->GetWorkApplicationName(item, strTempName);
|
2004-10-11 04:38:00 +00:00
|
|
|
pDoc->GetWorkApplicationVersion(item, iBuffer);
|
|
|
|
|
2005-02-04 21:24:28 +00:00
|
|
|
wxString strLocale = setlocale(LC_NUMERIC, NULL);
|
|
|
|
setlocale(LC_NUMERIC, "C");
|
|
|
|
strBuffer.Printf(wxT("%s %.2f"), strTempName.c_str(), iBuffer/100.0);
|
|
|
|
setlocale(LC_NUMERIC, strLocale.c_str());
|
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 {
|
2004-10-11 04:38:00 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
|
|
|
pDoc->GetWorkName(item, strBuffer);
|
|
|
|
|
|
|
|
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;
|
2004-10-11 04:38:00 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsWorkActive(item)) {
|
2004-10-11 04:38:00 +00:00
|
|
|
pDoc->GetWorkCurrentCPUTime(item, fBuffer);
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-11-17 09:27:06 +00:00
|
|
|
if(pDoc->GetWorkState(item) < CMainDocument::COMPUTE_ERROR)
|
2004-10-11 04:38:00 +00:00
|
|
|
fBuffer = 0;
|
|
|
|
else
|
|
|
|
pDoc->GetWorkFinalCPUTime(item, fBuffer);
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (!pDoc->IsWorkActive(item)) {
|
|
|
|
if(pDoc->GetWorkState(item) < CMainDocument::COMPUTE_ERROR)
|
2005-02-04 21:24:28 +00:00
|
|
|
strBuffer.Printf(wxT("%.2f%%"), 0.0);
|
2004-10-11 04:38:00 +00:00
|
|
|
else
|
2005-02-04 21:24:28 +00:00
|
|
|
strBuffer.Printf(wxT("%.2f%%"), 100.00);
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-11 04:38:00 +00:00
|
|
|
pDoc->GetWorkFractionDone(item, fBuffer);
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer.Printf(wxT("%.2f%%"), fBuffer * 100);
|
2004-10-11 04:38:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatTimeToCompletion(wxInt32 item, wxString& strBuffer) const
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
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;
|
2004-10-19 18:14:40 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
|
|
|
pDoc->GetWorkEstimatedCPUTime(item, fBuffer);
|
|
|
|
|
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
|
|
|
wxInt32 iBuffer = 0;
|
|
|
|
wxDateTime dtTemp;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
|
|
|
pDoc->GetWorkReportDeadline(item, iBuffer);
|
|
|
|
dtTemp.Set((time_t)iBuffer);
|
|
|
|
|
|
|
|
strBuffer = dtTemp.Format();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewWork::FormatStatus(wxInt32 item, wxString& strBuffer) const {
|
2004-10-19 18:14:40 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2004-10-31 22:41:15 +00:00
|
|
|
wxInt32 iActivityMode = -1;
|
2005-02-22 07:10:44 +00:00
|
|
|
bool bActivitiesSuspended = false;
|
|
|
|
bool bNetworkSuspended = false;
|
|
|
|
|
2004-10-19 18:14:40 +00:00
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
2005-04-07 07:04:50 +00:00
|
|
|
pDoc->GetActivityState(bActivitiesSuspended, bNetworkSuspended);
|
|
|
|
pDoc->GetActivityRunMode(iActivityMode);
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
switch(pDoc->GetWorkState(item)) {
|
2004-11-17 09:27:06 +00:00
|
|
|
case CMainDocument::NEW:
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("New");
|
|
|
|
break;
|
2004-11-17 09:27:06 +00:00
|
|
|
case CMainDocument::FILES_DOWNLOADING:
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsWorkReadyToReport(item)) {
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("Download failed");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("Downloading");
|
|
|
|
}
|
|
|
|
break;
|
2004-11-17 09:27:06 +00:00
|
|
|
case CMainDocument::FILES_DOWNLOADED:
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsWorkAborted(item)) {
|
2005-02-01 21:58:47 +00:00
|
|
|
strBuffer = _("Aborted");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (!pDoc->IsWorkActive(item) && pDoc->IsWorkSuspended(item)) {
|
2005-02-09 23:41:14 +00:00
|
|
|
strBuffer = _("Suspended");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (pDoc->IsWorkActive(item)) {
|
2004-10-19 18:14:40 +00:00
|
|
|
wxInt32 iSchedulerState = pDoc->GetWorkSchedulerState(item);
|
2005-04-07 07:04:50 +00:00
|
|
|
if (CMainDocument::SCHED_SCHEDULED == iSchedulerState) {
|
|
|
|
if (bActivitiesSuspended) { strBuffer = _("Suspended");
|
|
|
|
} else {
|
2005-02-22 07:10:44 +00:00
|
|
|
strBuffer = _("Running");
|
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (CMainDocument::SCHED_PREEMPTED == iSchedulerState) {
|
|
|
|
if (pDoc->IsWorkSuspended(item)) {
|
2004-10-21 14:29:59 +00:00
|
|
|
strBuffer = _("Suspended");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-21 14:29:59 +00:00
|
|
|
strBuffer = _("Paused");
|
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (CMainDocument::SCHED_UNINITIALIZED == iSchedulerState) {
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("Ready to run");
|
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("Ready to run");
|
|
|
|
}
|
|
|
|
break;
|
2004-11-17 09:27:06 +00:00
|
|
|
case CMainDocument::COMPUTE_ERROR:
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("Computation error");
|
|
|
|
break;
|
2004-11-17 09:27:06 +00:00
|
|
|
case CMainDocument::FILES_UPLOADING:
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsWorkReadyToReport(item)) {
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("Upload failed");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("Uploading");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsWorkAcknowledged(item)) {
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("Acknowledged");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (pDoc->IsWorkReadyToReport(item)) {
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer = _("Ready to report");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-19 18:14:40 +00:00
|
|
|
strBuffer.Format(_("Error: invalid state '%d'"), pDoc->GetWorkState(item));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2004-10-31 22:41:15 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (CMainDocument::MODE_NEVER == iActivityMode) {
|
|
|
|
strBuffer = wxT(" (") + strBuffer + wxT(") ");
|
2004-10-31 22:41:15 +00:00
|
|
|
strBuffer = _("Suspended") + strBuffer;
|
|
|
|
}
|
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$";
|