2008-11-05 12:14:53 +00:00
// 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
2022-04-24 07:28:13 +00:00
////@begin includes
2008-11-05 12:14:53 +00:00
# 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"
2008-11-27 15:50:15 +00:00
# include "DlgExitMessage.h"
2022-04-24 07:28:13 +00:00
# ifdef __WXMAC__
# include "mac_util.h"
# endif
2008-11-05 12:14:53 +00:00
////@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 ;
2008-11-05 18:33:30 +00:00
wxString strAlwaysExitMessage = wxEmptyString ;
2008-11-05 12:14:53 +00:00
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 ) ;
2013-11-05 10:53:27 +00:00
wxFlexGridSizer * itemFlexGridSizer4 = new wxFlexGridSizer ( 1 , 0 , 0 ) ;
2008-11-05 12:14:53 +00:00
itemBoxSizer3 - > Add ( itemFlexGridSizer4 , 0 , wxALIGN_CENTER_HORIZONTAL | wxALL , 5 ) ;
2011-06-08 10:41:34 +00:00
# ifndef __WXMAC__
2008-11-05 12:14:53 +00:00
strExitMessage . Printf (
2011-05-25 23:13:26 +00:00
_ ( " You have requested to exit the %s, \n which allows you to view and manage \n the tasks running on your computer. \n \n If you also want to stop running the tasks, \n choose from the following options: " ) ,
2008-11-05 19:53:32 +00:00
pSkinAdvanced - > GetApplicationName ( ) . c_str ( )
2008-11-05 18:33:30 +00:00
) ;
2008-11-11 02:58:05 +00:00
# else
2022-04-24 07:28:13 +00:00
if ( compareOSVersionTo ( 10 , 15 ) > = 0 ) {
strExitMessage . Printf (
_ ( " This will shut down %s and its tasks until the \n %s is run again. \n \n In most cases, it is better just to close the %s window \n rather than to exit the application; that will allow %s to run its \n tasks at the times you selected in your preferences. " ) ,
pSkinAdvanced - > GetApplicationShortName ( ) . c_str ( ) ,
pSkinAdvanced - > GetApplicationName ( ) . c_str ( ) ,
pSkinAdvanced - > GetApplicationName ( ) . c_str ( ) ,
pSkinAdvanced - > GetApplicationShortName ( ) . 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 \n In most cases, it is better just to close the %s window \n rather than to exit the application; that will allow %s to run its \n tasks 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 ( )
) ;
}
2008-11-10 16:25:37 +00:00
# endif
2008-11-05 12:14:53 +00:00
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 ) ;
2011-02-03 18:19:04 +00:00
# ifndef __WXMAC__
2008-11-05 18:33:30 +00:00
strAlwaysExitMessage . Printf (
2011-05-25 23:16:08 +00:00
_ ( " Stop running tasks when exiting the %s " ) ,
pSkinAdvanced - > GetApplicationName ( ) . c_str ( )
2008-11-05 19:53:32 +00:00
) ;
2008-11-05 18:33:30 +00:00
m_DialogShutdownCoreClient = new wxCheckBox ;
m_DialogShutdownCoreClient - > Create ( itemDialog1 , ID_CDLGEXITMESSAGE_SHUTDOWNCORECLIENT , strAlwaysExitMessage , wxDefaultPosition , wxDefaultSize , wxCHK_2STATE ) ;
2008-11-05 19:53:32 +00:00
m_DialogShutdownCoreClient - > SetValue ( false ) ;
2008-11-05 12:14:53 +00:00
itemFlexGridSizer4 - > Add ( m_DialogShutdownCoreClient , 0 , wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2008-11-05 18:33:30 +00:00
2008-11-05 12:14:53 +00:00
# endif
m_DialogDisplay = new wxCheckBox ;
2008-11-05 18:33:30 +00:00
m_DialogDisplay - > Create ( itemDialog1 , ID_CDLGEXITMESSAGE_DISPLAY , _ ( " Remember this decision and do not show this dialog. " ) , wxDefaultPosition , wxDefaultSize , wxCHK_2STATE ) ;
2008-11-05 12:14:53 +00:00
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
}