Audacity 3.2.0
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
SetPreferenceCommand Class Referencefinal

Command for setting a preference to a given value. More...

#include <PreferenceCommands.h>

Inheritance diagram for SetPreferenceCommand:
[legend]
Collaboration diagram for SetPreferenceCommand:
[legend]

Public Member Functions

ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
template<bool Const>
bool VisitSettings (SettingsVisitorBase< Const > &S)
 
bool VisitSettings (SettingsVisitor &S) override
 
bool VisitSettings (ConstSettingsVisitor &S) override
 
void PopulateOrExchange (ShuttleGui &S) override
 
bool Apply (const CommandContext &context) override
 
ManualPageID ManualPage () override
 
- Public Member Functions inherited from AudacityCommand
 AudacityCommand ()
 
virtual ~AudacityCommand ()
 
PluginPath GetPath () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
ComponentInterfaceSymbol GetSymbol () const override=0
 
virtual TranslatableString GetDescription () const override
 
virtual ManualPageID ManualPage ()
 
virtual bool IsBatchProcessing () const
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
bool SaveSettingsAsString (wxString &parms)
 
bool LoadSettingsFromString (const wxString &parms)
 
bool DoAudacityCommand (const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
virtual bool Init ()
 
virtual bool PromptUser (AudacityProject &)
 
virtual bool CheckWhetherSkipAudacityCommand ()
 
virtual void End ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
virtual bool VisitSettings (SettingsVisitor &)
 
virtual bool VisitSettings (ConstSettingsVisitor &)
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 

Public Attributes

wxString mName
 
wxString mValue
 
bool mbReload
 
bool bHasReload
 

Static Public Attributes

static const ComponentInterfaceSymbol Symbol { XO("Set Preference") }
 

Additional Inherited Members

- Public Types inherited from AudacityCommand
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 

Detailed Description

Command for setting a preference to a given value.

Definition at line 51 of file PreferenceCommands.h.

Member Function Documentation

◆ Apply()

bool SetPreferenceCommand::Apply ( const CommandContext context)
override

Definition at line 102 of file PreferenceCommands.cpp.

103{
104 bool bOK = gPrefs->Write(mName, mValue) && gPrefs->Flush();
105 if( bOK && mbReload ){
106 auto &project = context.project;
108 }
109 return bOK;
110}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
void DoReloadPreferences(AudacityProject &project)
const auto project
AudacityProject & project
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0

References DoReloadPreferences(), audacity::BasicSettings::Flush(), gPrefs, mbReload, mName, mValue, CommandContext::project, project, and audacity::BasicSettings::Write().

Here is the call graph for this function:

◆ GetDescription()

TranslatableString SetPreferenceCommand::GetDescription ( ) const
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 58 of file PreferenceCommands.h.

58{return XO("Sets the value of a single preference.");};
XO("Cut/Copy/Paste")

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol SetPreferenceCommand::GetSymbol ( ) const
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 57 of file PreferenceCommands.h.

57{return Symbol;};
static const ComponentInterfaceSymbol Symbol

References Symbol.

◆ ManualPage()

ManualPageID SetPreferenceCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 66 of file PreferenceCommands.h.

66{return L"Extra_Menu:_Scriptables_I#set_preference";}

◆ PopulateOrExchange()

void SetPreferenceCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 89 of file PreferenceCommands.cpp.

90{
91 S.AddSpace(0, 5);
92
93 S.StartMultiColumn(2, wxALIGN_CENTER);
94 {
95 S.TieTextBox(XXO("Name:"),mName);
96 S.TieTextBox(XXO("Value:"),mValue);
97 S.TieCheckBox(XXO("Reload"),mbReload);
98 }
99 S.EndMultiColumn();
100}
XXO("&Cut/Copy/Paste Toolbar")
#define S(N)
Definition: ToChars.cpp:64

References mbReload, mName, mValue, S, and XXO().

Here is the call graph for this function:

◆ VisitSettings() [1/3]

bool SetPreferenceCommand::VisitSettings ( ConstSettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 86 of file PreferenceCommands.cpp.

87 { return VisitSettings<true>(S); }

References S.

◆ VisitSettings() [2/3]

bool SetPreferenceCommand::VisitSettings ( SettingsVisitor )
overridevirtual

Visit settings, if defined. false means no defined settings. Default implementation returns false

Reimplemented from AudacityCommand.

Definition at line 83 of file PreferenceCommands.cpp.

84 { return VisitSettings<false>(S); }

References S.

◆ VisitSettings() [3/3]

template<bool Const>
bool SetPreferenceCommand::VisitSettings ( SettingsVisitorBase< Const > &  S)

Definition at line 76 of file PreferenceCommands.cpp.

76 {
77 S.Define( mName, wxT("Name"), wxString{} );
78 S.Define( mValue, wxT("Value"), wxString{} );
79 S.Define( mbReload, wxT("Reload"), false );
80 return true;
81}
wxT("CloseDown"))

References mbReload, mName, mValue, S, and wxT().

Here is the call graph for this function:

Member Data Documentation

◆ bHasReload

bool SetPreferenceCommand::bHasReload

Definition at line 71 of file PreferenceCommands.h.

◆ mbReload

bool SetPreferenceCommand::mbReload

Definition at line 70 of file PreferenceCommands.h.

Referenced by Apply(), PopulateOrExchange(), and VisitSettings().

◆ mName

wxString SetPreferenceCommand::mName

Definition at line 68 of file PreferenceCommands.h.

Referenced by Apply(), PopulateOrExchange(), and VisitSettings().

◆ mValue

wxString SetPreferenceCommand::mValue

Definition at line 69 of file PreferenceCommands.h.

Referenced by Apply(), PopulateOrExchange(), and VisitSettings().

◆ Symbol

const ComponentInterfaceSymbol SetPreferenceCommand::Symbol { XO("Set Preference") }
static

Definition at line 54 of file PreferenceCommands.h.

Referenced by GetSymbol().


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