forked from BOINC/boinc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDlgExitMessage.cpp
217 lines (173 loc) · 7.04 KB
/
DlgExitMessage.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
//
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "DlgExitMessage.h"
#endif
#include "stdwx.h"
#include "diagnostics.h"
#include "network.h"
#include "util.h"
#include "mfile.h"
#include "miofile.h"
#include "parse.h"
#include "BOINCGUIApp.h"
#include "SkinManager.h"
#include "DlgExitMessage.h"
////@begin includes
////@end includes
////@begin XPM images
////@end XPM images
/*!
* CDlgExitMessage type definition
*/
IMPLEMENT_DYNAMIC_CLASS( CDlgExitMessage, wxDialog )
/*!
* CDlgExitMessage event table definition
*/
BEGIN_EVENT_TABLE( CDlgExitMessage, wxDialog )
////@begin CDlgExitMessage event table entries
////@end CDlgExitMessage event table entries
END_EVENT_TABLE()
/*!
* CDlgExitMessage constructors
*/
CDlgExitMessage::CDlgExitMessage( )
{
}
CDlgExitMessage::CDlgExitMessage( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Create(parent, id, caption, pos, size, style);
}
/*!
* CDlgFileExit creator
*/
bool CDlgExitMessage::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
wxString strCaption = caption;
if (strCaption.IsEmpty()) {
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
wxASSERT(pSkinAdvanced);
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
strCaption.Printf(_("%s - Exit Confirmation"), pSkinAdvanced->GetApplicationName().c_str());
}
////@begin CDlgExitMessage member initialisation
m_DialogExitMessage = NULL;
m_DialogShutdownCoreClient = NULL;
m_DialogDisplay = NULL;
////@end CDlgExitMessage member initialisation
////@begin CDlgExitMessage creation
SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, strCaption, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
////@end CDlgExitMessage creation
return true;
}
/*!
* Control creation for CDlgFileExit
*/
void CDlgExitMessage::CreateControls()
{
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
wxString strExitMessage = wxEmptyString;
wxString strAlwaysExitMessage = wxEmptyString;
wxASSERT(pSkinAdvanced);
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
////@begin CDlgExitMessage content construction
CDlgExitMessage* itemDialog1 = this;
wxFlexGridSizer* itemFlexGridSizer2 = new wxFlexGridSizer(1, 2, 0, 0);
itemDialog1->SetSizer(itemFlexGridSizer2);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
itemFlexGridSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxFlexGridSizer* itemFlexGridSizer4 = new wxFlexGridSizer(1, 0, 0);
itemBoxSizer3->Add(itemFlexGridSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
#ifndef __WXMAC__
strExitMessage.Printf(
_("You have requested to exit the %s,\nwhich allows you to view and manage\nthe tasks running on your computer.\n\nIf you also want to stop running the tasks,\nchoose from the following options:"),
pSkinAdvanced->GetApplicationName().c_str()
);
#else
strExitMessage.Printf(
_("This will shut down %s and its tasks until either the\n%s or the %s screen saver is run again.\n\nIn most cases, it is better just to close the %s window\nrather than to exit the application; that will allow %s to run its\ntasks at the times you selected in your preferences."),
pSkinAdvanced->GetApplicationShortName().c_str(),
pSkinAdvanced->GetApplicationName().c_str(),
pSkinAdvanced->GetApplicationShortName().c_str(),
pSkinAdvanced->GetApplicationName().c_str(),
pSkinAdvanced->GetApplicationShortName().c_str()
);
#endif
m_DialogExitMessage = new wxStaticText;
m_DialogExitMessage->Create( itemDialog1, wxID_STATIC, strExitMessage, wxDefaultPosition, wxDefaultSize, 0);
itemFlexGridSizer4->Add(m_DialogExitMessage, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemFlexGridSizer4->Add(5, 5, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
#ifndef __WXMAC__
strAlwaysExitMessage.Printf(
_("Stop running tasks when exiting the %s"),
pSkinAdvanced->GetApplicationName().c_str()
);
m_DialogShutdownCoreClient = new wxCheckBox;
m_DialogShutdownCoreClient->Create( itemDialog1, ID_CDLGEXITMESSAGE_SHUTDOWNCORECLIENT, strAlwaysExitMessage, wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DialogShutdownCoreClient->SetValue(false);
itemFlexGridSizer4->Add(m_DialogShutdownCoreClient, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
#endif
m_DialogDisplay = new wxCheckBox;
m_DialogDisplay->Create( itemDialog1, ID_CDLGEXITMESSAGE_DISPLAY, _("Remember this decision and do not show this dialog."), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
m_DialogDisplay->SetValue(false);
itemFlexGridSizer4->Add(m_DialogDisplay, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxFlexGridSizer* itemFlexGridSizer8 = new wxFlexGridSizer(2, 1, 0, 0);
itemFlexGridSizer2->Add(itemFlexGridSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxALL, 5);
wxButton* itemButton9 = new wxButton;
itemButton9->Create( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton9->SetDefault();
itemFlexGridSizer8->Add(itemButton9, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxButton* itemButton10 = new wxButton;
itemButton10->Create( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer8->Add(itemButton10, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
////@end CDlgExitMessage content construction
}
/*!
* Should we show tooltips?
*/
bool CDlgExitMessage::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap CDlgExitMessage::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin CDlgExitMessage bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end CDlgExitMessage bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon CDlgExitMessage::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin CDlgExitMessage icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end CDlgExitMessage icon retrieval
}