mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=4452
This commit is contained in:
parent
903c0c1891
commit
50dc9e51ae
|
@ -39,12 +39,13 @@
|
|||
#define ID_NETWORKRUNBASEDONPREPERENCES 6010
|
||||
#define ID_NETWORKSUSPEND 6011
|
||||
#define ID_RUNBENCHMARKS 6012
|
||||
#define ID_TB_ACTIVITYRUNALWAYS 6013
|
||||
#define ID_TB_ACTIVITYRUNBASEDONPREPERENCES 6014
|
||||
#define ID_TB_ACTIVITYSUSPEND 6015
|
||||
#define ID_TB_NETWORKRUNALWAYS 6016
|
||||
#define ID_TB_NETWORKRUNBASEDONPREPERENCES 6017
|
||||
#define ID_TB_NETWORKSUSPEND 6018
|
||||
#define ID_SELECTCOMPUTER 6013
|
||||
#define ID_TB_ACTIVITYRUNALWAYS 6014
|
||||
#define ID_TB_ACTIVITYRUNBASEDONPREPERENCES 6015
|
||||
#define ID_TB_ACTIVITYSUSPEND 6016
|
||||
#define ID_TB_NETWORKRUNALWAYS 6017
|
||||
#define ID_TB_NETWORKRUNBASEDONPREPERENCES 6018
|
||||
#define ID_TB_NETWORKSUSPEND 6019
|
||||
#define ID_LIST_BASE 7000
|
||||
#define ID_LIST_PROJECTSVIEW 7000
|
||||
#define ID_LIST_WORKVIEW 7001
|
||||
|
|
|
@ -48,6 +48,7 @@ CMainDocument::CMainDocument()
|
|||
#endif
|
||||
|
||||
m_bIsConnected = false;
|
||||
m_strConnectedComputer = wxEmptyString;
|
||||
|
||||
m_iCachedActivityRunMode = 0;
|
||||
m_iCachedNetworkRunMode = 0;
|
||||
|
@ -79,6 +80,7 @@ CMainDocument::~CMainDocument()
|
|||
m_iCachedActivityRunMode = 0;
|
||||
m_iCachedNetworkRunMode = 0;
|
||||
|
||||
m_strConnectedComputer = wxEmptyString;
|
||||
m_bIsConnected = false;
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
@ -126,41 +128,95 @@ wxInt32 CMainDocument::CachedStateUpdate()
|
|||
|
||||
wxInt32 CMainDocument::OnInit()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
wxInt32 iRetVal = -1;
|
||||
wxString strMachine = wxEmptyString;
|
||||
|
||||
if (!m_bIsConnected)
|
||||
{
|
||||
retval = rpc.init(NULL);
|
||||
if (retval)
|
||||
wxLogTrace("CMainDocument::OnInit - RPC Initialization Failed '%d'", retval);
|
||||
}
|
||||
if ( !IsConnected() )
|
||||
iRetVal = Connect( strMachine );
|
||||
|
||||
return retval;
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::OnExit()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
wxInt32 iRetVal = 0;
|
||||
|
||||
if (m_bIsConnected)
|
||||
rpc.close();
|
||||
if ( IsConnected() )
|
||||
iRetVal = Disconnect();
|
||||
|
||||
return retval;
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::OnIdle()
|
||||
{
|
||||
if (m_bIsConnected)
|
||||
{
|
||||
if ( IsConnected() )
|
||||
CachedStateUpdate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::Connect( wxString& strMachine )
|
||||
{
|
||||
wxInt32 iRetVal = -1;
|
||||
std::string str;
|
||||
|
||||
if ( IsConnected() )
|
||||
Disconnect();
|
||||
|
||||
str.clear();
|
||||
|
||||
if ( strMachine.empty() && !m_strConnectedComputer.empty() )
|
||||
str = m_strConnectedComputer.c_str();
|
||||
else
|
||||
str = strMachine.c_str();
|
||||
|
||||
if ( str.empty() )
|
||||
iRetVal = rpc.init( NULL );
|
||||
else
|
||||
iRetVal = rpc.init( str.c_str() );
|
||||
|
||||
if ( 0 == iRetVal )
|
||||
m_strConnectedComputer = strMachine;
|
||||
else
|
||||
wxLogTrace("CMainDocument::Connect - RPC Initialization Failed '%d'", iRetVal);
|
||||
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::Disconnect()
|
||||
{
|
||||
if ( IsConnected() )
|
||||
{
|
||||
rpc.close();
|
||||
state.clear();
|
||||
host.clear();
|
||||
project_status.clear();
|
||||
results.clear();
|
||||
messages.clear();
|
||||
ft.clear();
|
||||
resource_status.clear();
|
||||
proxy_info.clear();
|
||||
|
||||
m_dtCachedStateLockTimestamp = wxDateTime::Now();
|
||||
m_dtCachedStateTimestamp = wxDateTime( (time_t)0 );
|
||||
|
||||
m_bIsConnected = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool CMainDocument::IsConnected()
|
||||
{
|
||||
return m_bIsConnected;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::CachedStateLock()
|
||||
{
|
||||
m_bCachedStateLocked = true;
|
||||
|
|
|
@ -79,6 +79,7 @@ private:
|
|||
bool m_bCachedStateLocked;
|
||||
|
||||
bool m_bIsConnected;
|
||||
wxString m_strConnectedComputer;
|
||||
|
||||
wxInt32 m_iCachedActivityRunMode;
|
||||
wxInt32 m_iCachedNetworkRunMode;
|
||||
|
@ -91,6 +92,10 @@ public:
|
|||
wxInt32 OnExit();
|
||||
wxInt32 OnIdle();
|
||||
|
||||
wxInt32 Connect( wxString& strMachine );
|
||||
wxInt32 Disconnect();
|
||||
bool IsConnected();
|
||||
|
||||
wxInt32 CachedStateLock();
|
||||
wxInt32 CachedStateUnlock();
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include "DlgOptions.h"
|
||||
|
||||
#include "res/BOINCGUIApp.xpm"
|
||||
#include "res/connect.xpm"
|
||||
#include "res/disconnect.xpm"
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(CMainFrame, wxFrame)
|
||||
|
@ -48,6 +50,7 @@ BEGIN_EVENT_TABLE (CMainFrame, wxFrame)
|
|||
EVT_MENU_RANGE(ID_ACTIVITYRUNALWAYS, ID_ACTIVITYSUSPEND, CMainFrame::OnActivitySelection)
|
||||
EVT_MENU_RANGE(ID_NETWORKRUNALWAYS, ID_NETWORKSUSPEND, CMainFrame::OnNetworkSelection)
|
||||
EVT_MENU(ID_RUNBENCHMARKS, CMainFrame::OnRunBenchmarks)
|
||||
EVT_MENU(ID_SELECTCOMPUTER, CMainFrame::OnSelectComputer)
|
||||
EVT_MENU(wxID_EXIT, CMainFrame::OnExit)
|
||||
EVT_MENU(ID_TOOLSOPTIONS, CMainFrame::OnToolsOptions)
|
||||
EVT_MENU(wxID_ABOUT, CMainFrame::OnAbout)
|
||||
|
@ -181,6 +184,14 @@ bool CMainFrame::CreateMenu()
|
|||
|
||||
menuFile->AppendSeparator();
|
||||
|
||||
menuFile->Append(
|
||||
ID_SELECTCOMPUTER,
|
||||
_("Select Computer..."),
|
||||
_("Allows you to remotely connect up to another computer running BOINC")
|
||||
);
|
||||
|
||||
menuFile->AppendSeparator();
|
||||
|
||||
menuFile->Append(
|
||||
wxID_EXIT,
|
||||
_("E&xit"),
|
||||
|
@ -287,7 +298,7 @@ bool CMainFrame::CreateStatusbar()
|
|||
|
||||
wxInt32 ch = GetCharWidth();
|
||||
|
||||
const wxInt32 widths[] = {-1, 20*ch, 15};
|
||||
const wxInt32 widths[] = {-1, 16, 15};
|
||||
|
||||
m_pStatusbar = CreateStatusBar(WXSIZEOF(widths), wxST_SIZEGRIP, ID_STATUSBAR);
|
||||
wxASSERT(NULL != m_pStatusbar);
|
||||
|
@ -297,6 +308,9 @@ bool CMainFrame::CreateStatusbar()
|
|||
SetStatusBar(m_pStatusbar);
|
||||
SendSizeEvent();
|
||||
|
||||
m_pbmpConnected = new wxStaticBitmap(m_pStatusbar, -1, wxIcon(connect_xpm));
|
||||
m_pbmpDisconnected = new wxStaticBitmap(m_pStatusbar, -1, wxIcon(disconnect_xpm));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -541,6 +555,30 @@ void CMainFrame::OnRunBenchmarks( wxCommandEvent& WXUNUSED(event) )
|
|||
}
|
||||
|
||||
|
||||
void CMainFrame::OnSelectComputer( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxInt32 iRetVal = -1;
|
||||
wxString strMachine = wxEmptyString;
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
|
||||
wxASSERT(NULL != pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
|
||||
strMachine = ::wxGetTextFromUser(
|
||||
_("Which computer do you wish to connect to?"),
|
||||
_("Select Computer...")
|
||||
);
|
||||
|
||||
iRetVal = pDoc->Connect( strMachine );
|
||||
if ( !(0 == iRetVal) )
|
||||
::wxMessageBox(
|
||||
_("Failed to connect to the requested computer, please check the name of the computer and try again."),
|
||||
_("Failed to connect..."),
|
||||
wxICON_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void CMainFrame::OnExit( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
Close(true);
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
void OnActivitySelection( wxCommandEvent& event );
|
||||
void OnNetworkSelection( wxCommandEvent& event );
|
||||
void OnRunBenchmarks( wxCommandEvent& event );
|
||||
void OnSelectComputer( wxCommandEvent& event );
|
||||
void OnExit( wxCommandEvent& event );
|
||||
|
||||
void OnToolsOptions( wxCommandEvent& event );
|
||||
|
@ -74,6 +75,9 @@ private:
|
|||
wxTimer* m_pFrameTaskPanelRenderTimer;
|
||||
wxTimer* m_pFrameListPanelRenderTimer;
|
||||
|
||||
wxStaticBitmap* m_pbmpConnected;
|
||||
wxStaticBitmap* m_pbmpDisconnected;
|
||||
|
||||
|
||||
bool CreateMenu();
|
||||
bool DeleteMenu();
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
// Revision History:
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.2 2004/10/28 07:03:06 rwalton
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.1 2004/10/28 06:53:17 rwalton
|
||||
// *** empty log message ***
|
||||
//
|
||||
|
@ -31,7 +34,7 @@ static const char *connect_xpm[] = {
|
|||
"16 16 6 1",
|
||||
" c #000000",
|
||||
". c #C0C0C0",
|
||||
"X c #FF00FF",
|
||||
"X c None",
|
||||
"o c #FFFFFF",
|
||||
"O c #808080",
|
||||
"+ c #FF0000",
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
// Revision History:
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.2 2004/10/28 07:03:06 rwalton
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.1 2004/10/28 06:53:17 rwalton
|
||||
// *** empty log message ***
|
||||
//
|
||||
|
@ -31,7 +34,7 @@ static const char *disconnect_xpm[] = {
|
|||
"16 16 6 1",
|
||||
" c #000000",
|
||||
". c #C0C0C0",
|
||||
"X c #FF00FF",
|
||||
"X c None",
|
||||
"o c #FFFFFF",
|
||||
"O c #808080",
|
||||
"+ c #FF0000",
|
||||
|
|
|
@ -72,9 +72,11 @@
|
|||
#include <wx/notebook.h> // notebook support
|
||||
#include <wx/html/htmlwin.h> // html window support
|
||||
#include <wx/statline.h> // static line support
|
||||
#include <wx/statbmp.h> // static bitmap support
|
||||
#include <wx/taskbar.h> // taskbar support
|
||||
#include <wx/clipbrd.h> // clipboard support
|
||||
#include <wx/datetime.h> // date/time support
|
||||
#include <wx/textdlg.h>
|
||||
#include <wx/mimetype.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/utils.h>
|
||||
|
|
Loading…
Reference in New Issue