1 // This file is part of BOINC. 2 // http://boinc.berkeley.edu 3 // Copyright (C) 2015 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 #ifndef BOINC_DLGADVPREFERENCES_H 19 #define BOINC_DLGADVPREFERENCES_H 20 21 #if defined(__GNUG__) && !defined(__APPLE__) 22 #pragma interface "DlgAdvPreferences.cpp" 23 #endif 24 25 26 #include "DlgAdvPreferencesBase.h" 27 #include "prefs.h" 28 #include "cc_config.h" 29 30 class CDlgAdvPreferences : public CDlgAdvPreferencesBase { 31 DECLARE_DYNAMIC_CLASS( CDlgAdvPreferences ) 32 DECLARE_EVENT_TABLE() 33 void ReadPreferenceSettings(); 34 bool SavePreferencesSettings(); 35 void UpdateControlStates(); 36 void SetSpecialTooltips(); 37 bool SaveState(); 38 bool RestoreState(); 39 bool ValidateInput(); 40 void SetValidators(); 41 bool IsValidFloatChar(const wxChar& ch); 42 bool IsValidFloatValue(const wxString& value, bool allowNegative=false); 43 bool IsValidFloatValueBetween(const wxString& value, double minVal, double maxVal); 44 bool IsValidTimeChar(const wxChar& ch); 45 bool IsValidTimeValue(const wxString& value); 46 void ShowErrorMessage(wxString& msg,wxTextCtrl* errorCtrl); 47 bool EnsureTabPageVisible(wxTextCtrl* txtCtrl); 48 bool ConfirmClear(); 49 wxString DoubleToTimeString(double dt); 50 double TimeStringToDouble(wxString timeStr); 51 double RoundToHundredths(double td); 52 public: 53 CDlgAdvPreferences(wxWindow* parent=NULL);//to act as standard constructor set a default value 54 virtual ~CDlgAdvPreferences(); 55 //generic event handler 56 void OnHandleCommandEvent(wxCommandEvent& ev); 57 void OnOK(wxCommandEvent& event); 58 void OnHelp(wxCommandEvent& event); 59 void OnClear(wxCommandEvent& event); 60 void DisplayValue(double value, wxTextCtrl* textCtrl, wxCheckBox* checkBox=NULL); OKToShow()61 bool OKToShow() { return m_bOKToShow; } 62 private: 63 GLOBAL_PREFS prefs; 64 GLOBAL_PREFS_MASK mask; 65 GLOBAL_PREFS defaultPrefs; 66 LOG_FLAGS log_flags; 67 CC_CONFIG config; 68 wxArrayInt m_arrTabPageIds; 69 wxTextValidator* m_vTimeValidator; 70 wxCheckBox* procDayChks[7]; 71 wxTextCtrl* procDayStartTxts[7]; 72 wxTextCtrl* procDayStopTxts[7]; 73 wxCheckBox* netDayChks[7]; 74 wxTextCtrl* netDayStartTxts[7]; 75 wxTextCtrl* netDayStopTxts[7]; 76 bool m_bOKToShow; 77 wxColour stdTextBkgdColor; 78 wxTextCtrl* lastErrorCtrl; 79 }; 80 81 #endif 82 83