Audacity  3.0.3
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 () override
 
TranslatableString GetDescription () override
 
bool DefineParams (ShuttleParams &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 () override
 
VendorSymbol GetVendor () override
 
wxString GetVersion () override
 
virtual bool IsBatchProcessing ()
 
virtual void SetBatchProcessing (bool start)
 
virtual bool Apply (const CommandContext &WXUNUSED(context))
 
bool ShowInterface (wxWindow *parent, bool forceModal=false)
 
virtual void SetHostUI (EffectUIHostInterface *WXUNUSED(host))
 
wxDialog * CreateUI (wxWindow *parent, AudacityCommand *client)
 
virtual bool GetAutomationParameters (wxString &parms)
 
virtual bool SetAutomationParameters (const wxString &parms)
 
bool DoAudacityCommand (wxWindow *parent, const CommandContext &context, bool shouldPrompt=true)
 
int MessageBox (const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
virtual bool Init ()
 
virtual bool PromptUser (wxWindow *parent)
 
virtual bool CheckWhetherSkipAudacityCommand ()
 
virtual void End ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual bool TransferDataToWindow ()
 
virtual bool TransferDataFromWindow ()
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
TranslatableString GetName ()
 
virtual bool DefineParams (ShuttleParams &WXUNUSED(S))
 

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 }
 
using VetoDialogHook = bool(*)(wxDialog *)
 
- Static Public Member Functions inherited from AudacityCommand
static VetoDialogHook SetVetoDialogHook (VetoDialogHook hook)
 
- Protected Attributes inherited from AudacityCommand
ProgressDialogmProgress
 
wxDialog * mUIDialog
 
wxWindow * mUIParent
 
int mUIResultID
 

Detailed Description

Command for setting a preference to a given value.

Definition at line 49 of file PreferenceCommands.h.

Member Function Documentation

◆ Apply()

bool SetPreferenceCommand::Apply ( const CommandContext context)
override

Definition at line 85 of file PreferenceCommands.cpp.

86 {
87  bool bOK = gPrefs->Write(mName, mValue) && gPrefs->Flush();
88  if( bOK && mbReload ){
89  auto &project = context.project;
90  DoReloadPreferences( project );
91  }
92  return bOK;
93 }

References DoReloadPreferences(), FileConfig::Flush(), gPrefs, mbReload, mName, mValue, and CommandContext::project.

Here is the call graph for this function:

◆ DefineParams()

bool SetPreferenceCommand::DefineParams ( ShuttleParams S)
override

Definition at line 65 of file PreferenceCommands.cpp.

65  {
66  S.Define( mName, wxT("Name"), wxT("") );
67  S.Define( mValue, wxT("Value"), wxT("") );
68  S.Define( mbReload, wxT("Reload"), false );
69  return true;
70 }

References ShuttleParams::Define(), mbReload, mName, and mValue.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString SetPreferenceCommand::GetDescription ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 56 of file PreferenceCommands.h.

56 {return XO("Sets the value of a single preference.");};

References XO.

◆ GetSymbol()

ComponentInterfaceSymbol SetPreferenceCommand::GetSymbol ( )
inlineoverridevirtual

Implements AudacityCommand.

Definition at line 55 of file PreferenceCommands.h.

55 {return Symbol;};

References Symbol.

◆ ManualPage()

ManualPageID SetPreferenceCommand::ManualPage ( )
inlineoverridevirtual

Reimplemented from AudacityCommand.

Definition at line 62 of file PreferenceCommands.h.

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

◆ PopulateOrExchange()

void SetPreferenceCommand::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 72 of file PreferenceCommands.cpp.

73 {
74  S.AddSpace(0, 5);
75 
76  S.StartMultiColumn(2, wxALIGN_CENTER);
77  {
78  S.TieTextBox(XXO("Name:"),mName);
79  S.TieTextBox(XXO("Value:"),mValue);
80  S.TieCheckBox(XXO("Reload"),mbReload);
81  }
82  S.EndMultiColumn();
83 }

References ShuttleGui::AddSpace(), ShuttleGuiBase::EndMultiColumn(), mbReload, mName, mValue, ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::TieCheckBox(), ShuttleGuiBase::TieTextBox(), and XXO.

Here is the call graph for this function:

Member Data Documentation

◆ bHasReload

bool SetPreferenceCommand::bHasReload

Definition at line 67 of file PreferenceCommands.h.

◆ mbReload

bool SetPreferenceCommand::mbReload

Definition at line 66 of file PreferenceCommands.h.

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

◆ mName

wxString SetPreferenceCommand::mName

Definition at line 64 of file PreferenceCommands.h.

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

◆ mValue

wxString SetPreferenceCommand::mValue

Definition at line 65 of file PreferenceCommands.h.

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

◆ Symbol

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

Definition at line 52 of file PreferenceCommands.h.

Referenced by GetSymbol().


The documentation for this class was generated from the following files:
DoReloadPreferences
void DoReloadPreferences(AudacityProject &project)
Definition: PrefsDialog.cpp:846
SetPreferenceCommand::mValue
wxString mValue
Definition: PreferenceCommands.h:65
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
ShuttleGuiBase::TieCheckBox
wxCheckBox * TieCheckBox(const TranslatableString &Prompt, bool &Var)
Definition: ShuttleGui.cpp:1629
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2459
XO
#define XO(s)
Definition: Internat.h:31
ShuttleGuiBase::EndMultiColumn
void EndMultiColumn()
Definition: ShuttleGui.cpp:1238
ShuttleGuiBase::TieTextBox
wxTextCtrl * TieTextBox(const TranslatableString &Caption, wxString &Value, const int nChars=0)
Definition: ShuttleGui.cpp:1652
XXO
#define XXO(s)
Definition: Internat.h:44
SetPreferenceCommand::mbReload
bool mbReload
Definition: PreferenceCommands.h:66
ShuttleGuiBase::StartMultiColumn
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
Definition: ShuttleGui.cpp:1229
SetPreferenceCommand::Symbol
static const ComponentInterfaceSymbol Symbol
Definition: PreferenceCommands.h:52
SetPreferenceCommand::mName
wxString mName
Definition: PreferenceCommands.h:64
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
ShuttleParams::Define
virtual void Define(bool &var, const wxChar *key, const bool vdefault, const bool vmin=false, const bool vmax=false, const bool vscl=false)
Definition: Shuttle.cpp:332
CommandContext::project
AudacityProject & project
Definition: CommandContext.h:64