Audacity  2.2.2
Public Member Functions | Private Member Functions | Private Attributes | 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:
PrefsPanel wxPanelWrapper wxTabTraversalWrapper< wxPanel >

Public Member Functions

 LibraryPrefs (wxWindow *parent, wxWindowID winid)
 
 ~LibraryPrefs ()
 
bool Commit () override
 
wxString HelpPageName () override
 
void PopulateOrExchange (ShuttleGui &S) override
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const wxString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
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 wxString &name=_("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
- 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...
 
void SetMP3VersionText (bool prompt=false)
 
void SetFFmpegVersionText ()
 
void OnMP3FindButton (wxCommandEvent &e)
 
void OnMP3DownButton (wxCommandEvent &e)
 Opens help on downloading a suitable MP3 library is. More...
 
void OnFFmpegFindButton (wxCommandEvent &e)
 
void OnFFmpegDownButton (wxCommandEvent &e)
 

Private Attributes

wxStaticText * mMP3Version
 
wxStaticText * mFFmpegVersion
 

Detailed Description

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

Definition at line 25 of file LibraryPrefs.h.

Constructor & Destructor Documentation

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

Definition at line 49 of file LibraryPrefs.cpp.

51 : PrefsPanel(parent, winid, _("Libraries"))
52 {
53  Populate();
54 }
PrefsPanel(wxWindow *parent, wxWindowID winid, const wxString &title)
Definition: PrefsPanel.h:48
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void Populate()
Creates the dialog and its contents.
LibraryPrefs::~LibraryPrefs ( )

Definition at line 56 of file LibraryPrefs.cpp.

57 {
58 }

Member Function Documentation

bool LibraryPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 240 of file LibraryPrefs.cpp.

References eIsSavingToPrefs, and PopulateOrExchange().

241 {
242  ShuttleGui S(this, eIsSavingToPrefs);
244 
245  return true;
246 }
void PopulateOrExchange(ShuttleGui &S) override
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
wxString LibraryPrefs::HelpPageName ( )
overridevirtual

Reimplemented from PrefsPanel.

Definition at line 248 of file LibraryPrefs.cpp.

249 {
250  return "Libraries_Preferences";
251 }
void LibraryPrefs::OnFFmpegDownButton ( wxCommandEvent &  e)
private

Definition at line 235 of file LibraryPrefs.cpp.

References HelpSystem::ShowHelp().

236 {
237  HelpSystem::ShowHelp(this, wxT("FAQ:Installing_the_FFmpeg_Import_Export_Library"), true);
238 }
static void ShowHelp(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:194
void LibraryPrefs::OnFFmpegFindButton ( wxCommandEvent &  e)
private

Definition at line 198 of file LibraryPrefs.cpp.

References _(), AudacityMessageBox(), and SetFFmpegVersionText().

199 {
200 #ifdef USE_FFMPEG
201  FFmpegLibs* FFmpegLibsPtr = PickFFmpegLibs();
202  bool showerrs =
203 #if defined(__WXDEBUG__)
204  true;
205 #else
206  false;
207 #endif
208 
209  FFmpegLibsPtr->FreeLibs();
210  // Load the libs ('true' means that all errors will be shown)
211  bool locate = !LoadFFmpeg(showerrs);
212 
213  // Libs are fine, don't show "locate" dialog unless user really wants it
214  if (!locate) {
215  int response = AudacityMessageBox(_("Audacity has automatically detected valid FFmpeg libraries.\nDo you still want to locate them manually?"),
216  wxT("Success"),
217  wxCENTRE | wxYES_NO | wxNO_DEFAULT |wxICON_QUESTION);
218  if (response == wxYES) {
219  locate = true;
220  }
221  }
222 
223  if (locate) {
224  // Show "Locate FFmpeg" dialog
225  FFmpegLibsPtr->FindLibs(this);
226  FFmpegLibsPtr->FreeLibs();
227  LoadFFmpeg(showerrs);
228  }
230 
231  DropFFmpegLibs();
232 #endif
233 }
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void SetFFmpegVersionText()
Class used to dynamically load FFmpeg libraries.
void LibraryPrefs::OnMP3DownButton ( wxCommandEvent &  e)
private

Opens help on downloading a suitable MP3 library is.

Definition at line 186 of file LibraryPrefs.cpp.

References HelpSystem::ShowHelp().

187 {
188  // Modal help dialogue required here
189  HelpSystem::ShowHelp(this, wxT("FAQ:Installing_the_LAME_MP3_Encoder"), true);
190 }
static void ShowHelp(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:194
void LibraryPrefs::OnMP3FindButton ( wxCommandEvent &  e)
private

Opens a file-finder dialog so that the user can tell us where the MP3 library is.

Definition at line 180 of file LibraryPrefs.cpp.

References SetMP3VersionText().

181 {
182  SetMP3VersionText(true);
183 }
void SetMP3VersionText(bool prompt=false)
void LibraryPrefs::Populate ( )
private

Creates the dialog and its contents.

Definition at line 61 of file LibraryPrefs.cpp.

References eIsCreatingFromPrefs, PopulateOrExchange(), SetFFmpegVersionText(), and SetMP3VersionText().

62 {
63  //------------------------- Main section --------------------
64  // Now construct the GUI itself.
65  // Use 'eIsCreatingFromPrefs' so that the GUI is
66  // initialised with values from gPrefs.
69  // ----------------------- End of main section --------------
70 
71  // Set the MP3 Version string.
74 }
void PopulateOrExchange(ShuttleGui &S) override
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void SetMP3VersionText(bool prompt=false)
void SetFFmpegVersionText()
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 81 of file LibraryPrefs.cpp.

References _(), ShuttleGuiBase::AddButton(), ShuttleGuiBase::AddVariableText(), ShuttleGuiBase::EndScroller(), ShuttleGuiBase::EndStatic(), ShuttleGuiBase::EndTwoColumn(), ShuttleGui::Id(), ID_FFMPEG_DOWN_BUTTON, ID_FFMPEG_FIND_BUTTON, ID_MP3_DOWN_BUTTON, ID_MP3_FIND_BUTTON, mFFmpegVersion, mMP3Version, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::StartScroller(), ShuttleGuiBase::StartStatic(), ShuttleGuiBase::StartTwoColumn(), and ShuttleGuiBase::TieCheckBox().

Referenced by Commit(), and Populate().

82 {
83  S.SetBorder(2);
84  S.StartScroller();
85 
86  S.StartStatic(_("MP3 Export Library"));
87  {
88  S.StartTwoColumn();
89  {
90  S.AddVariableText(_("MP3 Library Version:"),
91  true,
92  wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
93  mMP3Version = S.AddVariableText(wxT("9.99"),
94  true,
95  wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
96  S.AddVariableText(_("MP3 Library:"),
97  true,
98  wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
99  wxButton *locate_button = S.Id(ID_MP3_FIND_BUTTON).AddButton(_("&Locate..."),
100  wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
101  S.AddVariableText(_("LAME MP3 Library:"),
102  true,
103  wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
104  wxButton *download_button = S.Id(ID_MP3_DOWN_BUTTON).AddButton(_("&Download"),
105  wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
106 #ifdef DISABLE_DYNAMIC_LOADING_LAME
107  locate_button->Enable(FALSE);
108  download_button->Enable(FALSE);
109 #else
110  (void)locate_button;
111  (void)download_button;
112 #endif // DISABLE_DYNAMIC_LOADING_LAME
113  }
114  S.EndTwoColumn();
115  }
116  S.EndStatic();
117 
118  S.StartStatic(_("FFmpeg Import/Export Library"));
119  {
120  S.StartTwoColumn();
121  {
122  S.AddVariableText(_("FFmpeg Library Version:"),
123  true,
124  wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
125 #if defined(USE_FFMPEG)
126  mFFmpegVersion = S.AddVariableText(_("No compatible FFmpeg library was found"),
127  true,
128  wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
129 #else
130  mFFmpegVersion = S.AddVariableText(wxT("FFmpeg support is not compiled in"),
131  true,
132  wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
133 #endif
134  S.AddVariableText(_("FFmpeg Library:"),
135  true,
136  wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
138  wxButton *bfnd = S.AddButton(_("Loca&te..."),
139  wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
140  S.AddVariableText(_("FFmpeg Library:"),
141  true,
142  wxALL | wxALIGN_RIGHT | wxALIGN_CENTRE_VERTICAL);
144  wxButton *bdwn = S.AddButton(_("Dow&nload"),
145  wxALL | wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
146 #if !defined(USE_FFMPEG) || defined(DISABLE_DYNAMIC_LOADING_FFMPEG)
147  bdwn->Enable(FALSE);
148  bfnd->Enable(FALSE);
149 #else
150  // fix compilation warnings about unused variables
151  wxUnusedVar(bfnd);
152  wxUnusedVar(bdwn);
153 #endif
154  }
155  S.EndTwoColumn();
156 #ifdef EXPERIMENTAL_OD_FFMPEG
157  wxCheckBox* checkbox = S.TieCheckBox(_("Allow &background on-demand loading"),
158  wxT("/Library/FFmpegOnDemand"),
159  false);
160 #if !defined(USE_FFMPEG)
161  if( checkbox ) checkbox->Enable(FALSE);
162 #endif
163 #endif
164  }
165  S.EndStatic();
166  S.EndScroller();
167 
168 }
wxStaticText * mMP3Version
Definition: LibraryPrefs.h:44
#define ID_MP3_DOWN_BUTTON
void EndScroller()
Definition: ShuttleGui.cpp:828
#define ID_FFMPEG_DOWN_BUTTON
wxScrolledWindow * StartScroller(int iStyle=0)
Definition: ShuttleGui.cpp:795
void StartTwoColumn()
Definition: ShuttleGui.h:136
ShuttleGui & Id(int id)
#define ID_FFMPEG_FIND_BUTTON
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxCheckBox * TieCheckBox(const wxString &Prompt, WrappedType &WrappedRef)
#define ID_MP3_FIND_BUTTON
wxStaticText * AddVariableText(const wxString &Str, bool bCenter=false, int PositionFlags=0)
Definition: ShuttleGui.cpp:414
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:763
void SetBorder(int Border)
Definition: ShuttleGui.h:286
void EndTwoColumn()
Definition: ShuttleGui.h:137
wxButton * AddButton(const wxString &Text, int PositionFlags=wxALIGN_CENTRE)
Definition: ShuttleGui.cpp:341
wxStaticText * mFFmpegVersion
Definition: LibraryPrefs.h:45
void LibraryPrefs::SetFFmpegVersionText ( )
private

Definition at line 192 of file LibraryPrefs.cpp.

References GetFFmpegVersion(), and mFFmpegVersion.

Referenced by OnFFmpegFindButton(), and Populate().

193 {
194  mFFmpegVersion->SetLabel(GetFFmpegVersion(this));
195  mFFmpegVersion->SetName(mFFmpegVersion->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
196 }
wxString GetFFmpegVersion(wxWindow *parent)
Definition: FFmpeg.cpp:35
wxStaticText * mFFmpegVersion
Definition: LibraryPrefs.h:45
void LibraryPrefs::SetMP3VersionText ( bool  prompt = false)
private

Sets the a text area on the dialog to have the name of the MP3 Library version.

Definition at line 172 of file LibraryPrefs.cpp.

References GetMP3Version(), and mMP3Version.

Referenced by OnMP3FindButton(), and Populate().

173 {
174  mMP3Version->SetLabel(GetMP3Version(this, prompt));
175  mMP3Version->SetName(mMP3Version->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
176 }
wxStaticText * mMP3Version
Definition: LibraryPrefs.h:44
wxString GetMP3Version(wxWindow *parent, bool prompt)
Definition: ExportMP3.cpp:2170

Member Data Documentation

wxStaticText* LibraryPrefs::mFFmpegVersion
private

Definition at line 45 of file LibraryPrefs.h.

Referenced by PopulateOrExchange(), and SetFFmpegVersionText().

wxStaticText* LibraryPrefs::mMP3Version
private

Definition at line 44 of file LibraryPrefs.h.

Referenced by PopulateOrExchange(), and SetMP3VersionText().


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