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-05-17 22:15:10 +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-04-10 09:11:03 +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-05-17 22:15:10 +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-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#ifndef _MAINDOCUMENT_H_
|
|
|
|
#define _MAINDOCUMENT_H_
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma interface "MainDocument.cpp"
|
|
|
|
#endif
|
|
|
|
|
2004-09-10 23:17:08 +00:00
|
|
|
#include "gui_rpc_client.h"
|
|
|
|
|
2005-04-06 20:40:19 +00:00
|
|
|
class CMainDocument;
|
|
|
|
|
2005-04-17 02:10:52 +00:00
|
|
|
class CNetworkConnection : public wxObject {
|
2005-04-06 20:40:19 +00:00
|
|
|
public:
|
2005-04-17 02:10:52 +00:00
|
|
|
CNetworkConnection(CMainDocument* pDocument);
|
2005-04-10 02:24:08 +00:00
|
|
|
~CNetworkConnection();
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-04-10 02:24:08 +00:00
|
|
|
virtual void* Poll();
|
2005-04-08 04:23:37 +00:00
|
|
|
void FireReconnectEvent() { m_bConnectEvent = true; };
|
|
|
|
void ForceReconnect() { m_bForceReconnect = true; };
|
2005-04-24 00:09:40 +00:00
|
|
|
int FrameShutdownDetected();
|
|
|
|
int GetConnectedComputerName(wxString& strMachine);
|
|
|
|
int GetConnectingComputerName(wxString& strMachine);
|
|
|
|
int SetNewComputerName(const wxChar* szComputer);
|
|
|
|
int SetNewComputerPassword(const wxChar* szPassword);
|
2005-04-08 04:23:37 +00:00
|
|
|
void SetStateError();
|
2005-04-08 21:18:30 +00:00
|
|
|
void SetStateErrorAuthentication();
|
2005-04-08 04:23:37 +00:00
|
|
|
void SetStateReconnecting();
|
2005-04-17 02:10:52 +00:00
|
|
|
void SetStateSuccess(std::string& strComputer, std::string& strComputerPassword);
|
2005-04-08 19:57:31 +00:00
|
|
|
void SetStateDisconnected();
|
2005-04-08 04:23:37 +00:00
|
|
|
bool IsConnectEventSignaled() { return m_bConnectEvent; };
|
|
|
|
bool IsConnected() { return m_bConnected; };
|
|
|
|
bool IsReconnecting() { return m_bReconnecting; };
|
2005-04-06 20:40:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
CMainDocument* m_pDocument;
|
2005-04-08 22:23:53 +00:00
|
|
|
bool m_bFrameShutdownDetected;
|
2005-04-08 04:23:37 +00:00
|
|
|
bool m_bConnectEvent;
|
|
|
|
bool m_bForceReconnect;
|
|
|
|
bool m_bReconnectOnError;
|
|
|
|
bool m_bConnected;
|
|
|
|
bool m_bReconnecting;
|
|
|
|
wxString m_strNewComputerName;
|
|
|
|
wxString m_strNewComputerPassword;
|
|
|
|
wxString m_strConnectedComputerName;
|
|
|
|
wxString m_strConnectedComputerPassword;
|
2005-04-06 20:40:19 +00:00
|
|
|
};
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-04-17 02:10:52 +00:00
|
|
|
class CMainDocument : public wxObject {
|
2004-04-10 09:11:03 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(CMainDocument)
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
public:
|
|
|
|
CMainDocument();
|
|
|
|
~CMainDocument();
|
|
|
|
|
|
|
|
//
|
2004-09-29 22:21:45 +00:00
|
|
|
// Global
|
2004-09-25 21:33:24 +00:00
|
|
|
//
|
2004-07-12 08:46:26 +00:00
|
|
|
private:
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2005-04-10 02:24:08 +00:00
|
|
|
CNetworkConnection* m_pNetworkConnection;
|
2004-10-01 00:06:32 +00:00
|
|
|
|
2005-04-08 04:23:37 +00:00
|
|
|
bool m_bCachedStateLocked;
|
|
|
|
|
2005-02-22 07:10:44 +00:00
|
|
|
wxDateTime m_dtCachedActivityRunModeTimestamp;
|
|
|
|
wxDateTime m_dtCachedNetworkRunModeTimestamp;
|
|
|
|
wxDateTime m_dtCachedActivityStateTimestamp;
|
2005-04-24 00:09:40 +00:00
|
|
|
int m_iCachedActivityRunMode;
|
|
|
|
int m_iCachedNetworkRunMode;
|
2005-02-22 07:10:44 +00:00
|
|
|
bool m_iCachedActivitiesSuspended;
|
|
|
|
bool m_iCachedNetworkSuspended;
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedStateUpdate();
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int OnInit();
|
|
|
|
int OnExit();
|
|
|
|
int OnPoll();
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int OnRefreshState();
|
|
|
|
int ResetState();
|
2004-10-24 05:40:12 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int Connect(const wxChar* szComputer, const wxChar* szComputerPassword = wxEmptyString, bool bDisconnect = FALSE);
|
2004-10-28 07:03:06 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedStateLock();
|
|
|
|
int CachedStateUnlock();
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int FrameShutdownDetected();
|
|
|
|
int CoreClientQuit();
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetConnectedComputerName(wxString& strMachine);
|
|
|
|
int GetConnectingComputerName(wxString& strMachine);
|
2005-04-08 04:23:37 +00:00
|
|
|
bool IsConnected();
|
|
|
|
bool IsReconnecting();
|
2005-02-22 23:40:38 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetActivityRunMode(int& iMode);
|
|
|
|
int SetActivityRunMode(int iMode);
|
|
|
|
int GetNetworkRunMode(int& iMode);
|
|
|
|
int SetNetworkRunMode(int iMode);
|
|
|
|
int GetActivityState(bool& bActivitiesSuspended, bool& bNetworkSuspended);
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
int ForceCacheUpdate();
|
2005-04-24 00:09:40 +00:00
|
|
|
int RunBenchmarks();
|
2004-10-27 23:19:50 +00:00
|
|
|
|
2005-04-06 20:40:19 +00:00
|
|
|
RPC_CLIENT rpc;
|
|
|
|
CC_STATE state;
|
|
|
|
HOST_INFO host;
|
|
|
|
wxDateTime m_dtCachedStateTimestamp;
|
|
|
|
wxDateTime m_dtCachedStateLockTimestamp;
|
|
|
|
|
2004-10-27 23:19:50 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
//
|
|
|
|
// Project Tab
|
|
|
|
//
|
|
|
|
private:
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedProjectStatusUpdate();
|
2004-09-25 21:33:24 +00:00
|
|
|
|
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
PROJECTS project_status;
|
2005-06-24 10:49:42 +00:00
|
|
|
PROJECT* project(unsigned int);
|
2005-06-13 08:47:51 +00:00
|
|
|
float m_fProjectTotalResourceShare;
|
2005-04-17 02:10:52 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
int GetProjectCount();
|
2005-04-17 02:10:52 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int ProjectNoMoreWork(int iIndex);
|
|
|
|
int ProjectAllowMoreWork(int iIndex);
|
|
|
|
int ProjectAttach(const wxString& strURL, const wxString& strAccountKey);
|
|
|
|
int ProjectDetach(int iIndex);
|
|
|
|
int ProjectUpdate(int iIndex);
|
|
|
|
int ProjectReset(int iIndex);
|
|
|
|
int ProjectSuspend(int iIndex);
|
|
|
|
int ProjectResume(int iIndex);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
//
|
|
|
|
// Work Tab
|
|
|
|
//
|
|
|
|
private:
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedResultsStatusUpdate();
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
RESULTS results;
|
2005-06-24 10:49:42 +00:00
|
|
|
RESULT* result(unsigned int);
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetWorkCount();
|
2005-04-17 02:10:52 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int WorkSuspend(int iIndex);
|
|
|
|
int WorkResume(int iIndex);
|
|
|
|
int WorkShowGraphics(int iIndex, bool bFullScreen, std::string, std::string, std::string);
|
|
|
|
int WorkAbort(int iIndex);
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
//
|
|
|
|
// Messages Tab
|
|
|
|
//
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
MESSAGES messages;
|
2005-06-24 10:49:42 +00:00
|
|
|
MESSAGE* message(unsigned int);
|
2005-06-11 00:30:11 +00:00
|
|
|
int CachedMessageUpdate();
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetMessageCount();
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int ResetMessageState();
|
2004-12-02 21:43:44 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int m_iMessageSequenceNumber;
|
2005-04-06 20:40:19 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
//
|
|
|
|
// Transfers Tab
|
|
|
|
//
|
2004-09-25 21:33:24 +00:00
|
|
|
private:
|
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedFileTransfersUpdate();
|
2004-10-22 00:41:18 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
FILE_TRANSFERS ft;
|
2005-06-24 10:49:42 +00:00
|
|
|
FILE_TRANSFER* file_transfer(unsigned int);
|
2004-04-11 04:37:10 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetTransferCount();
|
2005-04-17 02:10:52 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int TransferRetryNow(int iIndex);
|
|
|
|
int TransferAbort(int iIndex);
|
2004-10-22 19:23:09 +00:00
|
|
|
|
2004-10-22 22:37:11 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Resources Tab
|
|
|
|
//
|
|
|
|
private:
|
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedResourceStatusUpdate();
|
2004-10-22 22:37:11 +00:00
|
|
|
|
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
PROJECTS resource_status;
|
2005-06-24 10:49:42 +00:00
|
|
|
PROJECT* resource(unsigned int);
|
2004-10-22 22:37:11 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetResourceCount();
|
2005-04-06 20:40:19 +00:00
|
|
|
|
2004-10-25 16:14:51 +00:00
|
|
|
|
2005-04-04 06:02:36 +00:00
|
|
|
//
|
|
|
|
// Statistics Tab
|
|
|
|
//
|
|
|
|
private:
|
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedStatisticsStatusUpdate();
|
2005-04-04 06:02:36 +00:00
|
|
|
|
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
PROJECTS statistics_status;
|
2005-06-24 10:49:42 +00:00
|
|
|
PROJECT* statistic(unsigned int);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetStatisticsCount();
|
2005-04-04 06:02:36 +00:00
|
|
|
|
|
|
|
|
2004-10-25 16:14:51 +00:00
|
|
|
//
|
|
|
|
// Proxy Configuration
|
|
|
|
//
|
|
|
|
private:
|
|
|
|
|
|
|
|
public:
|
2005-08-02 01:28:29 +00:00
|
|
|
GR_PROXY_INFO proxy_info;
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetProxyConfiguration();
|
|
|
|
int SetProxyConfiguration();
|
2005-04-06 20:40:19 +00:00
|
|
|
|
2004-07-12 08:46:26 +00:00
|
|
|
};
|
2004-04-11 04:37:10 +00:00
|
|
|
|
2004-04-11 05:09:18 +00:00
|
|
|
#endif
|
|
|
|
|