Audacity  3.0.3
Classes | Macros | Typedefs | Functions | Variables
Prefs.h File Reference
#include <functional>
#include "ComponentInterfaceSymbol.h"
#include "wxArrayStringEx.h"
#include "FileConfig.h"
#include <memory>
#include <wx/event.h>
Include dependency graph for Prefs.h:

Go to the source code of this file.

Classes

struct  ByColumns_t
 
class  SettingBase
 Base class for settings objects. It holds a configuration key path. More...
 
class  CachingSettingBase< T >
 Class template adds an in-memory cache of a value to SettingBase. More...
 
class  Setting< T >
 Class template adds default value, read, and write methods to CachingSetingBase. More...
 
class  BoolSetting
 This specialization of Setting for bool adds a Toggle method to negate the saved value. More...
 
class  IntSetting
 Specialization of Setting for int. More...
 
class  DoubleSetting
 Specialization of Setting for double. More...
 
class  StringSetting
 Specialization of Setting for strings. More...
 
class  EnumValueSymbols
 
class  ChoiceSetting
 
class  EnumSettingBase
 
class  EnumSetting< Enum >
 Adapts EnumSettingBase to a particular enumeration type. More...
 
class  PrefsListener
 A listener notified of changes in preferences. More...
 
struct  PreferenceInitializer
 

Macros

#define AUDACITY_PREFS_VERSION_STRING   "1.1.1r1"
 

Typedefs

using EnumValueSymbol = ComponentInterfaceSymbol
 

Functions

PREFERENCES_API void InitPreferences (std::unique_ptr< FileConfig > uPrefs)
 
PREFERENCES_API void ResetPreferences ()
 Call this to reset preferences to an (almost)-"new" default state. More...
 
PREFERENCES_API void FinishPreferences ()
 
PREFERENCES_API wxString WarningDialogKey (const wxString &internalDialogName)
 

Variables

PREFERENCES_API FileConfiggPrefs
 
int gMenusDirty
 
PREFERENCES_API ByColumns_t ByColumns
 
PREFERENCES_API BoolSetting DefaultUpdatesCheckingFlag
 

Macro Definition Documentation

◆ AUDACITY_PREFS_VERSION_STRING

#define AUDACITY_PREFS_VERSION_STRING   "1.1.1r1"

Definition at line 35 of file Prefs.h.

Typedef Documentation

◆ EnumValueSymbol

Definition at line 233 of file Prefs.h.

Function Documentation

◆ FinishPreferences()

PREFERENCES_API void FinishPreferences ( )

Definition at line 228 of file Prefs.cpp.

229 {
230  if (gPrefs) {
231  wxConfigBase::Set(NULL);
232  ugPrefs.reset();
233  gPrefs = NULL;
234  }
235 }

References gPrefs, and ugPrefs.

Referenced by AudacityApp::InitPart2(), AudacityApp::OnExit(), and AudacityApp::OnInit().

Here is the caller graph for this function:

◆ InitPreferences()

PREFERENCES_API void InitPreferences ( std::unique_ptr< FileConfig uPrefs)

Definition at line 202 of file Prefs.cpp.

203 {
204  gPrefs = uPrefs.get();
205  ugPrefs = std::move(uPrefs);
206  wxConfigBase::Set(gPrefs);
207 }

References gPrefs, and ugPrefs.

Referenced by AudacityApp::OnInit().

Here is the caller graph for this function:

◆ ResetPreferences()

PREFERENCES_API void ResetPreferences ( )

Call this to reset preferences to an (almost)-"new" default state.

There is at least one exception to that: user preferences we want to make more "sticky." Notably, whether automatic update checking is preferred.

Definition at line 209 of file Prefs.cpp.

210 {
211  // Future: make this a static registry table, so the settings objects
212  // don't need to be defined in this source code file to avoid dependency
213  // cycles
214  std::pair<BoolSetting &, bool> stickyBoolSettings[] {
216  // ... others?
217  };
218  for (auto &pair : stickyBoolSettings)
219  pair.second = pair.first.Read();
220 
221  bool savedValue = DefaultUpdatesCheckingFlag.Read();
222  gPrefs->DeleteAll();
223 
224  for (auto &pair : stickyBoolSettings)
225  pair.first.Write(pair.second);
226 }

References DefaultUpdatesCheckingFlag, FileConfig::DeleteAll(), gPrefs, and Setting< T >::Read().

Referenced by PluginActions::Handler::OnResetConfig(), and anonymous_namespace{AudacityApp.cpp}::PopulatePreferences().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WarningDialogKey()

PREFERENCES_API wxString WarningDialogKey ( const wxString &  internalDialogName)

Return the config file key associated with a warning dialog identified by internalDialogName. When the box is checked, the value at the key becomes false.

Definition at line 415 of file Prefs.cpp.

416 {
417  return wxT("/Warnings/") + internalDialogName;
418 }

Referenced by RecordingPrefs::PopulateOrExchange(), ShowWarningDialog(), and AudioIO::StartStream().

Here is the caller graph for this function:

Variable Documentation

◆ ByColumns

PREFERENCES_API ByColumns_t ByColumns
extern

◆ DefaultUpdatesCheckingFlag

PREFERENCES_API BoolSetting DefaultUpdatesCheckingFlag
extern

◆ gMenusDirty

int gMenusDirty
extern

Definition at line 71 of file Prefs.cpp.

◆ gPrefs

PREFERENCES_API FileConfig* gPrefs
extern

Definition at line 70 of file Prefs.cpp.

Referenced by anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItemGroup(), AdornedRulerPanel::AdornedRulerPanel(), PluginManager::Iterator::Advance(), EffectTruncSilence::Analyze(), GetPreferenceCommand::Apply(), SetPreferenceCommand::Apply(), MacroCommands::ApplyMacro(), ApplyMacroDialog::ApplyMacroToProject(), ProjectSelectionManager::AS_SetSelectionFormat(), ProjectSelectionManager::AS_SetSnapTo(), ProgressDialog::Beep(), ScreenshotCommand::CapturePreferences(), DeviceToolBar::ChangeHost(), ExportMP3::CheckFileName(), GUIPrefs::Commit(), KeyConfigPrefs::Commit(), QualityPrefs::Commit(), RecordingPrefs::Commit(), TracksPrefs::Commit(), LabelTrackView::ComputeLayout(), ControlToolBar::ControlToolBar(), anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), LabelTrackView::DoCaptureKey(), LabelTrackView::DoChar(), Exporter::DoEditMetadata(), anonymous_namespace{FileMenus.cpp}::DoImport(), ProjectAudioManager::DoRecord(), WaveTrackVZoomHandle::DoRelease(), SpectrumView::DoSetMinimized(), WaveformView::DoSetMinimized(), SpectrumVZoomHandle::DoZoom(), EffectNoiseRemoval::EffectNoiseRemoval(), EVT_COMMAND_RANGE(), Exporter::ExamineTracks(), ExportFFmpeg::Export(), ExportMP3::Export(), ExportOGG::Export(), ExportFFmpegOptions::ExportFFmpegOptions(), ExportMultipleDialog::ExportMultipleByLabel(), ExportMultipleDialog::ExportMultipleByTrack(), ExportOGGOptions::ExportOGGOptions(), anonymous_namespace{ExtraMenus.cpp}::ExtraMenu(), FFmpegLibs::FFmpegLibs(), FFmpegStartup(), DeviceToolBar::FillHostDevices(), MP3Exporter::FindLibrary(), FFmpegLibs::FindLibs(), FinishPreferences(), EditToolBar::ForAllButtons(), anonymous_namespace{Registry.cpp}::ItemOrdering::Get(), ModulePrefs::GetAllModuleStatuses(), SettingBase::GetConfig(), TracksPrefs::GetDefaultAudioTrackNamePreference(), GetEditClipsCanMove(), Exporter::GetFilename(), ModuleSettings::GetModuleStatus(), GetNextWindowPlacement(), TracksPrefs::GetPinnedHeadPositionPreference(), TracksPrefs::GetPinnedHeadPreference(), GlobalPrefsDialog::GetPreferredPage(), ExportCL::GetSettings(), PlaybackPrefs::GetUnpinnedScrubbingPreference(), FileHistory::Global(), NoteTrackVZoomHandle::HitPreview(), WaveTrackVZoomHandle::HitPreview(), Importer::Import(), AudioIO::Init(), EffectNoiseRemoval::Init(), ExportFFmpeg::InitCodecs(), AudacityApp::InitPart2(), InitPreferences(), anonymous_namespace{NoteTrackVZoomHandle.cpp}::IsDragZooming(), WaveTrackVZoomHandle::IsDragZooming(), UpdateManager::IsTimeForUpdatesChecking(), EffectEqualization::LoadCurves(), Tags::LoadDefaults(), LoadEncoding(), LoadFFmpeg(), LoadOtherFormat(), SpectrogramSettings::Globals::LoadPrefs(), SpectrogramSettings::LoadPrefs(), ToolBar::MakeButtonBackgroundsLarge(), ToolBar::MakeButtonBackgroundsSmall(), CommandManager::Options::MakeCheckFn(), EnumSettingBase::Migrate(), SpectrogramSettings::ColorSchemeEnumSetting::Migrate(), TracksViewModeEnumSetting::Migrate(), MenuManager::ModifyToolbarMenus(), MP3Exporter::MP3Exporter(), CommandManager::NewIdentifier(), FileHistory::NotifyMenus(), NyqBench::NyqBench(), ViewActions::Handler::OnAdvancedVZoom(), TrackActions::Handler::OnAlign(), ApplyMacroDialog::OnApplyToFiles(), AdornedRulerPanel::OnAutoScroll(), PrefsDialog::OnCancel(), ScreenshotBigDialog::OnClose(), BrowserDialog::OnClose(), FrequencyPlotDialog::OnCloseButton(), ScreenshotBigDialog::OnCloseWindow(), EditActions::Handler::OnCut(), LabelEditActions::Handler::OnCutLabels(), ScreenshotBigDialog::OnDirChoose(), SplashDialog::OnDontShow(), TagsEditorDialog::OnDontShow(), AudacityApp::OnExit(), ExportMultipleDialog::OnExport(), ExportFFmpegOptions::OnExportPresets(), EffectUIHost::OnFFwd(), NyqBench::OnFind(), NyqBench::OnFindDialog(), KeyConfigPrefs::OnImportDefaults(), ExportFFmpegOptions::OnImportPresets(), ExportMP3Options::OnMono(), TrackActions::Handler::OnMoveSelectionWithTracks(), PrefsDialog::OnOK(), ExportFFmpegOptions::OnOK(), SoundActivatedRecordDialog::OnOK(), TagsEditorDialog::OnOk(), TimerRecordDialog::OnOK(), FFmpegNotFoundDialog::OnOk(), NyqBench::OnOpen(), TransportActions::Handler::OnPlayAfterSelectionEnd(), TransportActions::Handler::OnPlayAfterSelectionStart(), TransportActions::Handler::OnPlayBeforeAndAfterSelectionEnd(), TransportActions::Handler::OnPlayBeforeAndAfterSelectionStart(), TransportActions::Handler::OnPlayBeforeSelectionEnd(), TransportActions::Handler::OnPlayBeforeSelectionStart(), MeterPanel::OnPreferences(), ProjectAudioManager::OnRecord(), PluginActions::Handler::OnResetConfig(), EffectUIHost::OnRewind(), BenchmarkDialog::OnRun(), NyqBench::OnSaveAs(), TagsEditorDialog::OnSaveDefaults(), LabelTrackMenuTable::OnSetFont(), ViewActions::Handler::OnShowClipping(), ViewActions::Handler::OnShowExtraMenus(), ViewActions::Handler::OnShowNameOverlay(), TrackActions::Handler::OnSyncLock(), AdornedRulerPanel::OnSyncSelToQuickPlay(), DirectoriesPrefs::OnTempBrowse(), TransportActions::Handler::OnTimerRecord(), TransportActions::Handler::OnTogglePlayRecording(), AdornedRulerPanel::OnToggleQuickPlay(), TransportActions::Handler::OnToggleSoundActivated(), TransportActions::Handler::OnToggleSWPlaythrough(), LabelEditActions::Handler::OnToggleTypeToCreateLabel(), ToolsToolBar::OnTool(), FFmpegImportPlugin::Open(), Registry::OrderingPreferenceInitializer::operator()(), TranscriptionToolBar::PlayAtSpeed(), ProjectAudioManager::PlayPlayRegion(), ApplyMacroDialog::Populate(), MacrosWindow::Populate(), ControlToolBar::Populate(), SplashDialog::Populate(), ExportFFmpegOptions::PopulateOrExchange(), ExportMP3Options::PopulateOrExchange(), ExportMultipleDialog::PopulateOrExchange(), FFmpegNotFoundDialog::PopulateOrExchange(), anonymous_namespace{HelpMenus.cpp}::QuickFixDialog::PopulateOrExchange(), ScreenshotBigDialog::PopulateOrExchange(), TagsEditorDialog::PopulateOrExchange(), TimerRecordDialog::PopulateOrExchange(), anonymous_namespace{AudacityApp.cpp}::PopulatePreferences(), PrefsDialog::PrefsDialog(), EffectNoiseReduction::Settings::PrefsIO(), Effect::Preview(), NyquistEffect::Process(), Exporter::Process(), EffectPaulstretch::ProcessOne(), Effect::ProcessTrack(), ToolBarConfiguration::Read(), ToolManager::ReadConfig(), ThemeBase::ReadImageCache(), Importer::ReadImportItems(), anonymous_namespace{NoiseReduction.cpp}::readPrefs(), LabelDialog::ReadSize(), ChoiceSetting::ReadWithDefault(), RecordingPrefs::RecordingPrefs(), ControlToolBar::RegenerateTooltips(), LabelStruct::RegionRelation(), NoteTrackVZoomHandle::Release(), CommandManager::RemoveDuplicateShortcuts(), MacroCommands::ReportAndSkip(), LabelTrackView::ResetFont(), ResetPreferences(), MacrosWindow::SaveChanges(), SaveEncoding(), DependencyDialog::SaveFutureActionChoice(), SaveOtherFormat(), GlobalPrefsDialog::SavePreferredPage(), NyqBench::SavePrefs(), SpectrogramSettings::Globals::SavePrefs(), SpectrogramSettings::SavePrefs(), ProjectManager::SaveWindowSize(), SelectUtilities::SelectAllIfNoneAndAllowed(), Importer::SelectDefaultOpenType(), SelectionBar::SelectionBar(), SelectionBar::SelectionModeUpdated(), ToolsToolBar::SetCurrentTool(), Importer::SetDefaultOpenType(), DeviceToolBar::SetDevices(), GUIPrefs::SetLang(), Importer::SetLastOpenType(), CommandManager::SetMaxList(), ModuleSettings::SetModuleStatus(), ExportMP3::SetNumExportChannels(), TracksPrefs::SetPinnedHeadPositionPreference(), TracksPrefs::SetPinnedHeadPreference(), Journal::SetRecordEnabled(), HelpSystem::ShowHelp(), EffectNoiseRemoval::ShowInterface(), ShowWarningDialog(), ProjectSelectionManager::SSBL_SetBandwidthSelectionFormatName(), ProjectSelectionManager::SSBL_SetFrequencySelectionFormatName(), UpdateManager::Start(), WaveTrackAffordanceControls::StartEditClipName(), AudioIO::StartMonitoring(), ControlToolBar::StartScrolling(), AudioIO::StartStream(), EffectAutoDuck::Startup(), EffectChangeSpeed::Startup(), EffectClickRemoval::Startup(), EffectCompressor::Startup(), EffectDtmf::Startup(), EffectEqualization::Startup(), EffectLoudness::Startup(), EffectNoise::Startup(), EffectNormalize::Startup(), EffectReverb::Startup(), EffectScienFilter::Startup(), EffectTruncSilence::Startup(), WaveTrack::SyncLockAdjust(), TagsEditorDialog::TagsEditorDialog(), TempDirectory::TempDir(), ShuttlePrefs::TransferBool(), ExportCLOptions::TransferDataFromWindow(), ExportFFmpegAC3Options::TransferDataFromWindow(), ExportFFmpegAACOptions::TransferDataFromWindow(), ExportFFmpegAMRNBOptions::TransferDataFromWindow(), ExportFFmpegOPUSOptions::TransferDataFromWindow(), ExportFFmpegWMAOptions::TransferDataFromWindow(), ExportFLACOptions::TransferDataFromWindow(), ExportMP3Options::TransferDataFromWindow(), ExportOGGOptions::TransferDataFromWindow(), TimerRecordDialog::TransferDataFromWindow(), ExportFFmpegCustomOptions::TransferDataToWindow(), ShuttlePrefs::TransferDouble(), ShuttlePrefs::TransferInt(), ShuttlePrefs::TransferString(), anonymous_namespace{TransportMenus.cpp}::TransportMenu(), ProjectSelectionManager::TT_SetAudioTimeFormat(), EffectEqualization::UpdateDefaultCurves(), ViewInfo::UpdatePrefs(), AdornedRulerPanel::UpdatePrefs(), MenuManager::UpdatePrefs(), NavigationActions::Handler::UpdatePrefs(), SelectActions::Handler::UpdatePrefs(), SpectrogramSettings::UpdatePrefs(), ProjectSettings::UpdatePrefs(), ControlToolBar::UpdatePrefs(), DeviceToolBar::UpdatePrefs(), SelectionBar::UpdatePrefs(), MeterPanel::UpdatePrefs(), ViewInfo::UpdateSelectedPrefs(), TrackArtist::UpdateSelectedPrefs(), ProjectAudioManager::UseDuplex(), Registry::Visit(), anonymous_namespace{Registry.cpp}::VisitItems(), FileNames::WithDefaultPath(), ToolBarConfiguration::Write(), ChoiceSetting::Write(), ToolManager::WriteConfig(), Importer::WriteImportItems(), anonymous_namespace{NoiseReduction.cpp}::writePrefs(), and LabelDialog::WriteSize().

gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
Setting::Read
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:128
ugPrefs
std::unique_ptr< FileConfig > ugPrefs
Definition: Prefs.cpp:68
DefaultUpdatesCheckingFlag
BoolSetting DefaultUpdatesCheckingFlag
Definition: Prefs.cpp:65
FileConfig::DeleteAll
virtual bool DeleteAll() wxOVERRIDE
Definition: FileConfig.cpp:229