2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2004-05-17 22:15:10 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// 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.
|
2004-04-10 09:11:03 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// 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
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
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"
|
2008-06-02 07:42:27 +00:00
|
|
|
#include "DlgItemProperties.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
|
2010-05-18 22:15:03 +00:00
|
|
|
#define COLUMN_PROGRESS 1
|
2010-05-19 18:59:51 +00:00
|
|
|
#define COLUMN_STATUS 2
|
|
|
|
#define COLUMN_CPUTIME 3
|
|
|
|
#define COLUMN_TOCOMPLETION 4
|
|
|
|
#define COLUMN_REPORTDEADLINE 5
|
|
|
|
#define COLUMN_APPLICATION 6
|
|
|
|
#define COLUMN_NAME 7
|
2004-08-11 23:52:22 +00:00
|
|
|
|
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
|
2009-08-07 08:33:31 +00:00
|
|
|
#define BTN_ACTIVE_ONLY 0
|
|
|
|
#define BTN_GRAPHICS 1
|
2012-01-12 22:05:25 +00:00
|
|
|
#define BTN_VMCONSOLE 2
|
|
|
|
#define BTN_SUSPEND 3
|
|
|
|
#define BTN_ABORT 4
|
|
|
|
#define BTN_PROPERTIES 5
|
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() {
|
2008-09-08 09:11:56 +00:00
|
|
|
m_fCPUTime = -1.0;
|
|
|
|
m_fProgress = -1.0;
|
|
|
|
m_fTimeToCompletion = -1.0;
|
|
|
|
m_tReportDeadline = (time_t)0;
|
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_strStatus.Clear();
|
2008-09-08 09:11:56 +00:00
|
|
|
m_strProjectURL.Clear();
|
|
|
|
m_strCPUTime.Clear();
|
|
|
|
m_strProgress.Clear();
|
|
|
|
m_strTimeToCompletion.Clear();
|
|
|
|
m_strReportDeadline.Clear();
|
2004-12-02 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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)
|
2012-01-12 22:05:25 +00:00
|
|
|
EVT_BUTTON(ID_TASK_WORK_VMCONSOLE, CViewWork::OnWorkShowVMConsole)
|
2005-04-21 06:04:26 +00:00
|
|
|
EVT_BUTTON(ID_TASK_WORK_ABORT, CViewWork::OnWorkAbort)
|
2008-07-02 10:03:01 +00:00
|
|
|
EVT_BUTTON(ID_TASK_SHOW_PROPERTIES, CViewWork::OnShowItemProperties)
|
2009-08-07 08:33:31 +00:00
|
|
|
EVT_BUTTON(ID_TASK_ACTIVE_ONLY, CViewWork::OnActiveTasksOnly)
|
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)
|
2008-06-25 10:38:16 +00:00
|
|
|
EVT_LIST_COL_CLICK(ID_LIST_WORKVIEW, CViewWork::OnColClick)
|
2008-06-27 10:05:47 +00:00
|
|
|
EVT_LIST_CACHE_HINT(ID_LIST_WORKVIEW, CViewWork::OnCacheHint)
|
2013-11-05 02:11:36 +00:00
|
|
|
EVT_LIST_COL_END_DRAG(ID_LIST_WORKVIEW, CViewWork::OnColResize)
|
2005-04-21 06:04:26 +00:00
|
|
|
END_EVENT_TABLE ()
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2008-06-25 13:53:52 +00:00
|
|
|
static CViewWork* myCViewWork;
|
|
|
|
|
2008-07-08 15:13:34 +00:00
|
|
|
static bool CompareViewWorkItems(int iRowIndex1, int iRowIndex2) {
|
2008-10-14 12:35:48 +00:00
|
|
|
CWork* work1;
|
|
|
|
CWork* work2;
|
2008-07-08 15:13:34 +00:00
|
|
|
int result = false;
|
2008-06-26 01:25:31 +00:00
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
try {
|
|
|
|
work1 = myCViewWork->m_WorkCache.at(iRowIndex1);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
work2 = myCViewWork->m_WorkCache.at(iRowIndex2);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-26 01:25:31 +00:00
|
|
|
switch (myCViewWork->m_iSortColumn) {
|
2010-05-18 22:32:05 +00:00
|
|
|
case COLUMN_PROJECT:
|
|
|
|
result = work1->m_strProjectName.CmpNoCase(work2->m_strProjectName);
|
2008-06-26 01:25:31 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_APPLICATION:
|
2010-05-18 22:32:05 +00:00
|
|
|
result = work1->m_strApplicationName.CmpNoCase(work2->m_strApplicationName);
|
2008-06-26 01:25:31 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_NAME:
|
2010-05-18 22:32:05 +00:00
|
|
|
result = work1->m_strName.CmpNoCase(work2->m_strName);
|
2008-06-26 01:25:31 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_CPUTIME:
|
|
|
|
if (work1->m_fCPUTime < work2->m_fCPUTime) {
|
|
|
|
result = -1;
|
|
|
|
} else if (work1->m_fCPUTime > work2->m_fCPUTime) {
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_PROGRESS:
|
|
|
|
if (work1->m_fProgress < work2->m_fProgress) {
|
|
|
|
result = -1;
|
|
|
|
} else if (work1->m_fProgress > work2->m_fProgress) {
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_TOCOMPLETION:
|
|
|
|
if (work1->m_fTimeToCompletion < work2->m_fTimeToCompletion) {
|
|
|
|
result = -1;
|
|
|
|
} else if (work1->m_fTimeToCompletion > work2->m_fTimeToCompletion) {
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_REPORTDEADLINE:
|
|
|
|
if (work1->m_tReportDeadline < work2->m_tReportDeadline) {
|
|
|
|
result = -1;
|
|
|
|
} else if (work1->m_tReportDeadline > work2->m_tReportDeadline) {
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2010-05-18 22:32:05 +00:00
|
|
|
result = work1->m_strStatus.CmpNoCase(work2->m_strStatus);
|
2008-06-26 01:25:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-07-08 15:13:34 +00:00
|
|
|
// Always return FALSE for equality (result == 0)
|
|
|
|
return (myCViewWork->m_bReverseSort ? (result > 0) : (result < 0));
|
2008-06-26 01:25:31 +00:00
|
|
|
}
|
|
|
|
|
2008-06-25 13:53:52 +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) :
|
2008-06-26 01:25:31 +00:00
|
|
|
CBOINCBaseView(pNotebook, ID_TASK_WORKVIEW, DEFAULT_TASK_FLAGS, ID_LIST_WORKVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS)
|
2005-04-21 06:04:26 +00:00
|
|
|
{
|
2010-05-18 22:32:05 +00:00
|
|
|
CTaskItemGroup* pGroup = NULL;
|
|
|
|
CTaskItem* pItem = NULL;
|
2005-04-21 06:04:26 +00:00
|
|
|
|
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
|
|
|
|
//
|
2010-05-18 22:32:05 +00:00
|
|
|
pGroup = new CTaskItemGroup( _("Commands") );
|
|
|
|
m_TaskGroups.push_back( pGroup );
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2010-05-18 22:32:05 +00:00
|
|
|
pItem = new CTaskItem(
|
2009-08-07 08:33:31 +00:00
|
|
|
_("Show active tasks"),
|
|
|
|
_("Show only active tasks."),
|
|
|
|
ID_TASK_ACTIVE_ONLY
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
2010-05-18 22:32:05 +00:00
|
|
|
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 );
|
|
|
|
|
2012-01-12 22:05:25 +00:00
|
|
|
pItem = new CTaskItem(
|
|
|
|
_("Show VM Console"),
|
|
|
|
_("Show VM Console in a window."),
|
|
|
|
ID_TASK_WORK_VMCONSOLE
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
2010-05-18 22:32:05 +00:00
|
|
|
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 );
|
|
|
|
|
2010-05-18 22:32:05 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-04-21 23:53:39 +00:00
|
|
|
_("Abort"),
|
2008-07-08 20:05:07 +00:00
|
|
|
_("Abandon work on the result. You will get no credit for it."),
|
2005-04-21 06:04:26 +00:00
|
|
|
ID_TASK_WORK_ABORT
|
|
|
|
);
|
2008-07-02 10:03:01 +00:00
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
2010-05-18 22:32:05 +00:00
|
|
|
pItem = new CTaskItem(
|
2008-07-02 10:03:01 +00:00
|
|
|
_("Properties"),
|
|
|
|
_("Show task details."),
|
|
|
|
ID_TASK_SHOW_PROPERTIES
|
|
|
|
);
|
2005-04-21 06:04:26 +00:00
|
|
|
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);
|
2010-05-18 22:15:03 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_PROGRESS, _("Progress"), wxLIST_FORMAT_RIGHT, 60);
|
2010-05-19 18:59:51 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_STATUS, _("Status"), wxLIST_FORMAT_LEFT, 135);
|
2010-05-18 22:15:03 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_CPUTIME, _("Elapsed"), wxLIST_FORMAT_RIGHT, 80);
|
2012-03-01 21:12:20 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_TOCOMPLETION, _("Remaining (estimated)"), wxLIST_FORMAT_RIGHT, 100);
|
2013-02-11 23:51:15 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_REPORTDEADLINE, _("Deadline"), wxLIST_FORMAT_RIGHT, 150);
|
2004-10-19 19:41:29 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_APPLICATION, _("Application"), wxLIST_FORMAT_LEFT, 95);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_NAME, _("Name"), wxLIST_FORMAT_LEFT, 285);
|
2005-04-21 23:53:39 +00:00
|
|
|
|
2008-06-24 10:52:12 +00:00
|
|
|
m_iProgressColumn = COLUMN_PROGRESS;
|
|
|
|
|
2008-06-25 13:53:52 +00:00
|
|
|
// Needed by static sort routine;
|
|
|
|
myCViewWork = this;
|
2008-06-26 01:25:31 +00:00
|
|
|
m_funcSortCompare = CompareViewWorkItems;
|
2008-06-25 13:53:52 +00:00
|
|
|
|
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() {
|
2009-05-01 01:32:26 +00:00
|
|
|
static wxString strViewName(wxT("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
|
|
|
|
2013-02-07 18:26:02 +00:00
|
|
|
int CViewWork::GetViewCurrentViewPage() {
|
2009-12-22 01:22:11 +00:00
|
|
|
return VW_TASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-04 13:00:24 +00:00
|
|
|
wxString CViewWork::GetKeyValue1(int iRowIndex) {
|
2008-10-14 12:35:48 +00:00
|
|
|
CWork* work;
|
|
|
|
|
|
|
|
if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) {
|
|
|
|
return wxEmptyString;
|
|
|
|
}
|
|
|
|
|
2008-09-04 13:00:24 +00:00
|
|
|
return work->m_strName;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString CViewWork::GetKeyValue2(int iRowIndex) {
|
2008-10-14 12:35:48 +00:00
|
|
|
CWork* work;
|
|
|
|
|
|
|
|
if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) {
|
|
|
|
return wxEmptyString;
|
|
|
|
}
|
|
|
|
|
2008-09-04 13:00:24 +00:00
|
|
|
return work->m_strProjectURL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CViewWork::FindRowIndexByKeyValues(wxString& key1, wxString& key2) {
|
|
|
|
CWork* work;
|
|
|
|
unsigned int iRowIndex, n = GetCacheCount();
|
2010-05-18 22:32:05 +00:00
|
|
|
for(iRowIndex=0; iRowIndex < n; iRowIndex++) {
|
2008-10-14 12:35:48 +00:00
|
|
|
if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) {
|
|
|
|
continue;
|
|
|
|
}
|
2008-09-04 13:00:24 +00:00
|
|
|
if(! (work->m_strName).IsSameAs(key1)) continue;
|
|
|
|
if((work->m_strProjectURL).IsSameAs(key2)) return iRowIndex;
|
2010-05-18 22:32:05 +00:00
|
|
|
}
|
|
|
|
return -1;
|
2008-09-04 13:00:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-07 08:33:31 +00:00
|
|
|
void CViewWork::OnActiveTasksOnly( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnActiveTasksOnly - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
|
|
|
|
|
|
|
pDoc->m_ActiveTasksOnly = !pDoc->m_ActiveTasksOnly;
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnActiveTasksOnly - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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);
|
2008-06-26 11:49:43 +00:00
|
|
|
int row;
|
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
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
row = -1;
|
|
|
|
while (1) {
|
|
|
|
// Step through all selected items
|
|
|
|
row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (row < 0) break;
|
|
|
|
|
|
|
|
RESULT* result = pDoc->result(m_iSortedIndexes[row]);
|
|
|
|
if (result) {
|
|
|
|
if (result->suspended_via_gui) {
|
|
|
|
pFrame->UpdateStatusText(_("Resuming task..."));
|
|
|
|
pDoc->WorkResume(result->project_url, result->name);
|
|
|
|
} else {
|
|
|
|
pFrame->UpdateStatusText(_("Suspending task..."));
|
|
|
|
pDoc->WorkSuspend(result->project_url, result->name);
|
|
|
|
}
|
|
|
|
}
|
2005-04-21 23:53:39 +00:00
|
|
|
}
|
2009-02-26 18:32:07 +00:00
|
|
|
|
2008-06-26 11:49:43 +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::OnWorkSuspend - Function End"));
|
|
|
|
}
|
|
|
|
|
2012-01-12 22:05:25 +00:00
|
|
|
|
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"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-07-21 08:23:26 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2009-02-26 18:32:07 +00:00
|
|
|
RESULT* result;
|
2008-06-26 11:49:43 +00:00
|
|
|
int row;
|
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
|
|
|
|
2009-02-26 18:32:07 +00:00
|
|
|
row = -1;
|
|
|
|
while (1) {
|
|
|
|
// Step through all selected items
|
|
|
|
row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (row < 0) break;
|
|
|
|
|
|
|
|
result = pDoc->result(m_iSortedIndexes[row]);
|
|
|
|
if (result) {
|
|
|
|
pDoc->WorkShowGraphics(result);
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
2007-06-18 11:46:01 +00:00
|
|
|
}
|
2009-02-26 18:32:07 +00:00
|
|
|
|
2007-06-18 11:46:01 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkShowGraphics - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-12 22:05:25 +00:00
|
|
|
void CViewWork::OnWorkShowVMConsole( wxCommandEvent& WXUNUSED(event) ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkShowVMConsole - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
|
|
|
RESULT* result;
|
|
|
|
int row;
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
|
|
|
wxASSERT(m_pListPane);
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Showing VM console for task..."));
|
|
|
|
|
|
|
|
row = -1;
|
|
|
|
while (1) {
|
|
|
|
// Step through all selected items
|
|
|
|
row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (row < 0) break;
|
|
|
|
|
|
|
|
result = pDoc->result(m_iSortedIndexes[row]);
|
|
|
|
if (result) {
|
|
|
|
pDoc->WorkShowVMConsole(result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewWork::OnWorkShowVMConsole - 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;
|
2005-04-21 06:04:26 +00:00
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2006-07-21 08:23:26 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2008-09-08 09:11:56 +00:00
|
|
|
CWork* work;
|
2009-10-09 05:43:35 +00:00
|
|
|
int row, n;
|
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;
|
2009-02-26 18:32:07 +00:00
|
|
|
|
2009-10-09 05:43:35 +00:00
|
|
|
n = m_pListPane->GetSelectedItemCount();
|
|
|
|
|
|
|
|
if (n == 1) {
|
|
|
|
row = -1;
|
2008-06-26 11:49:43 +00:00
|
|
|
row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
2009-10-09 05:43:35 +00:00
|
|
|
if (row < 0) return;
|
2008-10-14 12:35:48 +00:00
|
|
|
if (GetWorkCacheAtIndex(work, m_iSortedIndexes[row])) {
|
|
|
|
return;
|
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
strMessage.Printf(
|
2008-07-08 20:05:07 +00:00
|
|
|
_("Are you sure you want to abort this task '%s'?\n(Progress: %s, Status: %s)"),
|
2008-09-08 09:11:56 +00:00
|
|
|
(work->m_strName).c_str(),
|
|
|
|
(work->m_strProgress).c_str(),
|
|
|
|
(work->m_strStatus).c_str()
|
2008-06-26 11:49:43 +00:00
|
|
|
);
|
2009-10-09 05:43:35 +00:00
|
|
|
} else {
|
|
|
|
strMessage.Printf(_("Are you sure you want to abort these %d tasks?"), n);
|
|
|
|
}
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2009-10-09 05:43:35 +00:00
|
|
|
iAnswer = wxGetApp().SafeMessageBox(
|
|
|
|
strMessage,
|
|
|
|
_("Abort task"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
2005-04-21 06:04:26 +00:00
|
|
|
|
2009-10-09 05:43:35 +00:00
|
|
|
if (wxYES != iAnswer) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-15 18:20:18 +00:00
|
|
|
pFrame->UpdateStatusText(_("Aborting task..."));
|
2009-10-09 05:43:35 +00:00
|
|
|
|
|
|
|
row = -1;
|
|
|
|
while (1) {
|
|
|
|
// Step through all selected items
|
|
|
|
row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (row < 0) break;
|
|
|
|
|
|
|
|
RESULT* result = pDoc->result(m_iSortedIndexes[row]);
|
|
|
|
if (result) {
|
|
|
|
pDoc->WorkAbort(result->project_url, result->name);
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
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"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-02 10:03:01 +00:00
|
|
|
void CViewWork::OnShowItemProperties( wxCommandEvent& WXUNUSED(event) ) {
|
2008-09-13 00:27:13 +00:00
|
|
|
wxASSERT(m_pListPane);
|
|
|
|
|
2008-07-02 10:03:01 +00:00
|
|
|
long item = m_pListPane->GetFirstSelected();
|
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(m_iSortedIndexes[item]);
|
|
|
|
|
2008-10-08 08:50:18 +00:00
|
|
|
if(!result) return; // TODO: display some sort of error alert?
|
2008-07-02 10:03:01 +00:00
|
|
|
//displaying the infos on a dialog
|
|
|
|
CDlgItemProperties dlg(this);
|
|
|
|
dlg.renderInfos(result);
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-07 08:33:31 +00:00
|
|
|
bool CViewWork::OnSaveState(wxConfigBase* pConfig) {
|
2009-08-07 09:44:08 +00:00
|
|
|
bool bReturnValue = true;
|
2009-08-07 08:33:31 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(pConfig);
|
|
|
|
wxASSERT(m_pTaskPane);
|
2009-08-07 09:44:08 +00:00
|
|
|
wxASSERT(m_pListPane);
|
2009-08-07 08:33:31 +00:00
|
|
|
|
|
|
|
if (!m_pTaskPane->OnSaveState(pConfig)) {
|
2009-08-07 09:44:08 +00:00
|
|
|
bReturnValue = false;
|
|
|
|
}
|
|
|
|
if (!m_pListPane->OnSaveState(pConfig)) {
|
|
|
|
bReturnValue = false;
|
2009-08-07 08:33:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxString strBaseConfigLocation = wxEmptyString;
|
|
|
|
strBaseConfigLocation = wxT("/Tasks");
|
2010-05-18 22:32:05 +00:00
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
pConfig->Write(wxT("ActiveTasksOnly"), (pDoc->m_ActiveTasksOnly ? 1 : 0));
|
2009-08-07 08:33:31 +00:00
|
|
|
|
2009-08-07 09:44:08 +00:00
|
|
|
return bReturnValue;
|
2009-08-07 08:33:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CViewWork::OnRestoreState(wxConfigBase* pConfig) {
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2010-05-18 22:32:05 +00:00
|
|
|
wxASSERT(pConfig);
|
2009-08-07 08:33:31 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
2009-08-07 09:44:08 +00:00
|
|
|
wxASSERT(m_pListPane);
|
2009-08-07 08:33:31 +00:00
|
|
|
|
|
|
|
if (!m_pTaskPane->OnRestoreState(pConfig)) {
|
|
|
|
return false;
|
|
|
|
}
|
2009-08-07 09:44:08 +00:00
|
|
|
if (!m_pListPane->OnRestoreState(pConfig)) {
|
|
|
|
return false;
|
|
|
|
}
|
2009-08-07 08:33:31 +00:00
|
|
|
|
|
|
|
int iTempValue = 0;
|
|
|
|
wxString strBaseConfigLocation = wxEmptyString;
|
|
|
|
strBaseConfigLocation = wxT("/Tasks");
|
2010-05-18 22:32:05 +00:00
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
pConfig->Read(wxT("ActiveTasksOnly"), &iTempValue, 0);
|
2009-08-07 08:33:31 +00:00
|
|
|
pDoc->m_ActiveTasksOnly = (iTempValue != 0);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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;
|
2009-12-19 05:16:41 +00:00
|
|
|
wxLaunchDefaultBrowser(
|
2006-01-09 14:03:13 +00:00
|
|
|
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"));
|
|
|
|
}
|
|
|
|
|
2013-11-05 09:37:57 +00:00
|
|
|
|
|
|
|
void CViewWork::OnColResize( wxListEvent& ) {
|
2013-11-05 02:11:36 +00:00
|
|
|
// Register the new column widths immediately
|
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
|
|
|
|
|
|
|
wxASSERT(pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2013-11-05 09:37:57 +00:00
|
|
|
pFrame->SaveState();
|
2013-11-05 02:11:36 +00:00
|
|
|
}
|
|
|
|
|
2006-01-09 14:03:13 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-25 10:38:16 +00:00
|
|
|
wxString CViewWork::OnListGetItemText(long item, long column) const {
|
2008-09-08 09:11:56 +00:00
|
|
|
CWork* work = NULL;
|
|
|
|
wxString strBuffer = wxEmptyString;
|
2008-09-09 10:09:54 +00:00
|
|
|
|
2008-10-06 11:33:28 +00:00
|
|
|
m_pListPane->AddPendingProgressBar(item);
|
2008-09-08 09:11:56 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
work = m_WorkCache.at(m_iSortedIndexes[item]);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
work = NULL;
|
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2008-09-09 10:09:54 +00:00
|
|
|
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:
|
2008-10-06 12:01:27 +00:00
|
|
|
// CBOINCListCtrl::DrawProgressBars() will draw this using
|
2009-10-29 11:13:48 +00:00
|
|
|
// data provided by GetProgressText() and GetProgressValue(),
|
|
|
|
// but we need it here for accessibility programs.
|
|
|
|
strBuffer = work->m_strProgress;
|
2008-09-09 10:09:54 +00:00
|
|
|
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-07-13 05:56:03 +00:00
|
|
|
}
|
2008-09-09 10:09:54 +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);
|
2008-06-27 04:38:31 +00:00
|
|
|
m_iSortedIndexes.Add((int)m_WorkCache.size()-1);
|
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();
|
2008-06-25 10:38:16 +00:00
|
|
|
m_iSortedIndexes.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() {
|
2008-06-25 10:38:16 +00:00
|
|
|
unsigned int i;
|
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);
|
2008-06-25 10:38:16 +00:00
|
|
|
m_iSortedIndexes.Clear();
|
|
|
|
for (i=0; i<m_WorkCache.size(); i++) {
|
|
|
|
m_iSortedIndexes.Add(i);
|
|
|
|
}
|
2004-12-02 07:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-30 01:55:11 +00:00
|
|
|
bool CViewWork::IsSelectionManagementNeeded() {
|
- client: include precompiled header in rr_sim.cpp so memory
leak detection will work.
- MGR: Have the BaseFrame call a function to determine if the
selection list should be saved instead of traversing
the application pointer. Each view just overrides the function
returning a true/false value. We don't have to worry about null
pointers and the like.
- MGR: BOINCGUIApp should never need to know how either the views
work or the document. Move the code that determines which
RPCs should be fired into each of the views. Have the document
look for it there.
- MGR: Reduce duplicate code for hiding and showing an application
- MGR: Move some Windows and Mac specific code into functions
and streamline the application startup and shutdown rountines.
- MGR: Move the event processing that was in BOINCGUIApp into the
BaseFrame.
- MGR: General cleanup.
- MGR: Doxygen comments.
- MGR: Cleanup some warnings.
client/
rr_sim.cpp
clientgui/
AdvancedFrame.cpp, .h
AsyncRPC.cpp, .h
BOINCBaseFrame.cpp, .h
BOINCBaseView.cpp, .h
BOINCClientManager.cpp
BOINCGUIApp.cpp, .h
BOINCTaskBar.cpp
MainDocument.cpp, .h
sg_BoincSimpleGUI.cpp, .h
ViewProjects.cpp, .h
ViewTransfers.cpp, .h
ViewWork.cpp, .h
WelcomePage.cpp
win_build/installerv2/
BOINC.ism
BOINCx64.ism
win_build/
sim.vcproj
svn path=/trunk/boinc/; revision=16357
2008-10-29 22:44:55 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CViewWork::UpdateSelection() {
|
2009-02-26 18:32:07 +00:00
|
|
|
int i, n, row;
|
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;
|
2008-04-07 09:31:15 +00:00
|
|
|
CC_STATUS status;
|
2008-12-02 01:24:32 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2008-06-26 11:49:43 +00:00
|
|
|
std::string first_project_url;
|
2009-02-26 18:32:07 +00:00
|
|
|
wxString strMachineName;
|
2012-01-12 22:05:25 +00:00
|
|
|
bool wasSuspended=false;
|
|
|
|
bool all_same_project=false;
|
2008-09-13 10:24:24 +00:00
|
|
|
bool enableShowGraphics = false;
|
2012-01-12 22:05:25 +00:00
|
|
|
bool enableShowVMConsole = false;
|
2008-09-13 10:24:24 +00:00
|
|
|
bool enableSuspendResume = false;
|
|
|
|
bool enableAbort = false;
|
|
|
|
bool enableProperties = false;
|
2008-12-01 09:44:01 +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];
|
2008-06-26 11:49:43 +00:00
|
|
|
|
|
|
|
n = m_pListPane->GetSelectedItemCount();
|
|
|
|
if (n > 0) {
|
2008-09-13 10:24:24 +00:00
|
|
|
enableShowGraphics = true;
|
2012-01-12 22:05:25 +00:00
|
|
|
enableShowVMConsole = true;
|
2008-09-13 10:24:24 +00:00
|
|
|
enableSuspendResume = true;
|
|
|
|
enableAbort = true;
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
pDoc->GetCoreClientStatus(status);
|
2010-03-11 01:39:14 +00:00
|
|
|
if (status.task_suspend_reason & ~(SUSPEND_REASON_CPU_THROTTLE)) {
|
2008-09-13 10:24:24 +00:00
|
|
|
enableShowGraphics = false;
|
2012-01-12 22:05:25 +00:00
|
|
|
enableShowVMConsole = false;
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
2009-02-26 18:32:07 +00:00
|
|
|
|
|
|
|
pDoc->GetConnectedComputerName(strMachineName);
|
|
|
|
if (!pDoc->IsComputerNameLocal(strMachineName)) {
|
|
|
|
enableShowGraphics = false;
|
2012-01-12 22:05:25 +00:00
|
|
|
enableShowVMConsole = false;
|
2009-02-26 18:32:07 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
2009-08-07 08:33:31 +00:00
|
|
|
|
|
|
|
if (pDoc->m_ActiveTasksOnly) {
|
|
|
|
m_pTaskPane->UpdateTask(
|
|
|
|
pGroup->m_Tasks[BTN_ACTIVE_ONLY],
|
|
|
|
_("Show all tasks"),
|
|
|
|
_("Show all tasks.")
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
m_pTaskPane->UpdateTask(
|
|
|
|
pGroup->m_Tasks[BTN_ACTIVE_ONLY],
|
|
|
|
_("Show active tasks"),
|
|
|
|
_("Show only active tasks.")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
row = -1;
|
|
|
|
for (i=0; i<n; i++) {
|
|
|
|
// Step through all selected items
|
|
|
|
row = m_pListPane->GetNextItem(row, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
|
|
|
if (row < 0) break; // Should never happen
|
|
|
|
|
|
|
|
result = pDoc->result(m_iSortedIndexes[row]);
|
2009-03-24 17:18:09 +00:00
|
|
|
if (!result) continue;
|
|
|
|
if (i == 0) {
|
|
|
|
wasSuspended = result->suspended_via_gui;
|
|
|
|
if (result->suspended_via_gui) {
|
|
|
|
m_pTaskPane->UpdateTask(
|
|
|
|
pGroup->m_Tasks[BTN_SUSPEND],
|
|
|
|
_("Resume"),
|
|
|
|
_("Resume work for this task.")
|
|
|
|
);
|
2005-08-26 06:50:46 +00:00
|
|
|
} else {
|
2009-03-24 17:18:09 +00:00
|
|
|
m_pTaskPane->UpdateTask(
|
|
|
|
pGroup->m_Tasks[BTN_SUSPEND],
|
|
|
|
_("Suspend"),
|
|
|
|
_("Suspend work for this task.")
|
|
|
|
);
|
2008-04-07 09:31:15 +00:00
|
|
|
}
|
2009-03-24 17:18:09 +00:00
|
|
|
} else {
|
|
|
|
if (wasSuspended != result->suspended_via_gui) {
|
|
|
|
// Disable Suspend / Resume button if the multiple selection
|
|
|
|
// has a mix of suspended and not suspended tasks
|
|
|
|
enableSuspendResume = false;
|
2005-08-26 06:50:46 +00:00
|
|
|
}
|
2009-03-24 17:18:09 +00:00
|
|
|
}
|
|
|
|
|
2012-01-12 22:05:25 +00:00
|
|
|
// Disable Show VM console if the selected task hasn't registered a remote
|
|
|
|
// desktop connection
|
|
|
|
//
|
2012-01-13 19:24:22 +00:00
|
|
|
if (!strlen(result->remote_desktop_addr)) {
|
2012-01-13 19:26:24 +00:00
|
|
|
enableShowVMConsole = false;
|
2012-01-12 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
2011-12-26 03:30:32 +00:00
|
|
|
// Disable Show Graphics button if the selected task can't display graphics
|
|
|
|
//
|
|
|
|
if (!strlen(result->web_graphics_url) && !strlen(result->graphics_exec_path)) {
|
2012-01-13 19:26:24 +00:00
|
|
|
enableShowGraphics = false;
|
2009-03-24 17:18:09 +00:00
|
|
|
}
|
2006-01-09 14:03:13 +00:00
|
|
|
|
2009-03-24 17:18:09 +00:00
|
|
|
if (result->suspended_via_gui ||
|
|
|
|
result->project_suspended_via_gui ||
|
|
|
|
(result->scheduler_state != CPU_SCHED_SCHEDULED)
|
|
|
|
) {
|
2012-01-13 19:26:24 +00:00
|
|
|
enableShowGraphics = false;
|
2009-03-24 17:18:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Disable Abort button if any selected task already aborted
|
|
|
|
if (
|
|
|
|
result->active_task_state == PROCESS_ABORT_PENDING ||
|
|
|
|
result->active_task_state == PROCESS_ABORTED ||
|
|
|
|
result->state == RESULT_ABORTED
|
|
|
|
) {
|
|
|
|
enableAbort = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
first_project_url = result->project_url;
|
|
|
|
all_same_project = true;
|
|
|
|
} else {
|
|
|
|
if (first_project_url != result->project_url) {
|
|
|
|
all_same_project = false;
|
2008-07-02 10:03:01 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
2009-03-24 17:18:09 +00:00
|
|
|
|
|
|
|
if (n == 1) {
|
|
|
|
enableProperties = true;
|
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
2008-09-13 10:24:24 +00:00
|
|
|
// To minimize flicker, set each button only once to the final desired state
|
|
|
|
pGroup->m_Tasks[BTN_GRAPHICS]->m_pButton->Enable(enableShowGraphics);
|
2012-01-12 22:05:25 +00:00
|
|
|
if (enableShowVMConsole) {
|
|
|
|
pGroup->m_Tasks[BTN_VMCONSOLE]->m_pButton->Enable();
|
|
|
|
pGroup->m_Tasks[BTN_VMCONSOLE]->m_pButton->Show();
|
|
|
|
} else {
|
|
|
|
pGroup->m_Tasks[BTN_VMCONSOLE]->m_pButton->Disable();
|
|
|
|
pGroup->m_Tasks[BTN_VMCONSOLE]->m_pButton->Hide();
|
|
|
|
}
|
2008-09-13 10:24:24 +00:00
|
|
|
pGroup->m_Tasks[BTN_SUSPEND]->m_pButton->Enable(enableSuspendResume);
|
|
|
|
pGroup->m_Tasks[BTN_ABORT]->m_pButton->Enable(enableAbort);
|
|
|
|
pGroup->m_Tasks[BTN_PROPERTIES]->m_pButton->Enable(enableProperties);
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
if (all_same_project) {
|
|
|
|
project = pDoc->state.lookup_project(result->project_url);
|
|
|
|
UpdateWebsiteSelection(GRP_WEBSITES, project);
|
|
|
|
if(m_TaskGroups.size()>1) {
|
|
|
|
m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[1]);
|
2006-04-10 20:08:50 +00:00
|
|
|
}
|
2005-04-27 06:32:40 +00:00
|
|
|
} else {
|
2008-06-26 11:49:43 +00:00
|
|
|
UpdateWebsiteSelection(GRP_WEBSITES, NULL);
|
|
|
|
if(m_TaskGroups.size()>1) {
|
|
|
|
m_pTaskPane->DisableTaskGroupTasks(m_TaskGroups[1]);
|
2008-01-29 14:28:56 +00:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-25 10:38:16 +00:00
|
|
|
bool CViewWork::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) {
|
|
|
|
wxString strDocumentText = wxEmptyString;
|
2008-09-04 13:00:24 +00:00
|
|
|
wxString strDocumentText2 = wxEmptyString;
|
2008-06-25 10:38:16 +00:00
|
|
|
float fDocumentFloat = 0.0;
|
|
|
|
time_t tDocumentTime = (time_t)0;
|
2008-10-14 12:35:48 +00:00
|
|
|
CWork* work;
|
2008-06-25 10:38:16 +00:00
|
|
|
|
|
|
|
strDocumentText.Empty();
|
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
if (GetWorkCacheAtIndex(work, m_iSortedIndexes[iRowIndex])) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (iColumnIndex) {
|
2008-06-25 10:38:16 +00:00
|
|
|
case COLUMN_PROJECT:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocProjectName(m_iSortedIndexes[iRowIndex], strDocumentText);
|
2008-09-04 13:00:24 +00:00
|
|
|
GetDocProjectURL(m_iSortedIndexes[iRowIndex], strDocumentText2);
|
|
|
|
if (!strDocumentText.IsSameAs(work->m_strProjectName) || !strDocumentText2.IsSameAs(work->m_strProjectURL)) {
|
2008-06-25 10:38:16 +00:00
|
|
|
work->m_strProjectName = strDocumentText;
|
2008-09-04 13:00:24 +00:00
|
|
|
work->m_strProjectURL = strDocumentText2;
|
2008-06-25 10:38:16 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_APPLICATION:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocApplicationName(m_iSortedIndexes[iRowIndex], strDocumentText);
|
2008-06-25 10:38:16 +00:00
|
|
|
if (!strDocumentText.IsSameAs(work->m_strApplicationName)) {
|
|
|
|
work->m_strApplicationName = strDocumentText;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_NAME:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocName(m_iSortedIndexes[iRowIndex], strDocumentText);
|
2008-06-25 10:38:16 +00:00
|
|
|
if (!strDocumentText.IsSameAs(work->m_strName)) {
|
|
|
|
work->m_strName = strDocumentText;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_CPUTIME:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocCPUTime(m_iSortedIndexes[iRowIndex], fDocumentFloat);
|
2008-06-25 10:38:16 +00:00
|
|
|
if (fDocumentFloat != work->m_fCPUTime) {
|
|
|
|
work->m_fCPUTime = fDocumentFloat;
|
2008-09-08 09:11:56 +00:00
|
|
|
FormatCPUTime(fDocumentFloat, work->m_strCPUTime);
|
2008-06-25 10:38:16 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_PROGRESS:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocProgress(m_iSortedIndexes[iRowIndex], fDocumentFloat);
|
2008-06-25 10:38:16 +00:00
|
|
|
if (fDocumentFloat != work->m_fProgress) {
|
|
|
|
work->m_fProgress = fDocumentFloat;
|
2008-09-08 09:11:56 +00:00
|
|
|
FormatProgress(fDocumentFloat, work->m_strProgress);
|
2008-06-25 10:38:16 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_TOCOMPLETION:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocTimeToCompletion(m_iSortedIndexes[iRowIndex], fDocumentFloat);
|
2008-06-25 10:38:16 +00:00
|
|
|
if (fDocumentFloat != work->m_fTimeToCompletion) {
|
|
|
|
work->m_fTimeToCompletion = fDocumentFloat;
|
2008-09-08 09:11:56 +00:00
|
|
|
FormatTimeToCompletion(fDocumentFloat, work->m_strTimeToCompletion);
|
2008-06-25 10:38:16 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_REPORTDEADLINE:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocReportDeadline(m_iSortedIndexes[iRowIndex], tDocumentTime);
|
2008-06-25 10:38:16 +00:00
|
|
|
if (tDocumentTime != work->m_tReportDeadline) {
|
|
|
|
work->m_tReportDeadline = tDocumentTime;
|
2008-09-08 09:11:56 +00:00
|
|
|
FormatReportDeadline(tDocumentTime, work->m_strReportDeadline);
|
2008-06-25 10:38:16 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2010-05-07 16:14:54 +00:00
|
|
|
int i = m_iSortedIndexes[iRowIndex];
|
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(i);
|
|
|
|
strDocumentText = result_description(result);
|
2008-06-25 10:38:16 +00:00
|
|
|
if (!strDocumentText.IsSameAs(work->m_strStatus)) {
|
|
|
|
work->m_strStatus = strDocumentText;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewWork::GetDocProjectName(wxInt32 item, wxString& strBuffer) const {
|
2005-06-13 08:47:51 +00:00
|
|
|
CMainDocument* doc = wxGetApp().GetDocument();
|
2008-06-25 13:12:39 +00:00
|
|
|
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) {
|
2008-08-14 11:24:02 +00:00
|
|
|
// TODO: should we get the name directly with result->project->get_name(project_name) ?
|
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);
|
2008-09-08 09:11:56 +00:00
|
|
|
strBuffer = HtmlEntityDecode(wxString(project_name.c_str(), wxConvUTF8));
|
2008-06-25 10:38:16 +00:00
|
|
|
} else {
|
2005-06-13 08:47:51 +00:00
|
|
|
doc->ForceCacheUpdate();
|
|
|
|
}
|
|
|
|
}
|
2008-06-25 10:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewWork::GetDocApplicationName(wxInt32 item, wxString& strBuffer) const {
|
2006-09-01 04:24:25 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2009-02-11 22:52:40 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
|
|
|
RESULT* state_result = NULL;
|
|
|
|
wxString strAppBuffer = wxEmptyString;
|
|
|
|
wxString strClassBuffer = wxEmptyString;
|
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) {
|
2009-01-13 22:46:58 +00:00
|
|
|
state_result = pDoc->state.lookup_result(result->project_url, result->name);
|
2006-09-01 04:24:25 +00:00
|
|
|
if (!state_result) {
|
|
|
|
pDoc->ForceCacheUpdate();
|
2009-01-13 22:46:58 +00:00
|
|
|
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
|
|
|
|
2008-10-21 23:30:59 +00:00
|
|
|
if (!state_result) return;
|
|
|
|
WORKUNIT* wup = state_result->wup;
|
|
|
|
if (!wup) return;
|
|
|
|
APP* app = wup->app;
|
|
|
|
if (!app) return;
|
2009-02-11 22:03:34 +00:00
|
|
|
APP_VERSION* avp = state_result->avp;
|
|
|
|
if (!avp) return;
|
2008-10-21 23:30:59 +00:00
|
|
|
|
2010-03-13 04:40:37 +00:00
|
|
|
if (strlen(app->user_friendly_name)) {
|
|
|
|
strAppBuffer = HtmlEntityDecode(wxString(state_result->app->user_friendly_name, wxConvUTF8));
|
2007-01-11 23:20:42 +00:00
|
|
|
} else {
|
2010-03-13 04:40:37 +00:00
|
|
|
strAppBuffer = HtmlEntityDecode(wxString(state_result->avp->app_name, wxConvUTF8));
|
2007-01-11 21:46:18 +00:00
|
|
|
}
|
2008-07-09 03:46:34 +00:00
|
|
|
|
2010-03-13 04:40:37 +00:00
|
|
|
if (strlen(avp->plan_class)) {
|
2009-01-13 19:34:04 +00:00
|
|
|
strClassBuffer.Printf(
|
|
|
|
wxT(" (%s)"),
|
2010-03-13 04:40:37 +00:00
|
|
|
wxString(avp->plan_class, wxConvUTF8).c_str()
|
2009-01-13 19:34:04 +00:00
|
|
|
);
|
2008-04-01 20:46:41 +00:00
|
|
|
}
|
2009-02-11 22:52:40 +00:00
|
|
|
|
2006-09-01 04:24:25 +00:00
|
|
|
strBuffer.Printf(
|
2010-03-29 22:33:08 +00:00
|
|
|
wxT(" %s%s %d.%02d %s"),
|
2010-04-21 20:14:46 +00:00
|
|
|
state_result->project->anonymous_platform?_("Local: "):wxT(""),
|
2008-07-09 03:46:34 +00:00
|
|
|
strAppBuffer.c_str(),
|
2009-02-11 22:52:40 +00:00
|
|
|
state_result->avp->version_num / 100,
|
|
|
|
state_result->avp->version_num % 100,
|
2008-07-09 03:46:34 +00:00
|
|
|
strClassBuffer.c_str()
|
2006-09-01 04:24:25 +00:00
|
|
|
);
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2008-06-25 10:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewWork::GetDocName(wxInt32 item, wxString& strBuffer) const {
|
2008-06-25 13:12:39 +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) {
|
2010-03-12 17:47:17 +00:00
|
|
|
strBuffer = wxString(result->name, wxConvUTF8);
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2008-06-25 10:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewWork::GetDocCPUTime(wxInt32 item, float& fBuffer) const {
|
2008-06-25 13:12:39 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2008-06-25 10:38:16 +00:00
|
|
|
fBuffer = 0;
|
2005-06-13 08:47:51 +00:00
|
|
|
if (result) {
|
|
|
|
if (result->active_task) {
|
2009-03-11 22:01:38 +00:00
|
|
|
fBuffer = result->elapsed_time;
|
|
|
|
if (!fBuffer) fBuffer = result->current_cpu_time;
|
2005-06-13 08:47:51 +00:00
|
|
|
} 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 {
|
2009-03-11 22:01:38 +00:00
|
|
|
fBuffer = result->final_elapsed_time;
|
|
|
|
if (!fBuffer) 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
|
|
|
}
|
2008-06-25 10:38:16 +00:00
|
|
|
}
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2008-09-08 09:11:56 +00:00
|
|
|
wxInt32 CViewWork::FormatCPUTime(float fBuffer, wxString& strBuffer) const {
|
2008-06-25 10:38:16 +00:00
|
|
|
wxInt32 iHour = 0;
|
|
|
|
wxInt32 iMin = 0;
|
|
|
|
wxInt32 iSec = 0;
|
|
|
|
wxTimeSpan ts;
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-25 10:38:16 +00:00
|
|
|
void CViewWork::GetDocProgress(wxInt32 item, float& fBuffer) const {
|
2008-06-25 13:12:39 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2008-06-25 10:38:16 +00:00
|
|
|
fBuffer = 0;
|
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
|
|
|
}
|
2008-06-25 10:38:16 +00:00
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2008-06-25 10:38:16 +00:00
|
|
|
|
2008-09-08 09:11:56 +00:00
|
|
|
wxInt32 CViewWork::FormatProgress(float fBuffer, wxString& strBuffer) const {
|
|
|
|
strBuffer.Printf(wxT("%.3f%%"), fBuffer);
|
2005-06-13 08:47:51 +00:00
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-25 10:38:16 +00:00
|
|
|
void CViewWork::GetDocTimeToCompletion(wxInt32 item, float& fBuffer) const {
|
2008-06-25 13:12:39 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
2008-06-25 10:38:16 +00:00
|
|
|
|
|
|
|
fBuffer = 0;
|
|
|
|
if (result) {
|
|
|
|
fBuffer = result->estimated_cpu_time_remaining;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-08 09:11:56 +00:00
|
|
|
wxInt32 CViewWork::FormatTimeToCompletion(float fBuffer, wxString& strBuffer) const {
|
|
|
|
double est = fBuffer;
|
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
|
|
|
|
2008-07-21 22:07:25 +00:00
|
|
|
if (est > 86400*365*10) {
|
|
|
|
est = 86400*365*10;
|
|
|
|
}
|
|
|
|
if (est <= 0) {
|
2004-10-20 21:50:28 +00:00
|
|
|
strBuffer = wxT("---");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2008-07-21 22:07:25 +00:00
|
|
|
iHour = (wxInt32)(est / (60 * 60));
|
|
|
|
iMin = (wxInt32)(est / 60) % 60;
|
|
|
|
iSec = (wxInt32)(est) % 60;
|
2004-10-22 19:23:09 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-25 10:38:16 +00:00
|
|
|
void CViewWork::GetDocReportDeadline(wxInt32 item, time_t& time) const {
|
2008-06-25 13:12:39 +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) {
|
2010-03-12 17:47:17 +00:00
|
|
|
time = (time_t)result->report_deadline;
|
2008-06-25 10:38:16 +00:00
|
|
|
} else {
|
|
|
|
time = (time_t)0;
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2008-06-25 10:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-08 09:11:56 +00:00
|
|
|
wxInt32 CViewWork::FormatReportDeadline(time_t deadline, wxString& strBuffer) const {
|
2013-11-21 13:30:10 +00:00
|
|
|
#ifdef __WXMAC__
|
|
|
|
// Work around a wxCocoa bug(?) in wxDateTime::Format()
|
|
|
|
char buf[80];
|
|
|
|
struct tm * timeinfo = localtime(&deadline);
|
|
|
|
strftime(buf, sizeof(buf), "%c", timeinfo);
|
|
|
|
strBuffer = buf;
|
|
|
|
#else
|
2008-06-25 10:38:16 +00:00
|
|
|
wxDateTime dtTemp;
|
|
|
|
|
2008-09-08 09:11:56 +00:00
|
|
|
dtTemp.Set(deadline);
|
2008-06-25 10:38:16 +00:00
|
|
|
strBuffer = dtTemp.Format();
|
2013-11-21 13:30:10 +00:00
|
|
|
#endif
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-25 10:38:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewWork::FormatStatus(wxInt32 item, wxString& strBuffer) const {
|
2008-10-14 12:35:48 +00:00
|
|
|
CWork* work;
|
2008-06-25 10:38:16 +00:00
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
try {
|
|
|
|
work = m_WorkCache.at(m_iSortedIndexes[item]);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
work = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (work) {
|
|
|
|
strBuffer = work->m_strStatus;
|
|
|
|
} else {
|
|
|
|
strBuffer = wxEmptyString;
|
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-12-08 00:40:19 +00:00
|
|
|
|
2008-09-04 13:00:24 +00:00
|
|
|
void CViewWork::GetDocProjectURL(wxInt32 item, wxString& strBuffer) const {
|
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(item);
|
|
|
|
|
|
|
|
if (result) {
|
2010-03-12 17:47:17 +00:00
|
|
|
strBuffer = wxString(result->project_url, wxConvUTF8);
|
2008-09-04 13:00:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-24 10:52:12 +00:00
|
|
|
double CViewWork::GetProgressValue(long item) {
|
|
|
|
float fBuffer = 0;
|
2008-06-25 10:38:16 +00:00
|
|
|
RESULT* result = wxGetApp().GetDocument()->result(m_iSortedIndexes[item]);
|
2008-06-24 10:52:12 +00:00
|
|
|
|
|
|
|
if (result) {
|
|
|
|
if (result->active_task) {
|
|
|
|
fBuffer = result->fraction_done;
|
|
|
|
} else {
|
|
|
|
if(result->state < RESULT_COMPUTE_ERROR) {
|
|
|
|
fBuffer = 0.0;
|
|
|
|
} else {
|
|
|
|
fBuffer = 1.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-11-08 04:25:02 +00:00
|
|
|
if (fBuffer > 1) fBuffer = 1;
|
2008-06-24 10:52:12 +00:00
|
|
|
|
|
|
|
return fBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-06 11:33:28 +00:00
|
|
|
wxString CViewWork::GetProgressText( long item) {
|
|
|
|
CWork* work = NULL;
|
|
|
|
wxString strBuffer = wxEmptyString;
|
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
if (GetWorkCacheAtIndex(work, m_iSortedIndexes[item])) {
|
|
|
|
strBuffer = wxEmptyString;
|
|
|
|
} else {
|
2008-10-06 11:33:28 +00:00
|
|
|
strBuffer = work->m_strProgress;
|
|
|
|
}
|
2008-10-14 12:35:48 +00:00
|
|
|
|
2008-10-06 11:33:28 +00:00
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
int CViewWork::GetWorkCacheAtIndex(CWork*& workPtr, int index) {
|
|
|
|
try {
|
|
|
|
workPtr = m_WorkCache.at(index);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
workPtr = NULL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|