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-21 22:21:54 +00:00
|
|
|
// buttons in the "tasks" area
|
|
|
|
#define BTN_UPDATE 0
|
|
|
|
#define BTN_SUSPEND 1
|
|
|
|
#define BTN_NOWORK 2
|
|
|
|
#define BTN_RESET 3
|
|
|
|
#define BTN_DETACH 4
|
|
|
|
#define BTN_ATTACH 5
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
CProject::CProject() {
|
2004-12-02 07:43:47 +00:00
|
|
|
m_strProjectName = wxEmptyString;
|
|
|
|
m_strAccountName = wxEmptyString;
|
|
|
|
m_strTeamName = wxEmptyString;
|
|
|
|
m_strTotalCredit = wxEmptyString;
|
|
|
|
m_strAVGCredit = wxEmptyString;
|
|
|
|
m_strResourceShare = wxEmptyString;
|
|
|
|
m_strStatus = wxEmptyString;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
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-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;
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
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
|
|
|
|
);
|
|
|
|
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-20 22:22:41 +00:00
|
|
|
_("Stop work for this project "
|
|
|
|
"(you can resume later)."),
|
|
|
|
ID_TASK_PROJECT_SUSPEND
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
|
|
|
|
|
|
|
pItem = new CTaskItem(
|
|
|
|
_("Don't Get New Work"),
|
|
|
|
_("Tell the project to not "
|
|
|
|
"fetch additional work for this "
|
|
|
|
"project. Any work already downloaded will "
|
|
|
|
"still be processed and returned."),
|
|
|
|
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
|
|
|
pGroup = new CTaskItemGroup( _("Web sites") );
|
|
|
|
m_TaskGroups.push_back( pGroup );
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pItem = new CTaskItem(
|
|
|
|
_("BOINC"),
|
|
|
|
_("Open the BOINC home page in a web browser."),
|
|
|
|
ID_TASK_PROJECT_WEB_BOINC
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
pItem = new CTaskItem(
|
|
|
|
_("Project"),
|
|
|
|
_("Open this project's home page in a web browser."),
|
|
|
|
ID_TASK_PROJECT_WEB_PROJECT
|
|
|
|
);
|
|
|
|
pGroup->m_Tasks.push_back( pItem );
|
2004-09-21 01:30:29 +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();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Updating project..."));
|
|
|
|
pDoc->ProjectUpdate(m_pListPane->GetFirstSelected());
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
|
|
|
pFrame->ProcessRefreshView();
|
|
|
|
|
2005-04-20 22:22:41 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectUpdate - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::OnProjectSuspend( wxCommandEvent& event ) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnProjectSuspend - Function Begin"));
|
|
|
|
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
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();
|
|
|
|
pFrame->ProcessRefreshView();
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
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();
|
|
|
|
pFrame->ProcessRefreshView();
|
|
|
|
|
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;
|
|
|
|
wxString strProjectName = wxEmptyString;
|
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Resetting project..."));
|
|
|
|
|
|
|
|
pDoc->GetProjectProjectName(m_pListPane->GetFirstSelected(), strProjectName);
|
|
|
|
|
|
|
|
strMessage.Printf(
|
|
|
|
_("Are you sure you want to reset project '%s'?"),
|
|
|
|
strProjectName.c_str());
|
|
|
|
|
|
|
|
iAnswer = wxMessageBox(
|
|
|
|
strMessage,
|
|
|
|
_("Reset Project"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
if (wxYES == iAnswer) {
|
|
|
|
pDoc->ProjectReset(m_pListPane->GetFirstSelected());
|
|
|
|
}
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
|
|
|
pFrame->ProcessRefreshView();
|
|
|
|
|
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;
|
|
|
|
wxString strProjectName = wxEmptyString;
|
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Detaching from project..."));
|
|
|
|
|
|
|
|
pDoc->GetProjectProjectName(m_pListPane->GetFirstSelected(), strProjectName);
|
|
|
|
|
|
|
|
strMessage.Printf(
|
|
|
|
_("Are you sure you want to detach from project '%s'?"),
|
|
|
|
strProjectName.c_str()
|
|
|
|
);
|
|
|
|
|
|
|
|
iAnswer = wxMessageBox(
|
|
|
|
strMessage,
|
|
|
|
_("Detach from Project"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
if (wxYES == iAnswer) {
|
|
|
|
pDoc->ProjectDetach(m_pListPane->GetFirstSelected());
|
|
|
|
}
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(wxT(""));
|
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
UpdateSelection();
|
|
|
|
pFrame->ProcessRefreshView();
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText(_("Attaching to project..."));
|
|
|
|
|
|
|
|
CDlgAttachProject* pDlg = new CDlgAttachProject(this);
|
|
|
|
wxASSERT(NULL != pDlg);
|
|
|
|
|
|
|
|
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();
|
|
|
|
pFrame->ProcessRefreshView();
|
|
|
|
|
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-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::GetDocCount() {
|
2004-10-26 08:41:02 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
return pDoc->GetProjectCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-21 23:14:10 +00:00
|
|
|
void CViewProjects::OnListSelected(wxListEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnListSelected - Function Begin"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
event.Skip();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnListSelected - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::OnListDeselected(wxListEvent& event) {
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnListDeselected - Function Begin"));
|
|
|
|
|
|
|
|
UpdateSelection();
|
|
|
|
event.Skip();
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnListDeselected - Function End"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
FormatProjectName(item, strBuffer);
|
|
|
|
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-07 07:04:50 +00:00
|
|
|
wxASSERT(NULL != pItem);
|
|
|
|
if (NULL != pItem) {
|
|
|
|
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) {
|
2004-12-02 07:43:47 +00:00
|
|
|
case COLUMN_PROJECT:
|
2005-03-15 23:44:48 +00:00
|
|
|
project->m_strProjectName = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
2005-03-15 23:44:48 +00:00
|
|
|
project->m_strAccountName = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
2005-03-15 23:44:48 +00:00
|
|
|
project->m_strTeamName = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
2005-03-15 23:44:48 +00:00
|
|
|
project->m_strTotalCredit = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
2005-03-15 23:44:48 +00:00
|
|
|
project->m_strAVGCredit = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
2005-03-15 23:44:48 +00:00
|
|
|
project->m_strResourceShare = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2005-03-15 23:44:48 +00:00
|
|
|
project->m_strStatus = strNewData;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CViewProjects::UpdateSelection() {
|
2005-04-21 23:14:10 +00:00
|
|
|
// Update the tasks static box buttons
|
2005-04-21 22:21:54 +00:00
|
|
|
CTaskItemGroup* pGroup = m_TaskGroups[0];
|
|
|
|
if (m_pListPane->GetSelectedItemCount() == 0) {
|
2005-04-21 23:14:10 +00:00
|
|
|
pGroup->button(BTN_UPDATE)->Disable();
|
2005-04-21 22:21:54 +00:00
|
|
|
pGroup->button(BTN_SUSPEND)->Disable();
|
|
|
|
pGroup->button(BTN_NOWORK)->Disable();
|
|
|
|
pGroup->button(BTN_RESET)->Disable();
|
|
|
|
pGroup->button(BTN_DETACH)->Disable();
|
|
|
|
pGroup->button(BTN_ATTACH)->Enable();
|
|
|
|
} else {
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
PROJECT* project = pDoc->project(m_pListPane->GetFirstSelected());
|
|
|
|
pGroup->button(BTN_UPDATE)->Enable();
|
|
|
|
pGroup->button(BTN_SUSPEND)->Enable();
|
|
|
|
if (project->suspended_via_gui) {
|
|
|
|
pGroup->button(BTN_SUSPEND)->SetLabel(wxString("Resume"));
|
|
|
|
pGroup->button(BTN_SUSPEND)->SetToolTip(wxString("Resume work for this project"));
|
|
|
|
} else {
|
|
|
|
pGroup->button(BTN_SUSPEND)->SetLabel(wxString("Suspend"));
|
|
|
|
pGroup->button(BTN_SUSPEND)->SetToolTip(wxString("Suspend work for this project"));
|
|
|
|
}
|
|
|
|
pGroup->button(BTN_NOWORK)->Enable();
|
|
|
|
if (project->dont_request_more_work) {
|
|
|
|
pGroup->button(BTN_NOWORK)->SetLabel(wxString("Allow new work"));
|
|
|
|
pGroup->button(BTN_NOWORK)->SetToolTip(wxString("Allow fetching new work for this project"));
|
|
|
|
} else {
|
|
|
|
pGroup->button(BTN_NOWORK)->SetLabel(wxString("No new work"));
|
2005-04-21 23:53:39 +00:00
|
|
|
pGroup->button(BTN_NOWORK)->SetToolTip(wxString("Don't fetch new work for this project"));
|
2005-04-21 22:21:54 +00:00
|
|
|
}
|
|
|
|
pGroup->button(BTN_RESET)->Enable();
|
|
|
|
pGroup->button(BTN_DETACH)->Enable();
|
|
|
|
pGroup->button(BTN_ATTACH)->Enable();
|
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::FormatProjectName(wxInt32 item, wxString& strBuffer) const {
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectProjectName(item, strBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::FormatAccountName(wxInt32 item, wxString& strBuffer) const {
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectAccountName(item, strBuffer);
|
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 {
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectTeamName(item, strBuffer);
|
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 {
|
2004-10-05 02:55:26 +00:00
|
|
|
float fBuffer;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectTotalCredit(item, fBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Printf(wxT("%0.2f"), fBuffer);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::FormatAVGCredit(wxInt32 item, wxString& strBuffer) const {
|
2004-10-05 02:55:26 +00:00
|
|
|
float fBuffer;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectAvgCredit(item, fBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Printf(wxT("%0.2f"), fBuffer);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::FormatResourceShare(wxInt32 item, wxString& strBuffer) const {
|
2004-10-05 02:55:26 +00:00
|
|
|
float fResourceShareBuffer;
|
|
|
|
float fTotalResourceShareBuffer;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectResourceShare(item, fResourceShareBuffer);
|
|
|
|
pDoc->GetProjectTotalResourceShare(item, fTotalResourceShareBuffer);
|
2005-04-07 07:04:50 +00:00
|
|
|
strBuffer.Printf(wxT("%0.0f (%0.2f%%)"), fResourceShareBuffer, ((fResourceShareBuffer / fTotalResourceShareBuffer) * 100));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
wxInt32 CViewProjects::FormatStatus(wxInt32 item, wxString& strBuffer) const {
|
2004-10-05 02:55:26 +00:00
|
|
|
wxInt32 iNextRPC;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2005-04-15 19:33:47 +00:00
|
|
|
if (pDoc->IsProjectSuspended(item)) {
|
|
|
|
strBuffer = _("Project suspended");
|
|
|
|
} else if (pDoc->IsProjectAllowedToGetWork(item)) {
|
|
|
|
strBuffer = _("Won't get new work");
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (pDoc->IsProjectRPCPending(item)) {
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectMinRPCTime(item, iNextRPC);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
wxDateTime dtNextRPC((time_t)iNextRPC);
|
|
|
|
wxDateTime dtNow(wxDateTime::Now());
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (dtNextRPC > dtNow) {
|
2004-10-05 02:55:26 +00:00
|
|
|
wxTimeSpan tsNextRPC(dtNextRPC - dtNow);
|
|
|
|
strBuffer = _("Retry in ") + tsNextRPC.Format();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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$";
|