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

« back to all changes in this revision

Viewing changes to clientgui/ProxyInfoPage.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 "ProxyInfoPage.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 "ProxyInfoPage.h"
39
 
 
40
 
 
41
 
/*!
42
 
 * CErrProxyInfoPage type definition
43
 
 */
44
 
 
45
 
IMPLEMENT_DYNAMIC_CLASS( CErrProxyInfoPage, wxWizardPageEx )
46
 
  
47
 
/*!
48
 
 * CErrProxyInfoPage event table definition
49
 
 */
50
 
 
51
 
BEGIN_EVENT_TABLE( CErrProxyInfoPage, wxWizardPageEx )
52
 
 
53
 
////@begin CErrProxyInfoPage event table entries
54
 
    EVT_WIZARDEX_PAGE_CHANGED( -1, CErrProxyInfoPage::OnPageChanged )
55
 
    EVT_WIZARDEX_CANCEL( -1, CErrProxyInfoPage::OnCancel )
56
 
 
57
 
////@end CErrProxyInfoPage event table entries
58
 
 
59
 
END_EVENT_TABLE()
60
 
 
61
 
/*!
62
 
 * CErrProxyInfoPage constructors
63
 
 */
64
 
 
65
 
CErrProxyInfoPage::CErrProxyInfoPage( )
66
 
{
67
 
}
68
 
 
69
 
CErrProxyInfoPage::CErrProxyInfoPage( CBOINCBaseWizard* parent )
70
 
{
71
 
    Create( parent );
72
 
}
73
 
 
74
 
/*!
75
 
 * CErrProxyInfoPage creator
76
 
 */
77
 
 
78
 
bool CErrProxyInfoPage::Create( CBOINCBaseWizard* parent )
79
 
{
80
 
////@begin CErrProxyInfoPage member initialisation
81
 
    m_pTitleStaticCtrl = NULL;
82
 
    m_pDescriptionStaticCtrl = NULL;
83
 
    m_pDirectionsStaticCtrl = NULL;
84
 
////@end CErrProxyInfoPage member initialisation
85
 
  
86
 
////@begin CErrProxyInfoPage creation
87
 
    wxBitmap wizardBitmap(wxNullBitmap);
88
 
    wxWizardPageEx::Create( parent, ID_ERRPROXYINFOPAGE, wizardBitmap );
89
 
 
90
 
    CreateControls();
91
 
    GetSizer()->Fit(this);
92
 
////@end CErrProxyInfoPage creation
93
 
 
94
 
    return TRUE;
95
 
}
96
 
  
97
 
/*!
98
 
 * Control creation for CErrProxyInfoPage
99
 
 */
100
 
 
101
 
void CErrProxyInfoPage::CreateControls()
102
 
{    
103
 
////@begin CErrProxyInfoPage content construction
104
 
    CErrProxyInfoPage* itemWizardPage126 = this;
105
 
 
106
 
    wxBoxSizer* itemBoxSizer127 = new wxBoxSizer(wxVERTICAL);
107
 
    itemWizardPage126->SetSizer(itemBoxSizer127);
108
 
 
109
 
    m_pTitleStaticCtrl = new wxStaticText;
110
 
    m_pTitleStaticCtrl->Create( itemWizardPage126, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
111
 
    m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
112
 
    itemBoxSizer127->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
113
 
 
114
 
    itemBoxSizer127->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
115
 
 
116
 
    m_pDescriptionStaticCtrl = new wxStaticText;
117
 
    m_pDescriptionStaticCtrl->Create( itemWizardPage126, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
118
 
    itemBoxSizer127->Add(m_pDescriptionStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
119
 
 
120
 
    itemBoxSizer127->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
121
 
 
122
 
    m_pDirectionsStaticCtrl = new wxStaticText;
123
 
    m_pDirectionsStaticCtrl->Create( itemWizardPage126, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
124
 
    itemBoxSizer127->Add(m_pDirectionsStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
125
 
////@end CErrProxyInfoPage content construction
126
 
}
127
 
  
128
 
/*!
129
 
 * Gets the previous page.
130
 
 */
131
 
 
132
 
wxWizardPageEx* CErrProxyInfoPage::GetPrev() const
133
 
{
134
 
    return PAGE_TRANSITION_BACK;
135
 
}
136
 
  
137
 
/*!
138
 
 * Gets the next page.
139
 
 */
140
 
 
141
 
wxWizardPageEx* CErrProxyInfoPage::GetNext() const
142
 
{
143
 
    if (CHECK_CLOSINGINPROGRESS()) {
144
 
        // Cancel Event Detected
145
 
        return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
146
 
    } else {
147
 
        return PAGE_TRANSITION_NEXT(ID_ERRPROXYPAGE);
148
 
    }
149
 
    return NULL;
150
 
}
151
 
  
152
 
/*!
153
 
 * Should we show tooltips?
154
 
 */
155
 
 
156
 
bool CErrProxyInfoPage::ShowToolTips()
157
 
{
158
 
    return TRUE;
159
 
}
160
 
 
161
 
/*!
162
 
 * Get bitmap resources
163
 
 */
164
 
 
165
 
wxBitmap CErrProxyInfoPage::GetBitmapResource( const wxString& WXUNUSED(name) )
166
 
{
167
 
    // Bitmap retrieval
168
 
////@begin CErrProxyInfoPage bitmap retrieval
169
 
    return wxNullBitmap;
170
 
////@end CErrProxyInfoPage bitmap retrieval
171
 
}
172
 
  
173
 
/*!
174
 
 * Get icon resources
175
 
 */
176
 
 
177
 
wxIcon CErrProxyInfoPage::GetIconResource( const wxString& WXUNUSED(name) )
178
 
{
179
 
    // Icon retrieval
180
 
 
181
 
////@begin CErrProxyInfoPage icon retrieval
182
 
    return wxNullIcon;
183
 
////@end CErrProxyInfoPage icon retrieval
184
 
}
185
 
  
186
 
/*!
187
 
 * wxEVT_WIZARD_PAGE_CHANGED event handler for ID_ERRPROXYINFOPAGE
188
 
 */
189
 
 
190
 
void CErrProxyInfoPage::OnPageChanged( wxWizardExEvent& event ) {
191
 
    if (event.GetDirection() == false) return;
192
 
 
193
 
    wxASSERT(m_pTitleStaticCtrl);
194
 
    wxASSERT(m_pDescriptionStaticCtrl);
195
 
    wxASSERT(m_pDirectionsStaticCtrl);
196
 
 
197
 
    m_pTitleStaticCtrl->SetLabel(
198
 
        _("Network communication failure")
199
 
    );
200
 
#if defined (_WCG)
201
 
    m_pDescriptionStaticCtrl->SetLabel(
202
 
        _("The World Community Grid - BOINC software failed to communicate\n"
203
 
            "over the Internet. The most likely reasons are:\n"
204
 
            "\n"
205
 
            "1) Connectivity problem.  Check your network or modem connection\n"
206
 
            "and then click Back to try again.\n"
207
 
            "\n"
208
 
            "2) Personal firewall software is blocking the World Community\n"
209
 
            "Grid - BOINC software.  Configure your personal firewall to let\n"
210
 
            "BOINC and BOINC Manager communicate on port 80 and port 443,\n"
211
 
            "then click Back to try again.\n"
212
 
            "\n"
213
 
            "3) You are using a proxy server.\n"
214
 
            "Click Next to configure BOINC's proxy settings."
215
 
        )
216
 
    );
217
 
#else
218
 
    m_pDescriptionStaticCtrl->SetLabel(
219
 
        _("BOINC failed to communicate on the Internet.\n"
220
 
            "The most likely reasons are:\n"
221
 
            "\n"
222
 
            "1) Connectivity problem.  Check your network\n"
223
 
            "or modem connection and then click Back to try again.\n"
224
 
            "\n"
225
 
            "2) Personal firewall software is blocking BOINC.\n"
226
 
            "Configure your personal firewall to let BOINC and\n"
227
 
            "BOINC Manager communicate on port 80,\n"
228
 
            "then click Back to try again.\n"
229
 
            "\n"
230
 
            "3) You are using a proxy server.\n"
231
 
            "Click Next to configure BOINC's proxy settings."
232
 
        )
233
 
    );
234
 
#endif
235
 
 
236
 
    Fit();
237
 
}
238
 
  
239
 
/*!
240
 
 * wxEVT_WIZARD_CANCEL event handler for ID_ERRPROXYINFOPAGE
241
 
 */
242
 
 
243
 
void CErrProxyInfoPage::OnCancel( wxWizardExEvent& event ) {
244
 
    PROCESS_CANCELEVENT(event);
245
 
}
246
 
 
 
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 "ProxyInfoPage.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 "ProxyInfoPage.h"
 
37
 
 
38
 
 
39
/*!
 
40
 * CErrProxyInfoPage type definition
 
41
 */
 
42
 
 
43
IMPLEMENT_DYNAMIC_CLASS( CErrProxyInfoPage, wxWizardPageEx )
 
44
  
 
45
/*!
 
46
 * CErrProxyInfoPage event table definition
 
47
 */
 
48
 
 
49
BEGIN_EVENT_TABLE( CErrProxyInfoPage, wxWizardPageEx )
 
50
 
 
51
////@begin CErrProxyInfoPage event table entries
 
52
    EVT_WIZARDEX_PAGE_CHANGED( -1, CErrProxyInfoPage::OnPageChanged )
 
53
    EVT_WIZARDEX_CANCEL( -1, CErrProxyInfoPage::OnCancel )
 
54
 
 
55
////@end CErrProxyInfoPage event table entries
 
56
 
 
57
END_EVENT_TABLE()
 
58
 
 
59
/*!
 
60
 * CErrProxyInfoPage constructors
 
61
 */
 
62
 
 
63
CErrProxyInfoPage::CErrProxyInfoPage( )
 
64
{
 
65
}
 
66
 
 
67
CErrProxyInfoPage::CErrProxyInfoPage( CBOINCBaseWizard* parent )
 
68
{
 
69
    Create( parent );
 
70
}
 
71
 
 
72
/*!
 
73
 * CErrProxyInfoPage creator
 
74
 */
 
75
 
 
76
bool CErrProxyInfoPage::Create( CBOINCBaseWizard* parent )
 
77
{
 
78
////@begin CErrProxyInfoPage member initialisation
 
79
    m_pTitleStaticCtrl = NULL;
 
80
    m_pDescriptionStaticCtrl = NULL;
 
81
    m_pDirectionsStaticCtrl = NULL;
 
82
////@end CErrProxyInfoPage member initialisation
 
83
  
 
84
////@begin CErrProxyInfoPage creation
 
85
    wxWizardPageEx::Create( parent, ID_ERRPROXYINFOPAGE );
 
86
 
 
87
    CreateControls();
 
88
    GetSizer()->Fit(this);
 
89
////@end CErrProxyInfoPage creation
 
90
 
 
91
    return TRUE;
 
92
}
 
93
  
 
94
/*!
 
95
 * Control creation for CErrProxyInfoPage
 
96
 */
 
97
 
 
98
void CErrProxyInfoPage::CreateControls()
 
99
{    
 
100
////@begin CErrProxyInfoPage content construction
 
101
    CErrProxyInfoPage* itemWizardPage126 = this;
 
102
 
 
103
    wxBoxSizer* itemBoxSizer127 = new wxBoxSizer(wxVERTICAL);
 
104
    itemWizardPage126->SetSizer(itemBoxSizer127);
 
105
 
 
106
    m_pTitleStaticCtrl = new wxStaticText;
 
107
    m_pTitleStaticCtrl->Create( itemWizardPage126, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
 
108
    m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
 
109
    itemBoxSizer127->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
 
110
 
 
111
    itemBoxSizer127->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
 
112
 
 
113
    m_pDescriptionStaticCtrl = new wxStaticText;
 
114
    m_pDescriptionStaticCtrl->Create( itemWizardPage126, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
 
115
    itemBoxSizer127->Add(m_pDescriptionStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
 
116
 
 
117
    itemBoxSizer127->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
 
118
 
 
119
    m_pDirectionsStaticCtrl = new wxStaticText;
 
120
    m_pDirectionsStaticCtrl->Create( itemWizardPage126, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
 
121
    itemBoxSizer127->Add(m_pDirectionsStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
 
122
////@end CErrProxyInfoPage content construction
 
123
}
 
124
  
 
125
/*!
 
126
 * Gets the previous page.
 
127
 */
 
128
 
 
129
wxWizardPageEx* CErrProxyInfoPage::GetPrev() const
 
130
{
 
131
    return PAGE_TRANSITION_BACK;
 
132
}
 
133
  
 
134
/*!
 
135
 * Gets the next page.
 
136
 */
 
137
 
 
138
wxWizardPageEx* CErrProxyInfoPage::GetNext() const
 
139
{
 
140
    if (CHECK_CLOSINGINPROGRESS()) {
 
141
        // Cancel Event Detected
 
142
        return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
 
143
    } else {
 
144
        return PAGE_TRANSITION_NEXT(ID_ERRPROXYPAGE);
 
145
    }
 
146
    return NULL;
 
147
}
 
148
  
 
149
/*!
 
150
 * Should we show tooltips?
 
151
 */
 
152
 
 
153
bool CErrProxyInfoPage::ShowToolTips()
 
154
{
 
155
    return TRUE;
 
156
}
 
157
 
 
158
/*!
 
159
 * Get bitmap resources
 
160
 */
 
161
 
 
162
wxBitmap CErrProxyInfoPage::GetBitmapResource( const wxString& WXUNUSED(name) )
 
163
{
 
164
    // Bitmap retrieval
 
165
////@begin CErrProxyInfoPage bitmap retrieval
 
166
    return wxNullBitmap;
 
167
////@end CErrProxyInfoPage bitmap retrieval
 
168
}
 
169
  
 
170
/*!
 
171
 * Get icon resources
 
172
 */
 
173
 
 
174
wxIcon CErrProxyInfoPage::GetIconResource( const wxString& WXUNUSED(name) )
 
175
{
 
176
    // Icon retrieval
 
177
 
 
178
////@begin CErrProxyInfoPage icon retrieval
 
179
    return wxNullIcon;
 
180
////@end CErrProxyInfoPage icon retrieval
 
181
}
 
182
  
 
183
/*!
 
184
 * wxEVT_WIZARD_PAGE_CHANGED event handler for ID_ERRPROXYINFOPAGE
 
185
 */
 
186
 
 
187
void CErrProxyInfoPage::OnPageChanged( wxWizardExEvent& event ) {
 
188
    if (event.GetDirection() == false) return;
 
189
 
 
190
    wxASSERT(m_pTitleStaticCtrl);
 
191
    wxASSERT(m_pDescriptionStaticCtrl);
 
192
    wxASSERT(m_pDirectionsStaticCtrl);
 
193
 
 
194
    m_pTitleStaticCtrl->SetLabel(
 
195
        _("Network communication failure")
 
196
    );
 
197
#if defined (_WCG)
 
198
    m_pDescriptionStaticCtrl->SetLabel(
 
199
        _("The World Community Grid - BOINC software failed to communicate\nover the Internet. The most likely reasons are:\n\n1) Connectivity problem.  Check your network or modem connection\nand then click Back to try again.\n\n2) Personal firewall software is blocking the World Community\nGrid - BOINC software.  Configure your personal firewall to let\nBOINC and BOINC Manager communicate on port 80 and port 443,\nthen click Back to try again.\n\n3) You are using a proxy server.\nClick Next to configure BOINC's proxy settings.")
 
200
    );
 
201
#else
 
202
    m_pDescriptionStaticCtrl->SetLabel(
 
203
        _("BOINC failed to communicate on the Internet.\nThe most likely reasons are:\n\n1) Connectivity problem.  Check your network\nor modem connection and then click Back to try again.\n\n2) Personal firewall software is blocking BOINC.\nConfigure your personal firewall to let BOINC and\nBOINC Manager communicate on port 80,\nthen click Back to try again.\n\n3) You are using a proxy server.\nClick Next to configure BOINC's proxy settings.")
 
204
    );
 
205
#endif
 
206
 
 
207
    Fit();
 
208
}
 
209
  
 
210
/*!
 
211
 * wxEVT_WIZARD_CANCEL event handler for ID_ERRPROXYINFOPAGE
 
212
 */
 
213
 
 
214
void CErrProxyInfoPage::OnCancel( wxWizardExEvent& event ) {
 
215
    PROCESS_CANCELEVENT(event);
 
216
}
 
217