Audacity 3.2.0
Classes | Public Types | Public Member Functions | Private Member Functions | List of all members
LibraryPrefs Class Referencefinal

A PrefsPanel used to select manage external libraries like the MP3 and FFmpeg encoding libraries. More...

#include <LibraryPrefs.h>

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

Classes

struct  PopulatorItem
 
struct  RegisteredControls
 To be statically constructed, it registers additions to the Library preference page. More...
 

Public Types

using Populator = std::function< void(ShuttleGui &) >
 Type of function that adds to the Library preference page. More...
 
- Public Types inherited from PrefsPanel
using Factories = std::vector< PrefsPanel::PrefsNode >
 
using Factory = std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) >
 

Public Member Functions

 LibraryPrefs (wxWindow *parent, wxWindowID winid)
 
 ~LibraryPrefs ()
 
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 Populate ()
 Creates the dialog and its contents. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from PrefsPanel
static FactoriesDefaultFactories ()
 

Detailed Description

A PrefsPanel used to select manage external libraries like the MP3 and FFmpeg encoding libraries.

Definition at line 27 of file LibraryPrefs.h.

Member Typedef Documentation

◆ Populator

using LibraryPrefs::Populator = std::function< void(ShuttleGui&) >

Type of function that adds to the Library preference page.

Definition at line 33 of file LibraryPrefs.h.

Constructor & Destructor Documentation

◆ LibraryPrefs()

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

Definition at line 56 of file LibraryPrefs.cpp.

58: PrefsPanel(parent, winid, XO("Libraries"))
59{
60 Populate();
61}
XO("Cut/Copy/Paste")
void Populate()
Creates the dialog and its contents.
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:94

References Populate().

Here is the call graph for this function:

◆ ~LibraryPrefs()

LibraryPrefs::~LibraryPrefs ( )

Definition at line 63 of file LibraryPrefs.cpp.

64{
65}

Member Function Documentation

◆ Commit()

bool LibraryPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 130 of file LibraryPrefs.cpp.

131{
134
135 return true;
136}
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
#define S(N)
Definition: ToChars.cpp:64
void PopulateOrExchange(ShuttleGui &S) override
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:625

References eIsSavingToPrefs, PopulateOrExchange(), and S.

Here is the call graph for this function:

◆ GetDescription()

TranslatableString LibraryPrefs::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 72 of file LibraryPrefs.cpp.

73{
74 return XO("Preferences for Library");
75}

References XO().

Here is the call graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol LibraryPrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 67 of file LibraryPrefs.cpp.

68{
70}
#define LIBRARY_PREFS_PLUGIN_SYMBOL
Definition: LibraryPrefs.h:25

References LIBRARY_PREFS_PLUGIN_SYMBOL.

◆ HelpPageName()

ManualPageID LibraryPrefs::HelpPageName ( )
overridevirtual

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

Default returns empty string.

Reimplemented from PrefsPanel.

Definition at line 77 of file LibraryPrefs.cpp.

78{
79 return "Libraries_Preferences";
80}

◆ Populate()

void LibraryPrefs::Populate ( )
private

Creates the dialog and its contents.

Definition at line 83 of file LibraryPrefs.cpp.

84{
85 //------------------------- Main section --------------------
86 // Now construct the GUI itself.
87 // Use 'eIsCreatingFromPrefs' so that the GUI is
88 // initialised with values from gPrefs.
91 // ----------------------- End of main section --------------
92}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46

References eIsCreatingFromPrefs, PopulateOrExchange(), and S.

Referenced by LibraryPrefs().

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

◆ PopulateOrExchange()

void LibraryPrefs::PopulateOrExchange ( ShuttleGui S)
override

This PopulateOrExchange function is a good example of mixing the fully automatic style of reading/writing from GUI to prefs with the partial form.

You'll notice that some of the Tie functions have Prefs identifiers in them and others don't.

Definition at line 99 of file LibraryPrefs.cpp.

100{
101 using namespace Registry;
103 PathStart,
104 { {wxT(""), wxT("MP3,FFmpeg") } },
105 };
106
107 S.SetBorder(2);
108 S.StartScroller();
109
110 struct MyVisitor final : Visitor {
111 MyVisitor( ShuttleGui &S ) : S{ S }
112 {
113 // visit the registry to collect the plug-ins properly
114 // sorted
116 Registry::Visit( *this, &top, &PopulatorItem::Registry() );
117 }
118
119 void Visit( Registry::SingleItem &item, const Path &path ) override
120 {
121 static_cast<PopulatorItem&>(item).mPopulator(S);
122 }
123
124 ShuttleGui &S;
125 } visitor{ S };
126
127 S.EndScroller();
128}
wxT("CloseDown"))
static const auto PathStart
auto Visit(Visitor &&vis, Variant &&var)
Mimic some of std::visit, for the case of one visitor only.
Definition: MemoryX.h:628
Definition: Menus.h:35
void Visit(Visitor &visitor, BaseItem *pTopItem, const GroupItem *pRegistry)
Definition: Registry.cpp:713
filesystem::path Path
static Registry::GroupItem & Registry()

References PathStart, LibraryPrefs::PopulatorItem::Registry(), S, Visit(), Registry::Visit(), and wxT().

Referenced by Commit(), and Populate().

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

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