Audacity 3.2.0
Public Member Functions | List of all members
TracksViewModeEnumSetting Class Reference
Inheritance diagram for TracksViewModeEnumSetting:
[legend]
Collaboration diagram for TracksViewModeEnumSetting:
[legend]

Public Member Functions

void Migrate (wxString &value) override
 
- Public Member Functions inherited from EnumSetting< WaveChannelViewConstants::Display >
 EnumSetting (Key &&key, EnumValueSymbols symbols, long defaultSymbol, std::vector< WaveChannelViewConstants::Display > values, const wxString &oldKey={})
 
WaveChannelViewConstants::Display ReadEnum () const
 
WaveChannelViewConstants::Display ReadEnumWithDefault (WaveChannelViewConstants::Display defaultValue) const
 
bool WriteEnum (WaveChannelViewConstants::Display value)
 
- Public Member Functions inherited from EnumSettingBase
template<typename Key >
 EnumSettingBase (Key &&key, EnumValueSymbols symbols, long defaultSymbol, std::vector< int > intValues, const wxString &oldKey={})
 
- Public Member Functions inherited from ChoiceSetting
 ChoiceSetting (const SettingPath &, EnumValueSymbols, long=-1)=delete
 
 ChoiceSetting (TransactionalSettingBase &key, EnumValueSymbols symbols, long defaultSymbol=-1)
 
 ChoiceSetting (const SettingBase &key, EnumValueSymbols symbols, long defaultSymbol=-1)
 
const wxString & Key () const
 
const EnumValueSymbolDefault () const
 
const EnumValueSymbolsGetSymbols () const
 
wxString Read () const
 
wxString ReadWithDefault (const wxString &) const
 
bool Write (const wxString &value)
 
void SetDefault (long value)
 

Additional Inherited Members

- Protected Member Functions inherited from EnumSettingBase
int ReadInt () const
 
int ReadIntWithDefault (int defaultValue) const
 
bool WriteInt (int code)
 
size_t FindInt (int code) const
 
void Migrate (wxString &) override
 
- Protected Member Functions inherited from ChoiceSetting
size_t Find (const wxString &value) const
 
virtual void Migrate (wxString &)
 
- Protected Attributes inherited from ChoiceSetting
const wxString mKey
 
const EnumValueSymbols mSymbols
 
TransactionalSettingBase *const mpOtherSettings {}
 
bool mMigrated { false }
 
long mDefaultSymbol
 

Detailed Description

Definition at line 73 of file TracksPrefs.cpp.

Member Function Documentation

◆ Migrate()

void TracksViewModeEnumSetting::Migrate ( wxString &  value)
inlineoverridevirtual

Reimplemented from ChoiceSetting.

Definition at line 78 of file TracksPrefs.cpp.

79 {
80 // Special logic for this preference which was three times migrated!
81
82 // PRL: Bugs 1043, 1044
83 // 2.1.1 writes a NEW key for this preference, which got NEW values,
84 // to avoid confusing version 2.1.0 if it reads the preference file afterwards.
85 // Prefer the NEW preference key if it is present
86
87 static const EnumValueSymbol waveformSymbol{ XO("Waveform") };
88 static const EnumValueSymbol spectrumSymbol{ XO("Spectrogram") };
89
91 int oldMode;
92 wxString newValue;
93 auto stringValue =
95 switch (display) {
97 return spectrumSymbol.Internal();
99 return obsoleteValue;
100 default:
101 return waveformSymbol.Internal();
102 }
103 };
104
105 if (gPrefs->Read(key0, // The very old key
106 &oldMode,
109 newValue = stringValue(viewMode);
110 }
111 else if ( gPrefs->Read(key1,
112 &oldMode,
114 viewMode = static_cast<WaveChannelViewConstants::Display>(oldMode);
115 newValue = stringValue(viewMode);
116 }
117 else
118 gPrefs->Read( key2, &newValue );
119
120 if ( !gPrefs->Read( key3, &value ) ) {
121 if (newValue == obsoleteValue) {
122 newValue = waveformSymbol.Internal();
123 gPrefs->Write(
126 }
127
128 Write( value = newValue );
129 gPrefs->Flush();
130 return;
131 }
132 }
XO("Cut/Copy/Paste")
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
bool Write(const wxString &value)
Definition: Prefs.cpp:424
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
static const wxString dbLogValueString
static const wxString waveformScaleKey
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0
virtual bool Read(const wxString &key, bool *value) const =0
WAVE_TRACK_API Display ConvertLegacyDisplayValue(int oldValue)

References WaveChannelViewConstants::ConvertLegacyDisplayValue(), WaveformSettings::dbLogValueString, audacity::BasicSettings::Flush(), gPrefs, anonymous_namespace{TracksPrefs.cpp}::key0, anonymous_namespace{TracksPrefs.cpp}::key1, anonymous_namespace{TracksPrefs.cpp}::key2, anonymous_namespace{TracksPrefs.cpp}::key3, anonymous_namespace{TracksPrefs.cpp}::obsoleteValue, WaveChannelViewConstants::obsoleteWaveformDBDisplay, audacity::BasicSettings::Read(), WaveChannelViewConstants::Spectrum, WaveChannelViewConstants::Waveform, WaveformSettings::waveformScaleKey, audacity::BasicSettings::Write(), ChoiceSetting::Write(), and XO().

Here is the call graph for this function:

The documentation for this class was generated from the following file: