~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to clientgui/UnavailablePage.cpp

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

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