Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
ExportCLOptions Class Referencefinal
Inheritance diagram for ExportCLOptions:
[legend]
Collaboration diagram for ExportCLOptions:
[legend]

Public Member Functions

 ExportCLOptions (wxWindow *parent, int format)
 
virtual ~ExportCLOptions ()
 
void PopulateOrExchange (ShuttleGui &S)
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 
void OnBrowse (wxCommandEvent &event)
 
- 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 Attributes

wxComboBox * mCmd
 
FileHistory mHistory
 

Detailed Description

Definition at line 56 of file ExportCL.cpp.

Constructor & Destructor Documentation

◆ ExportCLOptions()

ExportCLOptions::ExportCLOptions ( wxWindow *  parent,
int  format 
)

Definition at line 83 of file ExportCL.cpp.

84: wxPanelWrapper(parent, wxID_ANY)
85{
86 mHistory.Load(*gPrefs, wxT("/FileFormats/ExternalProgramHistory"));
87
88 if (mHistory.empty()) {
89 mHistory.Append(wxT("ffmpeg -i - \"%f.opus\""));
90 mHistory.Append(wxT("ffmpeg -i - \"%f.wav\""));
91 mHistory.Append(wxT("ffmpeg -i - \"%f\""));
92 mHistory.Append(wxT("lame - \"%f\""));
93 }
94
95 mHistory.Append(gPrefs->Read(wxT("/FileFormats/ExternalProgramExportCommand"),
96 mHistory[ 0 ]));
97
100
102
103 parent->Layout();
104}
wxT("CloseDown"))
FileConfig * gPrefs
Definition: Prefs.cpp:70
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
#define S(N)
Definition: ToChars.cpp:64
void PopulateOrExchange(ShuttleGui &S)
Definition: ExportCL.cpp:113
FileHistory mHistory
Definition: ExportCL.cpp:70
bool TransferDataToWindow() override
Definition: ExportCL.cpp:153
bool empty() const
Definition: FileHistory.h:59
void Load(wxConfigBase &config, const wxString &group=wxEmptyString)
void Append(const FilePath &file)
Definition: FileHistory.h:42
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:625

References eIsCreatingFromPrefs, gPrefs, S, and wxT().

Here is the call graph for this function:

◆ ~ExportCLOptions()

ExportCLOptions::~ExportCLOptions ( )
virtual

Definition at line 106 of file ExportCL.cpp.

107{
109}
bool TransferDataFromWindow() override
Definition: ExportCL.cpp:160

References TransferDataFromWindow().

Here is the call graph for this function:

Member Function Documentation

◆ OnBrowse()

void ExportCLOptions::OnBrowse ( wxCommandEvent &  event)

Definition at line 178 of file ExportCL.cpp.

179{
180 wxString path;
181 FileExtension ext;
183
184#if defined(__WXMSW__)
185 ext = wxT("exe");
186 /* i18n-hint files that can be run as programs */
187 type = { XO("Executables"), { ext } };
188#endif
189
190 path = SelectFile(FileNames::Operation::Open,
191 XO("Find path to command"),
192 wxEmptyString,
193 wxEmptyString,
194 ext,
195 { type },
196 wxFD_OPEN | wxRESIZE_BORDER,
197 this);
198 if (path.empty()) {
199 return;
200 }
201
202 if (path.Find(wxT(' ')) == wxNOT_FOUND) {
203 mCmd->SetValue(path);
204 }
205 else {
206 mCmd->SetValue(wxT('"') + path + wxT('"'));
207 }
208
209 mCmd->SetInsertionPointEnd();
210
211 return;
212}
XO("Cut/Copy/Paste")
wxString FileExtension
File extension, not including any leading dot.
Definition: Identifier.h:224
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
wxComboBox * mCmd
Definition: ExportCL.cpp:69
FILES_API const FileType AllFiles
Definition: FileNames.h:70

References FileNames::AllFiles, mCmd, SelectFile(), wxT(), and XO().

Here is the call graph for this function:

◆ PopulateOrExchange()

void ExportCLOptions::PopulateOrExchange ( ShuttleGui S)

Definition at line 113 of file ExportCL.cpp.

114{
116 auto cmd = cmds[0];
117
118 S.StartVerticalLay();
119 {
120 S.StartHorizontalLay(wxEXPAND);
121 {
122 S.SetSizerProportion(1);
123 S.StartMultiColumn(3, wxEXPAND);
124 {
125 S.SetStretchyCol(1);
126 mCmd = S.AddCombo(XXO("Command:"),
127 cmd,
128 cmds);
129 S.Id(ID_BROWSE).AddButton(XXO("Browse..."),
130 wxALIGN_CENTER_VERTICAL);
131 S.AddFixedText( {} );
132 S.TieCheckBox(XXO("Show output"),
133 {wxT("/FileFormats/ExternalProgramShowOutput"),
134 false});
135 }
136 S.EndMultiColumn();
137 }
138 S.EndHorizontalLay();
139
140 S.AddTitle(XO(
141/* i18n-hint: Some programmer-oriented terminology here:
142 "Data" refers to the sound to be exported, "piped" means sent,
143 and "standard in" means the default input stream that the external program,
144 named by %f, will read. And yes, it's %f, not %s -- this isn't actually used
145 in the program as a format string. Keep %f unchanged. */
146"Data will be piped to standard in. \"%f\" uses the file name in the export window."), 250);
147 }
148 S.EndVerticalLay();
149}
#define ID_BROWSE
Definition: ExportCL.cpp:75
XXO("&Cut/Copy/Paste Toolbar")
const_iterator begin() const
Definition: FileHistory.h:56
const_iterator end() const
Definition: FileHistory.h:57
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.

References FileHistory::begin(), FileHistory::end(), ID_BROWSE, mCmd, mHistory, S, wxT(), XO(), and XXO().

Referenced by TransferDataFromWindow().

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

◆ TransferDataFromWindow()

bool ExportCLOptions::TransferDataFromWindow ( )
override

Definition at line 160 of file ExportCL.cpp.

161{
164
165 wxString cmd = mCmd->GetValue();
166
167 mHistory.Append(cmd);
169
170 gPrefs->Write(wxT("/FileFormats/ExternalProgramExportCommand"), cmd);
171 gPrefs->Flush();
172
173 return true;
174}
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
void Save(wxConfigBase &config)

References FileHistory::Append(), eIsSavingToPrefs, FileConfig::Flush(), gPrefs, mCmd, mHistory, PopulateOrExchange(), S, FileHistory::Save(), and wxT().

Referenced by ~ExportCLOptions().

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

◆ TransferDataToWindow()

bool ExportCLOptions::TransferDataToWindow ( )
override

Definition at line 153 of file ExportCL.cpp.

154{
155 return true;
156}

Member Data Documentation

◆ mCmd

wxComboBox* ExportCLOptions::mCmd
private

Definition at line 69 of file ExportCL.cpp.

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

◆ mHistory

FileHistory ExportCLOptions::mHistory
private

Definition at line 70 of file ExportCL.cpp.

Referenced by PopulateOrExchange(), and TransferDataFromWindow().


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