*** empty log message ***

svn path=/trunk/boinc/; revision=9385
This commit is contained in:
Rom Walton 2006-02-02 12:32:21 +00:00
parent de249941c3
commit c80c4f41d8
7 changed files with 220 additions and 71 deletions

View File

@ -1372,3 +1372,12 @@ Rom 2 Feb 2006
ProjectProcessingPage.cpp
lib/
gui_rpc_client.h
Rom 2 Feb 2006
- Setup new menu layout
clientgui/
BOINCGUIApp.cpp
Events.h
MainFrame.cpp, .h
WizardAccountManager.cpp, .h

View File

@ -112,11 +112,11 @@ bool CBrandingScheme::OnInit( wxConfigBase *pConfig ) {
switch (iBrandId) {
case 1:
// Running as a GridRepublic client.
m_strApplicationName = wxT("GridRepublic Manager");
m_strApplicationName = wxT("GridRepublic Desktop");
m_iconApplicationIcon = wxIcon(gridrepublic_xpm);
m_bitmapApplicationLogo = wxBitmap(gridrepublic_xpm);
m_strCompanyName = wxT("GridRepublic");
m_strCompanyWebsite = wxT("http://www.gridrepublic.com/");
m_strCompanyWebsite = wxT("http://www.gridrepublic.org/");
m_strProjectName = wxT("GridRepublic");
m_strAPWizardTitle = wxEmptyString;
m_bDefaultTabSpecified = false;

View File

@ -35,7 +35,7 @@
#define ID_FILENETWORKRUNALWAYS 6012
#define ID_FILENETWORKRUNBASEDONPREPERENCES 6013
#define ID_FILENETWORKSUSPEND 6014
#define ID_COMMADSRETRYCOMMUNICATIONS 6015
#define ID_COMMANDSRETRYCOMMUNICATIONS 6015
#define ID_FILERUNBENCHMARKS 6016
#define ID_FILESELECTCOMPUTER 6017
#define ID_PROJECTSATTACHACCOUNTMANAGER 6018
@ -49,6 +49,8 @@
#define ID_TB_NETWORKRUNALWAYS 6026
#define ID_TB_NETWORKRUNBASEDONPREPERENCES 6027
#define ID_TB_NETWORKSUSPEND 6028
#define ID_TOOLSAMUPDATENOW 6029
#define ID_ADVANCEDAMDEFECT 6030
#define ID_LIST_BASE 7000
#define ID_LIST_PROJECTSVIEW 7000
#define ID_LIST_WORKVIEW 7001

View File

@ -159,8 +159,10 @@ BEGIN_EVENT_TABLE (CMainFrame, wxFrame)
EVT_MENU_RANGE(ID_FILEACTIVITYRUNALWAYS, ID_FILEACTIVITYSUSPEND, CMainFrame::OnActivitySelection)
EVT_MENU_RANGE(ID_FILENETWORKRUNALWAYS, ID_FILENETWORKSUSPEND, CMainFrame::OnNetworkSelection)
EVT_MENU(ID_PROJECTSATTACHACCOUNTMANAGER, CMainFrame::OnProjectsAttachToAccountManager)
EVT_MENU(ID_TOOLSAMUPDATENOW, CMainFrame::OnAccountManagerUpdate)
EVT_MENU(ID_ADVANCEDAMDEFECT, CMainFrame::OnAccountManagerDetach)
EVT_MENU(ID_PROJECTSATTACHPROJECT, CMainFrame::OnProjectsAttachToProject)
EVT_MENU(ID_COMMADSRETRYCOMMUNICATIONS, CMainFrame::OnCommandsRetryCommunications)
EVT_MENU(ID_COMMANDSRETRYCOMMUNICATIONS, CMainFrame::OnCommandsRetryCommunications)
EVT_MENU(ID_OPTIONSOPTIONS, CMainFrame::OnOptionsOptions)
EVT_HELP(ID_FRAME, CMainFrame::OnHelp)
EVT_MENU(ID_HELPBOINCMANAGER, CMainFrame::OnHelpBOINCManager)
@ -320,26 +322,24 @@ CMainFrame::~CMainFrame() {
bool CMainFrame::CreateMenu() {
wxString strMenuName;
wxString strMenuDescription;
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateMenu - Function Begin"));
CMainDocument* pDoc = wxGetApp().GetDocument();
ACCT_MGR_INFO ami;
bool is_acct_mgr_detected = false;
wxString strMenuName;
wxString strMenuDescription;
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
// Account managers have a different menu arrangement
pDoc->rpc.acct_mgr_info(ami);
is_acct_mgr_detected = ami.acct_mgr_url.size() ? true : false;
// File menu
wxMenu *menuFile = new wxMenu;
// %s is the project name
// i.e. 'BOINC', 'GridRepublic'
strMenuDescription.Printf(
_("Connect to another computer running %s"),
wxGetApp().GetBrand()->GetProjectName().c_str()
);
menuFile->Append(
ID_FILESELECTCOMPUTER,
_("Select computer..."),
strMenuDescription
);
// %s is the application name
// i.e. 'BOINC Manager', 'GridRepublic Manager'
strMenuDescription.Printf(
@ -352,77 +352,113 @@ bool CMainFrame::CreateMenu() {
strMenuDescription
);
// Commands menu
wxMenu *menuCommands = new wxMenu;
// Tools menu
wxMenu *menuTools = new wxMenu;
menuCommands->AppendRadioItem(
if (!is_acct_mgr_detected) {
menuTools->Append(
ID_PROJECTSATTACHPROJECT,
_("Attach to &project"),
_("Attach to a project to begin processing work")
);
menuTools->Append(
ID_PROJECTSATTACHACCOUNTMANAGER,
_("&Account manager"),
_("Attach to an account manager")
);
} else {
menuTools->Append(
ID_TOOLSAMUPDATENOW,
_("&Update now"),
_("Reterive the latest settings from the account manager")
);
}
// Activity menu
wxMenu *menuActivity = new wxMenu;
menuActivity->AppendRadioItem(
ID_FILEACTIVITYRUNALWAYS,
_("&Run always"),
_("Does work regardless of preferences")
);
menuCommands->AppendRadioItem(
menuActivity->AppendRadioItem(
ID_FILEACTIVITYRUNBASEDONPREPERENCES,
_("Run based on &preferences"),
_("Does work according to your preferences")
);
menuCommands->AppendRadioItem(
menuActivity->AppendRadioItem(
ID_FILEACTIVITYSUSPEND,
_("&Suspend"),
_("Stops work regardless of preferences")
);
menuCommands->AppendSeparator();
menuActivity->AppendSeparator();
menuCommands->AppendRadioItem(
menuActivity->AppendRadioItem(
ID_FILENETWORKRUNALWAYS,
_("&Network activity always available"),
_("Does network activity regardless of preferences")
);
menuCommands->AppendRadioItem(
menuActivity->AppendRadioItem(
ID_FILENETWORKRUNBASEDONPREPERENCES,
_("Network activity based on &preferences"),
_("Does network activity according to your preferences")
);
menuCommands->AppendRadioItem(
menuActivity->AppendRadioItem(
ID_FILENETWORKSUSPEND,
_("&Network activity suspended"),
_("Stops BOINC network activity")
);
menuCommands->AppendSeparator();
menuCommands->Append(
ID_COMMADSRETRYCOMMUNICATIONS,
_("Retry &communications"),
_("Report completed work, get latest credit, "
"get latest preferences, and possibly get more work.")
);
menuCommands->Append(
ID_FILERUNBENCHMARKS,
_("Run &benchmarks"),
_("Runs BOINC CPU benchmarks")
);
// Projects menu
wxMenu *menuProjects = new wxMenu;
menuProjects->Append(
ID_PROJECTSATTACHPROJECT,
_("Attach to &project"),
_("Attach to a project to begin processing work")
);
menuProjects->Append(
ID_PROJECTSATTACHACCOUNTMANAGER,
_("&Account manager"),
_("Attach to an account manager")
);
// Options menu
wxMenu *menuOptions = new wxMenu;
menuOptions->Append(
// Advanced menu
wxMenu *menuAdvanced = new wxMenu;
menuAdvanced->Append(
ID_OPTIONSOPTIONS,
_("&Options"),
_("Configure GUI options and proxy settings")
);
// %s is the project name
// i.e. 'BOINC', 'GridRepublic'
strMenuDescription.Printf(
_("Connect to another computer running %s"),
wxGetApp().GetBrand()->GetProjectName().c_str()
);
menuAdvanced->Append(
ID_FILESELECTCOMPUTER,
_("Select computer..."),
strMenuDescription
);
menuAdvanced->Append(
ID_FILERUNBENCHMARKS,
_("Run CPU &benchmarks"),
_("Runs BOINC CPU benchmarks")
);
menuAdvanced->Append(
ID_COMMANDSRETRYCOMMUNICATIONS,
_("Retry &communications"),
_("Report completed work, get latest credit, "
"get latest preferences, and possibly get more work.")
);
if (is_acct_mgr_detected) {
// %s is the application name
// i.e. 'BOINC Manager', 'GridRepublic Manager'
strMenuName.Printf(
_("&Defect from %s"),
ami.acct_mgr_name.c_str()
);
menuAdvanced->Append(
ID_ADVANCEDAMDEFECT,
strMenuName,
_("Remove client from account manager control.")
);
menuAdvanced->Append(
ID_PROJECTSATTACHPROJECT,
_("Attach to &project"),
_("Attach to a project to begin processing work")
);
}
// Help menu
wxMenu *menuHelp = new wxMenu;
@ -484,22 +520,27 @@ bool CMainFrame::CreateMenu() {
_("&File")
);
m_pMenubar->Append(
menuCommands,
_("&Commands")
menuTools,
_("&Tools")
);
m_pMenubar->Append(
menuProjects,
_("&Projects")
menuActivity,
_("&Activity")
);
m_pMenubar->Append(
menuOptions,
_("&Options")
menuAdvanced,
_("A&dvanced")
);
m_pMenubar->Append(
menuHelp,
_("&Help")
);
wxMenuBar* m_pOldMenubar = GetMenuBar();
SetMenuBar(m_pMenubar);
if (m_pOldMenubar) {
delete m_pOldMenubar;
}
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::CreateMenu - Function End"));
return true;
@ -589,7 +630,6 @@ bool CMainFrame::CreateStatusbar() {
bool CMainFrame::DeleteMenu() {
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::DeleteMenu - Function Begin"));
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::DeleteMenu - Function End"));
return true;
}
@ -1077,7 +1117,7 @@ void CMainFrame::OnProjectsAttachToAccountManager(wxCommandEvent& WXUNUSED(event
CWizardAccountManager* pWizard = new CWizardAccountManager(this);
pWizard->Run();
pWizard->Run(ACCOUNTMANAGER_ATTACH);
if (pWizard)
pWizard->Destroy();
@ -1096,6 +1136,86 @@ void CMainFrame::OnProjectsAttachToAccountManager(wxCommandEvent& WXUNUSED(event
}
void CMainFrame::OnAccountManagerUpdate(wxCommandEvent& WXUNUSED(event)) {
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAccountManagerUpdate - Function Begin"));
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
#ifdef __WXMAC__
if (!Mac_Authorize())
return;
#endif
if (pDoc->IsConnected()) {
m_pRefreshStateTimer->Stop();
m_pFrameRenderTimer->Stop();
m_pFrameListPanelRenderTimer->Stop();
m_pDocumentPollTimer->Stop();
CWizardAccountManager* pWizard = new CWizardAccountManager(this);
pWizard->Run(ACCOUNTMANAGER_UPDATE);
if (pWizard)
pWizard->Destroy();
FireRefreshView();
m_pRefreshStateTimer->Start();
m_pFrameRenderTimer->Start();
m_pFrameListPanelRenderTimer->Start();
m_pDocumentPollTimer->Start();
} else {
ShowNotCurrentlyConnectedAlert();
}
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAccountManagerUpdate - Function End"));
}
void CMainFrame::OnAccountManagerDetach(wxCommandEvent& WXUNUSED(event)) {
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAccountManagerDetach - Function Begin"));
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
#ifdef __WXMAC__
if (!Mac_Authorize())
return;
#endif
if (pDoc->IsConnected()) {
m_pRefreshStateTimer->Stop();
m_pFrameRenderTimer->Stop();
m_pFrameListPanelRenderTimer->Stop();
m_pDocumentPollTimer->Stop();
CWizardAccountManager* pWizard = new CWizardAccountManager(this);
pWizard->Run(ACCOUNTMANAGER_DETACH);
if (pWizard)
pWizard->Destroy();
FireRefreshView();
m_pRefreshStateTimer->Start();
m_pFrameRenderTimer->Start();
m_pFrameListPanelRenderTimer->Start();
m_pDocumentPollTimer->Start();
} else {
ShowNotCurrentlyConnectedAlert();
}
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnAccountManagerDetach - Function End"));
}
void CMainFrame::OnProjectsAttachToProject( wxCommandEvent& WXUNUSED(event) ) {
wxLogTrace(wxT("Function Start/End"), wxT("CMainFrame::OnProjectsAttachToProject - Function Begin"));
@ -1436,6 +1556,9 @@ void CMainFrame::OnConnect(CMainFrameEvent&) {
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
// Update the menus
DeleteMenu();
CreateMenu();
// Only present one of the wizards if no projects are currently
// detected.

View File

@ -73,6 +73,8 @@ public:
void OnCommandsRetryCommunications( wxCommandEvent& event );
void OnProjectsAttachToAccountManager( wxCommandEvent& event );
void OnAccountManagerUpdate( wxCommandEvent& event );
void OnAccountManagerDetach( wxCommandEvent& event );
void OnProjectsAttachToProject( wxCommandEvent& event );
void OnOptionsOptions( wxCommandEvent& event );

View File

@ -242,7 +242,7 @@ void CWizardAccountManager::CreateControls()
* Runs the wizard.
*/
bool CWizardAccountManager::Run() {
bool CWizardAccountManager::Run(int action) {
ACCT_MGR_INFO ami;
CMainDocument* pDoc = wxGetApp().GetDocument();
@ -276,10 +276,20 @@ bool CWizardAccountManager::Run() {
m_bCredentialsCached = ami.have_credentials;
}
if ( ami.acct_mgr_url.size() && !ami.have_credentials && m_AccountManagerPropertiesPage) {
if ( ami.acct_mgr_url.size() && !ami.have_credentials) {
return RunWizard(m_AccountManagerPropertiesPage);
} else if ( ami.acct_mgr_url.size() && ami.have_credentials && m_AccountManagerStatusPage) {
return RunWizard(m_AccountManagerStatusPage);
} else if ( ami.acct_mgr_url.size() && ami.have_credentials && (action == ACCOUNTMANAGER_UPDATE)) {
IsAccountManagerUpdateWizard = true;
IsAccountManagerRemoveWizard = false;
return RunWizard(m_AccountManagerProcessingPage);
} else if ( ami.acct_mgr_url.size() && ami.have_credentials && (action == ACCOUNTMANAGER_DETACH)) {
IsAccountManagerUpdateWizard = false;
IsAccountManagerRemoveWizard = true;
m_AccountManagerInfoPage->SetProjectURL(wxEmptyString);
m_AccountInfoPage->SetAccountEmailAddress(wxEmptyString);
m_AccountInfoPage->SetAccountPassword(wxEmptyString);
m_bCredentialsCached = false;
return RunWizard(m_AccountManagerProcessingPage);
} else if (m_WelcomePage) {
return RunWizard(m_WelcomePage);
}

View File

@ -35,6 +35,9 @@ class CAccountManagerPropertiesPage;
class CAccountManagerProcessingPage;
////@end forward declarations
#define ACCOUNTMANAGER_ATTACH 0
#define ACCOUNTMANAGER_UPDATE 1
#define ACCOUNTMANAGER_DETACH 2
/*!
* CWizardAccountManager class declaration
@ -66,7 +69,7 @@ public:
////@begin CWizardAccountManager member function declarations
/// Runs the wizard.
bool Run();
bool Run(int action = ACCOUNTMANAGER_ATTACH);
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );