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-09-21 01:30:29 +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-09-21 01:30:29 +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-09-21 01:30:29 +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-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "ViewProjects.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
2007-02-21 17:06:11 +00:00
|
|
|
#include "str_util.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "BOINCBaseFrame.h"
|
2004-09-21 01:30:29 +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 "ViewProjects.h"
|
|
|
|
#include "Events.h"
|
2008-06-02 07:42:27 +00:00
|
|
|
#include "DlgItemProperties.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "res/proj.xpm"
|
|
|
|
|
|
|
|
|
|
|
|
#define COLUMN_PROJECT 0
|
|
|
|
#define COLUMN_ACCOUNTNAME 1
|
|
|
|
#define COLUMN_TEAMNAME 2
|
|
|
|
#define COLUMN_TOTALCREDIT 3
|
|
|
|
#define COLUMN_AVGCREDIT 4
|
|
|
|
#define COLUMN_RESOURCESHARE 5
|
2004-09-29 22:21:45 +00:00
|
|
|
#define COLUMN_STATUS 6
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2005-04-27 06:32:40 +00:00
|
|
|
// groups that contain buttons
|
|
|
|
#define GRP_TASKS 0
|
|
|
|
#define GRP_WEBSITES 1
|
|
|
|
|
2005-04-21 22:21:54 +00:00
|
|
|
// buttons in the "tasks" area
|
2005-06-24 10:49:42 +00:00
|
|
|
#define BTN_UPDATE 0
|
2005-10-05 19:01:28 +00:00
|
|
|
#define BTN_SUSPEND 1
|
|
|
|
#define BTN_NOWORK 2
|
|
|
|
#define BTN_RESET 3
|
|
|
|
#define BTN_DETACH 4
|
2008-07-02 10:03:01 +00:00
|
|
|
#define BTN_PROPERTIES 5
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2005-04-22 06:06:22 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CProject::CProject() {
|
2008-09-08 09:11:56 +00:00
|
|
|
m_fTotalCredit = -1.0;
|
|
|
|
m_fAVGCredit = -1.0;
|
|
|
|
m_fResourceShare = -1.0;
|
2008-10-17 06:54:05 +00:00
|
|
|
m_fResourcePercent = -1.0;
|
2004-12-02 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CProject::~CProject() {
|
2004-12-02 07:43:47 +00:00
|
|
|
m_strProjectName.Clear();
|
|
|
|
m_strAccountName.Clear();
|
|
|
|
m_strTeamName.Clear();
|
|
|
|
m_strStatus.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CViewProjects, CBOINCBaseView)
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
BEGIN_EVENT_TABLE (CViewProjects, CBOINCBaseView)
|
|
|
|
EVT_BUTTON(ID_TASK_PROJECT_UPDATE, CViewProjects::OnProjectUpdate)
|
|
|
|
EVT_BUTTON(ID_TASK_PROJECT_SUSPEND, CViewProjects::OnProjectSuspend)
|
|
|
|
EVT_BUTTON(ID_TASK_PROJECT_NONEWWORK, CViewProjects::OnProjectNoNewWork)
|
|
|
|
EVT_BUTTON(ID_TASK_PROJECT_RESET, CViewProjects::OnProjectReset)
|
|
|
|
EVT_BUTTON(ID_TASK_PROJECT_DETACH, CViewProjects::OnProjectDetach)
|
2008-07-02 10:03:01 +00:00
|
|
|
EVT_BUTTON(ID_TASK_PROJECT_SHOW_PROPERTIES, CViewProjects::OnShowItemProperties)
|
2005-04-22 01:46:32 +00:00
|
|
|
EVT_CUSTOM_RANGE(wxEVT_COMMAND_BUTTON_CLICKED, ID_TASK_PROJECT_WEB_PROJDEF_MIN, ID_TASK_PROJECT_WEB_PROJDEF_MAX, CViewProjects::OnProjectWebsiteClicked)
|
2005-04-21 23:14:10 +00:00
|
|
|
EVT_LIST_ITEM_SELECTED(ID_LIST_PROJECTSVIEW, CViewProjects::OnListSelected)
|
|
|
|
EVT_LIST_ITEM_DESELECTED(ID_LIST_PROJECTSVIEW, CViewProjects::OnListDeselected)
|
2008-06-26 11:49:43 +00:00
|
|
|
EVT_LIST_COL_CLICK(ID_LIST_PROJECTSVIEW, CViewProjects::OnColClick)
|
2008-06-27 04:34:47 +00:00
|
|
|
EVT_LIST_CACHE_HINT(ID_LIST_PROJECTSVIEW, CViewProjects::OnCacheHint)
|
2005-04-20 22:22:41 +00:00
|
|
|
END_EVENT_TABLE ()
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
static CViewProjects* myCViewProjects;
|
|
|
|
|
2008-07-08 15:13:34 +00:00
|
|
|
static bool CompareViewProjectsItems(int iRowIndex1, int iRowIndex2) {
|
2008-10-14 12:35:48 +00:00
|
|
|
CProject* project1;
|
|
|
|
CProject* project2;
|
|
|
|
int result = 0;
|
2008-06-26 11:49:43 +00:00
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
try {
|
|
|
|
project1 = myCViewProjects->m_ProjectCache.at(iRowIndex1);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
project2 = myCViewProjects->m_ProjectCache.at(iRowIndex2);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
switch (myCViewProjects->m_iSortColumn) {
|
2010-05-07 20:41:43 +00:00
|
|
|
case COLUMN_PROJECT:
|
|
|
|
result = project1->m_strProjectName.CmpNoCase(project2->m_strProjectName);
|
2008-06-26 11:49:43 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
2010-05-07 20:41:43 +00:00
|
|
|
result = project1->m_strAccountName.CmpNoCase(project2->m_strAccountName);
|
2008-06-26 11:49:43 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
2010-05-07 20:41:43 +00:00
|
|
|
result = project1->m_strTeamName.CmpNoCase(project2->m_strTeamName);
|
2008-06-26 11:49:43 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
|
|
|
if (project1->m_fTotalCredit < project2->m_fTotalCredit) {
|
|
|
|
result = -1;
|
|
|
|
} else if (project1->m_fTotalCredit > project2->m_fTotalCredit) {
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
|
|
|
if (project1->m_fAVGCredit < project2->m_fAVGCredit) {
|
|
|
|
result = -1;
|
|
|
|
} else if (project1->m_fAVGCredit > project2->m_fAVGCredit) {
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
|
|
|
if (project1->m_fResourceShare < project2->m_fResourceShare) {
|
|
|
|
result = -1;
|
|
|
|
} else if (project1->m_fResourceShare > project2->m_fResourceShare) {
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2010-05-07 20:41:43 +00:00
|
|
|
result = project1->m_strStatus.CmpNoCase(project2->m_strStatus);
|
2008-06-26 11:49:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-07-08 15:13:34 +00:00
|
|
|
// Always return FALSE for equality (result == 0)
|
2008-10-24 11:24:39 +00:00
|
|
|
return (myCViewProjects->m_bReverseSort ? (result > 0) : (result < 0));
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-02 18:40:06 +00:00
|
|
|
CViewProjects::CViewProjects()
|
|
|
|
{}
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
CViewProjects::CViewProjects(wxNotebook* pNotebook) :
|
2008-06-26 11:49:43 +00:00
|
|
|
CBOINCBaseView(pNotebook, ID_TASK_PROJECTSVIEW, DEFAULT_TASK_FLAGS, ID_LIST_PROJECTSVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS)
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2010-05-07 20:41:43 +00:00
|
|
|
CTaskItemGroup* pGroup = NULL;
|
|
|
|
CTaskItem* pItem = NULL;
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2004-12-23 01:06:41 +00:00
|
|
|
//
|
2005-04-20 22:22:41 +00:00
|
|
|
// Setup View
|
2004-12-23 01:06:41 +00:00
|
|
|
//
|
2010-05-07 20:41:43 +00:00
|
|
|
pGroup = new CTaskItemGroup( _("Commands") );
|
|
|
|
m_TaskGroups.push_back( pGroup );
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2010-05-07 20:41:43 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-04-21 23:53:39 +00:00
|
|
|
_("Update"),
|
2008-07-08 20:05:07 +00:00
|
|
|
_("Report all completed tasks, get latest credit, get latest preferences, and possibly get more tasks."),
|
2005-04-20 22:22:41 +00:00
|
|
|
ID_TASK_PROJECT_UPDATE
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
2004-12-23 01:06:41 +00:00
|
|
|
|
2010-05-07 20:41:43 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-04-21 23:53:39 +00:00
|
|
|
_("Suspend"),
|
2006-01-23 11:30:25 +00:00
|
|
|
_("Suspend tasks for this project."),
|
2005-04-20 22:22:41 +00:00
|
|
|
ID_TASK_PROJECT_SUSPEND
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
2010-05-07 20:41:43 +00:00
|
|
|
pItem = new CTaskItem(
|
2006-01-23 11:30:25 +00:00
|
|
|
_("No new tasks"),
|
|
|
|
_("Don't get new tasks for this project."),
|
2005-04-20 22:22:41 +00:00
|
|
|
ID_TASK_PROJECT_NONEWWORK
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
2004-12-23 01:06:41 +00:00
|
|
|
|
2010-05-07 20:41:43 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-04-20 22:22:41 +00:00
|
|
|
_("Reset project"),
|
2008-07-08 20:05:07 +00:00
|
|
|
_("Delete all files and tasks associated with this project, and get new tasks. You can update the project first to report any completed tasks."),
|
2005-04-20 22:22:41 +00:00
|
|
|
ID_TASK_PROJECT_RESET
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
2004-12-23 01:06:41 +00:00
|
|
|
|
2010-05-07 20:41:43 +00:00
|
|
|
pItem = new CTaskItem(
|
2010-08-01 04:17:04 +00:00
|
|
|
_("Remove"),
|
|
|
|
_("Remove this project. Tasks in progress will be lost (use 'Update' first to report any completed tasks)."),
|
2005-04-20 22:22:41 +00:00
|
|
|
ID_TASK_PROJECT_DETACH
|
|
|
|
);
|
2008-07-02 10:03:01 +00:00
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
2010-05-07 20:41:43 +00:00
|
|
|
pItem = new CTaskItem(
|
2008-07-02 10:03:01 +00:00
|
|
|
_("Properties"),
|
|
|
|
_("Show project details."),
|
|
|
|
ID_TASK_PROJECT_SHOW_PROPERTIES
|
|
|
|
);
|
2005-04-20 22:22:41 +00:00
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
2004-12-23 01:06:41 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
// Create Task Pane Items
|
2005-04-21 23:14:10 +00:00
|
|
|
m_pTaskPane->UpdateControls();
|
2005-04-20 22:22:41 +00:00
|
|
|
|
|
|
|
// Create List Pane Items
|
2004-10-19 19:41:29 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 150);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_ACCOUNTNAME, _("Account"), wxLIST_FORMAT_LEFT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_TEAMNAME, _("Team"), wxLIST_FORMAT_LEFT, 80);
|
2006-02-09 21:51:07 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_TOTALCREDIT, _("Work done"), wxLIST_FORMAT_RIGHT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_AVGCREDIT, _("Avg. work done"), wxLIST_FORMAT_RIGHT, 80);
|
2004-12-19 20:35:37 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_RESOURCESHARE, _("Resource share"), wxLIST_FORMAT_CENTRE, 85);
|
2004-10-19 19:41:29 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_STATUS, _("Status"), wxLIST_FORMAT_LEFT, 150);
|
2005-04-21 23:53:39 +00:00
|
|
|
|
2008-06-24 10:52:12 +00:00
|
|
|
m_iProgressColumn = COLUMN_RESOURCESHARE;
|
2008-06-26 11:49:43 +00:00
|
|
|
|
|
|
|
// Needed by static sort routine;
|
|
|
|
myCViewProjects = this;
|
|
|
|
m_funcSortCompare = CompareViewProjectsItems;
|
|
|
|
|
2005-04-21 23:53:39 +00:00
|
|
|
UpdateSelection();
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CViewProjects::~CViewProjects() {
|
2005-02-01 00:54:06 +00:00
|
|
|
EmptyCache();
|
2005-04-21 06:04:26 +00:00
|
|
|
EmptyTasks();
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-02 21:03:36 +00:00
|
|
|
wxString& CViewProjects::GetViewName() {
|
2009-05-01 01:32:26 +00:00
|
|
|
static wxString strViewName(wxT("Projects"));
|
2005-09-02 20:56:08 +00:00
|
|
|
return strViewName;
|
2004-09-21 01:30:29 +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& CViewProjects::GetViewDisplayName() {
|
|
|
|
static wxString strViewName(_("Projects"));
|
|
|
|
return strViewName;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
const char** CViewProjects::GetViewIcon() {
|
2004-09-21 01:30:29 +00:00
|
|
|
return proj_xpm;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-07 18:26:02 +00:00
|
|
|
int CViewProjects::GetViewCurrentViewPage() {
|
2009-12-22 01:22:11 +00:00
|
|
|
return VW_PROJ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-04 13:00:24 +00:00
|
|
|
wxString CViewProjects::GetKeyValue1(int iRowIndex) {
|
2008-10-14 12:35:48 +00:00
|
|
|
CProject* project;
|
|
|
|
|
|
|
|
if (GetProjectCacheAtIndex(project, m_iSortedIndexes[iRowIndex])) {
|
|
|
|
return wxEmptyString;
|
|
|
|
}
|
|
|
|
|
2008-09-04 13:00:24 +00:00
|
|
|
return project->m_strProjectURL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CViewProjects::FindRowIndexByKeyValues(wxString& key1, wxString&) {
|
|
|
|
CProject* project;
|
|
|
|
unsigned int iRowIndex, n = GetCacheCount();
|
2010-05-07 20:41:43 +00:00
|
|
|
for(iRowIndex=0; iRowIndex < n; iRowIndex++) {
|
2008-10-14 12:35:48 +00:00
|
|
|
if (GetProjectCacheAtIndex(project, m_iSortedIndexes[iRowIndex])) {
|
|
|
|
continue;
|
|
|
|
}
|
2008-09-04 13:00:24 +00:00
|
|
|
if((project->m_strProjectURL).IsSameAs(key1)) return iRowIndex;
|
2010-05-07 20:41:43 +00:00
|
|
|
}
|
|
|
|
return -1;
|
2008-09-04 13:00:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewProjects::OnProjectUpdate( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectUpdate - Function Begin"));
|
|
|
|
|
- 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
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2008-06-26 11:49:43 +00:00
|
|
|
int row;
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-20 22:22:41 +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));
|
2008-09-13 00:27:13 +00:00
|
|
|
wxASSERT(m_pListPane);
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pFrame->UpdateStatusText(_("Updating project..."));
|
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;
|
|
|
|
|
|
|
|
pDoc->ProjectUpdate(m_iSortedIndexes[row]);
|
|
|
|
}
|
2005-04-20 22:22:41 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
2008-12-04 11:39:51 +00:00
|
|
|
m_bForceUpdateSelection = true;
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
2006-02-17 20:59:15 +00:00
|
|
|
pFrame->ResetReminderTimers();
|
2005-05-05 06:07:14 +00:00
|
|
|
pFrame->FireRefreshView();
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectUpdate - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewProjects::OnProjectSuspend( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectSuspend - Function Begin"));
|
|
|
|
|
- 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
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2008-06-26 11:49:43 +00:00
|
|
|
int row;
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-20 22:22:41 +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-20 22:22:41 +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;
|
|
|
|
|
|
|
|
PROJECT* project = pDoc->project(m_iSortedIndexes[row]);
|
|
|
|
if (project) {
|
|
|
|
if (project->suspended_via_gui) {
|
|
|
|
pFrame->UpdateStatusText(_("Resuming project..."));
|
|
|
|
pDoc->ProjectResume(m_iSortedIndexes[row]);
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
} else {
|
|
|
|
pFrame->UpdateStatusText(_("Suspending project..."));
|
|
|
|
pDoc->ProjectSuspend(m_iSortedIndexes[row]);
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
}
|
|
|
|
}
|
2005-04-21 23:53:39 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
|
2008-12-04 11:39:51 +00:00
|
|
|
m_bForceUpdateSelection = true;
|
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-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectSuspend - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewProjects::OnProjectNoNewWork( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectNoNewWork - Function Begin"));
|
|
|
|
|
- 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
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2008-06-26 11:49:43 +00:00
|
|
|
int row;
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-20 22:22:41 +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-20 22:22:41 +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;
|
|
|
|
|
|
|
|
PROJECT* project = pDoc->project(m_iSortedIndexes[row]);
|
|
|
|
if (project) {
|
|
|
|
if (project->dont_request_more_work) {
|
|
|
|
pFrame->UpdateStatusText(_("Telling project to allow additional task downloads..."));
|
|
|
|
pDoc->ProjectAllowMoreWork(m_iSortedIndexes[row]);
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
} else {
|
|
|
|
pFrame->UpdateStatusText(_("Telling project to not fetch any additional tasks..."));
|
|
|
|
pDoc->ProjectNoMoreWork(m_iSortedIndexes[row]);
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
}
|
|
|
|
}
|
2005-04-21 23:53:39 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
|
2008-12-04 11:39:51 +00:00
|
|
|
m_bForceUpdateSelection = true;
|
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-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectNoNewWork - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewProjects::OnProjectReset( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectReset - Function Begin"));
|
|
|
|
|
- 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
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
|
|
|
CProject* pProject = NULL;
|
2008-06-26 11:49:43 +00:00
|
|
|
int row;
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-20 22:22:41 +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));
|
2008-09-13 00:27:13 +00:00
|
|
|
wxASSERT(m_pListPane);
|
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
if (!pDoc->IsUserAuthorized())
|
|
|
|
return;
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pFrame->UpdateStatusText(_("Resetting project..."));
|
|
|
|
|
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;
|
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
if (GetProjectCacheAtIndex(pProject, m_iSortedIndexes[row])) {
|
|
|
|
return;
|
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
|
|
|
|
strMessage.Printf(
|
|
|
|
_("Are you sure you want to reset project '%s'?"),
|
|
|
|
pProject->m_strProjectName.c_str()
|
|
|
|
);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2008-08-20 16:07:06 +00:00
|
|
|
iAnswer = wxGetApp().SafeMessageBox(
|
2008-06-26 11:49:43 +00:00
|
|
|
strMessage,
|
|
|
|
_("Reset Project"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
if (wxYES == iAnswer) {
|
|
|
|
pDoc->ProjectReset(m_iSortedIndexes[row]);
|
|
|
|
}
|
2005-04-20 22:22:41 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
2008-12-04 11:39:51 +00:00
|
|
|
m_bForceUpdateSelection = true;
|
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-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectReset - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-07-07 22:26:49 +00:00
|
|
|
void CViewProjects::OnProjectDetach( wxCommandEvent& WXUNUSED(event) ) {
|
2005-04-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectDetach - Function Begin"));
|
|
|
|
|
- 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
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
|
|
|
CProject* pProject = NULL;
|
2008-06-26 11:49:43 +00:00
|
|
|
int row;
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-20 22:22:41 +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));
|
2008-09-13 00:27:13 +00:00
|
|
|
wxASSERT(m_pListPane);
|
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
if (!pDoc->IsUserAuthorized())
|
|
|
|
return;
|
|
|
|
|
2010-08-01 04:17:04 +00:00
|
|
|
pFrame->UpdateStatusText(_("Removing project..."));
|
2005-04-20 22:22:41 +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;
|
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
if (GetProjectCacheAtIndex(pProject, m_iSortedIndexes[row])) {
|
|
|
|
return;
|
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
|
|
|
|
strMessage.Printf(
|
2010-08-01 04:27:24 +00:00
|
|
|
_("Are you sure you want to remove project '%s'?"),
|
2008-06-26 11:49:43 +00:00
|
|
|
pProject->m_strProjectName.c_str()
|
|
|
|
);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2008-08-20 16:07:06 +00:00
|
|
|
iAnswer = wxGetApp().SafeMessageBox(
|
2008-06-26 11:49:43 +00:00
|
|
|
strMessage,
|
2010-08-01 04:17:04 +00:00
|
|
|
_("Remove Project"),
|
2008-06-26 11:49:43 +00:00
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
if (wxYES == iAnswer) {
|
|
|
|
pDoc->ProjectDetach(m_iSortedIndexes[row]);
|
|
|
|
}
|
2005-04-20 22:22:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
2008-12-04 11:39:51 +00:00
|
|
|
m_bForceUpdateSelection = true;
|
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-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectDetach - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-02 10:03:01 +00:00
|
|
|
void CViewProjects::OnShowItemProperties( wxCommandEvent& WXUNUSED(event) ) {
|
2008-09-13 00:27:13 +00:00
|
|
|
wxASSERT(m_pListPane);
|
|
|
|
|
2008-09-16 23:50:34 +00:00
|
|
|
long item = m_pListPane->GetFirstSelected();
|
|
|
|
PROJECT* project = wxGetApp().GetDocument()->project(m_iSortedIndexes[item]);
|
2008-09-13 00:27:13 +00:00
|
|
|
|
2008-10-08 08:50:18 +00:00
|
|
|
if(!project) 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(project);
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-22 06:37:14 +00:00
|
|
|
void CViewProjects::OnProjectWebsiteClicked( wxEvent& event ) {
|
2005-04-22 01:46:32 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectWebsiteClicked - Function Begin"));
|
2004-10-26 08:41:02 +00:00
|
|
|
|
2006-06-24 05:00:57 +00:00
|
|
|
CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame);
|
2004-10-26 08:41:02 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pFrame);
|
2006-06-24 05:00:57 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame));
|
2005-04-22 01:46:32 +00:00
|
|
|
pFrame->UpdateStatusText(_("Launching browser..."));
|
2004-10-26 08:41:02 +00:00
|
|
|
|
2005-04-22 01:46:32 +00:00
|
|
|
int website_task_index = event.GetId() - ID_TASK_PROJECT_WEB_PROJDEF_MIN;
|
2009-12-19 05:16:41 +00:00
|
|
|
wxLaunchDefaultBrowser(
|
2005-04-22 01:46:32 +00:00
|
|
|
m_TaskGroups[1]->m_Tasks[website_task_index]->m_strWebSiteLink
|
2005-04-27 06:55:28 +00:00
|
|
|
);
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-22 01:46:32 +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-22 01:46:32 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectWebsiteClicked - Function End"));
|
2005-04-21 23:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-22 01:46:32 +00:00
|
|
|
wxInt32 CViewProjects::GetDocCount() {
|
2008-10-21 23:30:59 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
if (pDoc) {
|
|
|
|
return pDoc->GetProjectCount();
|
|
|
|
}
|
|
|
|
return -1;
|
2005-04-21 23:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
wxString CViewProjects::OnListGetItemText(long item, long column) const {
|
2008-09-08 09:11:56 +00:00
|
|
|
CProject* project = NULL;
|
2004-12-02 07:43:47 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2008-10-06 11:33:28 +00:00
|
|
|
m_pListPane->AddPendingProgressBar(item);
|
2008-09-09 10:09:54 +00:00
|
|
|
|
2008-09-08 09:11:56 +00:00
|
|
|
try {
|
|
|
|
project = m_ProjectCache.at(m_iSortedIndexes[item]);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
project = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (project) {
|
|
|
|
switch(column) {
|
|
|
|
case COLUMN_PROJECT:
|
|
|
|
strBuffer = project->m_strProjectName;
|
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
|
|
|
strBuffer = project->m_strAccountName;
|
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
|
|
|
strBuffer = project->m_strTeamName;
|
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
|
|
|
strBuffer = project->m_strTotalCredit;
|
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
|
|
|
strBuffer = project->m_strAVGCredit;
|
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
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 = project->m_strResourceShare;
|
2008-09-08 09:11:56 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
|
|
|
strBuffer = project->m_strStatus;
|
|
|
|
break;
|
|
|
|
}
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2008-09-08 09:11:56 +00:00
|
|
|
return strBuffer;
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
|
|
|
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::AddCacheElement() {
|
2004-12-02 07:43:47 +00:00
|
|
|
CProject* pItem = new CProject();
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pItem);
|
|
|
|
if (pItem) {
|
2005-04-07 07:04:50 +00:00
|
|
|
m_ProjectCache.push_back(pItem);
|
2008-06-27 04:38:31 +00:00
|
|
|
m_iSortedIndexes.Add((int)m_ProjectCache.size()-1);
|
2004-12-02 07:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-17 02:10:52 +00:00
|
|
|
wxInt32 CViewProjects::EmptyCache() {
|
2005-01-29 00:58:43 +00:00
|
|
|
unsigned int i;
|
|
|
|
for (i=0; i<m_ProjectCache.size(); i++) {
|
|
|
|
delete m_ProjectCache[i];
|
|
|
|
}
|
|
|
|
m_ProjectCache.clear();
|
2008-06-26 11:49:43 +00:00
|
|
|
m_iSortedIndexes.Clear();
|
2004-12-02 07:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::GetCacheCount() {
|
2006-07-21 08:23:26 +00:00
|
|
|
return (wxInt32)m_ProjectCache.size();
|
2004-12-02 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::RemoveCacheElement() {
|
2008-06-26 11:49:43 +00:00
|
|
|
unsigned int i;
|
2005-01-29 21:30:45 +00:00
|
|
|
delete m_ProjectCache.back();
|
2005-04-07 07:04:50 +00:00
|
|
|
m_ProjectCache.erase(m_ProjectCache.end() - 1);
|
2008-06-26 11:49:43 +00:00
|
|
|
m_iSortedIndexes.Clear();
|
|
|
|
for (i=0; i<m_ProjectCache.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 CViewProjects::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 CViewProjects::UpdateSelection() {
|
2005-04-22 01:46:32 +00:00
|
|
|
CTaskItemGroup* pGroup = NULL;
|
|
|
|
PROJECT* project = NULL;
|
2008-12-04 11:39:51 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2008-06-26 11:49:43 +00:00
|
|
|
int i, n, row;
|
|
|
|
bool wasSuspended=false, wasNoNewWork=false;
|
2008-09-13 10:24:24 +00:00
|
|
|
bool enableUpdate = false;
|
|
|
|
bool enableSuspendResume = false;
|
|
|
|
bool enableNoNewTasks = false;
|
|
|
|
bool enableReset = false;
|
|
|
|
bool enableDetach = false;
|
|
|
|
bool enableProperties = false;
|
2005-04-22 01:46:32 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-22 01:46:32 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-07-24 08:35:57 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
2006-01-09 14:03:13 +00:00
|
|
|
wxASSERT(m_pListPane);
|
|
|
|
|
|
|
|
CBOINCBaseView::PreUpdateSelection();
|
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
// Update the tasks static box buttons
|
2005-04-27 06:32:40 +00:00
|
|
|
//
|
2005-04-22 01:46:32 +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
|
|
|
enableUpdate = true;
|
|
|
|
enableSuspendResume = true;
|
|
|
|
enableNoNewTasks = true;
|
|
|
|
enableReset = true;
|
|
|
|
enableDetach = true;
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
2008-10-03 06:42:10 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
project = pDoc->project(m_iSortedIndexes[row]);
|
|
|
|
if (!project) {
|
|
|
|
m_pTaskPane->DisableTaskGroupTasks(pGroup);
|
|
|
|
if(m_TaskGroups.size()>1) {
|
|
|
|
m_pTaskPane->DisableTaskGroupTasks(m_TaskGroups[1]);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
wasSuspended = project->suspended_via_gui;
|
|
|
|
if (project->suspended_via_gui) {
|
2005-08-26 06:50:46 +00:00
|
|
|
m_pTaskPane->UpdateTask(
|
2006-01-23 11:30:25 +00:00
|
|
|
pGroup->m_Tasks[BTN_SUSPEND], _("Resume"), _("Resume tasks for this project.")
|
2005-08-26 06:50:46 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
m_pTaskPane->UpdateTask(
|
2006-01-23 11:30:25 +00:00
|
|
|
pGroup->m_Tasks[BTN_SUSPEND], _("Suspend"), _("Suspend tasks for this project.")
|
2005-08-26 06:50:46 +00:00
|
|
|
);
|
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
} else {
|
|
|
|
if (wasSuspended != project->suspended_via_gui) {
|
|
|
|
// Disable Suspend / Resume button if the multiple selection
|
|
|
|
// has a mix of suspended and not suspended projects
|
2008-09-13 10:24:24 +00:00
|
|
|
enableSuspendResume = false;
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
2005-04-21 22:21:54 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
wasNoNewWork = project->dont_request_more_work;
|
2005-08-26 06:50:46 +00:00
|
|
|
if (project->dont_request_more_work) {
|
|
|
|
m_pTaskPane->UpdateTask(
|
2006-01-23 11:30:25 +00:00
|
|
|
pGroup->m_Tasks[BTN_NOWORK], _("Allow new tasks"), _("Allow fetching new tasks for this project.")
|
2005-08-26 06:50:46 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
m_pTaskPane->UpdateTask(
|
2006-01-23 11:30:25 +00:00
|
|
|
pGroup->m_Tasks[BTN_NOWORK], _("No new tasks"), _("Don't fetch new tasks for this project.")
|
2005-08-26 06:50:46 +00:00
|
|
|
);
|
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
} else {
|
|
|
|
if (wasNoNewWork != project->dont_request_more_work) {
|
|
|
|
// Disable Allow New Work / No New Work button if the multiple
|
|
|
|
// selection has a mix of Allow New Work and No New Work projects
|
2008-09-13 10:24:24 +00:00
|
|
|
enableNoNewTasks = false;
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
2005-04-21 22:21:54 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
|
|
|
|
if (project->attached_via_acct_mgr) {
|
2008-09-13 10:24:24 +00:00
|
|
|
enableDetach = false;
|
2006-02-14 21:47:18 +00:00
|
|
|
}
|
2008-09-13 10:24:24 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
|
2008-09-13 10:24:24 +00:00
|
|
|
if (n == 1) {
|
|
|
|
enableProperties = true;
|
|
|
|
|
|
|
|
UpdateWebsiteSelection(GRP_WEBSITES, project);
|
|
|
|
if(m_TaskGroups.size()>1) {
|
|
|
|
m_pTaskPane->EnableTaskGroupTasks(m_TaskGroups[1]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
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-22 01:46:32 +00:00
|
|
|
}
|
2005-04-27 06:32:40 +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_UPDATE]->m_pButton->Enable(enableUpdate);
|
|
|
|
pGroup->m_Tasks[BTN_SUSPEND]->m_pButton->Enable(enableSuspendResume);
|
|
|
|
pGroup->m_Tasks[BTN_NOWORK]->m_pButton->Enable(enableNoNewTasks);
|
|
|
|
pGroup->m_Tasks[BTN_RESET]->m_pButton->Enable(enableReset);
|
|
|
|
pGroup->m_Tasks[BTN_DETACH]->m_pButton->Enable(enableDetach);
|
|
|
|
pGroup->m_Tasks[BTN_PROPERTIES]->m_pButton->Enable(enableProperties);
|
|
|
|
|
2006-01-09 14:03:13 +00:00
|
|
|
CBOINCBaseView::PostUpdateSelection();
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
bool CViewProjects::SynchronizeCacheItem(wxInt32 iRowIndex, wxInt32 iColumnIndex) {
|
|
|
|
wxString strDocumentText = wxEmptyString;
|
2008-09-04 13:00:24 +00:00
|
|
|
wxString strDocumentText2 = wxEmptyString;
|
2008-06-26 11:49:43 +00:00
|
|
|
float fDocumentFloat = 0.0;
|
2008-10-17 06:54:05 +00:00
|
|
|
float fDocumentPercent = 0.0;
|
2008-10-14 12:35:48 +00:00
|
|
|
CProject* project;
|
2008-10-17 06:54:05 +00:00
|
|
|
bool dirty = false;
|
2008-10-14 12:35:48 +00:00
|
|
|
|
|
|
|
if (GetProjectCacheAtIndex(project, m_iSortedIndexes[iRowIndex])) {
|
|
|
|
return false;
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
strDocumentText.Empty();
|
|
|
|
|
|
|
|
switch (iColumnIndex) {
|
|
|
|
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(project->m_strProjectName) || !strDocumentText2.IsSameAs(project->m_strProjectURL)) {
|
2008-06-26 11:49:43 +00:00
|
|
|
project->m_strProjectName = strDocumentText;
|
2008-09-04 13:00:24 +00:00
|
|
|
project->m_strProjectURL = strDocumentText2;
|
2008-06-26 11:49:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocAccountName(m_iSortedIndexes[iRowIndex], strDocumentText);
|
2008-06-26 11:49:43 +00:00
|
|
|
if (!strDocumentText.IsSameAs(project->m_strAccountName)) {
|
|
|
|
project->m_strAccountName = strDocumentText;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocTeamName(m_iSortedIndexes[iRowIndex], strDocumentText);
|
2008-06-26 11:49:43 +00:00
|
|
|
if (!strDocumentText.IsSameAs(project->m_strTeamName)) {
|
|
|
|
project->m_strTeamName = strDocumentText;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocTotalCredit(m_iSortedIndexes[iRowIndex], fDocumentFloat);
|
2008-06-26 11:49:43 +00:00
|
|
|
if (fDocumentFloat != project->m_fTotalCredit) {
|
|
|
|
project->m_fTotalCredit = fDocumentFloat;
|
2008-09-08 09:11:56 +00:00
|
|
|
FormatTotalCredit(fDocumentFloat, project->m_strTotalCredit);
|
2008-06-26 11:49:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocAVGCredit(m_iSortedIndexes[iRowIndex], fDocumentFloat);
|
2008-06-26 11:49:43 +00:00
|
|
|
if (fDocumentFloat != project->m_fAVGCredit) {
|
|
|
|
project->m_fAVGCredit = fDocumentFloat;
|
2008-09-08 09:11:56 +00:00
|
|
|
FormatAVGCredit(fDocumentFloat, project->m_strAVGCredit);
|
2008-06-26 11:49:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocResourceShare(m_iSortedIndexes[iRowIndex], fDocumentFloat);
|
2008-06-26 11:49:43 +00:00
|
|
|
if (fDocumentFloat != project->m_fResourceShare) {
|
|
|
|
project->m_fResourceShare = fDocumentFloat;
|
2008-10-17 06:54:05 +00:00
|
|
|
dirty = true;
|
|
|
|
}
|
|
|
|
GetDocResourcePercent(m_iSortedIndexes[iRowIndex], fDocumentPercent);
|
|
|
|
if (fDocumentPercent != project->m_fResourcePercent) {
|
|
|
|
project->m_fResourcePercent = fDocumentPercent;
|
|
|
|
dirty = true;
|
|
|
|
}
|
|
|
|
if (dirty) {
|
|
|
|
FormatResourceShare(fDocumentFloat, fDocumentPercent, project->m_strResourceShare);
|
2008-06-26 11:49:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2008-06-27 10:05:47 +00:00
|
|
|
GetDocStatus(m_iSortedIndexes[iRowIndex], strDocumentText);
|
2008-06-26 11:49:43 +00:00
|
|
|
if (!strDocumentText.IsSameAs(project->m_strStatus)) {
|
|
|
|
project->m_strStatus = strDocumentText;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::GetDocProjectName(wxInt32 item, wxString& strBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
PROJECT* project = NULL;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-06-13 08:47:51 +00:00
|
|
|
std::string project_name;
|
2008-10-21 23:30:59 +00:00
|
|
|
|
|
|
|
if (pDoc) {
|
|
|
|
project = pDoc->project(item);
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project) {
|
|
|
|
project->get_name(project_name);
|
2008-09-08 09:11:56 +00:00
|
|
|
strBuffer = strBuffer = HtmlEntityDecode(wxString(project_name.c_str(), wxConvUTF8));
|
2008-06-26 11:49:43 +00:00
|
|
|
} else {
|
|
|
|
strBuffer = wxEmptyString;
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatProjectName(wxInt32 item, wxString& strBuffer) const {
|
2008-10-14 12:35:48 +00:00
|
|
|
CProject* project;
|
|
|
|
|
|
|
|
try {
|
|
|
|
project = m_ProjectCache.at(m_iSortedIndexes[item]);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
project = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (project) {
|
|
|
|
strBuffer = project->m_strProjectName;
|
|
|
|
} else {
|
|
|
|
strBuffer = wxEmptyString;
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
void CViewProjects::GetDocAccountName(wxInt32 item, wxString& strBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
PROJECT* project = NULL;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
if (pDoc) {
|
|
|
|
project = pDoc->project(item);
|
|
|
|
}
|
2005-06-13 08:47:51 +00:00
|
|
|
|
|
|
|
if (project) {
|
2008-09-08 09:11:56 +00:00
|
|
|
strBuffer = HtmlEntityDecode(wxString(project->user_name.c_str(), wxConvUTF8));
|
2008-06-26 11:49:43 +00:00
|
|
|
} else {
|
|
|
|
strBuffer = wxEmptyString;
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatAccountName(wxInt32 item, wxString& strBuffer) const {
|
2008-10-14 12:35:48 +00:00
|
|
|
CProject* project;
|
|
|
|
|
|
|
|
try {
|
|
|
|
project = m_ProjectCache.at(m_iSortedIndexes[item]);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
project = NULL;
|
|
|
|
}
|
|
|
|
if (project) {
|
|
|
|
strBuffer = project->m_strAccountName;
|
|
|
|
} else {
|
|
|
|
strBuffer = wxEmptyString;
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
void CViewProjects::GetDocTeamName(wxInt32 item, wxString& strBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
PROJECT* project = NULL;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
if (pDoc) {
|
|
|
|
project = pDoc->project(item);
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project) {
|
2008-09-08 09:11:56 +00:00
|
|
|
strBuffer = HtmlEntityDecode(wxString(project->team_name.c_str(), wxConvUTF8));
|
2008-06-26 11:49:43 +00:00
|
|
|
} else {
|
|
|
|
strBuffer = wxEmptyString;
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatTeamName(wxInt32 item, wxString& strBuffer) const {
|
2008-10-14 12:35:48 +00:00
|
|
|
CProject* project;
|
|
|
|
|
|
|
|
try {
|
|
|
|
project = m_ProjectCache.at(m_iSortedIndexes[item]);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
project = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (project) {
|
|
|
|
strBuffer = project->m_strTeamName;
|
|
|
|
} else {
|
|
|
|
strBuffer = wxEmptyString;
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
void CViewProjects::GetDocTotalCredit(wxInt32 item, float& fBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
PROJECT* project = NULL;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
if (pDoc) {
|
|
|
|
project = pDoc->project(item);
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project) {
|
2008-06-26 11:49:43 +00:00
|
|
|
fBuffer = project->user_total_credit;
|
|
|
|
} else {
|
|
|
|
fBuffer = 0.0;
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-08 09:11:56 +00:00
|
|
|
wxInt32 CViewProjects::FormatTotalCredit(float fBuffer, wxString& strBuffer) const {
|
|
|
|
strBuffer.Printf(wxT("%0.2f"), fBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
void CViewProjects::GetDocAVGCredit(wxInt32 item, float& fBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
PROJECT* project = NULL;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
if (pDoc) {
|
|
|
|
project = pDoc->project(item);
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project) {
|
2008-06-26 11:49:43 +00:00
|
|
|
fBuffer = project->user_expavg_credit;
|
|
|
|
} else {
|
|
|
|
fBuffer = 0.0;
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-08 09:11:56 +00:00
|
|
|
wxInt32 CViewProjects::FormatAVGCredit(float fBuffer, wxString& strBuffer) const {
|
|
|
|
strBuffer.Printf(wxT("%0.2f"), fBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
void CViewProjects::GetDocResourceShare(wxInt32 item, float& fBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
PROJECT* project = NULL;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
if (pDoc) {
|
|
|
|
project = pDoc->project(item);
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
if (project) {
|
|
|
|
fBuffer = project->resource_share;
|
|
|
|
} else {
|
|
|
|
fBuffer = 0.0;
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-17 06:54:05 +00:00
|
|
|
void CViewProjects::GetDocResourcePercent(wxInt32 item, float& fBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
PROJECT* project = NULL;
|
2008-10-17 06:54:05 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2008-10-21 23:30:59 +00:00
|
|
|
|
|
|
|
if (pDoc) {
|
|
|
|
project = pDoc->project(item);
|
|
|
|
}
|
|
|
|
|
2008-10-17 06:54:05 +00:00
|
|
|
if (project && pDoc) {
|
|
|
|
fBuffer = (project->resource_share / pDoc->m_fProjectTotalResourceShare) * 100;
|
|
|
|
} else {
|
|
|
|
fBuffer = 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatResourceShare(float fBuffer, float fBufferPercent, wxString& strBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
strBuffer.Printf(wxT("%0.0f (%0.2f%%)"), fBuffer, fBufferPercent);
|
2008-06-26 11:49:43 +00:00
|
|
|
|
|
|
|
return 0;
|
2008-06-24 10:52:12 +00:00
|
|
|
}
|
|
|
|
|
2011-03-06 22:09:51 +00:00
|
|
|
wxString rpc_reason_string_translated(int reason) {
|
|
|
|
switch (reason) {
|
|
|
|
case RPC_REASON_USER_REQ: return _("Requested by user");
|
|
|
|
case RPC_REASON_NEED_WORK: return _("To fetch work");
|
|
|
|
case RPC_REASON_RESULTS_DUE: return _("To report completed tasks");
|
|
|
|
case RPC_REASON_TRICKLE_UP: return _("To send trickle-up message");
|
|
|
|
case RPC_REASON_ACCT_MGR_REQ: return _("Requested by account manager");
|
|
|
|
case RPC_REASON_INIT: return _("Project initialization");
|
|
|
|
case RPC_REASON_PROJECT_REQ: return _("Requested by project");
|
|
|
|
default: return _("Unknown reason");
|
|
|
|
}
|
|
|
|
}
|
2008-06-24 10:52:12 +00:00
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
void CViewProjects::GetDocStatus(wxInt32 item, wxString& strBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
PROJECT* project = NULL;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
if (pDoc) {
|
|
|
|
project = pDoc->project(item);
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project) {
|
|
|
|
if (project->suspended_via_gui) {
|
2008-06-26 11:49:43 +00:00
|
|
|
append_to_status(strBuffer, _("Suspended by user"));
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
|
|
|
if (project->dont_request_more_work) {
|
2008-06-26 11:49:43 +00:00
|
|
|
append_to_status(strBuffer, _("Won't get new tasks"));
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2007-05-24 16:07:21 +00:00
|
|
|
if (project->ended) {
|
2010-08-01 04:17:04 +00:00
|
|
|
append_to_status(strBuffer, _("Project ended - OK to remove"));
|
2007-05-24 16:07:21 +00:00
|
|
|
}
|
2007-03-23 18:51:08 +00:00
|
|
|
if (project->detach_when_done) {
|
2010-08-01 04:17:04 +00:00
|
|
|
append_to_status(strBuffer, _("Will remove when tasks done"));
|
2007-03-23 18:51:08 +00:00
|
|
|
}
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project->sched_rpc_pending) {
|
2008-06-26 11:49:43 +00:00
|
|
|
append_to_status(strBuffer, _("Scheduler request pending"));
|
2011-03-06 22:09:51 +00:00
|
|
|
append_to_status(strBuffer,
|
|
|
|
rpc_reason_string_translated(project->sched_rpc_pending)
|
|
|
|
);
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2007-05-11 18:27:16 +00:00
|
|
|
if (project->scheduler_rpc_in_progress) {
|
2008-06-26 11:49:43 +00:00
|
|
|
append_to_status(strBuffer, _("Scheduler request in progress"));
|
2007-05-11 18:27:16 +00:00
|
|
|
}
|
2010-05-07 20:41:43 +00:00
|
|
|
if (project->trickle_up_pending) {
|
2010-06-25 21:38:39 +00:00
|
|
|
append_to_status(strBuffer, _("Trickle up message pending"));
|
2010-05-07 20:41:43 +00:00
|
|
|
}
|
2005-06-13 08:47:51 +00:00
|
|
|
wxDateTime dtNextRPC((time_t)project->min_rpc_time);
|
|
|
|
wxDateTime dtNow(wxDateTime::Now());
|
|
|
|
if (dtNextRPC > dtNow) {
|
|
|
|
wxTimeSpan tsNextRPC(dtNextRPC - dtNow);
|
2008-06-26 11:49:43 +00:00
|
|
|
append_to_status(strBuffer, _("Communication deferred ") + tsNextRPC.Format());
|
2005-06-13 08:47:51 +00:00
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
}
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatStatus(wxInt32 item, wxString& strBuffer) const {
|
2008-10-14 12:35:48 +00:00
|
|
|
CProject* project;
|
|
|
|
|
|
|
|
try {
|
|
|
|
project = m_ProjectCache.at(m_iSortedIndexes[item]);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
project = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (project) {
|
|
|
|
strBuffer = project->m_strStatus;
|
|
|
|
} else {
|
|
|
|
strBuffer = wxEmptyString;
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2008-09-04 13:00:24 +00:00
|
|
|
void CViewProjects::GetDocProjectURL(wxInt32 item, wxString& strBuffer) const {
|
2008-10-21 23:30:59 +00:00
|
|
|
PROJECT* project = NULL;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
if (pDoc) {
|
|
|
|
project = pDoc->project(item);
|
|
|
|
}
|
2008-09-04 13:00:24 +00:00
|
|
|
|
|
|
|
if (project) {
|
2010-03-12 17:47:17 +00:00
|
|
|
strBuffer = wxString(project->master_url, wxConvUTF8);
|
2008-09-04 13:00:24 +00:00
|
|
|
} else {
|
|
|
|
strBuffer = wxEmptyString;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-26 11:49:43 +00:00
|
|
|
double CViewProjects::GetProgressValue(long item) {
|
2008-10-14 12:35:48 +00:00
|
|
|
CProject* project;
|
2008-06-26 11:49:43 +00:00
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
try {
|
|
|
|
project = m_ProjectCache.at(m_iSortedIndexes[item]);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
project = NULL;
|
|
|
|
}
|
|
|
|
|
2008-10-17 06:54:05 +00:00
|
|
|
if (project) {
|
|
|
|
return (project->m_fResourcePercent) / 100.0;
|
2008-06-26 11:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-06 11:33:28 +00:00
|
|
|
wxString CViewProjects::GetProgressText( long item) {
|
|
|
|
CProject* project = NULL;
|
|
|
|
wxString strBuffer = wxEmptyString;
|
|
|
|
|
|
|
|
try {
|
|
|
|
project = m_ProjectCache.at(m_iSortedIndexes[item]);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
project = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (project) {
|
|
|
|
strBuffer = project->m_strResourceShare;
|
|
|
|
}
|
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
bool CViewProjects::IsWebsiteLink(const wxString& strLink) {
|
2004-10-09 03:05:01 +00:00
|
|
|
bool bReturnValue = false;
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
if (strLink.StartsWith(wxT("web:")))
|
2004-10-09 03:05:01 +00:00
|
|
|
bReturnValue = true;
|
|
|
|
|
|
|
|
return bReturnValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::ConvertWebsiteIndexToLink(wxInt32 iProjectIndex, wxInt32 iWebsiteIndex, wxString& strLink) {
|
2005-04-20 22:22:41 +00:00
|
|
|
strLink.Printf(wxT("web:%d:%d"), iProjectIndex, iWebsiteIndex);
|
2004-10-09 03:05:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::ConvertLinkToWebsiteIndex(const wxString& strLink, wxInt32& iProjectIndex, wxInt32& iWebsiteIndex) {
|
2004-10-09 03:05:01 +00:00
|
|
|
wxString strTemplate = strLink;
|
|
|
|
wxString strBuffer = wxEmptyString;
|
2013-02-26 19:35:33 +00:00
|
|
|
long lProjectIndex, lWebsiteIndex;
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
strTemplate.Replace(wxT("web:"), wxEmptyString);
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
strBuffer = strTemplate;
|
2005-04-07 07:04:50 +00:00
|
|
|
strBuffer.Remove(strBuffer.Find(wxT(":")));
|
2013-02-26 19:35:33 +00:00
|
|
|
strBuffer.ToLong((long*) &lProjectIndex);
|
|
|
|
iProjectIndex = lProjectIndex;
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
strBuffer = strTemplate;
|
2005-04-07 07:04:50 +00:00
|
|
|
strBuffer = strBuffer.Mid(strBuffer.Find(wxT(":")) + 1);
|
2013-02-26 19:35:33 +00:00
|
|
|
strBuffer.ToLong((long*) &lWebsiteIndex);
|
|
|
|
iWebsiteIndex = lWebsiteIndex;
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-10-14 12:35:48 +00:00
|
|
|
int CViewProjects::GetProjectCacheAtIndex(CProject*& projectPtr, int index) {
|
|
|
|
try {
|
|
|
|
projectPtr = m_ProjectCache.at(index);
|
|
|
|
} catch ( std::out_of_range ) {
|
|
|
|
projectPtr = NULL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|