Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ModulePrefs Class Referencefinal

A PrefsPanel to enable/disable certain modules. 'Modules' are dynamically linked libraries that modify Audacity. They are plug-ins with names like mod-script-pipe that add NEW features. More...

#include <ModulePrefs.h>

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

Public Member Functions

 ModulePrefs (wxWindow *parent, wxWindowID winid)
 
 ~ModulePrefs ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
bool Commit () override
 
ManualPageID HelpPageName () override
 If not empty string, the Help button is added below the panel. More...
 
void PopulateOrExchange (ShuttleGui &S) override
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const TranslatableString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool Commit ()=0
 
virtual PluginPath GetPath () const override
 
virtual VendorSymbol GetVendor () const override
 
virtual wxString GetVersion () const override
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual ManualPageID HelpPageName ()
 If not empty string, the Help button is added below the panel. More...
 
virtual void Cancel ()
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void GetAllModuleStatuses ()
 
void Populate ()
 

Private Attributes

wxArrayString mModules
 
std::vector< int > mStatuses
 
FilePaths mPaths
 

Additional Inherited Members

- Public Types inherited from PrefsPanel
using Factories = std::vector< PrefsPanel::PrefsNode >
 
using Factory = std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) >
 
- Static Public Member Functions inherited from PrefsPanel
static FactoriesDefaultFactories ()
 

Detailed Description

A PrefsPanel to enable/disable certain modules. 'Modules' are dynamically linked libraries that modify Audacity. They are plug-ins with names like mod-script-pipe that add NEW features.

Definition at line 26 of file ModulePrefs.h.

Constructor & Destructor Documentation

◆ ModulePrefs()

ModulePrefs::ModulePrefs ( wxWindow *  parent,
wxWindowID  winid 
)

Definition at line 33 of file ModulePrefs.cpp.

35: PrefsPanel(parent, winid, XO("Modules"))
36{
37 Populate();
38}
XO("Cut/Copy/Paste")
void Populate()
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:94

References Populate().

Here is the call graph for this function:

◆ ~ModulePrefs()

ModulePrefs::~ModulePrefs ( )

Definition at line 40 of file ModulePrefs.cpp.

41{
42}

Member Function Documentation

◆ Commit()

bool ModulePrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 157 of file ModulePrefs.cpp.

158{
161 int i;
162 for(i=0;i<(int)mPaths.size();i++)
164 return true;
165}
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
#define S(N)
Definition: ToChars.cpp:64
void PopulateOrExchange(ShuttleGui &S) override
FilePaths mPaths
Definition: ModulePrefs.h:43
std::vector< int > mStatuses
Definition: ModulePrefs.h:42
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:625
MODULE_MANAGER_API void SetModuleStatus(const FilePath &fname, int iStatus)

References eIsSavingToPrefs, mPaths, mStatuses, PopulateOrExchange(), S, and ModuleSettings::SetModuleStatus().

Here is the call graph for this function:

◆ GetAllModuleStatuses()

void ModulePrefs::GetAllModuleStatuses ( )
private

Definition at line 59 of file ModulePrefs.cpp.

59 {
60 wxString str;
61 long dummy;
62
63 // Modules could for example be:
64 // mod-script-pipe
65 // mod-nyq-bench
66 // mod-menu-munger
67 // mod-theming
68
69 // TODO: On an Audacity upgrade we should (?) actually untick modules.
70 // The old modules might be still around, and we do not want to use them.
71 mModules.clear();
72 mStatuses.clear();
73 mPaths.clear();
74
75
76 // Iterate through all Modules listed in prefs.
77 // Get their names and values.
78 gPrefs->SetPath( wxT("Module/") );
79 bool bCont = gPrefs->GetFirstEntry(str, dummy);
80 while ( bCont ) {
81 int iStatus;
82 gPrefs->Read( str, &iStatus, kModuleDisabled );
83 wxString fname;
84 gPrefs->Read( wxString( wxT("/ModulePath/") ) + str, &fname, wxEmptyString );
85 if( !fname.empty() && wxFileExists( fname ) ){
86 if( iStatus > kModuleNew ){
87 iStatus = kModuleNew;
88 gPrefs->Write( str, iStatus );
89 }
90 //wxLogDebug( wxT("Entry: %s Value: %i"), str, iStatus );
91 mModules.push_back( str );
92 mStatuses.push_back( iStatus );
93 mPaths.push_back( fname );
94 }
95 bCont = gPrefs->GetNextEntry(str, dummy);
96 }
97 gPrefs->SetPath( wxT("") );
98}
wxT("CloseDown"))
#define str(a)
@ kModuleDisabled
@ kModuleNew
FileConfig * gPrefs
Definition: Prefs.cpp:70
virtual bool GetNextEntry(wxString &str, long &lIndex) const wxOVERRIDE
Definition: FileConfig.cpp:118
virtual void SetPath(const wxString &strPath) wxOVERRIDE
Definition: FileConfig.cpp:93
virtual bool GetFirstEntry(wxString &str, long &lIndex) const wxOVERRIDE
Definition: FileConfig.cpp:113
wxArrayString mModules
Definition: ModulePrefs.h:41

References FileConfig::GetFirstEntry(), FileConfig::GetNextEntry(), gPrefs, kModuleDisabled, kModuleNew, mModules, mPaths, mStatuses, FileConfig::SetPath(), str, and wxT().

Referenced by Populate().

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

◆ GetDescription()

TranslatableString ModulePrefs::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 49 of file ModulePrefs.cpp.

50{
51 return XO("Preferences for Module");
52}

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol ModulePrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 44 of file ModulePrefs.cpp.

45{
47}
#define MODULE_PREFS_PLUGIN_SYMBOL
Definition: ModulePrefs.h:24

References MODULE_PREFS_PLUGIN_SYMBOL.

◆ HelpPageName()

ManualPageID ModulePrefs::HelpPageName ( )
overridevirtual

If not empty string, the Help button is added below the panel.

Default returns empty string.

Reimplemented from PrefsPanel.

Definition at line 54 of file ModulePrefs.cpp.

55{
56 return "Modules_Preferences";
57}

◆ Populate()

void ModulePrefs::Populate ( )
private

Definition at line 100 of file ModulePrefs.cpp.

101{
103 //------------------------- Main section --------------------
104 // Now construct the GUI itself.
105 // Use 'eIsCreatingFromPrefs' so that the GUI is
106 // initialised with values from gPrefs.
109 // ----------------------- End of main section --------------
110}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
void GetAllModuleStatuses()
Definition: ModulePrefs.cpp:59

References eIsCreatingFromPrefs, GetAllModuleStatuses(), PopulateOrExchange(), and S.

Referenced by ModulePrefs().

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

◆ PopulateOrExchange()

void ModulePrefs::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 112 of file ModulePrefs.cpp.

113{
114 S.SetBorder(2);
115 S.StartScroller();
116
117 S.StartStatic( {} );
118 {
119 S.AddFixedText(XO(
120"These are experimental modules. Enable them only if you've read the Audacity Manual\nand know what you are doing.") );
121 S.AddFixedText(XO(
122/* i18n-hint preserve the leading spaces */
123" 'Ask' means Audacity will ask if you want to load the module each time it starts.") );
124 S.AddFixedText(XO(
125/* i18n-hint preserve the leading spaces */
126" 'Failed' means Audacity thinks the module is broken and won't run it.") );
127 S.AddFixedText(XO(
128/* i18n-hint preserve the leading spaces */
129" 'New' means no choice has been made yet.") );
130 S.AddFixedText(XO(
131"Changes to these settings only take effect when Audacity starts up."));
132 {
133 S.StartMultiColumn( 2 );
134 int i;
135 for(i=0;i<(int)mModules.size();i++)
136 S.TieChoice( Verbatim( mModules[i] ),
137 mStatuses[i],
138 {
139 XO("Disabled" ) ,
140 XO("Enabled" ) ,
141 XO("Ask" ) ,
142 XO("Failed" ) ,
143 XO("New" ) ,
144 }
145 );
146 S.EndMultiColumn();
147 }
148 if( mModules.size() < 1 )
149 {
150 S.AddFixedText( XO("No modules were found") );
151 }
152 }
153 S.EndStatic();
154 S.EndScroller();
155}
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.

References mModules, mStatuses, S, Verbatim(), and XO().

Referenced by Commit(), and Populate().

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

Member Data Documentation

◆ mModules

wxArrayString ModulePrefs::mModules
private

Definition at line 41 of file ModulePrefs.h.

Referenced by GetAllModuleStatuses(), and PopulateOrExchange().

◆ mPaths

FilePaths ModulePrefs::mPaths
private

Definition at line 43 of file ModulePrefs.h.

Referenced by Commit(), and GetAllModuleStatuses().

◆ mStatuses

std::vector<int> ModulePrefs::mStatuses
private

Definition at line 42 of file ModulePrefs.h.

Referenced by Commit(), GetAllModuleStatuses(), and PopulateOrExchange().


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