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-24 02:01:53 +00:00
|
|
|
#include "res/boinc.xpm"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "res/proj.xpm"
|
|
|
|
#include "res/task.xpm"
|
|
|
|
#include "res/web.xpm"
|
|
|
|
#include "res/tips.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-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-07 07:04:50 +00:00
|
|
|
CViewProjects::CViewProjects() {}
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
CViewProjects::CViewProjects(wxNotebook* pNotebook) :
|
2005-04-07 07:04:50 +00:00
|
|
|
CBOINCBaseView(pNotebook, ID_HTML_PROJECTSVIEW, DEFAULT_HTML_FLAGS, ID_LIST_PROJECTSVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS)
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-12-23 01:06:41 +00:00
|
|
|
//
|
|
|
|
// Globalization/Localization
|
|
|
|
//
|
|
|
|
VIEW_HEADER = wxT("proj");
|
|
|
|
|
|
|
|
SECTION_TASK = VIEW_HEADER + wxT("task");
|
|
|
|
SECTION_WEB = VIEW_HEADER + wxT("web");
|
|
|
|
SECTION_TIPS = VIEW_HEADER + wxT("tips");
|
|
|
|
|
|
|
|
BITMAP_PROJECTS = VIEW_HEADER + wxT(".xpm");
|
|
|
|
BITMAP_TASKHEADER = SECTION_TASK + wxT(".xpm");
|
|
|
|
BITMAP_WEBHEADER = SECTION_WEB + wxT(".xpm");
|
|
|
|
BITMAP_TIPSHEADER = SECTION_TIPS + wxT(".xpm");
|
|
|
|
BITMAP_BOINC = wxT("boinc.xpm");
|
|
|
|
|
|
|
|
|
|
|
|
LINKDESC_DEFAULT =
|
|
|
|
_("Click a project to see additional options.");
|
|
|
|
|
|
|
|
LINK_TASKATTACH = SECTION_TASK + wxT("attach");
|
|
|
|
LINKDESC_TASKATTACH =
|
|
|
|
_("<b>Attach to new project</b><br>"
|
|
|
|
"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).");
|
|
|
|
|
|
|
|
LINK_TASKDETACH = SECTION_TASK + wxT("detach");
|
|
|
|
LINKDESC_TASKDETACH =
|
|
|
|
_("<b>Detach from project</b><br>"
|
|
|
|
"Detach this computer from this project. "
|
|
|
|
"Work in progress will be lost. "
|
|
|
|
"You can update the project first to report "
|
|
|
|
"any completed work.");
|
|
|
|
|
|
|
|
LINK_TASKRESET = SECTION_TASK + wxT("reset");
|
|
|
|
LINKDESC_TASKRESET =
|
|
|
|
_("<b>Reset project</b><br>"
|
|
|
|
"Delete all files and work associated with this project, "
|
|
|
|
"and get new work. "
|
|
|
|
"You can update the project "
|
|
|
|
"first to report any completed work.");
|
|
|
|
|
|
|
|
LINK_TASKSUSPEND = SECTION_TASK + wxT("suspend");
|
|
|
|
LINKDESC_TASKSUSPEND =
|
|
|
|
_("<b>Suspend project</b><br>"
|
|
|
|
"Stop work for this project "
|
|
|
|
"(you can resume later).");
|
|
|
|
|
|
|
|
LINK_TASKRESUME = SECTION_TASK + wxT("resume");
|
|
|
|
LINKDESC_TASKRESUME =
|
|
|
|
_("<b>Resume project</b><br>"
|
|
|
|
"Resume work for this project");
|
2005-04-15 19:33:47 +00:00
|
|
|
LINK_TASKNOMOREWORK = SECTION_TASK + wxT("nomorework");
|
|
|
|
LINKDESC_TASKNOMOREWORK =
|
|
|
|
_("<b>Don't Get New Work</b><br>"
|
|
|
|
"Tell the project to not "
|
|
|
|
"fetch additional work for this "
|
|
|
|
"project. Any work already downloaded will "
|
|
|
|
"still be processed and returned."
|
|
|
|
);
|
|
|
|
LINK_TASKALLOWMOREWORK = SECTION_TASK + wxT("allowmorework");
|
|
|
|
LINKDESC_TASKALLOWMOREWORK =
|
|
|
|
_("<b>Allow Work Downloads</b><br>"
|
|
|
|
"Allow the project to fetch "
|
|
|
|
"additional work."
|
|
|
|
);
|
2004-12-23 01:06:41 +00:00
|
|
|
|
|
|
|
LINK_TASKUPDATE = SECTION_TASK + wxT("update");
|
|
|
|
LINKDESC_TASKUPDATE =
|
|
|
|
_("<b>Update project</b><br>"
|
|
|
|
"Report all completed work and refresh "
|
|
|
|
"your credit and preferences for this project.");
|
|
|
|
|
|
|
|
LINK_WEBBOINC = SECTION_WEB + wxT("boinc");
|
|
|
|
LINKDESC_WEBBOINC =
|
|
|
|
_("<b>BOINC home page</b><br>"
|
|
|
|
"Open the BOINC home page in a web browser.");
|
|
|
|
|
|
|
|
LINK_WEBPROJECT = SECTION_WEB + wxT("project");
|
|
|
|
LINKDESC_WEBPROJECT =
|
|
|
|
_("<b>Project home page</b><br>"
|
|
|
|
"Open this project's home page in a web browser.");
|
|
|
|
|
|
|
|
LINK_WEB = SECTION_WEB + wxT(":");
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setup View
|
|
|
|
//
|
2004-09-21 01:30:29 +00:00
|
|
|
wxBitmap bmpProject(proj_xpm);
|
|
|
|
wxBitmap bmpTask(task_xpm);
|
|
|
|
wxBitmap bmpWeb(web_xpm);
|
|
|
|
wxBitmap bmpTips(tips_xpm);
|
2004-09-24 02:01:53 +00:00
|
|
|
wxBitmap bmpBOINC(boinc_xpm);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
bmpProject.SetMask(new wxMask(bmpProject, wxColour(255, 0, 255)));
|
2004-09-22 21:53:07 +00:00
|
|
|
bmpTask.SetMask(new wxMask(bmpTask, wxColour(255, 0, 255)));
|
|
|
|
bmpWeb.SetMask(new wxMask(bmpWeb, wxColour(255, 0, 255)));
|
|
|
|
bmpTips.SetMask(new wxMask(bmpTips, wxColour(255, 0, 255)));
|
2004-09-24 02:01:53 +00:00
|
|
|
bmpBOINC.SetMask(new wxMask(bmpBOINC, wxColour(255, 0, 255)));
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
m_pTaskPane->AddVirtualFile(BITMAP_PROJECTS, bmpProject, wxBITMAP_TYPE_XPM);
|
|
|
|
m_pTaskPane->AddVirtualFile(BITMAP_BOINC, bmpBOINC, wxBITMAP_TYPE_XPM);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TASKHEADER, bmpTask, _("Tasks"));
|
2004-11-22 19:17:13 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_WEBHEADER, bmpWeb, _("Web sites"));
|
2004-12-19 20:35:37 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TIPSHEADER, bmpTips, _("Tips"));
|
2004-09-21 01:30:29 +00:00
|
|
|
|
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);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-09-23 08:28:50 +00:00
|
|
|
m_bTipsHeaderHidden = false;
|
2004-10-26 17:12:58 +00:00
|
|
|
m_bItemSelected = false;
|
2004-09-23 08:28:50 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
SetCurrentQuickTip(
|
2004-10-05 02:55:26 +00:00
|
|
|
LINK_DEFAULT,
|
2004-10-19 19:41:29 +00:00
|
|
|
LINKDESC_DEFAULT
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-09-24 02:01:53 +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();
|
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-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-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) {
|
2004-12-02 07:43:47 +00:00
|
|
|
case COLUMN_PROJECT:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = project->m_strProjectName;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = project->m_strAccountName;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = project->m_strTeamName;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = project->m_strTotalCredit;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = project->m_strAVGCredit;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = project->m_strResourceShare;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2005-03-15 23:44:48 +00:00
|
|
|
strBuffer = project->m_strStatus;
|
2004-12-02 07:43:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
2004-09-21 01:30:29 +00:00
|
|
|
case COLUMN_PROJECT:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatProjectName(item, strBuffer);
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatAccountName(item, strBuffer);
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatTeamName(item, strBuffer);
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatTotalCredit(item, strBuffer);
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatAVGCredit(item, strBuffer);
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatResourceShare(item, strBuffer);
|
2004-09-29 22:21:45 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2005-04-07 07:04:50 +00:00
|
|
|
FormatStatus(item, strBuffer);
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
void CViewProjects::OnTaskLinkClicked(const wxHtmlLinkInfo& link) {
|
2005-04-08 06:24:58 +00:00
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnTaskLinkClicked - Function Begin"));
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxInt32 iWebsiteIndex = 0;
|
|
|
|
wxString strProjectName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
2005-04-08 06:24:58 +00:00
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2005-04-08 06:24:58 +00:00
|
|
|
wxASSERT(NULL != pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
2004-09-24 02:01:53 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_bTaskHeaderHidden = false;
|
|
|
|
m_bWebsiteHeaderHidden = false;
|
|
|
|
m_bTipsHeaderHidden = false;
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (link.GetHref() == LINK_TASKATTACH) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Ataching to project..."));
|
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
CDlgAttachProject* pDlg = new CDlgAttachProject(this);
|
|
|
|
wxASSERT(NULL != pDlg);
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
iAnswer = pDlg->ShowModal();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (wxID_OK == iAnswer) {
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectAttach(
|
2005-03-31 19:01:44 +00:00
|
|
|
pDlg->GetProjectAddress(),
|
|
|
|
pDlg->GetProjectAccountKey()
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-09-25 21:33:24 +00:00
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
if (pDlg)
|
|
|
|
pDlg->Destroy();
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (link.GetHref() == LINK_TASKDETACH) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Detaching from project..."));
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetProjectProjectName(iProjectIndex, strProjectName);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage.Printf(
|
2004-11-22 19:17:13 +00:00
|
|
|
_("Are you sure you want to detach from project '%s'?"),
|
2004-09-25 21:33:24 +00:00
|
|
|
strProjectName.c_str());
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
iAnswer = wxMessageBox(
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage,
|
|
|
|
_("Detach from Project"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (wxYES == iAnswer) {
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectDetach(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (link.GetHref() == LINK_TASKRESET) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Resetting project..."));
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetProjectProjectName(iProjectIndex, strProjectName);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage.Printf(
|
2004-11-22 19:17:13 +00:00
|
|
|
_("Are you sure you want to reset project '%s'?"),
|
2004-09-25 21:33:24 +00:00
|
|
|
strProjectName.c_str());
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
iAnswer = wxMessageBox(
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage,
|
|
|
|
_("Reset Project"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (wxYES == iAnswer) {
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectReset(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (link.GetHref() == LINK_TASKUPDATE) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Updating project..."));
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2004-09-28 01:19:46 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectUpdate(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
|
|
|
} else if (link.GetHref() == LINK_TASKSUSPEND) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Suspending project..."));
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2004-09-28 01:19:46 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectSuspend(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
|
|
|
} else if (link.GetHref() == LINK_TASKRESUME) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Resuming project..."));
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2004-09-28 01:19:46 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectResume(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2005-04-15 19:33:47 +00:00
|
|
|
} else if (link.GetHref() == LINK_TASKNOMOREWORK) {
|
|
|
|
pFrame->UpdateStatusText(_("Telling project to not fetch additional work..."));
|
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->ProjectNoMoreWork( iProjectIndex );
|
|
|
|
} else if (link.GetHref() == LINK_TASKALLOWMOREWORK) {
|
|
|
|
pFrame->UpdateStatusText(_("Telling project to allow additional work downloads..."));
|
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->ProjectAllowMoreWork( iProjectIndex );
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (link.GetHref() == LINK_WEBBOINC) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Opening a browser to the BOINC homepage..."));
|
|
|
|
|
|
|
|
pFrame->ExecuteBrowserLink(wxT("http://boinc.berkeley.edu"));
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (link.GetHref() == LINK_WEBPROJECT) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Opening a browser to the project homepage..."));
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetProjectProjectURL(iProjectIndex, strURL);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->ExecuteBrowserLink(strURL);
|
2005-04-07 07:04:50 +00:00
|
|
|
} else if (link.GetHref().StartsWith(LINK_WEB)) {
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->UpdateStatusText(_("Opening a browser to a project specified URL..."));
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
ConvertLinkToWebsiteIndex(link.GetHref(), iProjectIndex, iWebsiteIndex);
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectWebsiteLink(iProjectIndex, iWebsiteIndex, strURL);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->ExecuteBrowserLink(strURL);
|
2004-10-09 03:05:01 +00:00
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
UpdateSelection();
|
2005-04-08 06:24:58 +00:00
|
|
|
pFrame->ProcessRefreshView();
|
|
|
|
|
|
|
|
pFrame->UpdateStatusText( wxEmptyString );
|
|
|
|
|
|
|
|
wxLogTrace(wxT("Function Start/End"), wxT("CViewProjects::OnTaskLinkClicked - Function End"));
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CViewProjects::OnTaskCellMouseHover(wxHtmlCell* cell, wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) {
|
|
|
|
if (NULL != cell->GetLink()) {
|
2004-10-09 03:05:01 +00:00
|
|
|
bool bUpdateSelection = false;
|
|
|
|
wxString strLink = wxEmptyString;
|
|
|
|
wxString strWebsiteLink = wxEmptyString;
|
|
|
|
wxString strWebsiteDescripton = wxEmptyString;
|
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxInt32 iWebsiteIndex = 0;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
strLink = cell->GetLink()->GetHref();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (UpdateQuickTip(strLink, LINK_TASKATTACH, LINKDESC_TASKATTACH))
|
2004-10-05 02:55:26 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKDETACH, LINKDESC_TASKDETACH))
|
2004-10-05 02:55:26 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKRESET, LINKDESC_TASKRESET))
|
2004-10-05 02:55:26 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKSUSPEND, LINKDESC_TASKSUSPEND))
|
2004-10-05 02:55:26 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKRESUME, LINKDESC_TASKRESUME))
|
2004-10-05 02:55:26 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKUPDATE, LINKDESC_TASKUPDATE))
|
2004-10-05 02:55:26 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_WEBBOINC, LINKDESC_WEBBOINC))
|
2004-10-05 02:55:26 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_WEBPROJECT, LINKDESC_WEBPROJECT))
|
2004-10-05 02:55:26 +00:00
|
|
|
bUpdateSelection = true;
|
2005-04-15 19:33:47 +00:00
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKNOMOREWORK, LINKDESC_TASKNOMOREWORK))
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if (UpdateQuickTip(strLink, LINK_TASKALLOWMOREWORK, LINKDESC_TASKALLOWMOREWORK))
|
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
else if (IsWebsiteLink(strLink)) {
|
|
|
|
ConvertLinkToWebsiteIndex(strLink, iProjectIndex, iWebsiteIndex);
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
pDoc->GetProjectWebsiteDescription(iProjectIndex, iWebsiteIndex, strWebsiteDescripton);
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
UpdateQuickTip(strLink, strLink, strWebsiteDescripton);
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
bUpdateSelection = true;
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
|
|
|
if (0 == m_pListPane->GetSelectedItemCount()) {
|
|
|
|
if ((LINK_DEFAULT != GetCurrentQuickTip()) &&
|
|
|
|
(LINK_TASKATTACH != strLink) &&
|
|
|
|
(LINK_WEBBOINC != strLink))
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
|
|
|
SetCurrentQuickTip(
|
2004-10-05 03:40:28 +00:00
|
|
|
LINK_DEFAULT,
|
2004-10-19 19:41:29 +00:00
|
|
|
LINKDESC_DEFAULT
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
bUpdateSelection = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (bUpdateSelection) {
|
2004-09-24 22:19:02 +00:00
|
|
|
UpdateSelection();
|
2004-09-24 02:01:53 +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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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() {
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-24 02:01:53 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (0 == m_pListPane->GetSelectedItemCount()) {
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bTaskHeaderHidden = false;
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskAttachHidden = false;
|
|
|
|
m_bTaskDetachHidden = true;
|
|
|
|
m_bTaskResetHidden = true;
|
|
|
|
m_bTaskSuspendHidden = true;
|
|
|
|
m_bTaskResumeHidden = true;
|
|
|
|
m_bTaskUpdateHidden = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
m_bWebsiteHeaderHidden = false;
|
|
|
|
m_bWebsiteBOINCHidden = false;
|
|
|
|
m_bWebsiteProjectHidden = true;
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (m_bItemSelected) {
|
2004-10-09 03:05:01 +00:00
|
|
|
SetCurrentQuickTip(
|
|
|
|
LINK_DEFAULT,
|
2004-12-23 03:36:51 +00:00
|
|
|
LINKDESC_DEFAULT
|
2005-04-07 07:04:50 +00:00
|
|
|
);
|
2004-10-09 03:05:01 +00:00
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bItemSelected = false;
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bTaskHeaderHidden = false;
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskAttachHidden = false;
|
|
|
|
m_bTaskDetachHidden = false;
|
|
|
|
m_bTaskResetHidden = false;
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
if (pDoc->IsProjectSuspended(m_pListPane->GetFirstSelected())) {
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskSuspendHidden = true;
|
|
|
|
m_bTaskResumeHidden = false;
|
2005-04-07 07:04:50 +00:00
|
|
|
} else {
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskSuspendHidden = false;
|
|
|
|
m_bTaskResumeHidden = true;
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskUpdateHidden = false;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
m_bWebsiteHeaderHidden = false;
|
|
|
|
m_bWebsiteBOINCHidden = false;
|
|
|
|
m_bWebsiteProjectHidden = false;
|
|
|
|
|
|
|
|
m_bItemSelected = true;
|
|
|
|
}
|
|
|
|
UpdateTaskPane();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
void CViewProjects::UpdateTaskPane() {
|
2004-10-09 03:05:01 +00:00
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxInt32 iWebsiteIndex = 0;
|
|
|
|
wxInt32 iWebsiteCount = 0;
|
|
|
|
wxString strWebsiteName = wxEmptyString;
|
|
|
|
wxString strWebsiteLink = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-22 21:53:07 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
|
|
|
|
m_pTaskPane->BeginTaskPage();
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->BeginTaskSection(BITMAP_TASKHEADER, m_bTaskHeaderHidden);
|
|
|
|
if (!m_bTaskHeaderHidden) {
|
|
|
|
m_pTaskPane->CreateTask(LINK_TASKUPDATE, _("Update project"), m_bTaskUpdateHidden);
|
|
|
|
m_pTaskPane->CreateTask(LINK_TASKSUSPEND, _("Suspend project"), m_bTaskSuspendHidden);
|
|
|
|
m_pTaskPane->CreateTask(LINK_TASKRESUME, _("Resume project"), m_bTaskResumeHidden);
|
2005-04-15 19:33:47 +00:00
|
|
|
m_pTaskPane->CreateTask(LINK_TASKNOMOREWORK, _("Don't Get New Work"), m_bTaskNoMoreWorkHidden);
|
|
|
|
m_pTaskPane->CreateTask(LINK_TASKALLOWMOREWORK, _("Allow Work Downloads"), m_bTaskMoreWorkHidden);
|
2004-12-23 04:11:28 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->CreateTaskSeparator(m_bTaskUpdateHidden || (m_bTaskSuspendHidden && m_bTaskResumeHidden));
|
2004-12-23 04:11:28 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->CreateTask(LINK_TASKDETACH, _("Detach from project"), m_bTaskDetachHidden);
|
|
|
|
m_pTaskPane->CreateTask(LINK_TASKRESET, _("Reset project"), m_bTaskResetHidden);
|
2004-12-23 04:11:28 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->CreateTaskSeparator(m_bTaskDetachHidden || m_bTaskResetHidden);
|
2004-12-23 04:11:28 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->CreateTask(LINK_TASKATTACH, _("Attach to new project"), m_bTaskAttachHidden);
|
2004-09-22 21:53:07 +00:00
|
|
|
}
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->EndTaskSection(m_bTaskHeaderHidden);
|
2004-09-22 21:53:07 +00:00
|
|
|
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->BeginTaskSection(BITMAP_WEBHEADER, m_bWebsiteHeaderHidden);
|
|
|
|
if (!m_bWebsiteHeaderHidden) {
|
|
|
|
m_pTaskPane->CreateTask(LINK_WEBBOINC, _("BOINC"), m_bWebsiteBOINCHidden);
|
|
|
|
m_pTaskPane->CreateTask(LINK_WEBPROJECT, _("Project"), m_bWebsiteProjectHidden);
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2005-04-07 07:04:50 +00:00
|
|
|
if (-1 != iProjectIndex) {
|
2004-10-09 03:05:01 +00:00
|
|
|
iWebsiteCount = pDoc->GetProjectWebsiteCount(iProjectIndex);
|
2005-04-07 07:04:50 +00:00
|
|
|
for (iWebsiteIndex = 0; iWebsiteIndex < iWebsiteCount; iWebsiteIndex++) {
|
|
|
|
ConvertWebsiteIndexToLink(iProjectIndex, iWebsiteIndex, strWebsiteLink);
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectWebsiteName(iProjectIndex, iWebsiteIndex, strWebsiteName);
|
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->CreateTask(strWebsiteLink, strWebsiteName, false);
|
2004-10-09 03:05:01 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-22 21:53:07 +00:00
|
|
|
}
|
2004-09-23 08:28:50 +00:00
|
|
|
m_pTaskPane->EndTaskSection(m_bWebsiteHeaderHidden);
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2005-04-07 07:04:50 +00:00
|
|
|
m_pTaskPane->UpdateQuickTip(BITMAP_TIPSHEADER, GetCurrentQuickTipText(), m_bTipsHeaderHidden);
|
2004-09-22 21:53:07 +00:00
|
|
|
|
|
|
|
m_pTaskPane->EndTaskPage();
|
|
|
|
}
|
|
|
|
|
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-07 07:04:50 +00:00
|
|
|
if (strLink.StartsWith(LINK_WEB + wxT(":")))
|
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) {
|
2004-10-21 22:52:56 +00:00
|
|
|
strLink.Printf(wxT("%s:%d:%d"), LINK_WEB.c_str(), 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-07 07:04:50 +00:00
|
|
|
strTemplate.Replace(LINK_WEB + wxT(":"), 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$";
|