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 105 of file FFmpeg.cpp.

Constructor & Destructor Documentation

◆ FindFFmpegDialog()

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

Definition at line 109 of file FFmpeg.cpp.

110 : wxDialogWrapper(parent, wxID_ANY, XO("Locate FFmpeg"))
111 , mName(name)
112 , mFullPath(path, {})
113 {
114 SetName();
115
116 ShuttleGui S(this, eIsCreating);
118 }
const TranslatableString name
Definition: Distortion.cpp:76
XO("Cut/Copy/Paste")
@ eIsCreating
Definition: ShuttleGui.h:37
#define S(N)
Definition: ToChars.cpp:64
wxFileName mFullPath
Definition: FFmpeg.cpp:234
void PopulateOrExchange(ShuttleGui &S)
Definition: FFmpeg.cpp:120
wxString mName
Definition: FFmpeg.cpp:233
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640

Member Function Documentation

◆ GetLibPath()

wxString FindFFmpegDialog::GetLibPath ( )
inline

Definition at line 226 of file FFmpeg.cpp.

227 {
228 UpdatePath();
229 return mFullPath.GetFullPath();
230 }
void UpdatePath()
Definition: FFmpeg.cpp:216

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 173 of file FFmpeg.cpp.

174 {
175 static const FileNames::FileTypes types = {
176# if defined(__WXMSW__)
177 { XO("Only avformat.dll"), { wxT("avformat-*.dll") } },
178# elif defined(__WXMAC__)
179 { XO("Only libavformat.dylib"), { wxT("ffmpeg.*.dylib"), wxT("libavformat.*.dylib") } },
180# else
181 { XO("Only libavformat.so"), { wxT("libavformat.so.*") } },
182# endif
185 };
186
187 UpdatePath();
188
189 /* i18n-hint: It's asking for the location of a file, for
190 example, "Where is lame_enc.dll?" - you could translate
191 "Where would I find the file '%s'?" instead if you want. */
192 auto question = XO("Where is '%s'?").Format( mName );
193
194 wxString path = SelectFile(
195 FileNames::Operation::_None,
196 question,
197 mFullPath.GetPath(),
198 mFullPath.GetFullName(),
199 wxT(""),
200 types,
201 wxFD_OPEN | wxRESIZE_BORDER,
202 this);
203
204 if (!path.empty())
205 {
206 mFullPath = path;
207 mPathText->SetValue(path);
208 }
209 }
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:236

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 211 of file FFmpeg.cpp.

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

References HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ PopulateOrExchange()

void FindFFmpegDialog::PopulateOrExchange ( ShuttleGui S)
inline

Definition at line 120 of file FFmpeg.cpp.

121 {
122 S.SetBorder(10);
123 S.StartVerticalLay(true);
124 {
125 S.AddTitle(
126 XO(
127"Audacity needs the file '%s' to import and export audio via FFmpeg.")
128 .Format( mName ) );
129
130 S.SetBorder(3);
131 S.StartHorizontalLay(wxALIGN_LEFT, true);
132 {
133 S.AddTitle( XO("Location of '%s':").Format( mName ) );
134 }
135 S.EndHorizontalLay();
136
137 S.StartMultiColumn(2, wxEXPAND);
138 S.SetStretchyCol(0);
139 {
140 if (mFullPath.GetFullPath().empty())
141 {
142 mPathText = S.AddTextBox(
143 {},
144 XO("To find '%s', click here -->")
145 .Format(mName)
146 .Translation(),
147 0);
148 }
149 else
150 {
151 mPathText = S.AddTextBox({}, mFullPath.GetFullPath(), 0);
152 }
153
154 S.Id(ID_FFMPEG_BROWSE).AddButton(XXO("Browse..."), wxALIGN_RIGHT);
155 S.AddVariableText(
156 XO("To get a free copy of FFmpeg, click here -->"), true);
157 S.Id(ID_FFMPEG_DLOAD).AddButton(XXO("Download"), wxALIGN_RIGHT);
158 }
159 S.EndMultiColumn();
160
161 S.AddStandardButtons();
162 }
163 S.EndVerticalLay();
164
165 Layout();
166 Fit();
167 SetMinSize(GetSize());
168 Center();
169
170 return;
171 }
#define ID_FFMPEG_BROWSE
Definition: FFmpeg.cpp:101
#define ID_FFMPEG_DLOAD
Definition: FFmpeg.cpp:102
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 216 of file FFmpeg.cpp.

217 {
218 const wxString path = mPathText->GetValue();
219
220 if (wxDirExists(path))
221 mFullPath = wxFileName(path, {}, wxPATH_NATIVE);
222 else
223 mFullPath = mPathText->GetValue();
224 }

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 234 of file FFmpeg.cpp.

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

◆ mName

wxString FindFFmpegDialog::mName
private

Definition at line 233 of file FFmpeg.cpp.

Referenced by OnBrowse(), and PopulateOrExchange().

◆ mPathText

wxTextCtrl* FindFFmpegDialog::mPathText
private

Definition at line 236 of file FFmpeg.cpp.

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


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