2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-09-21 01:30:29 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2004-09-21 01:30:29 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2004-09-21 01:30:29 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "ViewProjects.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "MainDocument.h"
|
2004-09-24 22:19:02 +00:00
|
|
|
#include "BOINCTaskCtrl.h"
|
|
|
|
#include "BOINCListCtrl.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "ViewProjects.h"
|
2004-09-22 21:53:07 +00:00
|
|
|
#include "DlgAttachProject.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "Events.h"
|
|
|
|
|
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
|
|
|
|
#define BTN_UPDATE_ALL 1
|
|
|
|
#define BTN_SUSPEND 2
|
|
|
|
#define BTN_NOWORK 3
|
|
|
|
#define BTN_RESET 4
|
|
|
|
#define BTN_DETACH 5
|
|
|
|
#define BTN_ATTACH 6
|
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() {
|
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_strTotalCredit.Clear();
|
|
|
|
m_strAVGCredit.Clear();
|
|
|
|
m_strResourceShare.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)
|
2005-06-24 10:49:42 +00:00
|
|
|
EVT_BUTTON(ID_TASK_PROJECT_UPDATE_ALL, CViewProjects::OnProjectUpdateAll)
|
2005-04-20 22:22:41 +00:00
|
|
|
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)
|
|
|
|
EVT_BUTTON(ID_TASK_PROJECT_ATTACH, CViewProjects::OnProjectAttach)
|
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)
|
2005-04-20 22:22:41 +00:00
|
|
|
END_EVENT_TABLE ()
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CViewProjects::CViewProjects() {}
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
CViewProjects::CViewProjects(wxNotebook* pNotebook) :
|
2005-04-21 06:04:26 +00:00
|
|
|
CBOINCBaseView(pNotebook, ID_TASK_PROJECTSVIEW, DEFAULT_TASK_FLAGS, ID_LIST_PROJECTSVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS)
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2005-04-20 22:22:41 +00:00
|
|
|
CTaskItemGroup* pGroup = NULL;
|
|
|
|
CTaskItem* pItem = NULL;
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
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
|
|
|
//
|
2005-04-20 22:22:41 +00:00
|
|
|
pGroup = new CTaskItemGroup( _("Tasks") );
|
|
|
|
m_TaskGroups.push_back( pGroup );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
2005-04-21 23:53:39 +00:00
|
|
|
_("Update"),
|
|
|
|
_("Report all completed work, get latest credit, "
|
|
|
|
"get latest preferences, and possibly get more work."),
|
2005-04-20 22:22:41 +00:00
|
|
|
ID_TASK_PROJECT_UPDATE
|
|
|
|
);
|
2005-06-24 10:49:42 +00:00
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
|
|
|
_("Update All"),
|
|
|
|
_("Report all upload items, completed work, get latest credit, "
|
|
|
|
"get latest preferences, and possibly get more work."),
|
|
|
|
ID_TASK_PROJECT_UPDATE_ALL
|
|
|
|
);
|
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
|
|
|
pItem = new CTaskItem(
|
2005-04-21 23:53:39 +00:00
|
|
|
_("Suspend"),
|
2005-04-27 06:32:40 +00:00
|
|
|
_("Suspend work for this project."),
|
2005-04-20 22:22:41 +00:00
|
|
|
ID_TASK_PROJECT_SUSPEND
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
2005-04-27 06:32:40 +00:00
|
|
|
_("No new work"),
|
|
|
|
_("Don't fetch new work 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
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pItem = new CTaskItem(
|
|
|
|
_("Reset project"),
|
|
|
|
_("Delete all files and work associated with this project, "
|
|
|
|
"and get new work. "
|
|
|
|
"You can update the project "
|
|
|
|
"first to report any completed work."),
|
|
|
|
ID_TASK_PROJECT_RESET
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
2004-12-23 01:06:41 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pItem = new CTaskItem(
|
2005-04-21 23:53:39 +00:00
|
|
|
_("Detach"),
|
2005-04-20 22:22:41 +00:00
|
|
|
_("Detach this computer from this project. "
|
2004-12-23 01:06:41 +00:00
|
|
|
"Work in progress will be lost. "
|
|
|
|
"You can update the project first to report "
|
2005-04-20 22:22:41 +00:00
|
|
|
"any completed work."),
|
|
|
|
ID_TASK_PROJECT_DETACH
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
2004-12-23 01:06:41 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pItem = new CTaskItem(
|
|
|
|
_("Attach to new project"),
|
|
|
|
_("Attach this computer to a BOINC project. "
|
|
|
|
"You'll need a project URL and account key "
|
|
|
|
"(visit the project's web site to get these)."),
|
|
|
|
ID_TASK_PROJECT_ATTACH
|
|
|
|
);
|
|
|
|
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);
|
2004-12-19 20:35:37 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_TOTALCREDIT, _("Total credit"), wxLIST_FORMAT_RIGHT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_AVGCREDIT, _("Avg. credit"), wxLIST_FORMAT_RIGHT, 80);
|
|
|
|
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
|
|
|
|
|
|
|
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-04-07 07:04:50 +00:00
|
|
|
wxString CViewProjects::GetViewName() {
|
2004-09-21 01:30:29 +00:00
|
|
|
return wxString(_("Projects"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
const char** CViewProjects::GetViewIcon() {
|
2004-09-21 01:30:29 +00:00
|
|
|
return proj_xpm;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
void CViewProjects::OnProjectUpdate( wxCommandEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectUpdate - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
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);
|
2005-04-20 22:22:41 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Updating project..."));
|
|
|
|
pDoc->ProjectUpdate(m_pListPane->GetFirstSelected());
|
|
|
|
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-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectUpdate - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-24 10:49:42 +00:00
|
|
|
void CViewProjects::OnProjectUpdateAll( wxCommandEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectUpdateAll - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
|
|
|
wxASSERT(pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Updating all project(s)..."));
|
|
|
|
pDoc->rpc.network_available();
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
pFrame->FireRefreshView();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectUpdateAll - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
void CViewProjects::OnProjectSuspend( wxCommandEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectSuspend - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
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);
|
2005-04-20 22:22:41 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-21 23:53:39 +00:00
|
|
|
PROJECT* project = pDoc->project(m_pListPane->GetFirstSelected());
|
|
|
|
if (project->suspended_via_gui) {
|
|
|
|
pFrame->UpdateStatusText(_("Resuming project..."));
|
|
|
|
pDoc->ProjectResume(m_pListPane->GetFirstSelected());
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
} else {
|
|
|
|
pFrame->UpdateStatusText(_("Suspending project..."));
|
|
|
|
pDoc->ProjectSuspend(m_pListPane->GetFirstSelected());
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
}
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
2005-05-05 06:07:14 +00:00
|
|
|
pFrame->FireRefreshView();
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectSuspend - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::OnProjectNoNewWork( wxCommandEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectNoNewWork - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
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);
|
2005-04-20 22:22:41 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-21 23:53:39 +00:00
|
|
|
PROJECT* project = pDoc->project(m_pListPane->GetFirstSelected());
|
|
|
|
if (project->dont_request_more_work) {
|
|
|
|
pFrame->UpdateStatusText(_("Telling project to allow additional work downloads..."));
|
|
|
|
pDoc->ProjectAllowMoreWork(m_pListPane->GetFirstSelected());
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
} else {
|
|
|
|
pFrame->UpdateStatusText(_("Telling project to not fetch additional work..."));
|
|
|
|
pDoc->ProjectNoMoreWork(m_pListPane->GetFirstSelected());
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
}
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
2005-05-05 06:07:14 +00:00
|
|
|
pFrame->FireRefreshView();
|
2005-04-21 23:14:10 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectNoNewWork - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::OnProjectReset( wxCommandEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectReset - Function Begin"));
|
|
|
|
|
|
|
|
wxInt32 iAnswer = 0;
|
2005-04-27 06:55:28 +00:00
|
|
|
std::string strProjectName;
|
2005-04-20 22:22:41 +00:00
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
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);
|
2005-04-20 22:22:41 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Resetting project..."));
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
PROJECT* project = pDoc->project(m_pListPane->GetFirstSelected());
|
|
|
|
project->get_name(strProjectName);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
|
|
|
strMessage.Printf(
|
|
|
|
_("Are you sure you want to reset project '%s'?"),
|
2005-04-27 06:55:28 +00:00
|
|
|
strProjectName.c_str()
|
|
|
|
);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
2005-06-24 10:49:42 +00:00
|
|
|
iAnswer = ::wxMessageBox(
|
2005-04-20 22:22:41 +00:00
|
|
|
strMessage,
|
|
|
|
_("Reset Project"),
|
2005-06-24 10:49:42 +00:00
|
|
|
wxYES_NO | wxICON_QUESTION,
|
2005-04-20 22:22:41 +00:00
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
if (wxYES == iAnswer) {
|
|
|
|
pDoc->ProjectReset(m_pListPane->GetFirstSelected());
|
|
|
|
}
|
|
|
|
|
|
|
|
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-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectReset - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::OnProjectDetach( wxCommandEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectDetach - Function Begin"));
|
|
|
|
|
|
|
|
wxInt32 iAnswer = 0;
|
2005-04-27 06:55:28 +00:00
|
|
|
std::string strProjectName;
|
2005-04-20 22:22:41 +00:00
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
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);
|
2005-04-20 22:22:41 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Detaching from project..."));
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
PROJECT* project = pDoc->project(m_pListPane->GetFirstSelected());
|
|
|
|
project->get_name(strProjectName);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
|
|
|
strMessage.Printf(
|
|
|
|
_("Are you sure you want to detach from project '%s'?"),
|
|
|
|
strProjectName.c_str()
|
|
|
|
);
|
|
|
|
|
2005-06-24 10:49:42 +00:00
|
|
|
iAnswer = ::wxMessageBox(
|
2005-04-20 22:22:41 +00:00
|
|
|
strMessage,
|
|
|
|
_("Detach from Project"),
|
2005-06-24 10:49:42 +00:00
|
|
|
wxYES_NO | wxICON_QUESTION,
|
2005-04-20 22:22:41 +00:00
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
if (wxYES == iAnswer) {
|
|
|
|
pDoc->ProjectDetach(m_pListPane->GetFirstSelected());
|
|
|
|
}
|
|
|
|
|
|
|
|
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-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectDetach - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::OnProjectAttach( wxCommandEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectAttach - Function Begin"));
|
|
|
|
|
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
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);
|
2005-04-20 22:22:41 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Attaching to project..."));
|
|
|
|
|
|
|
|
CDlgAttachProject* pDlg = new CDlgAttachProject(this);
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDlg);
|
2005-04-20 22:22:41 +00:00
|
|
|
|
|
|
|
iAnswer = pDlg->ShowModal();
|
|
|
|
|
|
|
|
if (wxID_OK == iAnswer) {
|
|
|
|
pDoc->ProjectAttach(
|
|
|
|
pDlg->GetProjectAddress(),
|
|
|
|
pDlg->GetProjectAccountKey()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pDlg)
|
|
|
|
pDlg->Destroy();
|
|
|
|
|
|
|
|
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-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectAttach - Function End"));
|
|
|
|
}
|
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
|
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
|
|
|
|
2005-04-22 01:46:32 +00:00
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
2004-10-26 08:41:02 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pFrame);
|
2005-04-22 01:46:32 +00:00
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(m_pTaskPane);
|
|
|
|
wxASSERT(m_pListPane);
|
2004-10-26 08:41:02 +00:00
|
|
|
|
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;
|
|
|
|
pFrame->ExecuteBrowserLink(
|
|
|
|
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() {
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-04-21 23:14:10 +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-04-21 23:14:10 +00:00
|
|
|
|
2005-04-22 01:46:32 +00:00
|
|
|
return pDoc->GetProjectCount();
|
2005-04-21 23:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxString CViewProjects::OnListGetItemText(long item, long column) const {
|
|
|
|
CProject* project = m_ProjectCache.at(item);
|
2004-12-02 07:43:47 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
2004-10-21 21:19:49 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
switch(column) {
|
2005-04-17 02:10:52 +00:00
|
|
|
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:
|
|
|
|
strBuffer = project->m_strResourceShare;
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
|
|
|
strBuffer = project->m_strStatus;
|
|
|
|
break;
|
2004-12-02 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxString CViewProjects::OnDocGetItemText(long item, long column) const {
|
2004-12-02 07:43:47 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
switch(column) {
|
2005-04-17 02:10:52 +00:00
|
|
|
case COLUMN_PROJECT:
|
2005-06-13 08:47:51 +00:00
|
|
|
FormatProjectName(item, strBuffer);
|
2005-04-17 02:10:52 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
|
|
|
FormatAccountName(item, strBuffer);
|
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
|
|
|
FormatTeamName(item, strBuffer);
|
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
|
|
|
FormatTotalCredit(item, strBuffer);
|
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
|
|
|
FormatAVGCredit(item, strBuffer);
|
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
|
|
|
FormatResourceShare(item, strBuffer);
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
|
|
|
FormatStatus(item, strBuffer);
|
|
|
|
break;
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
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);
|
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();
|
2004-12-02 07:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::GetCacheCount() {
|
2005-01-29 00:58:43 +00:00
|
|
|
return m_ProjectCache.size();
|
2004-12-02 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::RemoveCacheElement() {
|
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);
|
2004-12-02 07:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::UpdateCache(long item, long column, wxString& strNewData) {
|
|
|
|
CProject* project = m_ProjectCache.at(item);
|
2004-12-02 07:43:47 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
switch(column) {
|
2005-06-13 08:47:51 +00:00
|
|
|
case COLUMN_PROJECT:
|
|
|
|
project->m_strProjectName = strNewData;
|
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
|
|
|
project->m_strAccountName = strNewData;
|
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
|
|
|
project->m_strTeamName = strNewData;
|
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
|
|
|
project->m_strTotalCredit = strNewData;
|
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
|
|
|
project->m_strAVGCredit = strNewData;
|
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
|
|
|
project->m_strResourceShare = strNewData;
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
|
|
|
project->m_strStatus = strNewData;
|
|
|
|
break;
|
2004-12-02 07:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CViewProjects::UpdateSelection() {
|
2005-04-27 06:32:40 +00:00
|
|
|
unsigned int i;
|
2005-04-22 01:46:32 +00:00
|
|
|
CTaskItemGroup* pGroup = NULL;
|
|
|
|
CTaskItem* pItem = NULL;
|
|
|
|
PROJECT* project = NULL;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2005-04-22 01:46:32 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-04-27 06:32:40 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
2005-04-22 01:46:32 +00:00
|
|
|
|
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];
|
2005-04-27 06:32:40 +00:00
|
|
|
if (m_pListPane->GetSelectedItemCount()) {
|
2005-04-22 01:46:32 +00:00
|
|
|
project = pDoc->project(m_pListPane->GetFirstSelected());
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_UPDATE]);
|
2005-06-24 10:49:42 +00:00
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_UPDATE_ALL]);
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_SUSPEND]);
|
2005-04-21 22:21:54 +00:00
|
|
|
if (project->suspended_via_gui) {
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->UpdateTask(
|
|
|
|
pGroup->m_Tasks[BTN_SUSPEND], _("Resume"), _("Resume work for this project.")
|
|
|
|
);
|
2005-04-21 22:21:54 +00:00
|
|
|
} else {
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->UpdateTask(
|
|
|
|
pGroup->m_Tasks[BTN_SUSPEND], _("Suspend"), _("Suspend work for this project.")
|
|
|
|
);
|
2005-04-21 22:21:54 +00:00
|
|
|
}
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_NOWORK]);
|
2005-04-21 22:21:54 +00:00
|
|
|
if (project->dont_request_more_work) {
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->UpdateTask(
|
|
|
|
pGroup->m_Tasks[BTN_NOWORK], _("Allow new work"), _("Allow fetching new work for this project.")
|
|
|
|
);
|
2005-04-21 22:21:54 +00:00
|
|
|
} else {
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->UpdateTask(
|
|
|
|
pGroup->m_Tasks[BTN_NOWORK], _("No new work"), _("Don't fetch new work for this project.")
|
|
|
|
);
|
2005-04-21 22:21:54 +00:00
|
|
|
}
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_RESET]);
|
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_DETACH]);
|
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_ATTACH]);
|
|
|
|
} else {
|
|
|
|
m_pTaskPane->DisableTaskGroupTasks(pGroup);
|
2005-06-24 10:49:42 +00:00
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_UPDATE_ALL]);
|
2005-04-27 06:32:40 +00:00
|
|
|
m_pTaskPane->EnableTask(pGroup->m_Tasks[BTN_ATTACH]);
|
2005-04-21 22:21:54 +00:00
|
|
|
}
|
2005-04-22 01:46:32 +00:00
|
|
|
|
|
|
|
// Update the websites list
|
2005-04-27 06:32:40 +00:00
|
|
|
//
|
|
|
|
if (m_TaskGroups.size() > 1) {
|
|
|
|
|
|
|
|
// Delete task group, objects, and controls.
|
|
|
|
pGroup = m_TaskGroups[1];
|
|
|
|
|
|
|
|
m_pTaskPane->DeleteTaskGroupAndTasks(pGroup);
|
|
|
|
for (i=0; i<pGroup->m_Tasks.size(); i++) {
|
|
|
|
delete pGroup->m_Tasks[i];
|
|
|
|
}
|
|
|
|
pGroup->m_Tasks.clear();
|
|
|
|
delete pGroup;
|
|
|
|
|
|
|
|
pGroup = NULL;
|
|
|
|
|
|
|
|
m_TaskGroups.erase( m_TaskGroups.begin() + 1 );
|
2005-04-22 01:46:32 +00:00
|
|
|
}
|
2005-04-27 06:32:40 +00:00
|
|
|
|
|
|
|
// If something is selected create the tasks and controls
|
2005-04-22 01:46:32 +00:00
|
|
|
if (m_pListPane->GetSelectedItemCount()) {
|
|
|
|
project = pDoc->project(m_pListPane->GetFirstSelected());
|
|
|
|
|
2005-04-27 06:32:40 +00:00
|
|
|
// Create the web sites task group
|
|
|
|
pGroup = new CTaskItemGroup( _("Web sites") );
|
|
|
|
m_TaskGroups.push_back( pGroup );
|
2005-04-22 01:46:32 +00:00
|
|
|
|
|
|
|
// Default project url
|
2005-04-27 06:32:40 +00:00
|
|
|
pItem = new CTaskItem(
|
|
|
|
project->project_name.c_str(),
|
|
|
|
wxT(""),
|
|
|
|
project->master_url.c_str(),
|
|
|
|
ID_TASK_PROJECT_WEB_PROJDEF_MIN
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back(pItem);
|
2005-04-22 01:46:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Project defined urls
|
2005-04-27 06:32:40 +00:00
|
|
|
for (i=0;(i<project->gui_urls.size())&&(i<=ID_TASK_PROJECT_WEB_PROJDEF_MAX);i++) {
|
|
|
|
pItem = new CTaskItem(
|
|
|
|
project->gui_urls[i].name.c_str(),
|
|
|
|
project->gui_urls[i].description.c_str(),
|
|
|
|
project->gui_urls[i].url.c_str(),
|
|
|
|
ID_TASK_PROJECT_WEB_PROJDEF_MIN + 1 + i
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back(pItem);
|
2005-04-22 01:46:32 +00:00
|
|
|
}
|
|
|
|
}
|
2005-04-27 06:32:40 +00:00
|
|
|
|
|
|
|
m_pTaskPane->UpdateControls();
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
wxInt32 CViewProjects::FormatProjectName(wxInt32 item, wxString& strBuffer) const {
|
|
|
|
PROJECT* project = wxGetApp().GetDocument()->project(item);
|
|
|
|
std::string project_name;
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project) {
|
|
|
|
project->get_name(project_name);
|
|
|
|
strBuffer = wxString(project_name.c_str());
|
|
|
|
}
|
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
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatAccountName(wxInt32 item, wxString& strBuffer) const {
|
|
|
|
PROJECT* project = wxGetApp().GetDocument()->project(item);
|
|
|
|
|
|
|
|
if (project) {
|
|
|
|
strBuffer = wxString(project->user_name.c_str());
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::FormatTeamName(wxInt32 item, wxString& strBuffer) const {
|
2005-06-13 08:47:51 +00:00
|
|
|
PROJECT* project = wxGetApp().GetDocument()->project(item);
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project) {
|
|
|
|
strBuffer = wxString(project->team_name.c_str());
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::FormatTotalCredit(wxInt32 item, wxString& strBuffer) const {
|
2005-06-13 08:47:51 +00:00
|
|
|
PROJECT* project = wxGetApp().GetDocument()->project(item);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project) {
|
|
|
|
strBuffer.Printf(wxT("%0.2f"), project->user_total_credit);
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::FormatAVGCredit(wxInt32 item, wxString& strBuffer) const {
|
2005-06-13 08:47:51 +00:00
|
|
|
PROJECT* project = wxGetApp().GetDocument()->project(item);
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project) {
|
|
|
|
strBuffer.Printf(wxT("%0.2f"), project->user_expavg_credit);
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::FormatResourceShare(wxInt32 item, wxString& strBuffer) const {
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-06-13 08:47:51 +00:00
|
|
|
PROJECT* project = wxGetApp().GetDocument()->project(item);
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-04-27 06:55:28 +00:00
|
|
|
wxASSERT(pDoc);
|
2004-10-09 03:05:01 +00:00
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
if (project && pDoc) {
|
|
|
|
strBuffer.Printf(wxT("%0.0f (%0.2f%%)"),
|
|
|
|
project->resource_share,
|
|
|
|
((project->resource_share / pDoc->m_fProjectTotalResourceShare) * 100)
|
|
|
|
);
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-10 19:38:48 +00:00
|
|
|
wxInt32 CViewProjects::FormatStatus(wxInt32 item, wxString& status) const {
|
2005-06-13 08:47:51 +00:00
|
|
|
PROJECT* project = wxGetApp().GetDocument()->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) {
|
|
|
|
append_to_status(status, _("Suspended by user"));
|
|
|
|
}
|
|
|
|
if (project->dont_request_more_work) {
|
|
|
|
append_to_status(status, _("Won't get new work"));
|
|
|
|
}
|
|
|
|
if (project->sched_rpc_pending) {
|
|
|
|
append_to_status(status, _("Scheduler request pending"));
|
|
|
|
}
|
|
|
|
wxDateTime dtNextRPC((time_t)project->min_rpc_time);
|
|
|
|
wxDateTime dtNow(wxDateTime::Now());
|
|
|
|
if (dtNextRPC > dtNow) {
|
|
|
|
wxTimeSpan tsNextRPC(dtNextRPC - dtNow);
|
|
|
|
append_to_status(status, _("Communication deferred ") + tsNextRPC.Format());
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
|
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;
|
|
|
|
|
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(":")));
|
|
|
|
strBuffer.ToLong((long*) &iProjectIndex);
|
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);
|
|
|
|
strBuffer.ToLong((long*) &iWebsiteIndex);
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_b4edf777fc = "$Id$";
|