- MGR: Add a virtual list box to display available account managers.

clientgui/
        AccountManagerInfoPage.cpp, .h
        AccountManagerProcessingPage.cpp
        AccountManagerPropertiesPage.cpp
        ProjectInfoPage.cpp, .h
        WizardAccountManager.cpp
    lib/
        gui_rpc_client_ops.cpp

svn path=/trunk/boinc/; revision=17075
This commit is contained in:
Rom Walton 2009-01-29 22:20:14 +00:00
parent ca7b1cd8e4
commit d2007737d0
9 changed files with 105 additions and 47 deletions

View File

@ -916,3 +916,15 @@ David 29 Jan 2009
client/
work_fetch.cpp
Rom 29 Jan 2009
- MGR: Add a virtual list box to display available account managers.
clientgui/
AccountManagerInfoPage.cpp, .h
AccountManagerProcessingPage.cpp
AccountManagerPropertiesPage.cpp
ProjectInfoPage.cpp, .h
WizardAccountManager.cpp
lib/
gui_rpc_client_ops.cpp

View File

@ -36,6 +36,7 @@
#include "BOINCWizards.h"
#include "BOINCBaseWizard.h"
#include "AccountManagerInfoPage.h"
#include "ProjectListCtrl.h"
/*!
@ -54,7 +55,7 @@ BEGIN_EVENT_TABLE( CAccountManagerInfoPage, wxWizardPageEx )
EVT_WIZARDEX_PAGE_CHANGED( -1, CAccountManagerInfoPage::OnPageChanged )
EVT_WIZARDEX_PAGE_CHANGING( -1, CAccountManagerInfoPage::OnPageChanging )
EVT_WIZARDEX_CANCEL( -1, CAccountManagerInfoPage::OnCancel )
EVT_PROJECTLISTCTRL_SELECTION_CHANGED( CAccountManagerInfoPage::OnAccountManagerSelectionChanged )
////@end CAccountManagerInfoPage event table entries
END_EVENT_TABLE()
@ -81,12 +82,11 @@ bool CAccountManagerInfoPage::Create( CBOINCBaseWizard* parent )
////@begin CAccountManagerInfoPage member initialisation
m_pTitleStaticCtrl = NULL;
m_pDescriptionStaticCtrl = NULL;
m_pDescription2StaticCtrl = NULL;
m_pProjectListCtrl = NULL;
m_pProjectUrlStaticCtrl = NULL;
m_pProjectUrlCtrl = NULL;
m_pBOINCPromoStaticCtrl = NULL;
m_pBOINCPromoUrlCtrl = NULL;
////@end CAccountManagerInfoPage member initialisation
m_bAccountManagerListPopulated = false;
////@begin CAccountManagerInfoPage creation
wxBitmap wizardBitmap(wxNullBitmap);
@ -121,9 +121,26 @@ void CAccountManagerInfoPage::CreateControls()
itemBoxSizer24->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
m_pDescription2StaticCtrl = new wxStaticText;
m_pDescription2StaticCtrl->Create( itemWizardPage23, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer24->Add(m_pDescription2StaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(1, 1, 0, 0);
itemFlexGridSizer3->AddGrowableRow(0);
itemFlexGridSizer3->AddGrowableCol(0);
itemBoxSizer24->Add(itemFlexGridSizer3, 1, wxGROW|wxALL, 5);
m_pProjectListCtrl = new CProjectListCtrl;
m_pProjectListCtrl->Create( itemWizardPage23 );
itemFlexGridSizer3->Add(m_pProjectListCtrl, 0, wxGROW|wxRIGHT, 10);
wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(2, 1, 0, 0);
itemFlexGridSizer11->AddGrowableRow(0);
itemFlexGridSizer11->AddGrowableCol(0);
itemBoxSizer24->Add(itemFlexGridSizer11, 0, wxGROW|wxALL, 0);
wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL);
itemFlexGridSizer11->Add(itemBoxSizer22, 0, wxGROW|wxALL, 0);
wxFlexGridSizer* itemFlexGridSizer14 = new wxFlexGridSizer(1, 2, 0, 0);
itemFlexGridSizer14->AddGrowableCol(1);
itemBoxSizer24->Add(itemFlexGridSizer14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxRIGHT, 10);
itemBoxSizer24->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
@ -139,16 +156,6 @@ void CAccountManagerInfoPage::CreateControls()
m_pProjectUrlCtrl->Create( itemWizardPage23, ID_PROJECTURLCTRL, wxEmptyString, wxDefaultPosition, wxSize(200, -1), 0 );
itemFlexGridSizer30->Add(m_pProjectUrlCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemBoxSizer24->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
m_pBOINCPromoStaticCtrl = new wxStaticText;
m_pBOINCPromoStaticCtrl->Create( itemWizardPage23, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer24->Add(m_pBOINCPromoStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
m_pBOINCPromoUrlCtrl = new wxHyperLink;
m_pBOINCPromoUrlCtrl->Create( itemWizardPage23, ID_BOINCHYPERLINK, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxNO_BORDER );
itemBoxSizer24->Add(m_pBOINCPromoUrlCtrl, 0, wxALIGN_LEFT|wxALL, 5);
// Set validators
m_pProjectUrlCtrl->SetValidator( CValidateURL( & m_strProjectURL) );
////@end CAccountManagerInfoPage content construction
@ -161,13 +168,13 @@ void CAccountManagerInfoPage::CreateControls()
void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) {
if (event.GetDirection() == false) return;
unsigned int i;
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(m_pTitleStaticCtrl);
wxASSERT(m_pDescriptionStaticCtrl);
wxASSERT(m_pDescription2StaticCtrl);
wxASSERT(m_pProjectUrlStaticCtrl);
wxASSERT(m_pProjectUrlCtrl);
wxASSERT(m_pBOINCPromoStaticCtrl);
wxASSERT(m_pBOINCPromoUrlCtrl);
m_pTitleStaticCtrl->SetLabel(
_("Account Manager URL")
@ -175,21 +182,29 @@ void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) {
m_pDescriptionStaticCtrl->SetLabel(
_("Enter the URL of the account manager's web site.")
);
m_pDescription2StaticCtrl->SetLabel(
_("You can copy and paste the URL from your browser's\naddress bar.")
);
m_pProjectUrlStaticCtrl->SetLabel(
_("Account Manager &URL:")
);
m_pBOINCPromoStaticCtrl->SetLabel(
_("For a list of account managers go to:")
);
m_pBOINCPromoUrlCtrl->SetLabel(
wxT("http://boinc.berkeley.edu/")
);
// Populate the virtual list control with project information
//
if (!m_bAccountManagerListPopulated) {
pDoc->rpc.get_all_projects_list(m_pl);
for (i=0; i<m_pl.account_managers.size(); i++) {
m_bAccountManagerListPopulated = false;
m_pProjectListCtrl->Append(
wxString(m_pl.account_managers[i]->name.c_str(), wxConvUTF8),
wxString(m_pl.account_managers[i]->url.c_str(), wxConvUTF8)
);
}
m_bAccountManagerListPopulated = true;
}
Layout();
Fit();
m_pProjectUrlCtrl->SetFocus();
m_pProjectListCtrl->Layout();
m_pProjectListCtrl->SetFocus();
}
/*!
@ -200,6 +215,16 @@ void CAccountManagerInfoPage::OnPageChanging( wxWizardExEvent& event ) {
event.Skip();
}
/*!
* wxEVT_PROJECTLISTCTRL_SELECTION_CHANGED event handler for ID_PROJECTSELECTIONCTRL
*/
void CAccountManagerInfoPage::OnAccountManagerSelectionChanged( ProjectListCtrlEvent& event ) {
m_pProjectUrlCtrl->SetValue(
event.GetURL()
);
}
/*!
* wxEVT_WIZARD_CANCEL event handler for ID_PROJECTINFOPAGE
*/

View File

@ -22,6 +22,9 @@
#pragma interface "AccountManagerInfoPage.cpp"
#endif
class CProjectListCtrl;
class ProjectListCtrlEvent;
/*!
* CAccountManagerInfoPage class declaration
*/
@ -51,6 +54,9 @@ public:
/// wxEVT_WIZARD_PAGE_CHANGING event handler for ID_ACCOUNTMANAGERINFOPAGE
void OnPageChanging( wxWizardExEvent& event );
/// wxEVT_PROJECTLISTCTRL_SELECTION_CHANGED event handler for ID_PROJECTSELECTIONCTRL
void OnAccountManagerSelectionChanged( ProjectListCtrlEvent& event );
/// wxEVT_WIZARD_CANCEL event handler for ID_ACCOUNTMANAGERINFOPAGE
void OnCancel( wxWizardExEvent& event );
@ -80,13 +86,13 @@ public:
////@begin CAccountManagerInfoPage member variables
wxStaticText* m_pTitleStaticCtrl;
wxStaticText* m_pDescriptionStaticCtrl;
wxStaticText* m_pDescription2StaticCtrl;
CProjectListCtrl* m_pProjectListCtrl;
wxStaticText* m_pProjectUrlStaticCtrl;
wxTextCtrl* m_pProjectUrlCtrl;
wxStaticText* m_pBOINCPromoStaticCtrl;
wxHyperLink* m_pBOINCPromoUrlCtrl;
wxString m_strProjectURL;
////@end CAccountManagerInfoPage member variables
bool m_bAccountManagerListPopulated;
ALL_PROJECTS_LIST m_pl;
};
#endif // _WIZ_ACCOUNTMANAGERINFOPAGE_H_

View File

@ -33,6 +33,7 @@
#include "MainDocument.h"
#include "BOINCWizards.h"
#include "BOINCBaseWizard.h"
#include "ProjectListCtrl.h"
#include "WizardAccountManager.h"
#include "AccountManagerProcessingPage.h"
#include "AccountManagerInfoPage.h"

View File

@ -34,6 +34,7 @@
#include "MainDocument.h"
#include "BOINCWizards.h"
#include "BOINCBaseWizard.h"
#include "ProjectListCtrl.h"
#include "WizardAccountManager.h"
#include "AccountManagerPropertiesPage.h"
#include "AccountManagerInfoPage.h"

View File

@ -88,7 +88,7 @@ bool CProjectInfoPage::Create( CBOINCBaseWizard* parent )
m_pProjectUrlStaticCtrl = NULL;
m_pProjectUrlCtrl = NULL;
////@end CProjectInfoPage member initialisation
bProjectListPopulated = false;
m_bProjectListPopulated = false;
////@begin CProjectInfoPage creation
wxBitmap wizardBitmap(wxNullBitmap);
@ -225,7 +225,8 @@ wxIcon CProjectInfoPage::GetIconResource( const wxString& WXUNUSED(name) )
void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) {
if (event.GetDirection() == false) return;
unsigned int i;
unsigned int i, j, k;
bool bSupportedPlatformFound = false;
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(pDoc);
@ -247,17 +248,23 @@ void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) {
);
// Populate the combo box with project information
// Populate the virtual list control with project information
//
if (!bProjectListPopulated) {
pDoc->rpc.get_all_projects_list(pl);
for (i=0; i<pl.projects.size(); i++) {
m_pProjectListCtrl->Append(
wxString(pl.projects[i]->name.c_str(), wxConvUTF8),
wxString(pl.projects[i]->url.c_str(), wxConvUTF8)
);
if (!m_bProjectListPopulated) {
pDoc->rpc.get_all_projects_list(m_pl);
for (i=0; i<m_pl.projects.size(); i++) {
bSupportedPlatformFound = false;
if (bSupportedPlatformFound) {
m_pProjectListCtrl->Append(
wxString(m_pl.projects[i]->name.c_str(), wxConvUTF8),
wxString(m_pl.projects[i]->url.c_str(), wxConvUTF8)
);
}
}
bProjectListPopulated = true;
m_bProjectListPopulated = true;
}
Layout();

View File

@ -91,8 +91,8 @@ public:
wxTextCtrl* m_pProjectUrlCtrl;
wxString m_strProjectURL;
////@end CProjectInfoPage member variables
bool bProjectListPopulated;
ALL_PROJECTS_LIST pl;
bool m_bProjectListPopulated;
ALL_PROJECTS_LIST m_pl;
};
#endif // _WIZ_PROJECTINFOPAGE_H_

View File

@ -35,6 +35,7 @@
#include "BOINCWizards.h"
#include "BOINCBaseWizard.h"
#include "BOINCBaseFrame.h"
#include "ProjectListCtrl.h"
#include "WizardAccountManager.h"
#include "WelcomePage.h"
#include "AccountManagerInfoPage.h"

View File

@ -715,7 +715,11 @@ void ALL_PROJECTS_LIST::clear() {
for (i=0; i<projects.size(); i++) {
delete projects[i];
}
for (i=0; i<account_managers.size(); i++) {
delete account_managers[i];
}
projects.clear();
account_managers.clear();
}
PROJECTS::~PROJECTS() {
@ -1252,6 +1256,7 @@ int RPC_CLIENT::get_all_projects_list(ALL_PROJECTS_LIST& pl) {
bool is_tag;
MIOFILE mf;
PROJECT_LIST_ENTRY* project;
AM_LIST_ENTRY* am;
RPC rpc(this);
pl.clear();
@ -1272,7 +1277,7 @@ int RPC_CLIENT::get_all_projects_list(ALL_PROJECTS_LIST& pl) {
}
continue;
} else if (!strcmp(tag, "account_manager")) {
AM_LIST_ENTRY* am = new AM_LIST_ENTRY();
am = new AM_LIST_ENTRY();
retval = am->parse(xp);
if (!retval) {
am->rand = drand();