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

« back to all changes in this revision

Viewing changes to clientgui/CompletionErrorPage.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 "CompletionErrorPage.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 "CompletionErrorPage.h"
39
 
 
40
 
 
41
 
/*!
42
 
 * CCompletionErrorPage type definition
43
 
 */
44
 
 
45
 
IMPLEMENT_DYNAMIC_CLASS( CCompletionErrorPage, wxWizardPageEx )
46
 
 
47
 
/*!
48
 
 * CCompletionErrorPage event table definition
49
 
 */
50
 
 
51
 
BEGIN_EVENT_TABLE( CCompletionErrorPage, wxWizardPageEx )
52
 
 
53
 
////@begin CCompletionErrorPage event table entries
54
 
    EVT_WIZARDEX_PAGE_CHANGED( -1, CCompletionErrorPage::OnPageChanged )
55
 
    EVT_WIZARDEX_CANCEL( -1, CCompletionErrorPage::OnCancel )
56
 
 
57
 
////@end CCompletionErrorPage event table entries
58
 
 
59
 
END_EVENT_TABLE()
60
 
 
61
 
/*!
62
 
 * CCompletionErrorPage constructors
63
 
 */
64
 
 
65
 
CCompletionErrorPage::CCompletionErrorPage( )
66
 
{
67
 
}
68
 
 
69
 
CCompletionErrorPage::CCompletionErrorPage( CBOINCBaseWizard* parent )
70
 
{
71
 
    Create( parent );
72
 
}
73
 
 
74
 
/*!
75
 
 * CAccountResultPage creator
76
 
 */
77
 
 
78
 
bool CCompletionErrorPage::Create( CBOINCBaseWizard* parent )
79
 
{
80
 
////@begin CCompletionErrorPage member initialisation
81
 
    m_pTitleStaticCtrl = NULL;
82
 
    m_pDirectionsStaticCtrl = NULL;
83
 
    m_pServerMessagesDescriptionCtrl = NULL;
84
 
    m_pServerMessagesStaticBoxSizerCtrl = NULL;
85
 
    m_pServerMessagesCtrl = NULL;
86
 
////@end CCompletionErrorPage member initialisation
87
 
 
88
 
////@begin CCompletionErrorPage creation
89
 
    wxBitmap wizardBitmap(wxNullBitmap);
90
 
    wxWizardPageEx::Create( parent, ID_COMPLETIONERRORPAGE, wizardBitmap );
91
 
 
92
 
    CreateControls();
93
 
    GetSizer()->Fit(this);
94
 
////@end CCompletionErrorPage creation
95
 
 
96
 
    return TRUE;
97
 
}
98
 
 
99
 
/*!
100
 
 * Control creation for CAccountResultPage
101
 
 */
102
 
 
103
 
void CCompletionErrorPage::CreateControls()
104
 
{    
105
 
////@begin CCompletionErrorPage content construction
106
 
    CCompletionErrorPage* itemWizardPage85 = this;
107
 
 
108
 
    wxBoxSizer* itemBoxSizer86 = new wxBoxSizer(wxVERTICAL);
109
 
    itemWizardPage85->SetSizer(itemBoxSizer86);
110
 
 
111
 
    m_pTitleStaticCtrl = new wxStaticText;
112
 
    m_pTitleStaticCtrl->Create( itemWizardPage85, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
113
 
    m_pTitleStaticCtrl->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
114
 
    itemBoxSizer86->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
115
 
 
116
 
    itemBoxSizer86->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
117
 
 
118
 
    m_pDirectionsStaticCtrl = new wxStaticText;
119
 
    m_pDirectionsStaticCtrl->Create( itemWizardPage85, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
120
 
    itemBoxSizer86->Add(m_pDirectionsStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
121
 
 
122
 
    itemBoxSizer86->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
123
 
 
124
 
    m_pServerMessagesDescriptionCtrl = new wxStaticBox(itemWizardPage85, wxID_ANY, wxEmptyString);
125
 
    m_pServerMessagesStaticBoxSizerCtrl = new wxStaticBoxSizer(m_pServerMessagesDescriptionCtrl, wxVERTICAL);
126
 
    itemBoxSizer86->Add(m_pServerMessagesStaticBoxSizerCtrl, 0, wxGROW|wxALL, 5);
127
 
 
128
 
    m_pServerMessagesCtrl = new wxStaticText;
129
 
    m_pServerMessagesCtrl->Create( itemWizardPage85, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
130
 
    m_pServerMessagesStaticBoxSizerCtrl->Add(m_pServerMessagesCtrl, 0, wxGROW|wxALL, 5);
131
 
////@end CCompletionErrorPage content construction
132
 
}
133
 
 
134
 
/*!
135
 
 * Gets the previous page.
136
 
 */
137
 
 
138
 
wxWizardPageEx* CCompletionErrorPage::GetPrev() const
139
 
{
140
 
    return NULL;
141
 
}
142
 
 
143
 
/*!
144
 
 * Gets the next page.
145
 
 */
146
 
 
147
 
wxWizardPageEx* CCompletionErrorPage::GetNext() const
148
 
{
149
 
    return NULL;
150
 
}
151
 
 
152
 
/*!
153
 
 * Should we show tooltips?
154
 
 */
155
 
 
156
 
bool CCompletionErrorPage::ShowToolTips()
157
 
{
158
 
    return TRUE;
159
 
}
160
 
 
161
 
/*!
162
 
 * Get bitmap resources
163
 
 */
164
 
 
165
 
wxBitmap CCompletionErrorPage::GetBitmapResource( const wxString& WXUNUSED(name) )
166
 
{
167
 
    // Bitmap retrieval
168
 
 
169
 
////@begin CCompletionErrorPage bitmap retrieval
170
 
    return wxNullBitmap;
171
 
////@end CCompletionErrorPage bitmap retrieval
172
 
}
173
 
 
174
 
/*!
175
 
 * Get icon resources
176
 
 */
177
 
 
178
 
wxIcon CCompletionErrorPage::GetIconResource( const wxString& WXUNUSED(name) )
179
 
{
180
 
    // Icon retrieval
181
 
 
182
 
////@begin CCompletionErrorPage icon retrieval
183
 
    return wxNullIcon;
184
 
////@end CCompletionErrorPage icon retrieval
185
 
}
186
 
  
187
 
/*!
188
 
 * wxEVT_WIZARD_PAGE_CHANGED event handler for ID_COMPLETIONERRORPAGE
189
 
 */
190
 
 
191
 
void CCompletionErrorPage::OnPageChanged( wxWizardExEvent& event ) {
192
 
    if (event.GetDirection() == false) return;
193
 
 
194
 
    wxASSERT(m_pTitleStaticCtrl);
195
 
    wxASSERT(m_pDirectionsStaticCtrl);
196
 
    wxASSERT(m_pServerMessagesDescriptionCtrl);
197
 
    wxASSERT(m_pServerMessagesStaticBoxSizerCtrl);
198
 
    wxASSERT(m_pServerMessagesCtrl);
199
 
 
200
 
    if (IS_ATTACHTOPROJECTWIZARD()) {
201
 
        m_pTitleStaticCtrl->SetLabel(
202
 
            _("Failed to attach to project")
203
 
        );
204
 
    } else if (IS_ACCOUNTMANAGERWIZARD()) {
205
 
        if (IS_ACCOUNTMANAGERUPDATEWIZARD()) {
206
 
            m_pTitleStaticCtrl->SetLabel(
207
 
                _("Failed to update account manager")
208
 
            );
209
 
        } else if (IS_ACCOUNTMANAGERUPDATEWIZARD()) {
210
 
            m_pTitleStaticCtrl->SetLabel(
211
 
                _("Failed to remove account manager")
212
 
            );
213
 
        } else {
214
 
            m_pTitleStaticCtrl->SetLabel(
215
 
                _("Failed to attach to account manager")
216
 
            );
217
 
        }
218
 
    } else {
219
 
        wxASSERT(FALSE);
220
 
    }
221
 
 
222
 
    if (m_pServerMessagesCtrl->GetLabel().IsEmpty()) {
223
 
        m_pDirectionsStaticCtrl->SetLabel(
224
 
            _("An error has occurred;\n"
225
 
                                "check Messages for details.\n"
226
 
               "\n"
227
 
               "Click Finish to close.")
228
 
        );
229
 
    } else {
230
 
        m_pDirectionsStaticCtrl->SetLabel(
231
 
            _("Click Finish to close.")
232
 
        );
233
 
    }
234
 
 
235
 
    if (CHECK_CLOSINGINPROGRESS() || m_pServerMessagesCtrl->GetLabel().IsEmpty()) {
236
 
        m_pServerMessagesDescriptionCtrl->Hide();
237
 
        m_pServerMessagesCtrl->Hide();
238
 
    } else {
239
 
        m_pServerMessagesDescriptionCtrl->SetLabel(
240
 
            _("Messages from server:")
241
 
        );
242
 
        m_pServerMessagesDescriptionCtrl->Show();
243
 
        m_pServerMessagesCtrl->Show();
244
 
    }
245
 
 
246
 
    Fit();
247
 
}
248
 
 
249
 
/*!
250
 
 * wxEVT_WIZARD_CANCEL event handler for ID_COMPLETIONERRORPAGE
251
 
 */
252
 
 
253
 
void CCompletionErrorPage::OnCancel( wxWizardExEvent& event ) {
254
 
    PROCESS_CANCELEVENT(event);
255
 
}
256
 
 
 
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 "CompletionErrorPage.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 "CompletionErrorPage.h"
 
37
 
 
38
 
 
39
/*!
 
40
 * CCompletionErrorPage type definition
 
41
 */
 
42
 
 
43
IMPLEMENT_DYNAMIC_CLASS( CCompletionErrorPage, wxWizardPageEx )
 
44
 
 
45
/*!
 
46
 * CCompletionErrorPage event table definition
 
47
 */
 
48
 
 
49
BEGIN_EVENT_TABLE( CCompletionErrorPage, wxWizardPageEx )
 
50
 
 
51
////@begin CCompletionErrorPage event table entries
 
52
    EVT_WIZARDEX_PAGE_CHANGED( -1, CCompletionErrorPage::OnPageChanged )
 
53
    EVT_WIZARDEX_CANCEL( -1, CCompletionErrorPage::OnCancel )
 
54
 
 
55
////@end CCompletionErrorPage event table entries
 
56
 
 
57
END_EVENT_TABLE()
 
58
 
 
59
/*!
 
60
 * CCompletionErrorPage constructors
 
61
 */
 
62
 
 
63
CCompletionErrorPage::CCompletionErrorPage( )
 
64
{
 
65
}
 
66
 
 
67
CCompletionErrorPage::CCompletionErrorPage( CBOINCBaseWizard* parent )
 
68
{
 
69
    Create( parent );
 
70
}
 
71
 
 
72
/*!
 
73
 * CAccountResultPage creator
 
74
 */
 
75
 
 
76
bool CCompletionErrorPage::Create( CBOINCBaseWizard* parent )
 
77
{
 
78
////@begin CCompletionErrorPage member initialisation
 
79
    m_pTitleStaticCtrl = NULL;
 
80
    m_pDirectionsStaticCtrl = NULL;
 
81
    m_pServerMessagesDescriptionCtrl = NULL;
 
82
    m_pServerMessagesStaticBoxSizerCtrl = NULL;
 
83
    m_pServerMessagesCtrl = NULL;
 
84
////@end CCompletionErrorPage member initialisation
 
85
 
 
86
////@begin CCompletionErrorPage creation
 
87
    wxWizardPageEx::Create( parent, ID_COMPLETIONERRORPAGE );
 
88
 
 
89
    CreateControls();
 
90
    GetSizer()->Fit(this);
 
91
////@end CCompletionErrorPage creation
 
92
 
 
93
    return TRUE;
 
94
}
 
95
 
 
96
/*!
 
97
 * Control creation for CAccountResultPage
 
98
 */
 
99
 
 
100
void CCompletionErrorPage::CreateControls()
 
101
{    
 
102
////@begin CCompletionErrorPage content construction
 
103
    CCompletionErrorPage* itemWizardPage85 = this;
 
104
 
 
105
    wxBoxSizer* itemBoxSizer86 = new wxBoxSizer(wxVERTICAL);
 
106
    itemWizardPage85->SetSizer(itemBoxSizer86);
 
107
 
 
108
    m_pTitleStaticCtrl = new wxStaticText;
 
109
    m_pTitleStaticCtrl->Create( itemWizardPage85, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
 
110
    m_pTitleStaticCtrl->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
 
111
    itemBoxSizer86->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
 
112
 
 
113
    itemBoxSizer86->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
 
114
 
 
115
    m_pDirectionsStaticCtrl = new wxStaticText;
 
116
    m_pDirectionsStaticCtrl->Create( itemWizardPage85, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
 
117
    itemBoxSizer86->Add(m_pDirectionsStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
 
118
 
 
119
    itemBoxSizer86->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
 
120
 
 
121
    m_pServerMessagesDescriptionCtrl = new wxStaticBox(itemWizardPage85, wxID_ANY, wxEmptyString);
 
122
    m_pServerMessagesStaticBoxSizerCtrl = new wxStaticBoxSizer(m_pServerMessagesDescriptionCtrl, wxVERTICAL);
 
123
    itemBoxSizer86->Add(m_pServerMessagesStaticBoxSizerCtrl, 0, wxGROW|wxALL, 5);
 
124
 
 
125
    m_pServerMessagesCtrl = new wxStaticText;
 
126
    m_pServerMessagesCtrl->Create( itemWizardPage85, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
 
127
    m_pServerMessagesStaticBoxSizerCtrl->Add(m_pServerMessagesCtrl, 0, wxGROW|wxALL, 5);
 
128
////@end CCompletionErrorPage content construction
 
129
}
 
130
 
 
131
/*!
 
132
 * Gets the previous page.
 
133
 */
 
134
 
 
135
wxWizardPageEx* CCompletionErrorPage::GetPrev() const
 
136
{
 
137
    return NULL;
 
138
}
 
139
 
 
140
/*!
 
141
 * Gets the next page.
 
142
 */
 
143
 
 
144
wxWizardPageEx* CCompletionErrorPage::GetNext() const
 
145
{
 
146
    return NULL;
 
147
}
 
148
 
 
149
/*!
 
150
 * Should we show tooltips?
 
151
 */
 
152
 
 
153
bool CCompletionErrorPage::ShowToolTips()
 
154
{
 
155
    return TRUE;
 
156
}
 
157
 
 
158
/*!
 
159
 * Get bitmap resources
 
160
 */
 
161
 
 
162
wxBitmap CCompletionErrorPage::GetBitmapResource( const wxString& WXUNUSED(name) )
 
163
{
 
164
    // Bitmap retrieval
 
165
 
 
166
////@begin CCompletionErrorPage bitmap retrieval
 
167
    return wxNullBitmap;
 
168
////@end CCompletionErrorPage bitmap retrieval
 
169
}
 
170
 
 
171
/*!
 
172
 * Get icon resources
 
173
 */
 
174
 
 
175
wxIcon CCompletionErrorPage::GetIconResource( const wxString& WXUNUSED(name) )
 
176
{
 
177
    // Icon retrieval
 
178
 
 
179
////@begin CCompletionErrorPage icon retrieval
 
180
    return wxNullIcon;
 
181
////@end CCompletionErrorPage icon retrieval
 
182
}
 
183
  
 
184
/*!
 
185
 * wxEVT_WIZARD_PAGE_CHANGED event handler for ID_COMPLETIONERRORPAGE
 
186
 */
 
187
 
 
188
void CCompletionErrorPage::OnPageChanged( wxWizardExEvent& event ) {
 
189
    if (event.GetDirection() == false) return;
 
190
 
 
191
    wxASSERT(m_pTitleStaticCtrl);
 
192
    wxASSERT(m_pDirectionsStaticCtrl);
 
193
    wxASSERT(m_pServerMessagesDescriptionCtrl);
 
194
    wxASSERT(m_pServerMessagesStaticBoxSizerCtrl);
 
195
    wxASSERT(m_pServerMessagesCtrl);
 
196
 
 
197
    if (IS_ATTACHTOPROJECTWIZARD()) {
 
198
        m_pTitleStaticCtrl->SetLabel(
 
199
            _("Failed to add project")
 
200
        );
 
201
    } else if (IS_ACCOUNTMANAGERWIZARD()) {
 
202
        if (IS_ACCOUNTMANAGERUPDATEWIZARD()) {
 
203
            m_pTitleStaticCtrl->SetLabel(
 
204
                _("Failed to update account manager")
 
205
            );
 
206
        } else if (IS_ACCOUNTMANAGERUPDATEWIZARD()) {
 
207
            m_pTitleStaticCtrl->SetLabel(
 
208
                _("Failed to remove account manager")
 
209
            );
 
210
        } else {
 
211
            m_pTitleStaticCtrl->SetLabel(
 
212
                _("Failed to add account manager")
 
213
            );
 
214
        }
 
215
    } else {
 
216
        wxASSERT(FALSE);
 
217
    }
 
218
 
 
219
    if (m_pServerMessagesCtrl->GetLabel().IsEmpty()) {
 
220
        m_pDirectionsStaticCtrl->SetLabel(
 
221
            _("An error has occurred;\ncheck Messages for details.\n\nClick Finish to close.")
 
222
        );
 
223
    } else {
 
224
        m_pDirectionsStaticCtrl->SetLabel(
 
225
            _("Click Finish to close.")
 
226
        );
 
227
    }
 
228
 
 
229
    if (CHECK_CLOSINGINPROGRESS() || m_pServerMessagesCtrl->GetLabel().IsEmpty()) {
 
230
        m_pServerMessagesDescriptionCtrl->Hide();
 
231
        m_pServerMessagesCtrl->Hide();
 
232
    } else {
 
233
        m_pServerMessagesDescriptionCtrl->SetLabel(
 
234
            _("Messages from server:")
 
235
        );
 
236
        m_pServerMessagesDescriptionCtrl->Show();
 
237
        m_pServerMessagesCtrl->Show();
 
238
    }
 
239
 
 
240
    Fit();
 
241
}
 
242
 
 
243
/*!
 
244
 * wxEVT_WIZARD_CANCEL event handler for ID_COMPLETIONERRORPAGE
 
245
 */
 
246
 
 
247
void CCompletionErrorPage::OnCancel( wxWizardExEvent& event ) {
 
248
    PROCESS_CANCELEVENT(event);
 
249
}
 
250