From d2007737d049f4391fe4514762ee29546c58de56 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 29 Jan 2009 22:20:14 +0000 Subject: [PATCH] - 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 --- checkin_notes | 12 +++ clientgui/AccountManagerInfoPage.cpp | 85 ++++++++++++++-------- clientgui/AccountManagerInfoPage.h | 12 ++- clientgui/AccountManagerProcessingPage.cpp | 1 + clientgui/AccountManagerPropertiesPage.cpp | 1 + clientgui/ProjectInfoPage.cpp | 29 +++++--- clientgui/ProjectInfoPage.h | 4 +- clientgui/WizardAccountManager.cpp | 1 + lib/gui_rpc_client_ops.cpp | 7 +- 9 files changed, 105 insertions(+), 47 deletions(-) diff --git a/checkin_notes b/checkin_notes index b20484d9f6..b984873d55 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/clientgui/AccountManagerInfoPage.cpp b/clientgui/AccountManagerInfoPage.cpp index 1700a6cdf6..472e92beb6 100644 --- a/clientgui/AccountManagerInfoPage.cpp +++ b/clientgui/AccountManagerInfoPage.cpp @@ -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; iAppend( + 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 */ diff --git a/clientgui/AccountManagerInfoPage.h b/clientgui/AccountManagerInfoPage.h index 4ec100b90a..3530bc6fa8 100644 --- a/clientgui/AccountManagerInfoPage.h +++ b/clientgui/AccountManagerInfoPage.h @@ -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_ diff --git a/clientgui/AccountManagerProcessingPage.cpp b/clientgui/AccountManagerProcessingPage.cpp index 32f11f5c83..faf5504154 100644 --- a/clientgui/AccountManagerProcessingPage.cpp +++ b/clientgui/AccountManagerProcessingPage.cpp @@ -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" diff --git a/clientgui/AccountManagerPropertiesPage.cpp b/clientgui/AccountManagerPropertiesPage.cpp index 90faebcb5e..4cca904fab 100644 --- a/clientgui/AccountManagerPropertiesPage.cpp +++ b/clientgui/AccountManagerPropertiesPage.cpp @@ -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" diff --git a/clientgui/ProjectInfoPage.cpp b/clientgui/ProjectInfoPage.cpp index ef4e640393..8986e74fb3 100644 --- a/clientgui/ProjectInfoPage.cpp +++ b/clientgui/ProjectInfoPage.cpp @@ -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; iAppend( - 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; iAppend( + wxString(m_pl.projects[i]->name.c_str(), wxConvUTF8), + wxString(m_pl.projects[i]->url.c_str(), wxConvUTF8) + ); + } } - bProjectListPopulated = true; + m_bProjectListPopulated = true; } Layout(); diff --git a/clientgui/ProjectInfoPage.h b/clientgui/ProjectInfoPage.h index 21e2941b1e..c06318cc4a 100644 --- a/clientgui/ProjectInfoPage.h +++ b/clientgui/ProjectInfoPage.h @@ -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_ diff --git a/clientgui/WizardAccountManager.cpp b/clientgui/WizardAccountManager.cpp index f29e73e955..badaf9078e 100644 --- a/clientgui/WizardAccountManager.cpp +++ b/clientgui/WizardAccountManager.cpp @@ -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" diff --git a/lib/gui_rpc_client_ops.cpp b/lib/gui_rpc_client_ops.cpp index 4fbc88d80f..ece4cd9605 100644 --- a/lib/gui_rpc_client_ops.cpp +++ b/lib/gui_rpc_client_ops.cpp @@ -715,7 +715,11 @@ void ALL_PROJECTS_LIST::clear() { for (i=0; iparse(xp); if (!retval) { am->rand = drand();