Audacity 3.2.0
Classes | Macros | Typedefs | Functions | Variables
Prefs.h File Reference
#include <functional>
#include <set>
#include <vector>
#include "ComponentInterfaceSymbol.h"
#include "wxArrayStringEx.h"
#include <wx/filename.h>
#include <wx/textfile.h>
#include "GlobalVariable.h"
#include "BasicSettings.h"
Include dependency graph for Prefs.h:

Go to the source code of this file.

Classes

struct  ByColumns_t
 
struct  SettingPath
 
class  SettingBase
 Base class for settings objects. It holds a configuration key path. More...
 
class  TransactionalSettingBase
 
class  SettingScope
 Makes temporary changes to preferences, then rolls them back at destruction. More...
 
class  SettingTransaction
 Extend SettingScope with Commit() which flushes updates in a batch. More...
 
class  CachingSettingBase< T >
 Class template adds an in-memory cache of a value to TransactionalSettingBase and support for SettingTransaction. More...
 
class  Setting< T >
 
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< audacity::BasicSettings > uPrefs)
 
PREFERENCES_API void GetPreferencesVersion (int &vMajor, int &vMinor, int &vMicro)
 
PREFERENCES_API void SetPreferencesVersion (int vMajor, int vMinor, int vMicor)
 
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 audacity::BasicSettingsgPrefs
 
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 39 of file Prefs.h.

Typedef Documentation

◆ EnumValueSymbol

Definition at line 373 of file Prefs.h.

Function Documentation

◆ FinishPreferences()

PREFERENCES_API void FinishPreferences ( )

Definition at line 243 of file Prefs.cpp.

244{
245 if (gPrefs) {
246 ugPrefs.reset();
247 gPrefs = nullptr;
248 }
249}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
std::unique_ptr< audacity::BasicSettings > ugPrefs
Definition: Prefs.cpp:66

References gPrefs, and ugPrefs.

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

Here is the caller graph for this function:

◆ GetPreferencesVersion()

PREFERENCES_API void GetPreferencesVersion ( int &  vMajor,
int &  vMinor,
int &  vMicro 
)

Definition at line 210 of file Prefs.cpp.

211{
212 vMajor = gVersionMajorKeyInit;
213 vMinor = gVersionMinorKeyInit;
214 vMicro = gVersionMicroKeyInit;
215}
int gVersionMinorKeyInit
Definition: Prefs.cpp:72
int gVersionMicroKeyInit
Definition: Prefs.cpp:73
int gVersionMajorKeyInit
Definition: Prefs.cpp:71

References gVersionMajorKeyInit, gVersionMicroKeyInit, and gVersionMinorKeyInit.

Referenced by AudacityApp::InitPart2(), and ToolManager::ReadConfig().

Here is the caller graph for this function:

◆ InitPreferences()

PREFERENCES_API void InitPreferences ( std::unique_ptr< audacity::BasicSettings uPrefs)

Definition at line 202 of file Prefs.cpp.

203{
204 gPrefs = uPrefs.get();
205 ugPrefs = std::move(uPrefs);
206 //wxConfigBase::Set(gPrefs);
208}
static void Broadcast(int id=0)
Call this static function to notify all PrefsListener objects.
Definition: Prefs.cpp:99

References PrefsListener::Broadcast(), gPrefs, and ugPrefs.

Referenced by AudacityApp::OnInit(), and PluginHost::PluginHost().

Here is the call graph for this function:
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 224 of file Prefs.cpp.

225{
226 // Future: make this a static registry table, so the settings objects
227 // don't need to be defined in this source code file to avoid dependency
228 // cycles
229 std::pair<BoolSetting &, bool> stickyBoolSettings[] {
231 // ... others?
232 };
233 for (auto &pair : stickyBoolSettings)
234 pair.second = pair.first.Read();
235
236 bool savedValue = DefaultUpdatesCheckingFlag.Read();
237 gPrefs->Clear();
238
239 for (auto &pair : stickyBoolSettings)
240 pair.first.Write(pair.second);
241}
BoolSetting DefaultUpdatesCheckingFlag
Definition: Prefs.cpp:63
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:205
virtual void Clear()=0
Remove all groups and keys.

References audacity::BasicSettings::Clear(), DefaultUpdatesCheckingFlag, gPrefs, and Setting< T >::Read().

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

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

◆ SetPreferencesVersion()

PREFERENCES_API void SetPreferencesVersion ( int  vMajor,
int  vMinor,
int  vMicor 
)

Definition at line 217 of file Prefs.cpp.

218{
219 gVersionMajorKeyInit = vMajor;
220 gVersionMinorKeyInit = vMinor;
221 gVersionMicroKeyInit = vMicro;
222}

References gVersionMajorKeyInit, gVersionMicroKeyInit, and gVersionMinorKeyInit.

Referenced by anonymous_namespace{AudacityApp.cpp}::PopulatePreferences().

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 484 of file Prefs.cpp.

485{
486 return wxT("/Warnings/") + internalDialogName;
487}
wxT("CloseDown"))

References wxT().

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

Here is the call graph for this function:
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 69 of file Prefs.cpp.

◆ gPrefs

PREFERENCES_API audacity::BasicSettings* gPrefs
extern

Definition at line 68 of file Prefs.cpp.

Referenced by AdornedRulerPanel::AdornedRulerPanel(), PluginManager::Iterator::Advance(), EffectTruncSilence::Analyze(), ExportCommand::Apply(), GetPreferenceCommand::Apply(), SetPreferenceCommand::Apply(), MacroCommands::ApplyMacro(), ApplyMacroDialog::ApplyMacroToProject(), AudacityApp::AssociateFileTypes(), ProgressDialog::Beep(), DeviceToolBar::ChangeHost(), AudioSetupToolBar::ChangeHost(), ExportMP3::CheckFileName(), cloud::audiocom::UserService::ClearUserData(), SettingTransaction::Commit(), DevicePrefs::Commit(), GUIPrefs::Commit(), KeyConfigPrefs::Commit(), RecordingPrefs::Commit(), TracksPrefs::Commit(), LabelTrackView::ComputeLayout(), ControlToolBar::ControlToolBar(), DeduceSnapTo(), anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), cloud::audiocom::OAuthService::DoAuthorise(), LabelTrackView::DoCaptureKey(), LabelTrackView::DoChar(), anonymous_namespace{FileMenus.cpp}::DoExport(), ProjectAudioManager::DoRecord(), SpectrumView::DoSetMinimized(), WaveformView::DoSetMinimized(), ToolsToolBar::DoToolChanged(), cloud::audiocom::UserService::DownloadAvatar(), EffectNoiseRemoval::EffectNoiseRemoval(), EffectPreview(), ExportFFmpegOptions::ExportFFmpegOptions(), ExportOptionsHandler::ExportOptionsHandler(), anonymous_namespace{ExtraMenus.cpp}::ExtraMenu(), AudioSetupToolBar::FillHostDevices(), DeviceToolBar::FillHostDevices(), MP3Exporter::FindLibrary(), FinishPreferences(), anonymous_namespace{Registry.cpp}::ItemOrdering::Get(), ModulePrefs::GetAllModuleStatuses(), SettingBase::GetConfig(), ExportPCM::GetFormatInfo(), ModuleSettings::GetModuleStatus(), TracksPrefs::GetPinnedHeadPositionPreference(), TracksPrefs::GetPinnedHeadPreference(), GlobalPrefsDialog::GetPreferredPage(), PlaybackPrefs::GetUnpinnedScrubbingPreference(), FileHistory::Global(), Importer::Import(), AudioIO::Init(), EffectNoiseRemoval::Init(), MP3ExportProcessor::Initialize(), AudacityApp::InitPart2(), InitPreferences(), UpdateManager::IsTimeForUpdatesChecking(), EQCurveReader::LoadCurves(), Tags::LoadDefaults(), LoadFFmpeg(), ToolBar::MakeButtonBackgroundsLarge(), ToolBar::MakeButtonBackgroundsSmall(), MenuRegistry::Options::MakeCheckFn(), EnumSettingBase::Migrate(), SpectrogramSettings::ColorSchemeEnumSetting::Migrate(), TracksViewModeEnumSetting::Migrate(), MP3Exporter::MP3Exporter(), CommandManager::Populator::NewIdentifier(), FileHistory::NotifyMenus(), NyqBench::NyqBench(), anonymous_namespace{TrackMenus.cpp}::OnAlign(), ApplyMacroDialog::OnApplyToFiles(), AdornedRulerPanel::OnAutoScroll(), PrefsDialog::OnCancel(), BrowserDialog::OnClose(), FrequencyPlotDialog::OnCloseButton(), AudioPasteDialog::OnContinue(), anonymous_namespace{EditMenus.cpp}::OnCut(), anonymous_namespace{LabelMenus.cpp}::OnCutLabels(), SplashDialog::OnDontShow(), AudacityApp::OnExit(), ExportFFmpegOptions::OnExportPresets(), NyqBench::OnFind(), NyqBench::OnFindDialog(), KeyConfigPrefs::OnImportDefaults(), ExportFFmpegOptions::OnImportPresets(), anonymous_namespace{TrackMenus.cpp}::OnMoveSelectionWithTracks(), PrefsDialog::OnOK(), ExportFFmpegOptions::OnOK(), SoundActivatedRecordDialog::OnOK(), TagsEditorDialog::OnOk(), TimerRecordDialog::OnOK(), FFmpegNotFoundDialog::OnOk(), anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::OnOpen(), NyqBench::OnOpen(), anonymous_namespace{EditMenus.cpp}::OnPaste(), anonymous_namespace{TransportMenus.cpp}::OnPlayAfterSelectionEnd(), anonymous_namespace{TransportMenus.cpp}::OnPlayAfterSelectionStart(), anonymous_namespace{TransportMenus.cpp}::OnPlayBeforeAndAfterSelectionEnd(), anonymous_namespace{TransportMenus.cpp}::OnPlayBeforeAndAfterSelectionStart(), anonymous_namespace{TransportMenus.cpp}::OnPlayBeforeSelectionEnd(), anonymous_namespace{TransportMenus.cpp}::OnPlayBeforeSelectionStart(), MeterPanel::OnPreferences(), ProjectAudioManager::OnRecord(), anonymous_namespace{PluginMenus.cpp}::OnResetConfig(), NyqBench::OnSaveAs(), TagsEditorDialog::OnSaveDefaults(), LabelTrackMenuTable::OnSetFont(), anonymous_namespace{ViewMenus.cpp}::OnShowClipping(), anonymous_namespace{ViewMenus.cpp}::OnShowExtraMenus(), anonymous_namespace{ViewMenus.cpp}::OnShowNameOverlay(), anonymous_namespace{TrackMenus.cpp}::OnSyncLock(), AdornedRulerPanel::OnSyncSelToQuickPlay(), DirectoriesPrefs::OnTempBrowse(), anonymous_namespace{TimerRecordDialog.cpp}::OnTimerRecord(), anonymous_namespace{TransportMenus.cpp}::OnTogglePlayRecording(), anonymous_namespace{TransportMenus.cpp}::OnToggleSoundActivated(), anonymous_namespace{TransportMenus.cpp}::OnToggleSWPlaythrough(), anonymous_namespace{LabelMenus.cpp}::OnToggleTypeToCreateLabel(), FFmpegImportPlugin::Open(), Registry::OrderingPreferenceInitializer::operator()(), TranscriptionToolBar::PlayAtSpeed(), ProjectAudioManager::PlayPlayRegion(), ApplyMacroDialog::Populate(), MacrosWindow::Populate(), ControlToolBar::Populate(), SplashDialog::Populate(), ExportFFmpegOptions::PopulateOrExchange(), anonymous_namespace{HelpMenus.cpp}::QuickFixDialog::PopulateOrExchange(), TimerRecordDialog::PopulateOrExchange(), anonymous_namespace{AudacityApp.cpp}::PopulatePreferences(), ExportOptionsCLEditor::PopulateUI(), PrefsDialog::PrefsDialog(), EffectNoiseReduction::Settings::PrefsIO(), NyquistEffect::Process(), EffectPaulstretch::ProcessOne(), PerTrackEffect::ProcessPass(), ProjectRate::ProjectRate(), ProjectSettings::ProjectSettings(), ToolBarConfiguration::Read(), ToolManager::ReadConfig(), Importer::ReadImportItems(), anonymous_namespace{NoiseReduction.cpp}::readPrefs(), LabelDialog::ReadSize(), ReadSnapMode(), ReadSnapTo(), ChoiceSetting::ReadWithDefault(), RecordingPrefs::RecordingPrefs(), ControlToolBar::RegenerateTooltips(), LabelStruct::RegionRelation(), MenuCreator::RemoveDuplicateShortcuts(), MacroCommands::ReportAndSkip(), CommandManager::ReportDuplicateShortcuts(), LabelTrackView::ResetFont(), ResetPreferences(), MacrosWindow::SaveChanges(), DependencyDialog::SaveFutureActionChoice(), GlobalPrefsDialog::SavePreferredPage(), NyqBench::SavePrefs(), SelectUtilities::SelectAllIfNoneAndAllowed(), Importer::SelectDefaultOpenType(), ProjectSelectionManager::SetAudioTimeFormat(), ProjectSelectionManager::SetBandwidthSelectionFormatName(), Importer::SetDefaultOpenType(), AudioSetupToolBar::SetDevices(), DeviceToolBar::SetDevices(), ProjectSelectionManager::SetFrequencySelectionFormatName(), GUISettings::SetLang(), Importer::SetLastOpenType(), ProjectTimeSignature::SetLowerTimeSignature(), CommandManager::Populator::SetMaxList(), ModuleSettings::SetModuleStatus(), TracksPrefs::SetPinnedHeadPositionPreference(), TracksPrefs::SetPinnedHeadPreference(), Journal::SetRecordEnabled(), ProjectSelectionManager::SetSelectionFormat(), ProjectSnap::SetSnapMode(), ProjectSnap::SetSnapTo(), ProjectTimeSignature::SetTempo(), ProjectTimeSignature::SetUpperTimeSignature(), anonymous_namespace{ExportPCM.cpp}::ExportOptionsSFEditor::SetValue(), HelpSystem::ShowHelp(), EffectNoiseRemoval::ShowHostInterface(), ShowWarningDialog(), UpdateManager::Start(), WaveTrackAffordanceControls::StartEditClipName(), AudioIO::StartMonitoring(), ControlToolBar::StartScrolling(), AudioIO::StartStream(), TagsEditorDialog::TagsEditorDialog(), TempDirectory::TempDir(), ToolsToolBar::ToolsToolBar(), ShuttlePrefs::TransferBool(), ExportOptionsHandler::TransferDataFromEditor(), ExportOptionsCLEditor::TransferDataFromWindow(), anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::TransferDataFromWindow(), TimerRecordDialog::TransferDataFromWindow(), ShuttlePrefs::TransferDouble(), ShuttlePrefs::TransferInt(), ShuttlePrefs::TransferString(), anonymous_namespace{TransportMenus.cpp}::TransportMenu(), cloud::audiocom::OAuthService::UnlinkAccount(), anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::UpdateCodecAndFormat(), EQCurveReader::UpdateDefaultCurves(), CommandManager::UpdatePrefs(), ViewInfo::UpdatePrefs(), AdornedRulerPanel::UpdatePrefs(), NavigationActions::Handler::UpdatePrefs(), SelectActions::Handler::UpdatePrefs(), ProjectSettings::UpdatePrefs(), ControlToolBar::UpdatePrefs(), SelectionBar::UpdatePrefs(), MeterPanel::UpdatePrefs(), ViewInfo::UpdateSelectedPrefs(), TrackArtist::UpdateSelectedPrefs(), anonymous_namespace{SelectionBar.cpp}::UpdateSelectionMode(), cloud::audiocom::UserService::UpdateUserData(), ProjectAudioManager::UseDuplex(), Registry::detail::Visit(), anonymous_namespace{Registry.cpp}::VisitItems(), FileNames::WithDefaultPath(), ToolBarConfiguration::Write(), ChoiceSetting::Write(), ToolManager::WriteConfig(), Importer::WriteImportItems(), anonymous_namespace{NoiseReduction.cpp}::writePrefs(), and LabelDialog::WriteSize().