[GUI] Tune advanced preferences dialog (5)

Use class to pass variable, function not needed
Rename previous local variable to class format
This commit is contained in:
RichardHaselgrove 2018-07-12 19:22:15 +01:00
parent 67fb051c5b
commit 1d94d2d68c
3 changed files with 8 additions and 15 deletions

View File

@ -1124,7 +1124,7 @@ void CDlgAdvPreferences::OnOK(wxCommandEvent& ev) {
if(!ValidateInput()) {
return;
}
if (!isUsingLocalPrefs()) {
if (!m_bUsingLocalPrefs()) {
if(!this->ConfirmSetLocal()) {
return;
}

View File

@ -37,8 +37,6 @@
#define STATICBOXVERTICALSPACER 10
#define DAYOFWEEKBORDERSIZE 10
bool usingLocalPrefs;
///////////////////////////////////////////////////////////////////////////
// NOTE: On MS Windows with wxWidgets 3.0, controls inside a wxStaticBox
@ -63,7 +61,7 @@ CDlgAdvPreferencesBase::CDlgAdvPreferencesBase( wxWindow* parent, int id, wxStri
wxBoxSizer* dialogSizer = new wxBoxSizer( wxVERTICAL );
usingLocalPrefs = doesLocalPrefsFileExist();
m_bUsingLocalPrefs = doesLocalPrefsFileExist();
if (web_prefs_url->IsEmpty()) {
m_bmpWarning = NULL;
} else {
@ -78,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"
@ -103,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."),
@ -116,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();
}
@ -163,14 +161,14 @@ 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 (usingLocalPrefs) {
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.") );
if (!usingLocalPrefs) {
if (!m_bUsingLocalPrefs) {
m_btnCancel->SetDefault();
}
buttonSizer->Add( m_btnCancel, 0, wxALL, 5 );
@ -1085,11 +1083,6 @@ bool CDlgAdvPreferencesBase::doesLocalPrefsFileExist() {
return local_prefs_found;
}
// to make result available externally
bool CDlgAdvPreferencesBase::isUsingLocalPrefs() {
return usingLocalPrefs;
}
void CDlgAdvPreferencesBase::makeStaticBoxLabelItalic(wxStaticBox* staticBox) {
#if defined(__WXMSW__) || defined(__WXGTK__)
wxFont myFont = staticBox->GetFont();

View File

@ -243,10 +243,10 @@ 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 );
bool isUsingLocalPrefs();
private:
void addNewRowToSizer(wxSizer* toSizer, wxString& toolTipText,