mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=12191
This commit is contained in:
parent
4c10e2e5c3
commit
86bc75a83c
|
@ -2181,3 +2181,16 @@ David 5 Mar 2007
|
|||
sched/
|
||||
file_upload_handler.C
|
||||
show_shmem.C
|
||||
|
||||
Rom 5 Mar 2007
|
||||
- MGR: Rough draft for presenting an interface of known projects
|
||||
based on David's March 3rd "get project list" checkin.
|
||||
|
||||
clietgui/
|
||||
AccountInfoPage.cpp
|
||||
AccountManagerInfoPage.cpp
|
||||
BOINCWizards.h
|
||||
ProjectInfoPage.cpp, .h
|
||||
lib/
|
||||
gui_rpc_client.h
|
||||
gui_rpc_client_ops.C
|
||||
|
|
|
@ -501,7 +501,7 @@ void CAccountInfoPage::OnAccountUseExistingCtrlSelected( wxCommandEvent& WXUNUSE
|
|||
m_pAccountConfirmPasswordCtrl->Hide();
|
||||
m_pAccountPasswordRequirmentsStaticCtrl->Hide();
|
||||
m_pAccountEmailAddressCtrl->SetFocus();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -516,6 +516,6 @@ void CAccountInfoPage::OnAccountCreateCtrlSelected( wxCommandEvent& WXUNUSED(eve
|
|||
m_pAccountConfirmPasswordCtrl->Show();
|
||||
m_pAccountPasswordRequirmentsStaticCtrl->Show();
|
||||
m_pAccountEmailAddressCtrl->SetFocus();
|
||||
Layout();
|
||||
Fit();
|
||||
}
|
||||
|
||||
|
|
|
@ -191,8 +191,8 @@ void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) {
|
|||
wxT("http://boinc.berkeley.edu/")
|
||||
);
|
||||
|
||||
m_pProjectUrlCtrl->SetFocus();
|
||||
Fit();
|
||||
m_pProjectUrlCtrl->SetFocus();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -82,8 +82,10 @@
|
|||
#define ID_ERRNETDETECTION 11110
|
||||
|
||||
// Project Info/Account Manager Info Controls
|
||||
#define ID_PROJECTURLSTATICCTRL 11200
|
||||
#define ID_PROJECTURLCTRL 11201
|
||||
#define ID_PROJECTSELECTIONCTRL 11200
|
||||
#define ID_PROJECTURLSTATICCTRL 11201
|
||||
#define ID_PROJECTURLDESCRIPTIONSTATICCTRL 11202
|
||||
#define ID_PROJECTURLCTRL 11203
|
||||
|
||||
// Account Key Controls
|
||||
#define ID_ACCOUNTKEYSTATICCTRL 11300
|
||||
|
|
|
@ -55,6 +55,7 @@ BEGIN_EVENT_TABLE( CProjectInfoPage, wxWizardPageEx )
|
|||
////@begin CProjectInfoPage event table entries
|
||||
EVT_WIZARDEX_PAGE_CHANGED( -1, CProjectInfoPage::OnPageChanged )
|
||||
EVT_WIZARDEX_PAGE_CHANGING( -1, CProjectInfoPage::OnPageChanging )
|
||||
EVT_COMBOBOX( ID_PROJECTSELECTIONCTRL, CProjectInfoPage::OnProjectSelectionChanged )
|
||||
EVT_WIZARDEX_CANCEL( -1, CProjectInfoPage::OnCancel )
|
||||
|
||||
////@end CProjectInfoPage event table entries
|
||||
|
@ -84,10 +85,9 @@ bool CProjectInfoPage::Create( CBOINCBaseWizard* parent )
|
|||
m_pTitleStaticCtrl = NULL;
|
||||
m_pDescriptionStaticCtrl = NULL;
|
||||
m_pDescription2StaticCtrl = NULL;
|
||||
m_pProjectSelectionCtrl = NULL;
|
||||
m_pProjectUrlStaticCtrl = NULL;
|
||||
m_pProjectUrlCtrl = NULL;
|
||||
m_pBOINCPromoStaticCtrl = NULL;
|
||||
m_pBOINCPromoUrlCtrl = NULL;
|
||||
////@end CProjectInfoPage member initialisation
|
||||
|
||||
////@begin CProjectInfoPage creation
|
||||
|
@ -127,29 +127,51 @@ void CProjectInfoPage::CreateControls()
|
|||
m_pDescription2StaticCtrl->Create( itemWizardPage23, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer24->Add(m_pDescription2StaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
itemBoxSizer24->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
|
||||
itemBoxSizer24->Add(itemBoxSizer8, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
wxFlexGridSizer* itemFlexGridSizer30 = new wxFlexGridSizer(1, 2, 0, 0);
|
||||
itemFlexGridSizer30->AddGrowableCol(1);
|
||||
itemBoxSizer24->Add(itemFlexGridSizer30, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
itemBoxSizer8->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxString* strProjectSelectionCtrlStrings = NULL;
|
||||
m_pProjectSelectionCtrl = new wxComboBox;
|
||||
m_pProjectSelectionCtrl->Create( itemWizardPage23, ID_PROJECTSELECTIONCTRL, wxEmptyString, wxDefaultPosition, wxSize(300, -1), 0, strProjectSelectionCtrlStrings, wxCB_DROPDOWN | wxCB_READONLY);
|
||||
itemBoxSizer8->Add(m_pProjectSelectionCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
|
||||
wxFlexGridSizer* itemFlexGridSizer11 = new wxFlexGridSizer(2, 1, 0, 0);
|
||||
itemFlexGridSizer11->AddGrowableRow(0);
|
||||
itemFlexGridSizer11->AddGrowableCol(0);
|
||||
itemBoxSizer24->Add(itemFlexGridSizer11, 0, wxGROW|wxALL, 0);
|
||||
|
||||
m_pProjectSelectionStaticCtrl = new wxStaticBox(itemWizardPage23, wxID_STATIC, wxEmptyString);
|
||||
wxStaticBoxSizer* itemStaticBoxSizer12 = new wxStaticBoxSizer(m_pProjectSelectionStaticCtrl, wxVERTICAL);
|
||||
itemFlexGridSizer11->Add(itemStaticBoxSizer12, 0, wxGROW|wxALL, 0);
|
||||
|
||||
m_pProjectSelectionDescriptionStaticCtrl = new wxStaticText;
|
||||
m_pProjectSelectionDescriptionStaticCtrl->Create( itemWizardPage23, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxSize(300, 110), wxST_NO_AUTORESIZE );
|
||||
itemStaticBoxSizer12->Add(m_pProjectSelectionDescriptionStaticCtrl, 0, wxALL, 5);
|
||||
m_pProjectSelectionDescriptionStaticCtrl->Wrap(300);
|
||||
|
||||
wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL);
|
||||
itemFlexGridSizer11->Add(itemBoxSizer22, 0, wxGROW|wxALL, 0);
|
||||
|
||||
m_pProjectUrlDescriptionStaticCtrl = new wxStaticText;
|
||||
m_pProjectUrlDescriptionStaticCtrl->Create( itemWizardPage23, ID_PROJECTURLDESCRIPTIONSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer22->Add(m_pProjectUrlDescriptionStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
|
||||
m_pProjectUrlDescriptionStaticCtrl->Hide();
|
||||
|
||||
wxFlexGridSizer* itemFlexGridSizer14 = new wxFlexGridSizer(1, 2, 0, 0);
|
||||
itemFlexGridSizer14->AddGrowableCol(1);
|
||||
itemBoxSizer22->Add(itemFlexGridSizer14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0);
|
||||
|
||||
m_pProjectUrlStaticCtrl = new wxStaticText;
|
||||
m_pProjectUrlStaticCtrl->Create( itemWizardPage23, ID_PROJECTURLSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemFlexGridSizer30->Add(m_pProjectUrlStaticCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
itemFlexGridSizer14->Add(m_pProjectUrlStaticCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
m_pProjectUrlStaticCtrl->Hide();
|
||||
|
||||
m_pProjectUrlCtrl = new wxTextCtrl;
|
||||
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);
|
||||
itemFlexGridSizer14->Add(m_pProjectUrlCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
m_pProjectUrlCtrl->Hide();
|
||||
|
||||
// Set validators
|
||||
m_pProjectUrlCtrl->SetValidator( CValidateURL( & m_strProjectURL) );
|
||||
|
@ -219,36 +241,49 @@ wxIcon CProjectInfoPage::GetIconResource( const wxString& WXUNUSED(name) )
|
|||
void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) {
|
||||
if (event.GetDirection() == false) return;
|
||||
|
||||
unsigned int i;
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
|
||||
wxASSERT(pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
wxASSERT(m_pTitleStaticCtrl);
|
||||
wxASSERT(m_pDescriptionStaticCtrl);
|
||||
wxASSERT(m_pDescription2StaticCtrl);
|
||||
wxASSERT(m_pProjectSelectionCtrl);
|
||||
wxASSERT(m_pProjectUrlStaticCtrl);
|
||||
wxASSERT(m_pProjectUrlCtrl);
|
||||
wxASSERT(m_pBOINCPromoStaticCtrl);
|
||||
wxASSERT(m_pBOINCPromoUrlCtrl);
|
||||
|
||||
m_pTitleStaticCtrl->SetLabel(
|
||||
_("Project URL")
|
||||
_("Project Selection")
|
||||
);
|
||||
m_pDescriptionStaticCtrl->SetLabel(
|
||||
_("Enter the URL of the project's web site.")
|
||||
_("Choose which project you would like to participate in.")
|
||||
);
|
||||
m_pDescription2StaticCtrl->SetLabel(
|
||||
_("Project selection list:")
|
||||
);
|
||||
m_pProjectSelectionStaticCtrl->SetLabel(
|
||||
_("Project Description")
|
||||
);
|
||||
m_pProjectUrlDescriptionStaticCtrl->SetLabel(
|
||||
_("You can copy and paste the URL from your browser's\n"
|
||||
"address bar.")
|
||||
);
|
||||
m_pProjectUrlStaticCtrl->SetLabel(
|
||||
_("Project &URL:")
|
||||
);
|
||||
m_pBOINCPromoStaticCtrl->SetLabel(
|
||||
_("For a list of BOINC-based projects go to:")
|
||||
);
|
||||
m_pBOINCPromoUrlCtrl->SetLabel(
|
||||
wxT("http://boinc.berkeley.edu/")
|
||||
);
|
||||
|
||||
|
||||
// Populate the combo box with project information
|
||||
//
|
||||
pDoc->rpc.get_project_list(pl);
|
||||
for (i=0; i<pl.projects.size(); i++) {
|
||||
m_pProjectSelectionCtrl->Append(wxString(pl.projects[i]->name.c_str(), wxConvUTF8));
|
||||
}
|
||||
|
||||
Fit();
|
||||
m_pProjectUrlCtrl->SetFocus();
|
||||
m_pProjectSelectionCtrl->SetValue(wxString(pl.projects[0]->name.c_str(), wxConvUTF8));
|
||||
m_pProjectSelectionCtrl->SetFocus();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -259,6 +294,31 @@ void CProjectInfoPage::OnPageChanging( wxWizardExEvent& event ) {
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
/*!
|
||||
* wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_PROJECTSELECTIONCTRL
|
||||
*/
|
||||
|
||||
void CProjectInfoPage::OnProjectSelectionChanged( wxCommandEvent& /*event*/ ) {
|
||||
if (m_pProjectSelectionCtrl->GetValue() == _("Other")) {
|
||||
m_pProjectSelectionStaticCtrl->Hide();
|
||||
m_pProjectSelectionDescriptionStaticCtrl->Hide();
|
||||
m_pProjectUrlDescriptionStaticCtrl->Show();
|
||||
m_pProjectUrlStaticCtrl->Show();
|
||||
m_pProjectUrlCtrl->Show();
|
||||
} else {
|
||||
m_pProjectSelectionStaticCtrl->Show();
|
||||
m_pProjectSelectionDescriptionStaticCtrl->Show();
|
||||
m_pProjectUrlDescriptionStaticCtrl->Hide();
|
||||
m_pProjectUrlStaticCtrl->Hide();
|
||||
m_pProjectUrlCtrl->Hide();
|
||||
|
||||
m_pProjectSelectionDescriptionStaticCtrl->SetLabel(
|
||||
wxString(pl.projects[m_pProjectSelectionCtrl->GetSelection()]->description.c_str(), wxConvUTF8)
|
||||
);
|
||||
}
|
||||
Fit();
|
||||
}
|
||||
|
||||
/*!
|
||||
* wxEVT_WIZARD_CANCEL event handler for ID_PROJECTINFOPAGE
|
||||
*/
|
||||
|
|
|
@ -53,6 +53,9 @@ public:
|
|||
/// wxEVT_WIZARD_PAGE_CHANGING event handler for ID_PROJECTINFOPAGE
|
||||
void OnPageChanging( wxWizardExEvent& event );
|
||||
|
||||
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_PROJECTSELECTIONCTRL
|
||||
void OnProjectSelectionChanged( wxCommandEvent& event );
|
||||
|
||||
/// wxEVT_WIZARD_CANCEL event handler for ID_PROJECTINFOPAGE
|
||||
void OnCancel( wxWizardExEvent& event );
|
||||
|
||||
|
@ -83,12 +86,16 @@ public:
|
|||
wxStaticText* m_pTitleStaticCtrl;
|
||||
wxStaticText* m_pDescriptionStaticCtrl;
|
||||
wxStaticText* m_pDescription2StaticCtrl;
|
||||
wxComboBox* m_pProjectSelectionCtrl;
|
||||
wxStaticBox* m_pProjectSelectionStaticCtrl;
|
||||
wxStaticText* m_pProjectSelectionDescriptionStaticCtrl;
|
||||
wxStaticText* m_pProjectUrlDescriptionStaticCtrl;
|
||||
wxStaticText* m_pProjectUrlStaticCtrl;
|
||||
wxTextCtrl* m_pProjectUrlCtrl;
|
||||
wxStaticText* m_pBOINCPromoStaticCtrl;
|
||||
wxHyperLink* m_pBOINCPromoUrlCtrl;
|
||||
wxString m_strProjectURL;
|
||||
////@end CProjectInfoPage member variables
|
||||
|
||||
PROJECTLIST pl;
|
||||
};
|
||||
|
||||
#endif // _WIZ_PROJECTINFOPAGE_H_
|
||||
|
|
|
@ -58,6 +58,24 @@ struct DAILY_STATS {
|
|||
};
|
||||
|
||||
|
||||
class PROJECTLISTENTRY {
|
||||
public:
|
||||
std::string name;
|
||||
std::string url;
|
||||
std::string general_area;
|
||||
std::string specific_area;
|
||||
std::string description;
|
||||
std::string home;
|
||||
std::string image;
|
||||
|
||||
PROJECTLISTENTRY();
|
||||
~PROJECTLISTENTRY();
|
||||
|
||||
int parse(MIOFILE&);
|
||||
void clear();
|
||||
};
|
||||
|
||||
|
||||
class PROJECT {
|
||||
public:
|
||||
std::string master_url;
|
||||
|
@ -303,6 +321,16 @@ public:
|
|||
void clear();
|
||||
};
|
||||
|
||||
class PROJECTLIST {
|
||||
public:
|
||||
std::vector<PROJECTLISTENTRY*> projects;
|
||||
|
||||
PROJECTLIST();
|
||||
~PROJECTLIST();
|
||||
|
||||
void clear();
|
||||
};
|
||||
|
||||
class PROJECTS {
|
||||
public:
|
||||
std::vector<PROJECT*> projects;
|
||||
|
@ -519,6 +547,7 @@ public:
|
|||
int get_simple_gui_info(CC_STATE&, RESULTS&);
|
||||
int get_project_status(CC_STATE&);
|
||||
int get_project_status(PROJECTS&);
|
||||
int get_project_list(PROJECTLIST&);
|
||||
int get_disk_usage(DISK_USAGE&);
|
||||
int show_graphics(
|
||||
const char* project, const char* result_name, int graphics_mode,
|
||||
|
|
|
@ -91,6 +91,45 @@ int GUI_URL::parse(MIOFILE& in) {
|
|||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
||||
|
||||
PROJECTLISTENTRY::PROJECTLISTENTRY() {
|
||||
clear();
|
||||
}
|
||||
|
||||
PROJECTLISTENTRY::~PROJECTLISTENTRY() {
|
||||
clear();
|
||||
}
|
||||
|
||||
int PROJECTLISTENTRY::parse(MIOFILE& in) {
|
||||
char buf[256];
|
||||
|
||||
while (in.fgets(buf, 256)) {
|
||||
if (match_tag(buf, "</project>")) return 0;
|
||||
if (match_tag(buf, "</projects>")) break;
|
||||
else if (parse_str(buf, "<name>", name)) continue;
|
||||
else if (parse_str(buf, "<url>", url)) continue;
|
||||
else if (parse_str(buf, "<general_area>", general_area)) continue;
|
||||
else if (parse_str(buf, "<specific_area>", specific_area)) continue;
|
||||
else if (match_tag(buf, "<desc>" )) {
|
||||
copy_element_contents(in, "</desc>", description);
|
||||
continue;
|
||||
}
|
||||
else if (parse_str(buf, "<home>", home)) continue;
|
||||
else if (parse_str(buf, "<img>", image)) continue;
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
||||
void PROJECTLISTENTRY::clear() {
|
||||
name.clear();
|
||||
url.clear();
|
||||
general_area.clear();
|
||||
specific_area.clear();
|
||||
description.clear();
|
||||
home.clear();
|
||||
image.clear();
|
||||
}
|
||||
|
||||
PROJECT::PROJECT() {
|
||||
clear();
|
||||
}
|
||||
|
@ -719,6 +758,22 @@ RESULT* CC_STATE::lookup_result(PROJECT* project, string& str) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
PROJECTLIST::PROJECTLIST() {
|
||||
clear();
|
||||
}
|
||||
|
||||
PROJECTLIST::~PROJECTLIST() {
|
||||
clear();
|
||||
}
|
||||
|
||||
void PROJECTLIST::clear() {
|
||||
unsigned int i;
|
||||
for (i=0; i<projects.size(); i++) {
|
||||
delete projects[i];
|
||||
}
|
||||
projects.clear();
|
||||
}
|
||||
|
||||
PROJECTS::~PROJECTS() {
|
||||
clear();
|
||||
}
|
||||
|
@ -1326,6 +1381,33 @@ int RPC_CLIENT::get_project_status(CC_STATE& state) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
int RPC_CLIENT::get_project_list(PROJECTLIST& pl) {
|
||||
int retval = 0;
|
||||
SET_LOCALE sl;
|
||||
char buf[256];
|
||||
MIOFILE mf;
|
||||
FILE* f;
|
||||
PROJECTLISTENTRY* project;
|
||||
|
||||
pl.clear();
|
||||
|
||||
f = fopen("project_list.xml", "r");
|
||||
if (f) {
|
||||
mf.init_file(f);
|
||||
while(mf.fgets(buf, sizeof(buf))) {
|
||||
if (match_tag(buf, "</projects>")) break;
|
||||
else if (match_tag(buf, "<project>")) {
|
||||
project = new PROJECTLISTENTRY();
|
||||
retval = project->parse(mf);
|
||||
pl.projects.push_back(project);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int RPC_CLIENT::get_disk_usage(DISK_USAGE& du) {
|
||||
int retval;
|
||||
SET_LOCALE sl;
|
||||
|
|
Loading…
Reference in New Issue