1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 07:13:49 +01:00

Replace virtual with override wherever possible; eliminate needless virtual...

... for functions in final classes.

override is like const -- it's not necessary, but it helps the compiler to
catch mistakes.

There may be some overriding functions not explicitly declared virtual and I did
not identify such cases, in which I might also add override.
This commit is contained in:
Paul Licameli
2016-02-24 01:06:47 -05:00
parent 74121c1494
commit 990080ae7d
169 changed files with 1652 additions and 1639 deletions

View File

@@ -25,7 +25,7 @@ class BatchPrefs final : public PrefsPanel
public:
BatchPrefs(wxWindow * parent);
~BatchPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -37,6 +37,6 @@ private:
class BatchPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -28,7 +28,7 @@ class DevicePrefs final : public PrefsPanel
public:
DevicePrefs(wxWindow * parent);
virtual ~DevicePrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -57,7 +57,7 @@ class DevicePrefs final : public PrefsPanel
class DevicePrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -23,8 +23,8 @@ class DirectoriesPrefs final : public PrefsPanel
public:
DirectoriesPrefs(wxWindow * parent);
~DirectoriesPrefs();
virtual bool Apply();
virtual bool Validate();
bool Apply() override;
bool Validate() override;
private:
void Populate();
@@ -41,6 +41,6 @@ class DirectoriesPrefs final : public PrefsPanel
class DirectoriesPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -27,7 +27,7 @@ class EffectsPrefs final : public PrefsPanel
public:
EffectsPrefs(wxWindow * parent);
~EffectsPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -37,6 +37,6 @@ class EffectsPrefs final : public PrefsPanel
class EffectsPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -47,7 +47,7 @@ class ExtImportPrefs final : public PrefsPanel
public:
ExtImportPrefs(wxWindow * parent);
~ExtImportPrefs();
virtual bool Apply();
bool Apply() override;
void OnPluginKeyDown(wxListEvent& event);
void OnPluginBeginDrag(wxListEvent& event);
@@ -111,6 +111,6 @@ class ExtImportPrefs final : public PrefsPanel
class ExtImportPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -27,7 +27,7 @@ class GUIPrefs final : public PrefsPanel
public:
GUIPrefs(wxWindow * parent);
~GUIPrefs();
virtual bool Apply();
bool Apply() override;
static void GetRangeChoices(wxArrayString *pChoices, wxArrayString *pCodes);
@@ -48,6 +48,6 @@ class GUIPrefs final : public PrefsPanel
class GUIPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -26,7 +26,7 @@ class ImportExportPrefs final : public PrefsPanel
public:
ImportExportPrefs(wxWindow * parent);
~ImportExportPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -36,6 +36,6 @@ class ImportExportPrefs final : public PrefsPanel
class ImportExportPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -39,8 +39,8 @@ class KeyConfigPrefs final : public PrefsPanel
public:
KeyConfigPrefs(wxWindow * parent);
~KeyConfigPrefs();
virtual bool Apply();
virtual void Cancel();
bool Apply() override;
void Cancel() override;
private:
void Populate();
@@ -107,8 +107,8 @@ class KeyConfigPrefs final : public PrefsPanel
public:
KeyConfigPrefs(wxWindow * parent);
~KeyConfigPrefs();
virtual bool Apply();
virtual void Cancel();
bool Apply() override;
void Cancel() override;
private:
void Populate();
@@ -151,6 +151,6 @@ class KeyConfigPrefs final : public PrefsPanel
class KeyConfigPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -27,7 +27,7 @@ class LibraryPrefs final : public PrefsPanel
public:
LibraryPrefs(wxWindow * parent);
~LibraryPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -49,6 +49,6 @@ class LibraryPrefs final : public PrefsPanel
class LibraryPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -31,8 +31,8 @@ class MidiIOPrefs final : public PrefsPanel
public:
MidiIOPrefs(wxWindow * parent);
virtual ~MidiIOPrefs();
virtual bool Apply();
virtual bool Validate();
bool Apply() override;
bool Validate() override;
private:
void Populate();
@@ -65,7 +65,7 @@ class MidiIOPrefs final : public PrefsPanel
class MidiIOPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -36,7 +36,7 @@ class ModulePrefs final : public PrefsPanel
public:
ModulePrefs(wxWindow * parent);
~ModulePrefs();
virtual bool Apply();
bool Apply() override;
static int GetModuleStatus( const wxString &fname );
static void SetModuleStatus( const wxString &fname, int iStatus );
@@ -53,6 +53,6 @@ class ModulePrefs final : public PrefsPanel
class ModulePrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -24,7 +24,7 @@ class MousePrefs final : public PrefsPanel
public:
MousePrefs(wxWindow * parent);
~MousePrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -41,6 +41,6 @@ class MousePrefs final : public PrefsPanel
class MousePrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -25,7 +25,7 @@ class PlaybackPrefs final : public PrefsPanel
public:
PlaybackPrefs(wxWindow * parent);
virtual ~PlaybackPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -35,7 +35,7 @@ class PlaybackPrefs final : public PrefsPanel
class PlaybackPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -85,8 +85,8 @@ public:
, mTitlePrefix(titlePrefix)
{;};
~wxTreebookExt(){;};
virtual int ChangeSelection(size_t n);
virtual int SetSelection(size_t n);
int ChangeSelection(size_t n) override;
int SetSelection(size_t n) override;
const wxString mTitlePrefix;
};

View File

@@ -53,7 +53,7 @@ class PrefsDialog /* not final */ : public wxDialog
virtual ~PrefsDialog();
// Defined this so a protected virtual can be invoked after the constructor
virtual int ShowModal();
int ShowModal() override;
void OnCategoryChange(wxCommandEvent & e);
void OnOK(wxCommandEvent & e);
@@ -91,8 +91,8 @@ class GlobalPrefsDialog final : public PrefsDialog
public:
GlobalPrefsDialog(wxWindow * parent, Factories &factories = DefaultFactories());
virtual ~GlobalPrefsDialog();
virtual long GetPreferredPage();
virtual void SavePreferredPage();
long GetPreferredPage() override;
void SavePreferredPage() override;
};
#endif

View File

@@ -52,6 +52,7 @@ class PrefsPanel /* not final */ : public wxPanel
virtual ~PrefsPanel();
// NEW virtuals
virtual bool Apply() = 0;
// If it returns True, the Apply button is added below the panel

View File

@@ -26,7 +26,7 @@ class ProjectsPrefs final : public PrefsPanel
public:
ProjectsPrefs(wxWindow * parent);
~ProjectsPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -36,6 +36,6 @@ class ProjectsPrefs final : public PrefsPanel
class ProjectsPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -29,7 +29,7 @@ class QualityPrefs final : public PrefsPanel
QualityPrefs(wxWindow * parent);
virtual ~QualityPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -56,6 +56,6 @@ class QualityPrefs final : public PrefsPanel
class QualityPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -26,7 +26,7 @@ class RecordingPrefs final : public PrefsPanel
public:
RecordingPrefs(wxWindow * parent);
virtual ~RecordingPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -43,6 +43,6 @@ class RecordingPrefs final : public PrefsPanel
class RecordingPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -146,7 +146,7 @@ const wxArrayString &SpectrogramSettings::GetScaleNames()
{
class ScaleNamesArray final : public TranslatableStringArray
{
virtual void Populate()
void Populate() override
{
// Keep in correspondence with enum SpectrogramSettings::ScaleType:
mContents.Add(_("Linear"));
@@ -171,7 +171,7 @@ const wxArrayString &SpectrogramSettings::GetAlgorithmNames()
{
class AlgorithmNamesArray final : public TranslatableStringArray
{
virtual void Populate()
void Populate() override
{
// Keep in correspondence with enum SpectrogramSettings::Algorithm:
mContents.Add(_("Frequencies"));

View File

@@ -43,9 +43,9 @@ class SpectrumPrefs final : public PrefsPanel
public:
SpectrumPrefs(wxWindow * parent, WaveTrack *wt);
virtual ~SpectrumPrefs();
virtual bool Apply();
virtual bool ShowsApplyButton();
virtual bool Validate();
bool Apply() override;
bool ShowsApplyButton() override;
bool Validate() override;
private:
void Populate(int windowSize);
@@ -100,7 +100,7 @@ class SpectrumPrefsFactory final : public PrefsPanelFactory
{
public:
explicit SpectrumPrefsFactory(WaveTrack *wt = 0);
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
private:
WaveTrack *const mWt;

View File

@@ -26,7 +26,7 @@ class ThemePrefs final : public PrefsPanel
public:
ThemePrefs(wxWindow * parent);
~ThemePrefs(void);
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -44,6 +44,6 @@ class ThemePrefs final : public PrefsPanel
class ThemePrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -27,7 +27,7 @@ class TracksPrefs final : public PrefsPanel
public:
TracksPrefs(wxWindow * parent);
~TracksPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -42,6 +42,6 @@ class TracksPrefs final : public PrefsPanel
class TracksPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -26,7 +26,7 @@ class WarningsPrefs final : public PrefsPanel
public:
WarningsPrefs(wxWindow * parent);
~WarningsPrefs();
virtual bool Apply();
bool Apply() override;
private:
void Populate();
@@ -36,6 +36,6 @@ class WarningsPrefs final : public PrefsPanel
class WarningsPrefsFactory final : public PrefsPanelFactory
{
public:
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
};
#endif

View File

@@ -25,9 +25,9 @@ class WaveformPrefs final : public PrefsPanel
public:
WaveformPrefs(wxWindow * parent, WaveTrack *wt);
virtual ~WaveformPrefs();
virtual bool Apply();
virtual bool ShowsApplyButton();
virtual bool Validate();
bool Apply() override;
bool ShowsApplyButton() override;
bool Validate() override;
private:
void Populate();
@@ -60,7 +60,7 @@ class WaveformPrefsFactory final : public PrefsPanelFactory
{
public:
explicit WaveformPrefsFactory(WaveTrack *wt = 0);
virtual PrefsPanel *Create(wxWindow *parent);
PrefsPanel *Create(wxWindow *parent) override;
private:
WaveTrack *const mWt;

View File

@@ -151,7 +151,7 @@ const wxArrayString &WaveformSettings::GetScaleNames()
{
class ScaleNamesArray final : public TranslatableStringArray
{
virtual void Populate()
void Populate() override
{
// Keep in correspondence with enum WaveTrack::WaveTrackDisplay:
mContents.Add(_("Linear"));