1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 15:23:48 +01:00

Sweep unnecessary wxString copies: prefs

This commit is contained in:
Paul Licameli
2016-02-22 21:16:26 -05:00
parent 2efa24bc10
commit 0ce4fe0b83
5 changed files with 7 additions and 7 deletions

View File

@@ -138,7 +138,7 @@ bool ModulePrefs::Apply()
// static function that tells us about a module. // static function that tells us about a module.
int ModulePrefs::GetModuleStatus( wxString fname ){ int ModulePrefs::GetModuleStatus(const wxString &fname){
// Default status is NEW module, and we will ask once. // Default status is NEW module, and we will ask once.
int iStatus = kModuleNew; int iStatus = kModuleNew;
@@ -152,7 +152,7 @@ int ModulePrefs::GetModuleStatus( wxString fname ){
return iStatus; return iStatus;
} }
void ModulePrefs::SetModuleStatus( wxString fname, int iStatus ){ void ModulePrefs::SetModuleStatus(const wxString &fname, int iStatus){
wxString ShortName = wxFileName( fname ).GetName(); wxString ShortName = wxFileName( fname ).GetName();
wxString PrefName = wxString( wxT("/Module/") ) + ShortName.Lower(); wxString PrefName = wxString( wxT("/Module/") ) + ShortName.Lower();
gPrefs->Write( PrefName, iStatus ); gPrefs->Write( PrefName, iStatus );

View File

@@ -38,8 +38,8 @@ class ModulePrefs:public PrefsPanel
~ModulePrefs(); ~ModulePrefs();
virtual bool Apply(); virtual bool Apply();
static int GetModuleStatus( wxString fname ); static int GetModuleStatus( const wxString &fname );
static void SetModuleStatus( wxString fname, int iStatus ); static void SetModuleStatus( const wxString &fname, int iStatus );
private: private:
void GetAllModuleStatuses(); void GetAllModuleStatuses();

View File

@@ -448,7 +448,7 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
EndModal(true); EndModal(true);
} }
void PrefsDialog::SelectPageByName(wxString pageName) void PrefsDialog::SelectPageByName(const wxString &pageName)
{ {
if (mCategories) { if (mCategories) {
size_t n = mCategories->GetPageCount(); size_t n = mCategories->GetPageCount();

View File

@@ -61,7 +61,7 @@ class PrefsDialog:public wxDialog
void OnApply(wxCommandEvent & e); void OnApply(wxCommandEvent & e);
void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
void SelectPageByName(wxString pageName); void SelectPageByName(const wxString &pageName);
// Accessor to help implementations of SavePreferredPage(), // Accessor to help implementations of SavePreferredPage(),
// such as by saving a preference after DoModal() returns // such as by saving a preference after DoModal() returns

View File

@@ -43,7 +43,7 @@ ThemePrefs.
class PrefsPanel:public wxPanel class PrefsPanel:public wxPanel
{ {
public: public:
PrefsPanel(wxWindow * parent, wxString title) PrefsPanel(wxWindow * parent, const wxString &title)
: wxPanel(parent, wxID_ANY) : wxPanel(parent, wxID_ANY)
{ {
SetLabel(title); // Provide visual label SetLabel(title); // Provide visual label