1
// Berkeley Open Infrastructure for Network Computing
2
// http://boinc.berkeley.edu
3
// Copyright (C) 2005 University of California
5
// This is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation;
8
// either version 2.1 of the License, or (at your option) any later version.
10
// This software is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
// See the GNU Lesser General Public License for more details.
15
// To view the GNU Lesser General Public License visit
16
// http://www.gnu.org/copyleft/lesser.html
17
// or write to the Free Software Foundation, Inc.,
18
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
#if defined(__GNUG__) && !defined(__APPLE__)
21
#pragma implementation "CompletionPage.h"
25
#include "diagnostics.h"
30
#include "error_numbers.h"
32
#include "error_numbers.h"
33
#include "BOINCGUIApp.h"
34
#include "SkinManager.h"
35
#include "MainDocument.h"
36
#include "BOINCWizards.h"
37
#include "BOINCBaseWizard.h"
38
#include "WizardAttachProject.h"
39
#include "WizardAccountManager.h"
40
#include "CompletionPage.h"
41
#include "AccountInfoPage.h"
45
* CCompletionPage type definition
48
IMPLEMENT_DYNAMIC_CLASS( CCompletionPage, wxWizardPageEx )
51
* CCompletionPage event table definition
54
BEGIN_EVENT_TABLE( CCompletionPage, wxWizardPageEx )
56
////@begin CCompletionPage event table entries
57
EVT_WIZARDEX_PAGE_CHANGED( -1, CCompletionPage::OnPageChanged )
58
EVT_WIZARDEX_CANCEL( -1, CCompletionPage::OnCancel )
59
EVT_WIZARDEX_FINISHED( ID_COMPLETIONPAGE, CCompletionPage::OnFinished )
61
////@end CCompletionPage event table entries
66
* CCompletionPage constructors
69
CCompletionPage::CCompletionPage( )
73
CCompletionPage::CCompletionPage( CBOINCBaseWizard* parent )
79
* CCompletionPage creator
82
bool CCompletionPage::Create( CBOINCBaseWizard* parent )
84
////@begin CCompletionPage member initialisation
85
m_pCompletionTitle = NULL;
86
m_pCompletionWelcome = NULL;
87
m_pCompletionBrandedMessage = NULL;
88
m_pCompletionMessage = NULL;
89
////@end CCompletionPage member initialisation
91
////@begin CCompletionPage creation
92
wxBitmap wizardBitmap(wxNullBitmap);
93
wxWizardPageEx::Create( parent, ID_COMPLETIONPAGE, wizardBitmap );
96
GetSizer()->Fit(this);
97
////@end CCompletionPage creation
103
* Control creation for CCompletionPage
106
void CCompletionPage::CreateControls()
108
////@begin CCompletionPage content construction
109
CCompletionPage* itemWizardPage79 = this;
111
wxBoxSizer* itemBoxSizer80 = new wxBoxSizer(wxVERTICAL);
112
itemWizardPage79->SetSizer(itemBoxSizer80);
114
m_pCompletionTitle = new wxStaticText;
115
m_pCompletionTitle->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
116
m_pCompletionTitle->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD, FALSE, wxT("Verdana")));
117
itemBoxSizer80->Add(m_pCompletionTitle, 0, wxALIGN_LEFT|wxALL, 5);
119
m_pCompletionWelcome = new wxStaticText;
120
m_pCompletionWelcome->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
121
m_pCompletionWelcome->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE));
122
itemBoxSizer80->Add(m_pCompletionWelcome, 0, wxALIGN_LEFT|wxALL, 5);
124
m_pCompletionBrandedMessage = new wxStaticText;
125
m_pCompletionBrandedMessage->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
126
itemBoxSizer80->Add(m_pCompletionBrandedMessage, 0, wxALIGN_LEFT|wxALL, 5);
128
m_pCompletionMessage = new wxStaticText;
129
m_pCompletionMessage->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
130
itemBoxSizer80->Add(m_pCompletionMessage, 0, wxALIGN_LEFT|wxALL, 5);
131
////@end CCompletionPage content construction
135
* Gets the previous page.
138
wxWizardPageEx* CCompletionPage::GetPrev() const
144
* Gets the next page.
147
wxWizardPageEx* CCompletionPage::GetNext() const
153
* Should we show tooltips?
156
bool CCompletionPage::ShowToolTips()
162
* Get bitmap resources
165
wxBitmap CCompletionPage::GetBitmapResource( const wxString& WXUNUSED(name) )
168
////@begin CCompletionPage bitmap retrieval
170
////@end CCompletionPage bitmap retrieval
177
wxIcon CCompletionPage::GetIconResource( const wxString& WXUNUSED(name) )
181
////@begin CCompletionPage icon retrieval
183
////@end CCompletionPage icon retrieval
187
* wxEVT_WIZARD_PAGE_CHANGED event handler for ID_COMPLETIONPAGE
190
void CCompletionPage::OnPageChanged( wxWizardExEvent& event ) {
191
if (event.GetDirection() == false) return;
193
CWizardAttachProject* pWAP = ((CWizardAttachProject*)GetParent());
194
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
197
wxASSERT(pSkinAdvanced);
198
wxASSERT(m_pCompletionTitle);
199
wxASSERT(m_pCompletionWelcome);
200
wxASSERT(m_pCompletionBrandedMessage);
201
wxASSERT(m_pCompletionMessage);
202
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
205
if (IS_ATTACHTOPROJECTWIZARD()) {
206
m_pCompletionTitle->SetLabel(
207
_("Attached to project")
210
m_pCompletionWelcome->Hide();
212
m_pCompletionBrandedMessage->SetLabel(
213
_("You are now successfully attached to this project.")
216
if (pWAP->m_AccountInfoPage->m_pAccountCreateCtrl->GetValue()) {
217
m_pCompletionMessage->SetLabel(
218
_("When you click Finish, your web browser will go to a page where\n"
219
"you can set your account name and preferences.")
222
m_pCompletionMessage->SetLabel(
223
_("Click Finish to close.")
226
} else if (IS_ACCOUNTMANAGERWIZARD()) {
228
if (IS_ACCOUNTMANAGERUPDATEWIZARD()) {
232
if (pSkinAdvanced->IsBranded()) {
233
// %s is the project name
234
// i.e. 'GridRepublic'
236
_("Update from %s completed."),
237
pSkinAdvanced->GetApplicationShortName().c_str()
240
strTitle = _("Update completed.");
243
m_pCompletionTitle->SetLabel( strTitle );
245
m_pCompletionMessage->SetLabel(
246
_("Click Finish to close.")
249
} else if (IS_ACCOUNTMANAGERREMOVEWIZARD()) {
253
if (pSkinAdvanced->IsBranded()) {
254
// %s is the project name
255
// i.e. 'GridRepublic'
257
_("Removal from %s completed."),
258
pSkinAdvanced->GetApplicationShortName().c_str()
261
strTitle = _("Removal succeeded!");
264
m_pCompletionTitle->SetLabel( strTitle );
266
m_pCompletionMessage->SetLabel(
267
_("Click Finish to close.")
274
if (pSkinAdvanced->IsBranded()) {
275
// %s is the project name
276
// i.e. 'GridRepublic'
279
pSkinAdvanced->GetApplicationShortName().c_str()
282
strTitle = _("Attached to account manager");
285
m_pCompletionTitle->SetLabel( strTitle );
287
if (pSkinAdvanced->IsBranded()) {
288
// %s is the project name
289
// i.e. 'GridRepublic'
293
pSkinAdvanced->GetApplicationShortName().c_str()
296
m_pCompletionWelcome->Show();
297
m_pCompletionWelcome->SetLabel( strWelcome );
300
wxString strBrandedMessage;
301
if (pSkinAdvanced->IsBranded()) {
302
// 1st %s is the project name
303
// i.e. 'GridRepublic'
304
// 2nd %s is the account manager success message
305
strBrandedMessage.Printf(
306
_("You are now successfully attached to the %s system."),
307
pSkinAdvanced->GetApplicationShortName().c_str()
310
strBrandedMessage = _("You are now successfully attached to this account manager.");
313
m_pCompletionBrandedMessage->SetLabel( strBrandedMessage );
315
m_pCompletionMessage->SetLabel(
316
_("Click Finish to close.")
323
// Is this supposed to be completely automated?
324
// If so, then go ahead and close the wizard down now.
325
if (pWAP->close_when_completed) {
326
pWAP->SimulateNextButton();
331
* wxEVT_WIZARD_CANCEL event handler for ID_COMPLETIONPAGE
334
void CCompletionPage::OnCancel( wxWizardExEvent& event ) {
335
PROCESS_CANCELEVENT(event);
339
* wxEVT_WIZARD_FINISHED event handler for ID_COMPLETIONPAGE
342
void CCompletionPage::OnFinished( wxWizardExEvent& event ) {
1
// This file is part of BOINC.
2
// http://boinc.berkeley.edu
3
// Copyright (C) 2008 University of California
5
// BOINC is free software; you can redistribute it and/or modify it
6
// under the terms of the GNU Lesser General Public License
7
// as published by the Free Software Foundation,
8
// either version 3 of the License, or (at your option) any later version.
10
// BOINC is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
// See the GNU Lesser General Public License for more details.
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
18
#if defined(__GNUG__) && !defined(__APPLE__)
19
#pragma implementation "CompletionPage.h"
23
#include "diagnostics.h"
28
#include "error_numbers.h"
30
#include "error_numbers.h"
31
#include "BOINCGUIApp.h"
32
#include "SkinManager.h"
33
#include "MainDocument.h"
34
#include "BOINCBaseWizard.h"
35
#include "WizardAttach.h"
36
#include "CompletionPage.h"
37
#include "AccountInfoPage.h"
41
* CCompletionPage type definition
44
IMPLEMENT_DYNAMIC_CLASS( CCompletionPage, wxWizardPageEx )
47
* CCompletionPage event table definition
50
BEGIN_EVENT_TABLE( CCompletionPage, wxWizardPageEx )
52
////@begin CCompletionPage event table entries
53
EVT_WIZARDEX_PAGE_CHANGED( -1, CCompletionPage::OnPageChanged )
54
EVT_WIZARDEX_CANCEL( -1, CCompletionPage::OnCancel )
55
EVT_WIZARDEX_FINISHED( ID_COMPLETIONPAGE, CCompletionPage::OnFinished )
56
////@end CCompletionPage event table entries
61
* CCompletionPage constructors
64
CCompletionPage::CCompletionPage( )
68
CCompletionPage::CCompletionPage( CBOINCBaseWizard* parent )
74
* CCompletionPage creator
77
bool CCompletionPage::Create( CBOINCBaseWizard* parent )
79
////@begin CCompletionPage member initialisation
80
m_pCompletionTitle = NULL;
81
m_pCompletionWelcome = NULL;
82
m_pCompletionBrandedMessage = NULL;
83
m_pCompletionMessage = NULL;
84
////@end CCompletionPage member initialisation
86
////@begin CCompletionPage creation
87
wxWizardPageEx::Create( parent, ID_COMPLETIONPAGE );
90
GetSizer()->Fit(this);
91
////@end CCompletionPage creation
97
* Control creation for CCompletionPage
100
void CCompletionPage::CreateControls()
102
////@begin CCompletionPage content construction
103
CCompletionPage* itemWizardPage79 = this;
105
wxBoxSizer* itemBoxSizer80 = new wxBoxSizer(wxVERTICAL);
106
itemWizardPage79->SetSizer(itemBoxSizer80);
108
m_pCompletionTitle = new wxStaticText;
109
m_pCompletionTitle->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
110
m_pCompletionTitle->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD, FALSE, wxT("Verdana")));
111
itemBoxSizer80->Add(m_pCompletionTitle, 0, wxALIGN_LEFT|wxALL, 5);
113
m_pCompletionWelcome = new wxStaticText;
114
m_pCompletionWelcome->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
115
m_pCompletionWelcome->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE));
116
itemBoxSizer80->Add(m_pCompletionWelcome, 0, wxALIGN_LEFT|wxALL, 5);
118
m_pCompletionBrandedMessage = new wxStaticText;
119
m_pCompletionBrandedMessage->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
120
itemBoxSizer80->Add(m_pCompletionBrandedMessage, 0, wxALIGN_LEFT|wxALL, 5);
122
m_pCompletionMessage = new wxStaticText;
123
m_pCompletionMessage->Create( itemWizardPage79, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
124
itemBoxSizer80->Add(m_pCompletionMessage, 0, wxALIGN_LEFT|wxALL, 5);
128
HIViewRef textView = (HIViewRef)m_pCompletionTitle->GetHandle();
129
HIObjectRef theObject = (HIObjectRef)HIViewGetSuperview(textView);
130
HIObjectSetAccessibilityIgnored(theObject, true);
132
////@end CCompletionPage content construction
136
* Gets the previous page.
139
wxWizardPageEx* CCompletionPage::GetPrev() const
145
* Gets the next page.
148
wxWizardPageEx* CCompletionPage::GetNext() const
154
* Should we show tooltips?
157
bool CCompletionPage::ShowToolTips()
163
* Get bitmap resources
166
wxBitmap CCompletionPage::GetBitmapResource( const wxString& WXUNUSED(name) )
169
////@begin CCompletionPage bitmap retrieval
171
////@end CCompletionPage bitmap retrieval
178
wxIcon CCompletionPage::GetIconResource( const wxString& WXUNUSED(name) )
181
////@begin CCompletionPage icon retrieval
183
////@end CCompletionPage icon retrieval
187
* wxEVT_WIZARD_PAGE_CHANGED event handler for ID_COMPLETIONPAGE
190
void CCompletionPage::OnPageChanged( wxWizardExEvent& event ) {
191
if (event.GetDirection() == false) return;
193
CWizardAttach* pWAP = ((CWizardAttach*)GetParent());
194
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
197
wxASSERT(pSkinAdvanced);
198
wxASSERT(m_pCompletionTitle);
199
wxASSERT(m_pCompletionWelcome);
200
wxASSERT(m_pCompletionBrandedMessage);
201
wxASSERT(m_pCompletionMessage);
202
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
205
if (IS_ATTACHTOPROJECTWIZARD()) {
206
m_pCompletionTitle->SetLabel(
210
m_pCompletionWelcome->Hide();
212
m_pCompletionBrandedMessage->SetLabel(
213
_("This project has been successfully added.")
216
if (pWAP->m_AccountInfoPage->m_pAccountCreateCtrl->GetValue()) {
217
m_pCompletionMessage->SetLabel(
218
_("When you click Finish, your web browser will go to a page where\nyou can set your account name and preferences.")
221
m_pCompletionMessage->SetLabel(
222
_("Click Finish to close.")
225
} else if (IS_ACCOUNTMANAGERWIZARD()) {
227
if (IS_ACCOUNTMANAGERUPDATEWIZARD()) {
230
if (pSkinAdvanced->IsBranded()) {
232
_("Update from %s completed."),
233
pWAP->project_config.name.c_str()
236
strTitle = _("Update completed.");
239
m_pCompletionTitle->SetLabel( strTitle );
241
m_pCompletionMessage->SetLabel(
242
_("Click Finish to close.")
247
m_pCompletionTitle->SetLabel(_("Now using account manager"));
249
if (pSkinAdvanced->IsBranded()) {
253
pWAP->project_config.name.c_str()
256
m_pCompletionWelcome->Show();
257
m_pCompletionWelcome->SetLabel( strWelcome );
260
wxString strBrandedMessage;
261
if (pSkinAdvanced->IsBranded()) {
262
strBrandedMessage.Printf(
263
_("You are now using %s to manage accounts."),
264
pWAP->project_config.name.c_str()
267
strBrandedMessage = _("You are now using this account manager.");
270
m_pCompletionBrandedMessage->SetLabel( strBrandedMessage );
272
m_pCompletionMessage->SetLabel(
273
_("Click Finish to close.")
279
int x, y, x1, y1, w, h;
281
m_pCompletionBrandedMessage->GetPosition(&x1, &y1);
282
pWAP->GetSize(&w, &h);
283
m_pCompletionBrandedMessage->Wrap(w - x - x1 - 5);
286
// Is this supposed to be completely automated?
287
// If so, then go ahead and close the wizard down now.
288
if (pWAP->close_when_completed) {
289
pWAP->SimulateNextButton();
294
* wxEVT_WIZARD_CANCEL event handler for ID_COMPLETIONPAGE
297
void CCompletionPage::OnCancel( wxWizardExEvent& event ) {
298
PROCESS_CANCELEVENT(event);
302
* wxEVT_WIZARD_FINISHED event handler for ID_COMPLETIONPAGE
305
void CCompletionPage::OnFinished( wxWizardExEvent& event ) {