1 // This file is part of BOINC.
2 // http://boinc.berkeley.edu
3 // Copyright (C) 2008 University of California
4 //
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.
9 //
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.
14 //
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/>.
17 //
18 #if defined(__GNUG__) && !defined(__APPLE__)
19 #pragma implementation "UnavailablePage.h"
20 #endif
21 
22 #include "stdwx.h"
23 #include "diagnostics.h"
24 #include "util.h"
25 #include "mfile.h"
26 #include "miofile.h"
27 #include "parse.h"
28 #include "error_numbers.h"
29 #include "wizardex.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 "UnavailablePage.h"
37 
38 
39 /*!
40  * CErrUnavailablePage type definition
41  */
42 
IMPLEMENT_DYNAMIC_CLASS(CErrUnavailablePage,wxWizardPageEx)43 IMPLEMENT_DYNAMIC_CLASS( CErrUnavailablePage, wxWizardPageEx )
44 
45 /*!
46  * CErrUnavailablePage event table definition
47  */
48 
49 BEGIN_EVENT_TABLE( CErrUnavailablePage, wxWizardPageEx )
50 
51 ////@begin CErrUnavailablePage event table entries
52     EVT_WIZARDEX_PAGE_CHANGED( -1, CErrUnavailablePage::OnPageChanged )
53     EVT_WIZARDEX_CANCEL( -1, CErrUnavailablePage::OnCancel )
54 
55 ////@end CErrUnavailablePage event table entries
56 
57 END_EVENT_TABLE()
58 
59 /*!
60  * CErrUnavailablePage constructors
61  */
62 
63 CErrUnavailablePage::CErrUnavailablePage( )
64 {
65 }
66 
CErrUnavailablePage(CBOINCBaseWizard * parent)67 CErrUnavailablePage::CErrUnavailablePage( CBOINCBaseWizard* parent )
68 {
69     Create( parent );
70 }
71 
72 /*!
73  * CErrUnavailablePage creator
74  */
75 
Create(CBOINCBaseWizard * parent)76 bool CErrUnavailablePage::Create( CBOINCBaseWizard* parent )
77 {
78 ////@begin CErrUnavailablePage member initialisation
79     m_pTitleStaticCtrl = NULL;
80     m_pDirectionsStaticCtrl = NULL;
81 ////@end CErrUnavailablePage member initialisation
82 
83 ////@begin CErrUnavailablePage creation
84     wxWizardPageEx::Create( parent, ID_ERRUNAVAILABLEPAGE );
85 
86     CreateControls();
87     GetSizer()->Fit(this);
88 ////@end CErrUnavailablePage creation
89 
90     return TRUE;
91 }
92 
93 /*!
94  * Control creation for CErrUnavailablePage
95  */
96 
CreateControls()97 void CErrUnavailablePage::CreateControls()
98 {
99 ////@begin CErrUnavailablePage content construction
100     CErrUnavailablePage* itemWizardPage96 = this;
101 
102     wxBoxSizer* itemBoxSizer97 = new wxBoxSizer(wxVERTICAL);
103     itemWizardPage96->SetSizer(itemBoxSizer97);
104 
105     m_pTitleStaticCtrl = new wxStaticText;
106     m_pTitleStaticCtrl->Create( itemWizardPage96, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
107     m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
108     itemBoxSizer97->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
109 
110     itemBoxSizer97->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
111 
112     m_pDirectionsStaticCtrl = new wxStaticText;
113     m_pDirectionsStaticCtrl->Create( itemWizardPage96, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
114     itemBoxSizer97->Add(m_pDirectionsStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
115 ////@end CErrUnavailablePage content construction
116 }
117 
118 /*!
119  * Gets the previous page.
120  */
121 
GetPrev() const122 wxWizardPageEx* CErrUnavailablePage::GetPrev() const
123 {
124     return PAGE_TRANSITION_BACK;
125 }
126 
127 /*!
128  * Gets the next page.
129  */
130 
GetNext() const131 wxWizardPageEx* CErrUnavailablePage::GetNext() const
132 {
133     return NULL;
134 }
135 
136 /*!
137  * Should we show tooltips?
138  */
139 
ShowToolTips()140 bool CErrUnavailablePage::ShowToolTips()
141 {
142     return TRUE;
143 }
144 
145 /*!
146  * Get bitmap resources
147  */
148 
GetBitmapResource(const wxString & WXUNUSED (name))149 wxBitmap CErrUnavailablePage::GetBitmapResource( const wxString& WXUNUSED(name) )
150 {
151     // Bitmap retrieval
152 
153 ////@begin CErrUnavailablePage bitmap retrieval
154     return wxNullBitmap;
155 ////@end CErrUnavailablePage bitmap retrieval
156 }
157 
158 /*!
159  * Get icon resources
160  */
161 
GetIconResource(const wxString & WXUNUSED (name))162 wxIcon CErrUnavailablePage::GetIconResource( const wxString& WXUNUSED(name) )
163 {
164     // Icon retrieval
165 
166 ////@begin CErrUnavailablePage icon retrieval
167     return wxNullIcon;
168 ////@end CErrUnavailablePage icon retrieval
169 }
170 
171 /*!
172  * wxEVT_WIZARD_PAGE_CHANGED event handler for ID_ERRPROJECTUNAVAILABLEPAGE
173  */
174 
OnPageChanged(wxWizardExEvent & event)175 void CErrUnavailablePage::OnPageChanged( wxWizardExEvent& event ) {
176     if (event.GetDirection() == false) return;
177 
178     wxASSERT(m_pTitleStaticCtrl);
179     wxASSERT(m_pDirectionsStaticCtrl);
180 
181     if (IS_ATTACHTOPROJECTWIZARD()) {
182         m_pTitleStaticCtrl->SetLabel(
183             _("Project temporarily unavailable")
184         );
185         m_pDirectionsStaticCtrl->SetLabel(
186             _("The project is temporarily unavailable.\n\nPlease try again later.")
187         );
188     } else if (IS_ACCOUNTMANAGERWIZARD()) {
189         m_pTitleStaticCtrl->SetLabel(
190             _("Account manager temporarily unavailable")
191         );
192         m_pDirectionsStaticCtrl->SetLabel(
193             _("The account manager is temporarily unavailable.\n\nPlease try again later.")
194         );
195     } else {
196         wxASSERT(FALSE);
197     }
198 
199     Fit();
200 }
201 
202 /*!
203  * wxEVT_WIZARD_CANCEL event handler for ID_ERRPROJECTUNAVAILABLEPAGE
204  */
205 
OnCancel(wxWizardExEvent & event)206 void CErrUnavailablePage::OnCancel( wxWizardExEvent& event ) {
207     PROCESS_CANCELEVENT(event);
208 }
209 
210