2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-09-26 11:29:28 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2005-09-26 11:29:28 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2005-09-26 11:29:28 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-09-26 11:29:28 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2005-09-26 11:29:28 +00:00
|
|
|
//
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "CompletionPage.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "diagnostics.h"
|
|
|
|
#include "util.h"
|
|
|
|
#include "mfile.h"
|
|
|
|
#include "miofile.h"
|
|
|
|
#include "parse.h"
|
|
|
|
#include "error_numbers.h"
|
2005-09-26 11:29:28 +00:00
|
|
|
#include "wizardex.h"
|
|
|
|
#include "error_numbers.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
2006-10-20 15:00:14 +00:00
|
|
|
#include "SkinManager.h"
|
|
|
|
#include "MainDocument.h"
|
2005-09-26 11:29:28 +00:00
|
|
|
#include "BOINCBaseWizard.h"
|
2010-08-02 16:01:09 +00:00
|
|
|
#include "WizardAttach.h"
|
2005-09-26 11:29:28 +00:00
|
|
|
#include "CompletionPage.h"
|
|
|
|
#include "AccountInfoPage.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CCompletionPage type definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS( CCompletionPage, wxWizardPageEx )
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CCompletionPage event table definition
|
|
|
|
*/
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE( CCompletionPage, wxWizardPageEx )
|
|
|
|
|
|
|
|
////@begin CCompletionPage event table entries
|
|
|
|
EVT_WIZARDEX_PAGE_CHANGED( -1, CCompletionPage::OnPageChanged )
|
|
|
|
EVT_WIZARDEX_CANCEL( -1, CCompletionPage::OnCancel )
|
|
|
|
EVT_WIZARDEX_FINISHED( ID_COMPLETIONPAGE, CCompletionPage::OnFinished )
|
|
|
|
////@end CCompletionPage event table entries
|
|
|
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CCompletionPage constructors
|
|
|
|
*/
|
|
|
|
|
|
|
|
CCompletionPage::CCompletionPage( )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CCompletionPage::CCompletionPage( CBOINCBaseWizard* parent )
|
|
|
|
{
|
|
|
|
Create( parent );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CCompletionPage creator
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool CCompletionPage::Create( CBOINCBaseWizard* parent )
|
|
|
|
{
|
|
|
|
////@begin CCompletionPage member initialisation
|
2006-01-27 00:34:53 +00:00
|
|
|
m_pCompletionTitle = NULL;
|
|
|
|
m_pCompletionWelcome = NULL;
|
|
|
|
m_pCompletionBrandedMessage = NULL;
|
|
|
|
m_pCompletionMessage = NULL;
|
2005-09-26 11:29:28 +00:00
|
|
|
////@end CCompletionPage member initialisation
|
|
|
|
|
|
|
|
////@begin CCompletionPage creation
|
2009-11-17 19:19:50 +00:00
|
|
|
wxWizardPageEx::Create( parent, ID_COMPLETIONPAGE );
|
2005-09-26 11:29:28 +00:00
|
|
|
|
|
|
|
CreateControls();
|
|
|
|
GetSizer()->Fit(this);
|
|
|
|
////@end CCompletionPage creation
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Control creation for CCompletionPage
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CCompletionPage::CreateControls()
|
|
|
|
{
|
|
|
|
////@begin CCompletionPage content construction
|
|
|
|
CCompletionPage* itemWizardPage79 = this;
|
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer80 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemWizardPage79->SetSizer(itemBoxSizer80);
|
|
|
|
|
2006-01-27 00:34:53 +00:00
|
|
|
m_pCompletionTitle = new wxStaticText;
|
|
|
|
m_pCompletionTitle->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
m_pCompletionTitle->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD, FALSE, wxT("Verdana")));
|
|
|
|
itemBoxSizer80->Add(m_pCompletionTitle, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
m_pCompletionWelcome = new wxStaticText;
|
|
|
|
m_pCompletionWelcome->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
2006-01-27 01:43:03 +00:00
|
|
|
m_pCompletionWelcome->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE));
|
2006-01-27 00:34:53 +00:00
|
|
|
itemBoxSizer80->Add(m_pCompletionWelcome, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
m_pCompletionBrandedMessage = new wxStaticText;
|
|
|
|
m_pCompletionBrandedMessage->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemBoxSizer80->Add(m_pCompletionBrandedMessage, 0, wxALIGN_LEFT|wxALL, 5);
|
|
|
|
|
|
|
|
m_pCompletionMessage = new wxStaticText;
|
|
|
|
m_pCompletionMessage->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemBoxSizer80->Add(m_pCompletionMessage, 0, wxALIGN_LEFT|wxALL, 5);
|
2009-11-19 11:58:35 +00:00
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
|
|
|
//Accessibility
|
|
|
|
HIViewRef textView = (HIViewRef)m_pCompletionTitle->GetHandle();
|
|
|
|
HIObjectRef theObject = (HIObjectRef)HIViewGetSuperview(textView);
|
|
|
|
HIObjectSetAccessibilityIgnored(theObject, true);
|
|
|
|
#endif
|
|
|
|
////@end CCompletionPage content construction
|
2006-01-27 00:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Gets the previous page.
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxWizardPageEx* CCompletionPage::GetPrev() const
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Gets the next page.
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxWizardPageEx* CCompletionPage::GetNext() const
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Should we show tooltips?
|
|
|
|
*/
|
|
|
|
|
|
|
|
bool CCompletionPage::ShowToolTips()
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get bitmap resources
|
|
|
|
*/
|
|
|
|
|
2006-07-21 08:23:26 +00:00
|
|
|
wxBitmap CCompletionPage::GetBitmapResource( const wxString& WXUNUSED(name) )
|
2006-01-27 00:34:53 +00:00
|
|
|
{
|
|
|
|
// Bitmap retrieval
|
|
|
|
////@begin CCompletionPage bitmap retrieval
|
|
|
|
return wxNullBitmap;
|
|
|
|
////@end CCompletionPage bitmap retrieval
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get icon resources
|
|
|
|
*/
|
|
|
|
|
2006-07-21 08:23:26 +00:00
|
|
|
wxIcon CCompletionPage::GetIconResource( const wxString& WXUNUSED(name) )
|
2006-01-27 00:34:53 +00:00
|
|
|
{
|
|
|
|
// Icon retrieval
|
|
|
|
////@begin CCompletionPage icon retrieval
|
|
|
|
return wxNullIcon;
|
|
|
|
////@end CCompletionPage icon retrieval
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_PAGE_CHANGED event handler for ID_COMPLETIONPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CCompletionPage::OnPageChanged( wxWizardExEvent& event ) {
|
|
|
|
if (event.GetDirection() == false) return;
|
|
|
|
|
2010-08-02 16:01:09 +00:00
|
|
|
CWizardAttach* pWAP = ((CWizardAttach*)GetParent());
|
|
|
|
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
|
2006-10-20 15:00:14 +00:00
|
|
|
|
2006-03-06 17:31:02 +00:00
|
|
|
|
2006-10-20 15:00:14 +00:00
|
|
|
wxASSERT(pSkinAdvanced);
|
2006-01-27 00:34:53 +00:00
|
|
|
wxASSERT(m_pCompletionTitle);
|
|
|
|
wxASSERT(m_pCompletionWelcome);
|
|
|
|
wxASSERT(m_pCompletionBrandedMessage);
|
|
|
|
wxASSERT(m_pCompletionMessage);
|
2006-10-20 15:00:14 +00:00
|
|
|
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
|
2006-01-15 12:10:42 +00:00
|
|
|
|
|
|
|
|
2006-10-20 15:00:14 +00:00
|
|
|
if (IS_ATTACHTOPROJECTWIZARD()) {
|
|
|
|
m_pCompletionTitle->SetLabel(
|
2010-08-01 04:27:24 +00:00
|
|
|
_("Project added")
|
2006-10-20 15:00:14 +00:00
|
|
|
);
|
2006-01-27 00:34:53 +00:00
|
|
|
|
|
|
|
m_pCompletionWelcome->Hide();
|
2005-09-26 11:29:28 +00:00
|
|
|
|
2006-10-20 15:00:14 +00:00
|
|
|
m_pCompletionBrandedMessage->SetLabel(
|
2010-08-01 04:27:24 +00:00
|
|
|
_("This project has been successfully added.")
|
2006-10-20 15:00:14 +00:00
|
|
|
);
|
2005-09-26 11:29:28 +00:00
|
|
|
|
2006-03-06 17:31:02 +00:00
|
|
|
if (pWAP->m_AccountInfoPage->m_pAccountCreateCtrl->GetValue()) {
|
2006-10-20 15:00:14 +00:00
|
|
|
m_pCompletionMessage->SetLabel(
|
2008-07-08 20:05:07 +00:00
|
|
|
_("When you click Finish, your web browser will go to a page where\nyou can set your account name and preferences.")
|
2006-10-20 15:00:14 +00:00
|
|
|
);
|
2006-01-19 12:22:22 +00:00
|
|
|
} else {
|
2006-03-06 17:31:02 +00:00
|
|
|
m_pCompletionMessage->SetLabel(
|
|
|
|
_("Click Finish to close.")
|
|
|
|
);
|
2006-01-19 12:22:22 +00:00
|
|
|
}
|
2006-01-27 00:34:53 +00:00
|
|
|
} else if (IS_ACCOUNTMANAGERWIZARD()) {
|
2005-09-26 11:29:28 +00:00
|
|
|
|
2006-02-16 19:03:02 +00:00
|
|
|
if (IS_ACCOUNTMANAGERUPDATEWIZARD()) {
|
|
|
|
// Update completed
|
|
|
|
wxString strTitle;
|
2006-10-20 15:00:14 +00:00
|
|
|
if (pSkinAdvanced->IsBranded()) {
|
2006-02-16 19:03:02 +00:00
|
|
|
strTitle.Printf(
|
|
|
|
_("Update from %s completed."),
|
2013-08-23 18:02:58 +00:00
|
|
|
pWAP->m_strProjectName.c_str()
|
2006-02-16 19:03:02 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
strTitle = _("Update completed.");
|
|
|
|
}
|
|
|
|
|
|
|
|
m_pCompletionTitle->SetLabel( strTitle );
|
2005-09-26 11:29:28 +00:00
|
|
|
|
2006-02-16 19:03:02 +00:00
|
|
|
m_pCompletionMessage->SetLabel(
|
|
|
|
_("Click Finish to close.")
|
2006-01-06 10:50:59 +00:00
|
|
|
);
|
2006-01-27 00:34:53 +00:00
|
|
|
|
2006-01-06 10:50:59 +00:00
|
|
|
} else {
|
2006-02-16 19:03:02 +00:00
|
|
|
// Attach Completed
|
2010-10-06 20:13:34 +00:00
|
|
|
m_pCompletionTitle->SetLabel(_("Now using account manager"));
|
2006-02-16 19:03:02 +00:00
|
|
|
|
2006-10-20 15:00:14 +00:00
|
|
|
if (pSkinAdvanced->IsBranded()) {
|
2006-02-16 19:03:02 +00:00
|
|
|
wxString strWelcome;
|
|
|
|
strWelcome.Printf(
|
|
|
|
_("Welcome to %s!"),
|
2011-05-19 09:13:28 +00:00
|
|
|
pWAP->m_strProjectName.c_str()
|
2006-02-16 19:03:02 +00:00
|
|
|
);
|
2005-09-26 11:29:28 +00:00
|
|
|
|
2006-02-16 19:03:02 +00:00
|
|
|
m_pCompletionWelcome->Show();
|
|
|
|
m_pCompletionWelcome->SetLabel( strWelcome );
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString strBrandedMessage;
|
2006-10-20 15:00:14 +00:00
|
|
|
if (pSkinAdvanced->IsBranded()) {
|
2006-02-16 19:03:02 +00:00
|
|
|
strBrandedMessage.Printf(
|
2010-10-06 20:13:34 +00:00
|
|
|
_("You are now using %s to manage accounts."),
|
2011-05-19 09:13:28 +00:00
|
|
|
pWAP->m_strProjectName.c_str()
|
2006-02-16 19:03:02 +00:00
|
|
|
);
|
|
|
|
} else {
|
2010-10-06 20:13:34 +00:00
|
|
|
strBrandedMessage = _("You are now using this account manager.");
|
2006-02-16 19:03:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_pCompletionBrandedMessage->SetLabel( strBrandedMessage );
|
|
|
|
|
|
|
|
m_pCompletionMessage->SetLabel(
|
|
|
|
_("Click Finish to close.")
|
|
|
|
);
|
|
|
|
}
|
2005-09-26 11:29:28 +00:00
|
|
|
}
|
2006-01-27 08:11:29 +00:00
|
|
|
|
|
|
|
Fit();
|
2008-12-12 07:25:52 +00:00
|
|
|
int x, y, x1, y1, w, h;
|
|
|
|
GetPosition(&x, &y);
|
|
|
|
m_pCompletionBrandedMessage->GetPosition(&x1, &y1);
|
|
|
|
pWAP->GetSize(&w, &h);
|
|
|
|
m_pCompletionBrandedMessage->Wrap(w - x - x1 - 5);
|
2008-12-12 06:44:19 +00:00
|
|
|
Fit();
|
|
|
|
|
2006-10-13 17:02:28 +00:00
|
|
|
// Is this supposed to be completely automated?
|
|
|
|
// If so, then go ahead and close the wizard down now.
|
|
|
|
if (pWAP->close_when_completed) {
|
|
|
|
pWAP->SimulateNextButton();
|
|
|
|
}
|
2005-09-26 11:29:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_CANCEL event handler for ID_COMPLETIONPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CCompletionPage::OnCancel( wxWizardExEvent& event ) {
|
|
|
|
PROCESS_CANCELEVENT(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_WIZARD_FINISHED event handler for ID_COMPLETIONPAGE
|
|
|
|
*/
|
|
|
|
|
|
|
|
void CCompletionPage::OnFinished( wxWizardExEvent& event ) {
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|