2004-05-17 22:15:10 +00:00
|
|
|
// $Id$
|
|
|
|
//
|
2004-04-10 09:11:03 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
2004-05-17 22:15:10 +00:00
|
|
|
// Revision History:
|
|
|
|
//
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "MainDocument.h"
|
|
|
|
#endif
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
#include "stdwx.h"
|
2004-10-09 03:05:01 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
2004-04-11 04:12:44 +00:00
|
|
|
#include "MainDocument.h"
|
2004-07-12 08:46:26 +00:00
|
|
|
#include "error_numbers.h"
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
|
2004-09-10 23:17:08 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CMainDocument, wxObject)
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
|
2004-07-12 08:46:26 +00:00
|
|
|
CMainDocument::CMainDocument()
|
|
|
|
{
|
2004-09-10 23:17:08 +00:00
|
|
|
#ifdef __WIN32__
|
|
|
|
wxInt32 retval;
|
|
|
|
WSADATA wsdata;
|
|
|
|
|
|
|
|
retval = WSAStartup( MAKEWORD( 1, 1 ), &wsdata);
|
|
|
|
if (retval)
|
|
|
|
{
|
|
|
|
wxLogTrace("CMainDocument::CMainDocument - Winsock Initialization Failure '%d'", retval);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_bIsConnected = false;
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-10-01 00:06:32 +00:00
|
|
|
m_fProjectTotalResourceShare = 0.0;
|
|
|
|
|
|
|
|
m_iMessageSequenceNumber = 0;
|
|
|
|
|
|
|
|
m_bCachedStateLocked = false;
|
2004-07-13 05:56:03 +00:00
|
|
|
m_dtCachedStateLockTimestamp = wxDateTime::Now();
|
|
|
|
m_dtCachedStateTimestamp = 0;
|
2004-07-12 08:46:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CMainDocument::~CMainDocument()
|
|
|
|
{
|
2004-07-13 05:56:03 +00:00
|
|
|
m_dtCachedStateTimestamp = wxDateTime::Now();
|
|
|
|
m_dtCachedStateLockTimestamp = wxDateTime::Now();
|
|
|
|
m_bCachedStateLocked = false;
|
2004-09-10 23:17:08 +00:00
|
|
|
|
2004-10-01 00:06:32 +00:00
|
|
|
m_iMessageSequenceNumber = 0;
|
|
|
|
|
|
|
|
m_fProjectTotalResourceShare = 0.0;
|
|
|
|
|
|
|
|
m_bIsConnected = false;
|
|
|
|
|
2004-09-10 23:17:08 +00:00
|
|
|
#ifdef __WIN32__
|
|
|
|
WSACleanup();
|
|
|
|
#endif
|
2004-07-12 08:46:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
wxInt32 CMainDocument::OnInit()
|
|
|
|
{
|
|
|
|
wxInt32 retval = 0;
|
|
|
|
|
|
|
|
if (!m_bIsConnected)
|
|
|
|
{
|
|
|
|
retval = rpc.init(NULL);
|
|
|
|
if (retval)
|
2004-10-20 01:29:53 +00:00
|
|
|
wxLogTrace("CMainDocument::OnInit - RPC Initialization Failed '%d'", retval);
|
2004-10-09 03:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMainDocument::OnExit()
|
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
wxInt32 retval = 0;
|
|
|
|
|
|
|
|
if (m_bIsConnected)
|
|
|
|
rpc.close();
|
|
|
|
|
|
|
|
return retval;
|
2004-10-09 03:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMainDocument::OnIdle()
|
|
|
|
{
|
|
|
|
if (m_bIsConnected)
|
|
|
|
{
|
|
|
|
CachedStateUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMainDocument::CachedStateUpdate()
|
|
|
|
{
|
|
|
|
wxInt32 retval = 0;
|
|
|
|
CMainFrame* pFrame = wxGetApp().GetFrame();
|
|
|
|
wxString strEmpty = wxEmptyString;
|
|
|
|
|
|
|
|
wxASSERT(NULL != pFrame);
|
|
|
|
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
|
|
|
|
|
|
|
wxTimeSpan ts(m_dtCachedStateLockTimestamp - m_dtCachedStateTimestamp);
|
|
|
|
if (!m_bCachedStateLocked && (ts > wxTimeSpan::Seconds(3600)))
|
|
|
|
{
|
|
|
|
pFrame->UpdateStatusbar( _("Retrieving the BOINC system state. Please wait...") );
|
|
|
|
m_dtCachedStateTimestamp = m_dtCachedStateLockTimestamp;
|
|
|
|
|
|
|
|
retval = rpc.get_state(state);
|
|
|
|
if (retval)
|
2004-10-20 01:29:53 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
wxLogTrace("CMainDocument::CachedStateUpdate - Get State Failed '%d'", retval);
|
2004-10-20 01:29:53 +00:00
|
|
|
state.clear();
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2004-10-20 01:29:53 +00:00
|
|
|
pFrame->UpdateStatusbar( _("Retrieving the BOINC host information. Please wait...") );
|
2004-10-19 18:14:40 +00:00
|
|
|
retval = rpc.get_host_info(host);
|
|
|
|
if (retval)
|
2004-10-20 01:29:53 +00:00
|
|
|
{
|
2004-10-19 18:14:40 +00:00
|
|
|
wxLogTrace("CMainDocument::CachedStateUpdate - Get Host Information Failed '%d'", retval);
|
2004-10-20 01:29:53 +00:00
|
|
|
host.clear();
|
|
|
|
}
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pFrame->UpdateStatusbar( strEmpty );
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMainDocument::CachedStateLock()
|
|
|
|
{
|
|
|
|
m_bCachedStateLocked = true;
|
|
|
|
m_dtCachedStateLockTimestamp = wxDateTime::Now();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMainDocument::CachedStateUnlock()
|
|
|
|
{
|
|
|
|
m_bCachedStateLocked = false;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
wxInt32 CMainDocument::CachedProjectStatusUpdate()
|
|
|
|
{
|
|
|
|
wxInt32 retval = 0;
|
2004-09-29 22:21:45 +00:00
|
|
|
wxInt32 i = 0;
|
2004-09-25 21:33:24 +00:00
|
|
|
|
|
|
|
retval = rpc.get_project_status(project_status);
|
|
|
|
if (retval)
|
|
|
|
{
|
2004-09-29 22:21:45 +00:00
|
|
|
wxLogTrace("CMainDocument::CachedProjectStatusUpdate - Get Project Status Failed '%d'", retval);
|
2004-10-20 01:29:53 +00:00
|
|
|
project_status.clear();
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_fProjectTotalResourceShare = 0.0;
|
|
|
|
for (i=0; i < (long)project_status.projects.size(); i++) {
|
2004-10-01 00:06:32 +00:00
|
|
|
m_fProjectTotalResourceShare += project_status.projects.at( i )->resource_share;
|
2004-09-25 21:33:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMainDocument::GetProjectCount()
|
|
|
|
{
|
2004-10-21 21:19:49 +00:00
|
|
|
wxInt32 iCount = 0;
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
CachedStateUpdate();
|
2004-09-25 21:33:24 +00:00
|
|
|
CachedProjectStatusUpdate();
|
2004-10-21 21:19:49 +00:00
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
iCount = project_status.projects.size();
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-09-10 23:17:08 +00:00
|
|
|
return iCount;
|
2004-07-12 08:46:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectProjectName( wxInt32 iIndex, wxString& strBuffer )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
if ( NULL != pProject )
|
|
|
|
strBuffer = pProject->project_name.c_str();
|
|
|
|
|
|
|
|
return 0;
|
2004-07-12 08:46:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectProjectURL( wxInt32 iIndex, wxString& strBuffer )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
if ( NULL != pProject )
|
|
|
|
strBuffer = pProject->master_url.c_str();
|
|
|
|
|
|
|
|
return 0;
|
2004-07-12 08:46:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectAccountName( wxInt32 iIndex, wxString& strBuffer )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
if ( NULL != pProject )
|
|
|
|
strBuffer = pProject->user_name.c_str();
|
|
|
|
|
|
|
|
return 0;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectTeamName( wxInt32 iIndex, wxString& strBuffer )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
if ( NULL != pProject )
|
|
|
|
strBuffer = pProject->team_name.c_str();
|
|
|
|
|
|
|
|
return 0;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectTotalCredit( wxInt32 iIndex, float& fBuffer )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
if ( NULL != pProject )
|
|
|
|
fBuffer = pProject->user_total_credit;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectAvgCredit( wxInt32 iIndex, float& fBuffer )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
if ( NULL != pProject )
|
2004-09-29 22:21:45 +00:00
|
|
|
fBuffer = pProject->user_expavg_credit;
|
2004-09-25 21:33:24 +00:00
|
|
|
|
|
|
|
return 0;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectResourceShare( wxInt32 iIndex, float& fBuffer )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
if ( NULL != pProject )
|
2004-09-29 22:21:45 +00:00
|
|
|
fBuffer = pProject->resource_share;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectTotalResourceShare( wxInt32 iIndex, float& fBuffer )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-05 02:55:26 +00:00
|
|
|
fBuffer = m_fProjectTotalResourceShare;
|
2004-09-25 21:33:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectMinRPCTime( wxInt32 iIndex, wxInt32& iBuffer )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
if ( NULL != pProject )
|
2004-09-29 22:21:45 +00:00
|
|
|
iBuffer = pProject->min_rpc_time;
|
2004-09-25 21:33:24 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectWebsiteCount( wxInt32 iIndex )
|
2004-10-09 03:05:01 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
wxInt32 iCount = 0;
|
|
|
|
wxString strProjectURL = wxEmptyString;
|
|
|
|
std::string str;
|
|
|
|
PROJECT* pProject = NULL;
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
CachedStateUpdate();
|
|
|
|
|
2004-10-20 01:29:53 +00:00
|
|
|
GetProjectProjectURL( iIndex, strProjectURL );
|
|
|
|
str = strProjectURL.c_str();
|
|
|
|
pProject = state.lookup_project( str );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
iCount = pProject->gui_urls.size();
|
|
|
|
|
|
|
|
return iCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectWebsiteName( wxInt32 iProjectIndex, wxInt32 iWebsiteIndex, wxString& strBuffer )
|
2004-10-09 03:05:01 +00:00
|
|
|
{
|
|
|
|
wxString strProjectURL = wxEmptyString;
|
|
|
|
std::string str;
|
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
GUI_URL Url;
|
|
|
|
|
|
|
|
CachedStateUpdate();
|
|
|
|
|
|
|
|
GetProjectProjectURL( iProjectIndex, strProjectURL );
|
|
|
|
str = strProjectURL.c_str();
|
|
|
|
pProject = state.lookup_project( str );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
{
|
|
|
|
Url = pProject->gui_urls.at( iWebsiteIndex );
|
|
|
|
strBuffer = Url.name.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectWebsiteDescription( wxInt32 iProjectIndex, wxInt32 iWebsiteIndex, wxString& strBuffer )
|
2004-10-09 03:05:01 +00:00
|
|
|
{
|
|
|
|
wxString strProjectURL = wxEmptyString;
|
|
|
|
std::string str;
|
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
GUI_URL Url;
|
|
|
|
|
|
|
|
CachedStateUpdate();
|
|
|
|
|
|
|
|
GetProjectProjectURL( iProjectIndex, strProjectURL );
|
|
|
|
str = strProjectURL.c_str();
|
|
|
|
pProject = state.lookup_project( str );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
{
|
|
|
|
Url = pProject->gui_urls.at( iWebsiteIndex );
|
|
|
|
strBuffer = Url.description.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetProjectWebsiteLink( wxInt32 iProjectIndex, wxInt32 iWebsiteIndex, wxString& strBuffer )
|
2004-10-09 03:05:01 +00:00
|
|
|
{
|
|
|
|
wxString strProjectURL = wxEmptyString;
|
|
|
|
std::string str;
|
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
GUI_URL Url;
|
|
|
|
|
|
|
|
CachedStateUpdate();
|
|
|
|
|
|
|
|
GetProjectProjectURL( iProjectIndex, strProjectURL );
|
|
|
|
str = strProjectURL.c_str();
|
|
|
|
pProject = state.lookup_project( str );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
{
|
|
|
|
Url = pProject->gui_urls.at( iWebsiteIndex );
|
|
|
|
strBuffer = Url.url.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
bool CMainDocument::IsProjectSuspended( wxInt32 iIndex )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
bool bRetVal = false;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
bRetVal = pProject->suspended_via_gui;
|
|
|
|
|
|
|
|
return bRetVal;
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
bool CMainDocument::IsProjectRPCPending( wxInt32 iIndex )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
bool bRetVal = false;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
bRetVal = pProject->sched_rpc_pending;
|
|
|
|
|
|
|
|
return bRetVal;
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
wxInt32 CMainDocument::ProjectAttach( wxString& strURL, wxString& strAccountKey )
|
|
|
|
{
|
|
|
|
return rpc.project_attach((char *)strURL.c_str(), (char *)strAccountKey.c_str());
|
|
|
|
}
|
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxInt32 CMainDocument::ProjectDetach( wxInt32 iIndex )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
wxInt32 iRetVal = -1;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
iRetVal = rpc.project_op( (*pProject), wxT("detach") );
|
|
|
|
|
|
|
|
return iRetVal;
|
2004-09-25 21:33:24 +00:00
|
|
|
}
|
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxInt32 CMainDocument::ProjectUpdate( wxInt32 iIndex )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
wxInt32 iRetVal = -1;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
iRetVal = rpc.project_op( (*pProject), wxT("update") );
|
|
|
|
|
|
|
|
return iRetVal;
|
2004-09-25 21:33:24 +00:00
|
|
|
}
|
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxInt32 CMainDocument::ProjectReset( wxInt32 iIndex )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
wxInt32 iRetVal = -1;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
iRetVal = rpc.project_op( (*pProject), wxT("reset") );
|
|
|
|
|
|
|
|
return iRetVal;
|
2004-09-28 01:19:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxInt32 CMainDocument::ProjectSuspend( wxInt32 iIndex )
|
2004-09-28 01:19:46 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
PROJECT* pStateProject = NULL;
|
|
|
|
wxInt32 iRetVal = -1;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
{
|
|
|
|
iRetVal = rpc.project_op( (*pProject), wxT("suspend") );
|
|
|
|
if ( 0 == iRetVal )
|
|
|
|
{
|
|
|
|
pProject->suspended_via_gui = true;
|
|
|
|
pStateProject = state.lookup_project( pProject->master_url );
|
|
|
|
if ( NULL != pStateProject )
|
|
|
|
pStateProject->suspended_via_gui = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return iRetVal;
|
2004-09-28 01:19:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxInt32 CMainDocument::ProjectResume( wxInt32 iIndex )
|
2004-09-28 01:19:46 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
PROJECT* pStateProject = NULL;
|
|
|
|
wxInt32 iRetVal = -1;
|
|
|
|
|
|
|
|
if ( project_status.projects.size() != 0 )
|
|
|
|
pProject = project_status.projects.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pProject )
|
|
|
|
{
|
|
|
|
iRetVal = rpc.project_op( (*pProject), wxT("resume") );
|
|
|
|
if ( 0 == iRetVal )
|
|
|
|
{
|
|
|
|
pProject->suspended_via_gui = false;
|
|
|
|
pStateProject = state.lookup_project( pProject->master_url );
|
|
|
|
if ( NULL != pStateProject )
|
|
|
|
pStateProject->suspended_via_gui = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return iRetVal;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
wxInt32 CMainDocument::CachedResultsStatusUpdate()
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
|
|
|
wxInt32 retval = 0;
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
retval = rpc.get_results(results);
|
2004-09-29 22:21:45 +00:00
|
|
|
if (retval)
|
|
|
|
{
|
2004-10-11 04:38:00 +00:00
|
|
|
wxLogTrace("CMainDocument::CachedResultsStatusUpdate - Get Result Status Failed '%d'", retval);
|
2004-10-20 01:29:53 +00:00
|
|
|
results.clear();
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkCount()
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-21 21:19:49 +00:00
|
|
|
wxInt32 iCount = 0;
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
CachedStateUpdate();
|
|
|
|
CachedResultsStatusUpdate();
|
2004-10-21 21:19:49 +00:00
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
iCount = results.results.size();
|
2004-09-29 22:21:45 +00:00
|
|
|
|
|
|
|
return iCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkProjectName( wxInt32 iIndex, wxString& strBuffer )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
2004-10-19 18:14:40 +00:00
|
|
|
RESULT* pStateResult = NULL;
|
|
|
|
PROJECT* pProject = NULL;
|
|
|
|
|
2004-10-20 01:29:53 +00:00
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
2004-10-19 18:14:40 +00:00
|
|
|
if ( NULL != pResult )
|
|
|
|
{
|
2004-10-19 22:41:26 +00:00
|
|
|
pStateResult = state.lookup_result( pResult->project_url, pResult->name );
|
2004-10-19 18:14:40 +00:00
|
|
|
if ( NULL != pStateResult )
|
|
|
|
{
|
|
|
|
pProject = pStateResult->project;
|
|
|
|
if ( NULL != pProject )
|
|
|
|
{
|
|
|
|
strBuffer = pProject->project_name.c_str();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkProjectURL( wxInt32 iIndex, wxString& strBuffer )
|
2004-10-19 18:14:40 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
if ( NULL != pResult )
|
2004-10-19 22:41:26 +00:00
|
|
|
strBuffer = pResult->project_url.c_str();
|
2004-09-29 22:21:45 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkApplicationName( wxInt32 iIndex, wxString& strBuffer )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
2004-10-19 18:14:40 +00:00
|
|
|
RESULT* pStateResult = NULL;
|
2004-10-11 04:38:00 +00:00
|
|
|
WORKUNIT* pWorkunit = NULL;
|
|
|
|
APP_VERSION* pAppVersion = NULL;
|
|
|
|
|
2004-10-20 01:29:53 +00:00
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
if ( NULL != pResult )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-19 22:41:26 +00:00
|
|
|
pStateResult = state.lookup_result( pResult->project_url, pResult->name );
|
2004-10-19 18:14:40 +00:00
|
|
|
if ( NULL != pStateResult )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-19 18:14:40 +00:00
|
|
|
pWorkunit = pStateResult->wup;
|
|
|
|
if ( NULL != pWorkunit )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-19 18:14:40 +00:00
|
|
|
pAppVersion = pWorkunit->avp;
|
|
|
|
if ( NULL != pAppVersion )
|
|
|
|
{
|
|
|
|
strBuffer = pAppVersion->app_name.c_str();
|
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkApplicationVersion( wxInt32 iIndex, wxInt32& iBuffer )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
2004-10-19 18:14:40 +00:00
|
|
|
RESULT* pStateResult = NULL;
|
2004-10-11 04:38:00 +00:00
|
|
|
WORKUNIT* pWorkunit = NULL;
|
|
|
|
APP_VERSION* pAppVersion = NULL;
|
|
|
|
|
2004-10-20 01:29:53 +00:00
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
if ( NULL != pResult )
|
|
|
|
{
|
2004-10-19 22:41:26 +00:00
|
|
|
pStateResult = state.lookup_result( pResult->project_url, pResult->name );
|
2004-10-19 18:14:40 +00:00
|
|
|
if ( NULL != pStateResult )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-19 18:14:40 +00:00
|
|
|
pWorkunit = pStateResult->wup;
|
|
|
|
if ( NULL != pWorkunit )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-19 18:14:40 +00:00
|
|
|
pAppVersion = pWorkunit->avp;
|
|
|
|
if ( NULL != pAppVersion )
|
|
|
|
{
|
|
|
|
iBuffer = pAppVersion->version_num;
|
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-09-29 22:21:45 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkName( wxInt32 iIndex, wxString& strBuffer )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
strBuffer = pResult->name.c_str();
|
2004-09-29 22:21:45 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkCurrentCPUTime( wxInt32 iIndex, float& fBuffer )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
if ( NULL != pResult )
|
|
|
|
fBuffer = pResult->current_cpu_time;
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkEstimatedCPUTime( wxInt32 iIndex, float& fBuffer )
|
2004-10-19 18:14:40 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2004-10-20 01:29:53 +00:00
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
2004-10-19 18:14:40 +00:00
|
|
|
if ( NULL != pResult )
|
2004-10-20 21:50:28 +00:00
|
|
|
fBuffer = pResult->estimated_cpu_time_remaining;
|
2004-10-19 18:14:40 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkFinalCPUTime( wxInt32 iIndex, float& fBuffer )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
fBuffer = pResult->final_cpu_time;
|
|
|
|
|
|
|
|
return 0;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkFractionDone( wxInt32 iIndex, float& fBuffer )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
fBuffer = pResult->fraction_done;
|
|
|
|
|
|
|
|
return 0;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkReportDeadline( wxInt32 iIndex, wxInt32& iBuffer )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
iBuffer = pResult->report_deadline;
|
|
|
|
|
|
|
|
return 0;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkState( wxInt32 iIndex )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
|
|
|
wxInt32 iBuffer = 0;
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
iBuffer = pResult->state;
|
|
|
|
|
|
|
|
return iBuffer;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetWorkSchedulerState( wxInt32 iIndex )
|
2004-10-19 18:14:40 +00:00
|
|
|
{
|
|
|
|
wxInt32 iBuffer = 0;
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
2004-10-19 18:14:40 +00:00
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
iBuffer = pResult->scheduler_state;
|
|
|
|
|
|
|
|
return iBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
bool CMainDocument::IsWorkAcknowledged( wxInt32 iIndex )
|
2004-10-19 18:14:40 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
bool bRetVal = false;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
bRetVal = pResult->got_server_ack;
|
|
|
|
|
|
|
|
return bRetVal;
|
2004-10-19 18:14:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
bool CMainDocument::IsWorkActive( wxInt32 iIndex )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
bool bRetVal = false;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pResult )
|
2004-10-20 23:38:56 +00:00
|
|
|
bRetVal = pResult->active_task;
|
2004-10-20 01:29:53 +00:00
|
|
|
|
|
|
|
return bRetVal;
|
2004-10-19 18:14:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
bool CMainDocument::IsWorkReadyToReport( wxInt32 iIndex )
|
2004-10-19 18:14:40 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
bool bRetVal = false;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
bRetVal = pResult->ready_to_report;
|
|
|
|
|
|
|
|
return bRetVal;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
bool CMainDocument::IsWorkSuspended( wxInt32 iIndex )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
bool bRetVal = false;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
bRetVal = pResult->suspended_via_gui;
|
|
|
|
|
|
|
|
return bRetVal;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxInt32 CMainDocument::WorkSuspend( wxInt32 iIndex )
|
2004-10-19 18:14:40 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
RESULT* pStateResult = NULL;
|
|
|
|
wxInt32 iRetVal = 0;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
{
|
|
|
|
pStateResult = state.lookup_result( pResult->project_url, pResult->name );
|
|
|
|
if ( NULL != pStateResult )
|
|
|
|
{
|
|
|
|
iRetVal = rpc.result_op( (*pStateResult), wxT("suspend") );
|
|
|
|
if ( 0 == iRetVal )
|
|
|
|
{
|
|
|
|
pResult->suspended_via_gui = true;
|
|
|
|
pStateResult->suspended_via_gui = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return iRetVal;
|
2004-10-19 18:14:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxInt32 CMainDocument::WorkResume( wxInt32 iIndex )
|
2004-10-19 18:14:40 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
RESULT* pResult = NULL;
|
|
|
|
RESULT* pStateResult = NULL;
|
|
|
|
wxInt32 iRetVal = 0;
|
|
|
|
|
|
|
|
if ( results.results.size() != 0 )
|
|
|
|
pResult = results.results.at( iIndex );
|
|
|
|
|
|
|
|
if ( NULL != pResult )
|
|
|
|
{
|
|
|
|
pStateResult = state.lookup_result( pResult->project_url, pResult->name );
|
|
|
|
if ( NULL != pStateResult )
|
|
|
|
{
|
|
|
|
iRetVal = rpc.result_op( (*pStateResult), wxT("resume") );
|
|
|
|
if ( 0 == iRetVal )
|
|
|
|
{
|
|
|
|
pResult->suspended_via_gui = false;
|
|
|
|
pStateResult->suspended_via_gui = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return iRetVal;
|
2004-10-19 18:14:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMainDocument::WorkShowGraphics( wxString& strProjectURL, wxString& strResultName, bool bFullScreen )
|
|
|
|
{
|
|
|
|
return rpc.show_graphics( (char*)strProjectURL.c_str(), (char*)strResultName.c_str(), bFullScreen );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMainDocument::WorkAbort( wxString& strProjectURL, wxString& strResultName )
|
|
|
|
{
|
|
|
|
PROJECT p;
|
|
|
|
RESULT r;
|
|
|
|
p.master_url = strProjectURL;
|
|
|
|
r.name = strResultName;
|
|
|
|
r.project = &p;
|
|
|
|
return rpc.result_op(r, wxT("abort"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
wxInt32 CMainDocument::CachedMessageUpdate()
|
|
|
|
{
|
|
|
|
wxInt32 retval = 0;
|
2004-10-22 00:41:18 +00:00
|
|
|
//wxInt32 i = 0;
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
retval = rpc.get_messages( m_iMessageSequenceNumber, messages );
|
|
|
|
if (retval)
|
|
|
|
{
|
|
|
|
wxLogTrace("CMainDocument::CachedMessageUpdate - Get Messages Failed '%d'", retval);
|
2004-10-20 01:29:53 +00:00
|
|
|
messages.clear();
|
2004-10-11 04:38:00 +00:00
|
|
|
}
|
|
|
|
|
2004-10-20 01:29:53 +00:00
|
|
|
if ( messages.messages.size() != 0 )
|
|
|
|
m_iMessageSequenceNumber = messages.messages.at( messages.messages.size()-1 )->seqno;
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
return retval;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
wxInt32 CMainDocument::GetMessageCount()
|
|
|
|
{
|
2004-10-21 21:19:49 +00:00
|
|
|
wxInt32 iCount = 0;
|
|
|
|
|
2004-07-13 05:56:03 +00:00
|
|
|
CachedStateUpdate();
|
2004-10-11 04:38:00 +00:00
|
|
|
CachedMessageUpdate();
|
2004-10-21 21:19:49 +00:00
|
|
|
|
|
|
|
if ( messages.messages.size() != 0 )
|
|
|
|
iCount = messages.messages.size();
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
return iCount;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetMessageProjectName( wxInt32 iIndex, wxString& strBuffer )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
MESSAGE* pMessage = NULL;
|
|
|
|
|
|
|
|
if ( messages.messages.size() != 0 )
|
|
|
|
pMessage = messages.messages.at( iIndex );
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
if ( NULL != pMessage )
|
|
|
|
strBuffer = pMessage->project.c_str();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetMessageTime( wxInt32 iIndex, wxDateTime& dtBuffer )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
MESSAGE* pMessage = NULL;
|
|
|
|
|
|
|
|
if ( messages.messages.size() != 0 )
|
|
|
|
pMessage = messages.messages.at( iIndex );
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
if ( NULL != pMessage )
|
|
|
|
{
|
|
|
|
wxDateTime dtTemp((time_t)pMessage->timestamp);
|
|
|
|
dtBuffer = dtTemp;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetMessagePriority( wxInt32 iIndex, wxInt32& iBuffer )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
MESSAGE* pMessage = NULL;
|
|
|
|
|
|
|
|
if ( messages.messages.size() != 0 )
|
|
|
|
pMessage = messages.messages.at( iIndex );
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
if ( NULL != pMessage )
|
|
|
|
iBuffer = pMessage->priority;
|
|
|
|
|
|
|
|
return 0;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetMessageMessage( wxInt32 iIndex, wxString& strBuffer )
|
2004-10-11 04:38:00 +00:00
|
|
|
{
|
2004-10-20 01:29:53 +00:00
|
|
|
MESSAGE* pMessage = NULL;
|
|
|
|
|
|
|
|
if ( messages.messages.size() != 0 )
|
|
|
|
pMessage = messages.messages.at( iIndex );
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
if ( NULL != pMessage )
|
|
|
|
strBuffer = pMessage->body.c_str();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::CachedFileTransfersUpdate()
|
|
|
|
{
|
|
|
|
wxInt32 retval = 0;
|
|
|
|
|
|
|
|
retval = rpc.get_file_transfers( ft );
|
|
|
|
if (retval)
|
|
|
|
{
|
|
|
|
wxLogTrace("CMainDocument::CachedFileTransfersUpdate - Get File Transfers Failed '%d'", retval);
|
|
|
|
ft.clear();
|
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
return retval;
|
|
|
|
}
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetTransferCount()
|
|
|
|
{
|
2004-07-13 05:56:03 +00:00
|
|
|
CachedStateUpdate();
|
2004-08-11 23:52:22 +00:00
|
|
|
return 0;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetTransferProjectName( wxInt32 iIndex, wxString& strBuffer )
|
|
|
|
{
|
|
|
|
return 0;
|
2004-07-13 05:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetTransferFileName( wxInt32 iIndex, wxString& strBuffer )
|
|
|
|
{
|
|
|
|
return 0;
|
2004-07-12 08:46:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetTransferProgress( wxInt32 iIndex, wxString& strBuffer )
|
|
|
|
{
|
|
|
|
return 0;
|
2004-08-11 23:52:22 +00:00
|
|
|
}
|
2004-07-12 08:46:26 +00:00
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetTransferSize( wxInt32 iIndex, wxString& strBuffer )
|
|
|
|
{
|
|
|
|
return 0;
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
2004-07-12 08:46:26 +00:00
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetTransferSpeed( wxInt32 iIndex, wxString& strBuffer )
|
|
|
|
{
|
|
|
|
return 0;
|
2004-08-11 23:52:22 +00:00
|
|
|
}
|
2004-07-12 08:46:26 +00:00
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetTransferStatus( wxInt32 iIndex, wxString& strBuffer )
|
|
|
|
{
|
|
|
|
return 0;
|
2004-07-12 08:46:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
wxInt32 CMainDocument::GetTransferTime( wxInt32 iIndex, wxString& strBuffer )
|
|
|
|
{
|
|
|
|
return 0;
|
2004-08-11 23:52:22 +00:00
|
|
|
}
|
2004-07-12 08:46:26 +00:00
|
|
|
|