mirror of https://github.com/BOINC/boinc.git
Merge pull request #2585 from BOINC/RDH_tune_AdvPrefDlg
[GUI] Tune advanced preferences dialog
This commit is contained in:
commit
c294cf9354
|
@ -1124,6 +1124,11 @@ void CDlgAdvPreferences::OnOK(wxCommandEvent& ev) {
|
|||
if(!ValidateInput()) {
|
||||
return;
|
||||
}
|
||||
if (!m_bUsingLocalPrefs) {
|
||||
if(!this->ConfirmSetLocal()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(SavePreferencesSettings()) {
|
||||
pDoc->rpc.set_global_prefs_override_struct(prefs,mask);
|
||||
pDoc->rpc.read_global_prefs_override();
|
||||
|
@ -1132,6 +1137,18 @@ void CDlgAdvPreferences::OnOK(wxCommandEvent& ev) {
|
|||
ev.Skip();
|
||||
}
|
||||
|
||||
bool CDlgAdvPreferences::ConfirmSetLocal() {
|
||||
wxString strMessage = wxEmptyString;
|
||||
strMessage.Printf(
|
||||
_("Changing to use the local preferences defined on this page. This will override your web-based preferences, even if you subsequently make changes there. Do you want to proceed?")
|
||||
);
|
||||
int res = wxGetApp().SafeMessageBox(
|
||||
strMessage,
|
||||
_("Confirmation"),wxCENTER | wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT,this);
|
||||
|
||||
return res==wxYES;
|
||||
}
|
||||
|
||||
// handles Help button clicked
|
||||
void CDlgAdvPreferences::OnHelp(wxCommandEvent& ev) {
|
||||
if (IsShown()) {
|
||||
|
|
|
@ -28,35 +28,36 @@
|
|||
#include "cc_config.h"
|
||||
|
||||
class CDlgAdvPreferences : public CDlgAdvPreferencesBase {
|
||||
DECLARE_DYNAMIC_CLASS( CDlgAdvPreferences )
|
||||
DECLARE_DYNAMIC_CLASS( CDlgAdvPreferences )
|
||||
DECLARE_EVENT_TABLE()
|
||||
void ReadPreferenceSettings();
|
||||
bool SavePreferencesSettings();
|
||||
void UpdateControlStates();
|
||||
void SetSpecialTooltips();
|
||||
void ReadPreferenceSettings();
|
||||
bool SavePreferencesSettings();
|
||||
void UpdateControlStates();
|
||||
void SetSpecialTooltips();
|
||||
bool SaveState();
|
||||
bool RestoreState();
|
||||
bool ValidateInput();
|
||||
void SetValidators();
|
||||
bool IsValidFloatChar(const wxChar& ch);
|
||||
bool IsValidFloatValue(const wxString& value, bool allowNegative=false);
|
||||
bool ValidateInput();
|
||||
void SetValidators();
|
||||
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 ShowErrorMessage(wxString& msg,wxTextCtrl* errorCtrl);
|
||||
bool EnsureTabPageVisible(wxTextCtrl* txtCtrl);
|
||||
bool ConfirmClear();
|
||||
wxString DoubleToTimeString(double dt);
|
||||
double TimeStringToDouble(wxString timeStr);
|
||||
bool IsValidTimeChar(const wxChar& ch);
|
||||
bool IsValidTimeValue(const wxString& value);
|
||||
void ShowErrorMessage(wxString& msg,wxTextCtrl* errorCtrl);
|
||||
bool EnsureTabPageVisible(wxTextCtrl* txtCtrl);
|
||||
bool ConfirmClear();
|
||||
bool ConfirmSetLocal();
|
||||
wxString DoubleToTimeString(double dt);
|
||||
double TimeStringToDouble(wxString timeStr);
|
||||
double RoundToHundredths(double td);
|
||||
public:
|
||||
CDlgAdvPreferences(wxWindow* parent=NULL);//to act as standard constructor set a default value
|
||||
virtual ~CDlgAdvPreferences();
|
||||
//generic event handler
|
||||
void OnHandleCommandEvent(wxCommandEvent& ev);
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnHelp(wxCommandEvent& event);
|
||||
void OnClear(wxCommandEvent& event);
|
||||
CDlgAdvPreferences(wxWindow* parent=NULL);//to act as standard constructor set a default value
|
||||
virtual ~CDlgAdvPreferences();
|
||||
//generic event handler
|
||||
void OnHandleCommandEvent(wxCommandEvent& ev);
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnHelp(wxCommandEvent& event);
|
||||
void OnClear(wxCommandEvent& event);
|
||||
void DisplayValue(double value, wxTextCtrl* textCtrl, wxCheckBox* checkBox=NULL);
|
||||
bool OKToShow() { return m_bOKToShow; }
|
||||
private:
|
||||
|
@ -65,7 +66,7 @@ private:
|
|||
GLOBAL_PREFS defaultPrefs;
|
||||
LOG_FLAGS log_flags;
|
||||
CC_CONFIG config;
|
||||
wxArrayInt m_arrTabPageIds;
|
||||
wxArrayInt m_arrTabPageIds;
|
||||
wxTextValidator* m_vTimeValidator;
|
||||
wxCheckBox* procDayChks[7];
|
||||
wxTextCtrl* procDayStartTxts[7];
|
||||
|
|
|
@ -61,7 +61,7 @@ CDlgAdvPreferencesBase::CDlgAdvPreferencesBase( wxWindow* parent, int id, wxStri
|
|||
wxBoxSizer* dialogSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
bool usingLocalPrefs = doesLocalPrefsFileExist();
|
||||
m_bUsingLocalPrefs = doesLocalPrefsFileExist();
|
||||
if (web_prefs_url->IsEmpty()) {
|
||||
m_bmpWarning = NULL;
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@ CDlgAdvPreferencesBase::CDlgAdvPreferencesBase( wxWindow* parent, int id, wxStri
|
|||
|
||||
wxBoxSizer* legendSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
if (usingLocalPrefs) {
|
||||
if (m_bUsingLocalPrefs) {
|
||||
legendSizer->Add(
|
||||
new wxStaticText( topControlsStaticBox, ID_DEFAULT,
|
||||
_("Using local preferences.\n"
|
||||
|
@ -101,7 +101,7 @@ CDlgAdvPreferencesBase::CDlgAdvPreferencesBase( wxWindow* parent, int id, wxStri
|
|||
0, wxLEFT, 5
|
||||
);
|
||||
|
||||
if (!usingLocalPrefs) {
|
||||
if (!m_bUsingLocalPrefs) {
|
||||
legendSizer->Add(
|
||||
new wxStaticText( topControlsStaticBox, ID_DEFAULT,
|
||||
_("Set values and click Save to use local preferences instead."),
|
||||
|
@ -114,7 +114,7 @@ CDlgAdvPreferencesBase::CDlgAdvPreferencesBase( wxWindow* parent, int id, wxStri
|
|||
|
||||
m_btnClear = new wxButton( topControlsStaticBox, ID_BTN_CLEAR, _("Use web prefs"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_btnClear->SetToolTip( _("Restore web-based preferences and close the dialog.") );
|
||||
if (!usingLocalPrefs) {
|
||||
if (!m_bUsingLocalPrefs) {
|
||||
m_btnClear->Hide();
|
||||
}
|
||||
|
||||
|
@ -161,13 +161,16 @@ CDlgAdvPreferencesBase::CDlgAdvPreferencesBase( wxWindow* parent, int id, wxStri
|
|||
|
||||
m_btnOK = new wxButton( m_panelButtons, wxID_OK, _("Save"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_btnOK->SetToolTip( _("Save all values and close the dialog.") );
|
||||
|
||||
if (m_bUsingLocalPrefs) {
|
||||
m_btnOK->SetDefault();
|
||||
}
|
||||
buttonSizer->Add( m_btnOK, 0, wxALL, 5 );
|
||||
|
||||
m_btnCancel = new wxButton( m_panelButtons, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_btnCancel->SetToolTip( _("Close the dialog without saving.") );
|
||||
m_btnCancel->SetDefault();
|
||||
|
||||
if (!m_bUsingLocalPrefs) {
|
||||
m_btnCancel->SetDefault();
|
||||
}
|
||||
buttonSizer->Add( m_btnCancel, 0, wxALL, 5 );
|
||||
|
||||
m_btnHelp = new wxButton( m_panelButtons, ID_HELPBOINC, _("Help"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
|
|
|
@ -243,6 +243,7 @@ protected:
|
|||
wxButton* m_btnHelp;
|
||||
|
||||
wxString *web_prefs_url;
|
||||
bool m_bUsingLocalPrefs;
|
||||
|
||||
public:
|
||||
CDlgAdvPreferencesBase( wxWindow* parent, int id = -1, wxString title = wxT(""), wxPoint pos = wxDefaultPosition, wxSize size = wxDefaultSize, int style = wxDEFAULT_DIALOG_STYLE );
|
||||
|
|
Loading…
Reference in New Issue