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

Allows user to locate libav* libraries. More...

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

Public Member Functions

 FindFFmpegDialog (wxWindow *parent, const wxString &path, const wxString &name)
 
void PopulateOrExchange (ShuttleGui &S)
 
void OnBrowse (wxCommandEvent &WXUNUSED(event))
 
void OnDownload (wxCommandEvent &WXUNUSED(event))
 
void UpdatePath ()
 
wxString GetLibPath ()
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Attributes

wxString mName
 
wxFileName mFullPath
 
wxTextCtrl * mPathText
 

Detailed Description

Allows user to locate libav* libraries.

Definition at line 112 of file FFmpeg.cpp.

Constructor & Destructor Documentation

◆ FindFFmpegDialog()

FindFFmpegDialog::FindFFmpegDialog ( wxWindow *  parent,
const wxString &  path,
const wxString &  name 
)
inline

Definition at line 116 of file FFmpeg.cpp.

117 : wxDialogWrapper(parent, wxID_ANY, XO("Locate FFmpeg"))
118 , mName(name)
119 , mFullPath(path, {})
120 {
121 SetName();
122
123 ShuttleGui S(this, eIsCreating);
125 }
const TranslatableString name
Definition: Distortion.cpp:74
XO("Cut/Copy/Paste")
@ eIsCreating
Definition: ShuttleGui.h:39
#define S(N)
Definition: ToChars.cpp:64
wxFileName mFullPath
Definition: FFmpeg.cpp:241
void PopulateOrExchange(ShuttleGui &S)
Definition: FFmpeg.cpp:127
wxString mName
Definition: FFmpeg.cpp:240
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628

Member Function Documentation

◆ GetLibPath()

wxString FindFFmpegDialog::GetLibPath ( )
inline

Definition at line 233 of file FFmpeg.cpp.

234 {
235 UpdatePath();
236 return mFullPath.GetFullPath();
237 }
void UpdatePath()
Definition: FFmpeg.cpp:223

References mFullPath, and UpdatePath().

Referenced by FindFFmpegLibs().

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

◆ OnBrowse()

void FindFFmpegDialog::OnBrowse ( wxCommandEvent &  WXUNUSEDevent)
inline

Definition at line 180 of file FFmpeg.cpp.

181 {
182 static const FileNames::FileTypes types = {
183# if defined(__WXMSW__)
184 { XO("Only avformat.dll"), { wxT("avformat-*.dll") } },
185# elif defined(__WXMAC__)
186 { XO("Only libavformat.dylib"), { wxT("ffmpeg.*.dylib"), wxT("libavformat.*.dylib") } },
187# else
188 { XO("Only libavformat.so"), { wxT("libavformat.so.*") } },
189# endif
192 };
193
194 UpdatePath();
195
196 /* i18n-hint: It's asking for the location of a file, for
197 example, "Where is lame_enc.dll?" - you could translate
198 "Where would I find the file '%s'?" instead if you want. */
199 auto question = XO("Where is '%s'?").Format( mName );
200
201 wxString path = SelectFile(
202 FileNames::Operation::_None,
203 question,
204 mFullPath.GetPath(),
205 mFullPath.GetFullName(),
206 wxT(""),
207 types,
208 wxFD_OPEN | wxRESIZE_BORDER,
209 this);
210
211 if (!path.empty())
212 {
213 mFullPath = path;
214 mPathText->SetValue(path);
215 }
216 }
wxT("CloseDown"))
FilePath SelectFile(FileNames::Operation op, const TranslatableString &message, const FilePath &default_path, const FilePath &default_filename, const FileExtension &default_extension, const FileTypes &fileTypes, int flags, wxWindow *parent)
Definition: SelectFile.cpp:17
std::vector< FileType > FileTypes
Definition: FileNames.h:75
FILES_API const FileType AllFiles
Definition: FileNames.h:70
FILES_API const FileType DynamicLibraries
Definition: FileNames.h:72
wxTextCtrl * mPathText
Definition: FFmpeg.cpp:243

References FileNames::AllFiles, FileNames::DynamicLibraries, mFullPath, mName, mPathText, SelectFile(), UpdatePath(), wxT(), and XO().

Here is the call graph for this function:

◆ OnDownload()

void FindFFmpegDialog::OnDownload ( wxCommandEvent &  WXUNUSEDevent)
inline

Definition at line 218 of file FFmpeg.cpp.

219 {
220 HelpSystem::ShowHelp(this, L"FAQ:Installing_the_FFmpeg_Import_Export_Library");
221 }
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:234

References HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ PopulateOrExchange()

void FindFFmpegDialog::PopulateOrExchange ( ShuttleGui S)
inline

Definition at line 127 of file FFmpeg.cpp.

128 {
129 S.SetBorder(10);
130 S.StartVerticalLay(true);
131 {
132 S.AddTitle(
133 XO(
134"Audacity needs the file '%s' to import and export audio via FFmpeg.")
135 .Format( mName ) );
136
137 S.SetBorder(3);
138 S.StartHorizontalLay(wxALIGN_LEFT, true);
139 {
140 S.AddTitle( XO("Location of '%s':").Format( mName ) );
141 }
142 S.EndHorizontalLay();
143
144 S.StartMultiColumn(2, wxEXPAND);
145 S.SetStretchyCol(0);
146 {
147 if (mFullPath.GetFullPath().empty())
148 {
149 mPathText = S.AddTextBox(
150 {},
151 XO("To find '%s', click here -->")
152 .Format(mName)
153 .Translation(),
154 0);
155 }
156 else
157 {
158 mPathText = S.AddTextBox({}, mFullPath.GetFullPath(), 0);
159 }
160
161 S.Id(ID_FFMPEG_BROWSE).AddButton(XXO("Browse..."), wxALIGN_RIGHT);
162 S.AddVariableText(
163 XO("To get a free copy of FFmpeg, click here -->"), true);
164 S.Id(ID_FFMPEG_DLOAD).AddButton(XXO("Download"), wxALIGN_RIGHT);
165 }
166 S.EndMultiColumn();
167
168 S.AddStandardButtons();
169 }
170 S.EndVerticalLay();
171
172 Layout();
173 Fit();
174 SetMinSize(GetSize());
175 Center();
176
177 return;
178 }
#define ID_FFMPEG_BROWSE
Definition: FFmpeg.cpp:108
#define ID_FFMPEG_DLOAD
Definition: FFmpeg.cpp:109
XXO("&Cut/Copy/Paste Toolbar")
Abstract base class used in importing a file.

References ID_FFMPEG_BROWSE, ID_FFMPEG_DLOAD, mFullPath, mName, mPathText, S, XO(), and XXO().

Here is the call graph for this function:

◆ UpdatePath()

void FindFFmpegDialog::UpdatePath ( )
inline

Definition at line 223 of file FFmpeg.cpp.

224 {
225 const wxString path = mPathText->GetValue();
226
227 if (wxDirExists(path))
228 mFullPath = wxFileName(path, {}, wxPATH_NATIVE);
229 else
230 mFullPath = mPathText->GetValue();
231 }

References mFullPath, and mPathText.

Referenced by GetLibPath(), and OnBrowse().

Here is the caller graph for this function:

Member Data Documentation

◆ mFullPath

wxFileName FindFFmpegDialog::mFullPath
private

Definition at line 241 of file FFmpeg.cpp.

Referenced by GetLibPath(), OnBrowse(), PopulateOrExchange(), and UpdatePath().

◆ mName

wxString FindFFmpegDialog::mName
private

Definition at line 240 of file FFmpeg.cpp.

Referenced by OnBrowse(), and PopulateOrExchange().

◆ mPathText

wxTextCtrl* FindFFmpegDialog::mPathText
private

Definition at line 243 of file FFmpeg.cpp.

Referenced by OnBrowse(), PopulateOrExchange(), and UpdatePath().


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