2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2006-07-20 19:33:08 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2006-07-20 19:33:08 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// 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.
|
2006-07-20 19:33:08 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2006-07-20 19:33:08 +00:00
|
|
|
// 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.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2006-07-20 19:33:08 +00:00
|
|
|
|
|
|
|
|
2017-04-08 06:54:49 +00:00
|
|
|
#ifndef BOINC_SG_DLG_PREFERENCES_H
|
|
|
|
#define BOINC_SG_DLG_PREFERENCES_H
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2006-07-20 19:33:08 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma interface "sg_DlgPreferences.cpp"
|
|
|
|
#endif
|
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
/*!
|
|
|
|
* Includes
|
|
|
|
*/
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
////@begin includes
|
2006-10-27 10:26:56 +00:00
|
|
|
#include "wx/valtext.h"
|
|
|
|
#include "wx/valgen.h"
|
2006-10-25 14:09:47 +00:00
|
|
|
////@end includes
|
2006-07-24 22:10:28 +00:00
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
/*!
|
|
|
|
* Forward declarations
|
|
|
|
*/
|
2006-07-24 22:10:28 +00:00
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
////@begin forward declarations
|
|
|
|
////@end forward declarations
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Control identifiers
|
|
|
|
*/
|
|
|
|
|
|
|
|
////@begin control identifiers
|
2006-10-27 10:26:56 +00:00
|
|
|
#define ID_DLGPREFERENCES 10000
|
2006-10-28 09:02:46 +00:00
|
|
|
#define SYMBOL_CDLGPREFERENCES_STYLE wxDEFAULT_DIALOG_STYLE
|
2006-11-16 23:32:48 +00:00
|
|
|
#define SYMBOL_CDLGPREFERENCES_TITLE wxT("")
|
2006-10-27 10:26:56 +00:00
|
|
|
#define SYMBOL_CDLGPREFERENCES_IDNAME ID_DLGPREFERENCES
|
2006-10-25 14:09:47 +00:00
|
|
|
#define SYMBOL_CDLGPREFERENCES_SIZE wxDefaultSize
|
|
|
|
#define SYMBOL_CDLGPREFERENCES_POSITION wxDefaultPosition
|
2015-03-24 11:50:40 +00:00
|
|
|
|
|
|
|
#define ID_SG_PREFS_START ID_DLGPREFERENCES+1
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ID_SGPREFERENCESCLEAR = ID_SG_PREFS_START,
|
|
|
|
ID_CHKPROCONBATTERIES,
|
|
|
|
ID_CHKPROCINUSE,
|
|
|
|
ID_TXTPROCIDLEFOR,
|
|
|
|
ID_CHKPROCEVERYDAY,
|
|
|
|
ID_TXTPROCEVERYDAYSTART,
|
|
|
|
ID_TXTPROCEVERYDAYSTOP,
|
2021-10-11 08:34:38 +00:00
|
|
|
ID_TXTPROCUSECPUTIME,
|
2015-03-24 11:50:40 +00:00
|
|
|
ID_CHKNETEVERYDAY,
|
|
|
|
ID_TXTNETEVERYDAYSTART,
|
|
|
|
ID_TXTNETEVERYDAYSTOP,
|
|
|
|
ID_CHKDISKMAXSPACE,
|
|
|
|
ID_TXTDISKMAXSPACE,
|
|
|
|
ID_SG_PREFS_LAST
|
|
|
|
};
|
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
////@end control identifiers
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Compatibility
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef wxCLOSE_BOX
|
|
|
|
#define wxCLOSE_BOX 0x1000
|
|
|
|
#endif
|
|
|
|
#ifndef wxFIXED_MINSIZE
|
|
|
|
#define wxFIXED_MINSIZE 0
|
|
|
|
#endif
|
2006-07-24 22:10:28 +00:00
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
/*!
|
2006-11-06 13:45:50 +00:00
|
|
|
* CPanelPreferences class declaration
|
2006-10-25 14:09:47 +00:00
|
|
|
*/
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
class CPanelPreferences: public wxPanel
|
2006-10-27 10:26:56 +00:00
|
|
|
{
|
2006-11-06 13:45:50 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS( CPanelPreferences )
|
2006-10-25 14:09:47 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
2006-07-05 21:36:56 +00:00
|
|
|
public:
|
2006-10-25 14:09:47 +00:00
|
|
|
/// Constructors
|
2006-11-06 13:45:50 +00:00
|
|
|
CPanelPreferences( );
|
|
|
|
CPanelPreferences( wxWindow* parent );
|
2006-10-25 14:09:47 +00:00
|
|
|
|
2015-03-27 12:04:05 +00:00
|
|
|
~CPanelPreferences( );
|
|
|
|
|
2006-10-25 14:09:47 +00:00
|
|
|
/// Creation
|
2006-11-06 13:45:50 +00:00
|
|
|
bool Create();
|
2006-10-25 14:09:47 +00:00
|
|
|
|
|
|
|
/// Creates the controls and sizers
|
|
|
|
void CreateControls();
|
|
|
|
|
2015-03-27 12:04:05 +00:00
|
|
|
void MakeBackgroundBitmap();
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
////@begin CPanelPreferences event handler declarations
|
2006-10-27 23:34:24 +00:00
|
|
|
/// wxEVT_ERASE_BACKGROUND event handler for ID_DLGPREFERENCES
|
|
|
|
void OnEraseBackground( wxEraseEvent& event );
|
|
|
|
|
2006-11-15 11:32:52 +00:00
|
|
|
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_WORKBETWEENBEGIN
|
|
|
|
void OnWorkBetweenBeginSelected( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/// wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_CONNECTBETWEENBEGIN
|
|
|
|
void OnConnectBetweenBeginSelected( wxCommandEvent& event );
|
2011-10-21 12:17:10 +00:00
|
|
|
|
2007-01-06 05:14:26 +00:00
|
|
|
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SIMPLE_HELP
|
|
|
|
void OnButtonHelp( wxCommandEvent& event );
|
2011-10-21 12:17:10 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
////@end CPanelPreferences event handler declarations
|
2006-10-27 10:26:56 +00:00
|
|
|
|
2011-10-21 12:17:10 +00:00
|
|
|
void OnButtonClear();
|
2015-03-24 11:50:40 +00:00
|
|
|
bool OnOK();
|
2018-09-10 17:05:18 +00:00
|
|
|
bool ConfirmSetLocal();
|
2006-11-15 11:32:52 +00:00
|
|
|
|
|
|
|
bool UpdateControlStates();
|
2006-10-27 23:34:24 +00:00
|
|
|
|
2006-10-27 10:26:56 +00:00
|
|
|
bool ClearPreferenceSettings();
|
2015-03-24 11:50:40 +00:00
|
|
|
wxString DoubleToTimeString(double dt);
|
|
|
|
double TimeStringToDouble(wxString timeStr);
|
|
|
|
double RoundToHundredths(double td);
|
|
|
|
void DisplayValue(double value, wxTextCtrl* textCtrl, wxCheckBox* checkBox=NULL);
|
2006-10-27 10:26:56 +00:00
|
|
|
bool ReadPreferenceSettings();
|
|
|
|
bool SavePreferenceSettings();
|
2015-03-24 11:50:40 +00:00
|
|
|
bool ValidateInput();
|
2018-09-10 17:05:18 +00:00
|
|
|
bool m_bUsingLocalPrefs;
|
2015-03-24 11:50:40 +00:00
|
|
|
void ShowErrorMessage(wxString& msg,wxTextCtrl* errorCtrl);
|
|
|
|
bool IsValidFloatChar(const wxChar& ch);
|
|
|
|
bool IsValidFloatValue(const wxString& value, bool allowNegative=false);
|
|
|
|
bool IsValidFloatValueBetween(const wxString& value, double minVal, double maxVal);
|
|
|
|
bool IsValidTimeChar(const wxChar& ch);
|
|
|
|
bool IsValidTimeValue(const wxString& value);
|
|
|
|
void OnHandleCheckboxEvent(wxCommandEvent& ev);
|
|
|
|
|
|
|
|
void addNewRowToSizer(wxSizer* toSizer, wxString& toolTipText,
|
2015-03-27 02:37:59 +00:00
|
|
|
wxWindow* first, wxWindow* second, wxWindow* third,
|
2015-03-24 11:50:40 +00:00
|
|
|
wxWindow* fourth=NULL, wxWindow* fifth=NULL);
|
|
|
|
wxSize getTextCtrlSize(wxString maxText);
|
|
|
|
bool doesLocalPrefsFileExist();
|
2015-03-27 12:04:05 +00:00
|
|
|
wxBitmap* GetBackgroundBmp() { return m_backgroundBitmap; }
|
2006-10-27 10:26:56 +00:00
|
|
|
|
2015-04-08 10:03:26 +00:00
|
|
|
bool OKToShow() { return m_bOKToShow; }
|
|
|
|
|
2006-10-27 10:26:56 +00:00
|
|
|
private:
|
2006-11-06 13:45:50 +00:00
|
|
|
////@begin CPanelPreferences member variables
|
2015-03-24 11:50:40 +00:00
|
|
|
wxCheckBox* m_chkProcOnBatteries;
|
|
|
|
wxCheckBox* m_chkProcInUse;
|
|
|
|
wxTextCtrl* m_txtProcIdleFor;
|
|
|
|
wxCheckBox* m_chkProcEveryDay;
|
|
|
|
wxTextCtrl* m_txtProcEveryDayStart;
|
|
|
|
wxTextCtrl* m_txtProcEveryDayStop;
|
|
|
|
wxTextCtrl* m_txtProcUseCPUTime;
|
|
|
|
wxCheckBox* m_chkNetEveryDay;
|
|
|
|
wxTextCtrl* m_txtNetEveryDayStart;
|
|
|
|
wxTextCtrl* m_txtNetEveryDayStop;
|
|
|
|
wxCheckBox* m_chkDiskMaxSpace;
|
|
|
|
wxTextCtrl* m_txtDiskMaxSpace;
|
|
|
|
|
|
|
|
wxTextValidator* m_vTimeValidator;
|
2011-10-21 12:17:10 +00:00
|
|
|
wxButton* m_btnClear;
|
2015-03-24 11:50:40 +00:00
|
|
|
wxString *web_prefs_url;
|
2015-03-27 12:04:05 +00:00
|
|
|
|
|
|
|
wxBitmap* m_backgroundBitmap;
|
2015-04-08 10:03:26 +00:00
|
|
|
|
|
|
|
bool m_bOKToShow;
|
2015-08-27 08:30:19 +00:00
|
|
|
|
|
|
|
wxColour stdTextBkgdColor;
|
|
|
|
wxTextCtrl* lastErrorCtrl;
|
2015-03-27 12:04:05 +00:00
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
////@end CPanelPreferences member variables
|
2007-11-08 08:25:15 +00:00
|
|
|
GLOBAL_PREFS global_preferences_working;
|
2006-11-14 10:12:24 +00:00
|
|
|
GLOBAL_PREFS_MASK global_preferences_mask;
|
2007-11-08 08:25:15 +00:00
|
|
|
GLOBAL_PREFS_MASK global_preferences_override_mask;
|
2015-03-24 11:50:40 +00:00
|
|
|
GLOBAL_PREFS defaultPrefs;
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* CDlgPreferences class declaration
|
|
|
|
*/
|
|
|
|
|
|
|
|
class CDlgPreferences: public wxDialog
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS( CDlgPreferences )
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Constructors
|
|
|
|
CDlgPreferences( );
|
|
|
|
CDlgPreferences( wxWindow* parent, wxWindowID id = SYMBOL_CDLGPREFERENCES_IDNAME, const wxString& caption = SYMBOL_CDLGPREFERENCES_TITLE, const wxPoint& pos = SYMBOL_CDLGPREFERENCES_POSITION, const wxSize& size = SYMBOL_CDLGPREFERENCES_SIZE, long style = SYMBOL_CDLGPREFERENCES_STYLE );
|
|
|
|
|
|
|
|
/// Creation
|
|
|
|
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CDLGPREFERENCES_IDNAME, const wxString& caption = SYMBOL_CDLGPREFERENCES_TITLE, const wxPoint& pos = SYMBOL_CDLGPREFERENCES_POSITION, const wxSize& size = SYMBOL_CDLGPREFERENCES_SIZE, long style = SYMBOL_CDLGPREFERENCES_STYLE );
|
|
|
|
|
2006-12-30 00:50:04 +00:00
|
|
|
/// wxEVT_HELP event handler for ID_DLGPREFERENCES
|
|
|
|
void OnHelp( wxHelpEvent& event );
|
|
|
|
|
2011-10-21 12:17:10 +00:00
|
|
|
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SGPREFERENCESCLEAR
|
|
|
|
void OnButtonClear( wxCommandEvent& event );
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
|
|
|
void OnOK( wxCommandEvent& event );
|
|
|
|
|
2011-10-21 12:17:10 +00:00
|
|
|
bool ConfirmClear();
|
|
|
|
|
2015-04-08 10:03:26 +00:00
|
|
|
bool OKToShow() { return m_pBackgroundPanel->OKToShow(); }
|
|
|
|
|
2006-11-06 13:45:50 +00:00
|
|
|
private:
|
|
|
|
////@begin CDlgPreferences member variables
|
|
|
|
|
|
|
|
CPanelPreferences* m_pBackgroundPanel;
|
2006-10-27 10:26:56 +00:00
|
|
|
};
|
2006-07-05 21:36:56 +00:00
|
|
|
|
2017-04-08 06:54:49 +00:00
|
|
|
#endif
|