*** empty log message ***

svn path=/trunk/boinc/; revision=5786
This commit is contained in:
Rom Walton 2005-04-06 20:40:19 +00:00
parent 67f6558e04
commit 9adb8f429a
6 changed files with 250 additions and 91 deletions

View File

@ -26736,3 +26736,19 @@ David 6 April 2005
lib/
filesys.h
prefs.C,h
Rom 6 April 2005
- Implement a connection manager thread for the Manager, it is really rough.
NOTE: Currently crashes on exit, due to an access violation, and changing
computers does not work. It also prompts for a project every time it
starts
- Read/Write font information to the registry so we can attempt to
identify some of the localization issues as possible font set issues with
wxwidgets.
clientgui/
BOINCBaseView.h
BOINCTaskCtrl.cpp
MainDocument.cpp, .h
stdwx.h

View File

@ -51,7 +51,7 @@ public:
~CBOINCBaseView();
virtual wxString GetViewName();
virtual const char** GetViewIcon();
virtual const char** GetViewIcon();
virtual wxInt32 GetListRowCount();
void FireOnListRender( wxTimerEvent& event );
@ -66,6 +66,8 @@ public:
void FireOnTaskLinkClicked( const wxHtmlLinkInfo& link );
void FireOnTaskCellMouseHover( wxHtmlCell* cell, wxCoord x, wxCoord y );
virtual void UpdateTaskPane();
protected:
virtual wxInt32 GetDocCount();
@ -106,7 +108,6 @@ protected:
virtual bool UpdateQuickTip( const wxString& strCurrentLink, const wxString& strQuickTip, const wxString& strQuickTipText );
virtual void UpdateSelection();
virtual void UpdateTaskPane();
bool m_bProcessingTaskRenderEvent;
bool m_bProcessingListRenderEvent;

View File

@ -59,6 +59,15 @@ void CBOINCTaskCtrl::BeginTaskPage()
{
m_strTaskPage.Clear();
m_strTaskPage += wxT("<html>");
m_strTaskPage += wxT("<head>");
if ( wxLocale::GetSystemEncodingName().size() > 0 )
{
m_strTaskPage += wxT("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
m_strTaskPage += wxLocale::GetSystemEncodingName();
m_strTaskPage += wxT("\">");
}
m_strTaskPage += wxT("</head>");
m_strTaskPage += wxT("<body bgcolor=" BGCOLOR ">");
}
@ -252,14 +261,48 @@ void CBOINCTaskCtrl::RemoveVirtualFile( const wxString& strFilename )
}
bool CBOINCTaskCtrl::OnSaveState( wxConfigBase* WXUNUSED(pConfig) )
bool CBOINCTaskCtrl::OnSaveState( wxConfigBase* pConfig )
{
wxString strBaseConfigLocation = wxEmptyString;
wxASSERT(NULL != pConfig);
// Retrieve the base location to store configuration information
// Should be in the following form: "/Projects/"
strBaseConfigLocation = pConfig->GetPath() + wxT("/");
pConfig->SetPath(strBaseConfigLocation + wxT("TaskCtrl/"));
WriteCustomization( pConfig );
pConfig->SetPath(strBaseConfigLocation);
return true;
}
bool CBOINCTaskCtrl::OnRestoreState( wxConfigBase* WXUNUSED(pConfig) )
bool CBOINCTaskCtrl::OnRestoreState( wxConfigBase* pConfig )
{
wxString strBaseConfigLocation = wxEmptyString;
wxASSERT(NULL != pConfig);
// Retrieve the base location to store configuration information
// Should be in the following form: "/Projects/"
strBaseConfigLocation = pConfig->GetPath() + wxT("/");
pConfig->SetPath(strBaseConfigLocation + wxT("TaskCtrl/"));
ReadCustomization( pConfig );
pConfig->SetPath(strBaseConfigLocation);
// Aparently reading the customizations back in from the registry
// delete the contents of the page, so lets force an update
m_pParentView->UpdateTaskPane();
return true;
}

View File

@ -27,6 +27,126 @@
#include "error_numbers.h"
CNetworkConnectionThread::CNetworkConnectionThread( CMainDocument* pDocument )
{
m_pDocument = pDocument;
}
void* CNetworkConnectionThread::Entry()
{
wxInt32 iRetVal = -1;
std::string strComputer;
std::string strComputerPassword;
while ( !TestDestroy() )
{
if ( m_pDocument->m_bNCTConnectEvent )
{
if ( m_pDocument->IsConnected() && m_pDocument->m_bNCTNewShouldReconnect )
{
m_pDocument->rpc.close();
m_pDocument->state.clear();
m_pDocument->host.clear();
m_pDocument->project_status.clear();
m_pDocument->results.clear();
m_pDocument->messages.clear();
m_pDocument->ft.clear();
m_pDocument->resource_status.clear();
m_pDocument->proxy_info.clear();
m_pDocument->m_dtCachedStateLockTimestamp = wxDateTime::Now();
m_pDocument->m_dtCachedStateTimestamp = wxDateTime( (time_t)0 );
m_pDocument->m_iMessageSequenceNumber = 0;
m_pDocument->m_bIsConnected = false;
}
if ( m_pDocument->IsConnected() )
return BOINC_SUCCESS;
if ( strComputer.empty() && !m_pDocument->m_strConnectedComputerName.empty() )
if (!m_pDocument->m_strNCTNewConnectedComputerName.empty())
strComputer = m_pDocument->m_strNCTNewConnectedComputerName;
else
strComputer = m_pDocument->m_strConnectedComputerName.c_str();
else
{
if (!m_pDocument->m_strNCTNewConnectedComputerName.empty())
strComputer = m_pDocument->m_strNCTNewConnectedComputerName.empty();
}
if ( strComputerPassword.empty() && !m_pDocument->m_strConnectedComputerPassword.empty() )
if (!m_pDocument->m_strNCTNewConnectedComputerPassword.empty())
strComputerPassword = m_pDocument->m_strNCTNewConnectedComputerPassword;
else
strComputerPassword = m_pDocument->m_strConnectedComputerPassword.c_str();
else
{
if (!m_pDocument->m_strNCTNewConnectedComputerPassword.empty())
strComputerPassword = m_pDocument->m_strNCTNewConnectedComputerPassword;
}
if ( strComputer.empty() )
iRetVal = m_pDocument->rpc.init( NULL );
else
iRetVal = m_pDocument->rpc.init( strComputer.c_str() );
if (iRetVal)
{
wxLogTrace("CMainDocument::Connect - RPC Initialization Failed '%d'", iRetVal);
}
if ( !strComputerPassword.empty() )
iRetVal = m_pDocument->rpc.authorize( strComputerPassword.c_str() );
if (iRetVal)
{
wxLogTrace("CMainDocument::Connect - RPC Authorization Failed '%d'", iRetVal);
}
if ( 0 == iRetVal )
{
m_pDocument->m_bIsConnected = true;
m_pDocument->m_strConnectedComputerName = strComputer.c_str();
m_pDocument->m_strConnectedComputerPassword = strComputerPassword.c_str();
m_pDocument->m_bNCTNewShouldReconnect = false;
m_pDocument->m_strNCTNewConnectedComputerName = wxEmptyString;
m_pDocument->m_strNCTNewConnectedComputerPassword = wxEmptyString;
m_pDocument->m_bNCTConnectEvent = false;
}
}
Sleep(1000);
}
return NULL;
}
void CNetworkConnectionThread::OnExit()
{
m_pDocument->rpc.close();
m_pDocument->state.clear();
m_pDocument->host.clear();
m_pDocument->project_status.clear();
m_pDocument->results.clear();
m_pDocument->messages.clear();
m_pDocument->ft.clear();
m_pDocument->resource_status.clear();
m_pDocument->proxy_info.clear();
m_pDocument->m_dtCachedStateLockTimestamp = wxDateTime::Now();
m_pDocument->m_dtCachedStateTimestamp = wxDateTime( (time_t)0 );
m_pDocument->m_iMessageSequenceNumber = 0;
m_pDocument->m_bIsConnected = false;
}
IMPLEMENT_DYNAMIC_CLASS(CMainDocument, wxObject)
@ -137,6 +257,15 @@ wxInt32 CMainDocument::OnInit()
// attempt to lookup account management information
acct_mgr.init();
// start the connect management thread
m_pNetworkConnectionThread = new CNetworkConnectionThread(this);
if ( m_pNetworkConnectionThread->Create() != wxTHREAD_NO_ERROR )
wxLogTrace("CMainDocument::OnInit - Failed to create network connection thread");
m_pNetworkConnectionThread->Run();
// provide the default connection information
if ( !IsConnected() )
iRetVal = Connect( wxEmptyString );
@ -148,12 +277,16 @@ wxInt32 CMainDocument::OnExit()
{
wxInt32 iRetVal = 0;
if ( IsConnected() )
iRetVal = Disconnect();
// attempt to cleanup the account management information
acct_mgr.close();
if ( m_pNetworkConnectionThread )
{
m_pNetworkConnectionThread->Delete();
m_pNetworkConnectionThread->Wait();
delete m_pNetworkConnectionThread;
}
return iRetVal;
}
@ -169,66 +302,12 @@ wxInt32 CMainDocument::OnRefreshState()
wxInt32 CMainDocument::Connect( const wxChar* szComputer, const wxChar* szComputerPassword, bool bDisconnect )
{
wxInt32 iRetVal = -1;
std::string strComputer;
std::string strComputerPassword;
m_bNCTNewShouldReconnect = bDisconnect;
m_strNCTNewConnectedComputerName = szComputer;
m_strNCTNewConnectedComputerPassword = szComputerPassword;
if ( IsConnected() && bDisconnect )
Disconnect();
if ( IsConnected() )
return BOINC_SUCCESS;
if ( strComputer.empty() && !m_strConnectedComputerName.empty() )
if (szComputer)
strComputer = szComputer;
else
strComputer = m_strConnectedComputerName.c_str();
else
{
if (szComputer)
strComputer = szComputer;
}
if ( strComputerPassword.empty() && !m_strConnectedComputerPassword.empty() )
if (szComputerPassword)
strComputerPassword = szComputerPassword;
else
strComputerPassword = m_strConnectedComputerPassword.c_str();
else
{
if (szComputerPassword)
strComputerPassword = szComputerPassword;
}
if ( strComputer.empty() )
iRetVal = rpc.init( NULL );
else
iRetVal = rpc.init( strComputer.c_str() );
if (iRetVal)
{
wxLogTrace("CMainDocument::Connect - RPC Initialization Failed '%d'", iRetVal);
return iRetVal;
}
if ( !strComputerPassword.empty() )
iRetVal = rpc.authorize( strComputerPassword.c_str() );
if (iRetVal)
{
wxLogTrace("CMainDocument::Connect - RPC Authorization Failed '%d'", iRetVal);
return iRetVal;
}
if ( 0 == iRetVal )
{
m_bIsConnected = true;
m_strConnectedComputerName = strComputer.c_str();
m_strConnectedComputerPassword = strComputerPassword.c_str();
}
return iRetVal;
m_bNCTConnectEvent = true;
return 0;
}

View File

@ -27,6 +27,20 @@
#include "gui_rpc_client.h"
#include "acct_mgr_client.h"
class CMainDocument;
class CNetworkConnectionThread : public wxThread
{
public:
CNetworkConnectionThread( CMainDocument* pDocument );
virtual void* Entry();
void OnExit();
private:
CMainDocument* m_pDocument;
};
class CMainDocument : public wxObject
{
@ -66,16 +80,9 @@ public:
//
private:
RPC_CLIENT rpc;
CC_STATE state;
HOST_INFO host;
wxDateTime m_dtCachedStateTimestamp;
wxDateTime m_dtCachedStateLockTimestamp;
bool m_bCachedStateLocked;
bool m_bIsConnected;
wxString m_strConnectedComputerName;
wxString m_strConnectedComputerPassword;
CNetworkConnectionThread* m_pNetworkConnectionThread;
wxDateTime m_dtCachedActivityRunModeTimestamp;
wxDateTime m_dtCachedNetworkRunModeTimestamp;
@ -113,13 +120,26 @@ public:
wxInt32 RunBenchmarks();
wxInt32 CoreClientQuit();
RPC_CLIENT rpc;
CC_STATE state;
HOST_INFO host;
wxDateTime m_dtCachedStateTimestamp;
wxDateTime m_dtCachedStateLockTimestamp;
bool m_bNCTConnectEvent;
bool m_bNCTNewShouldReconnect;
wxString m_strNCTNewConnectedComputerName;
wxString m_strNCTNewConnectedComputerPassword;
bool m_bIsConnected;
wxString m_strConnectedComputerName;
wxString m_strConnectedComputerPassword;
//
// Project Tab
//
private:
PROJECTS project_status;
float m_fProjectTotalResourceShare;
wxInt32 CachedProjectStatusUpdate();
@ -150,14 +170,14 @@ public:
wxInt32 ProjectSuspend( wxInt32 iIndex );
wxInt32 ProjectResume( wxInt32 iIndex );
PROJECTS project_status;
//
// Work Tab
//
private:
RESULTS results;
wxInt32 CachedResultsStatusUpdate();
public:
@ -187,15 +207,14 @@ public:
wxInt32 WorkShowGraphics( wxInt32 iIndex, bool bFullScreen, std::string, std::string, std::string );
wxInt32 WorkAbort( wxInt32 iIndex );
RESULTS results;
//
// Messages Tab
//
private:
MESSAGES messages;
wxInt32 m_iMessageSequenceNumber;
wxInt32 CachedMessageUpdate();
public:
@ -208,14 +227,15 @@ public:
wxInt32 ResetMessageState();
MESSAGES messages;
wxInt32 m_iMessageSequenceNumber;
//
// Transfers Tab
//
private:
FILE_TRANSFERS ft;
wxInt32 CachedFileTransfersUpdate();
public:
@ -235,14 +255,14 @@ public:
wxInt32 TransferRetryNow( wxInt32 iIndex );
wxInt32 TransferAbort( wxInt32 iIndex );
FILE_TRANSFERS ft;
//
// Resources Tab
//
private:
PROJECTS resource_status;
wxInt32 CachedResourceStatusUpdate();
public:
@ -251,14 +271,14 @@ public:
wxInt32 GetResourceProjectName( wxInt32 iIndex, wxString& strBuffer );
wxInt32 GetResourceDiskspace( wxInt32 iIndex, float& fBuffer );
PROJECTS resource_status;
//
// Statistics Tab
//
private:
//PROJECTS statistics_status;
wxInt32 CachedStatisticsStatusUpdate();
public:
@ -266,7 +286,6 @@ public:
wxInt32 GetStatisticsCount();
wxInt32 GetStatisticsProjectName( wxInt32 iIndex, wxString& strBuffer );
//Should be private, but functions to access currently not implemented
PROJECTS statistics_status;
@ -275,8 +294,6 @@ public:
//
private:
PROXY_INFO proxy_info;
public:
wxInt32 GetProxyConfiguration();
@ -303,14 +320,14 @@ public:
wxInt32 SetProxySOCKSUserName( const wxString& strUserName );
wxInt32 SetProxySOCKSPassword( const wxString& strPassword );
PROXY_INFO proxy_info;
//
// Account Management
//
private:
ACCT_MGR_CLIENT acct_mgr;
public:
wxInt32 GetAccountManagerName( wxString& strName );
@ -320,6 +337,8 @@ public:
bool IsAccountManagerFound();
bool IsAccountManagerLoginFound();
ACCT_MGR_CLIENT acct_mgr;
};
#endif

View File

@ -90,6 +90,7 @@
#include <wx/settings.h>
#include <wx/process.h>
#include <wx/dynarray.h>
#include <wx/thread.h>
#ifndef NOTASKBAR
#include <wx/taskbar.h> // taskbar support