Reviewed uses of type alias FileExtension, it belongs in more places
This commit is contained in:
parent
3f88df06ec
commit
d6d4ee3c29
|
@ -73,7 +73,7 @@ public:
|
|||
// import. If a filename matches any of these extensions,
|
||||
// this importer will get first dibs on importing it.
|
||||
virtual FileExtensions GetSupportedExtensions() = 0;
|
||||
virtual bool SupportsExtension(const wxString & extension) = 0;
|
||||
virtual bool SupportsExtension(const FileExtension & extension) = 0;
|
||||
|
||||
// Create the client that will be used to import a file.
|
||||
virtual ImporterClientInterface *CreateClient() = 0;
|
||||
|
|
|
@ -631,7 +631,7 @@ bool MacroCommands::ApplySpecialCommand(
|
|||
}
|
||||
|
||||
wxString filename;
|
||||
wxString extension; // required for correct message
|
||||
FileExtension extension; // required for correct message
|
||||
if (command == wxT("ExportWAV"))
|
||||
extension = wxT(".wav");
|
||||
else if (command == wxT("ExportOgg"))
|
||||
|
|
|
@ -123,7 +123,7 @@ void ExportPlugin::SetDescription(const TranslatableString & description, int in
|
|||
mFormatInfos[index].mDescription = description;
|
||||
}
|
||||
|
||||
void ExportPlugin::AddExtension(const wxString &extension,int index)
|
||||
void ExportPlugin::AddExtension(const FileExtension &extension, int index)
|
||||
{
|
||||
mFormatInfos[index].mExtensions.push_back(extension);
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ bool ExportPlugin::GetCanMetaData(int index)
|
|||
return mFormatInfos[index].mCanMetaData;
|
||||
}
|
||||
|
||||
bool ExportPlugin::IsExtension(const wxString & ext, int index)
|
||||
bool ExportPlugin::IsExtension(const FileExtension & ext, int index)
|
||||
{
|
||||
bool isext = false;
|
||||
for (int i = index; i < GetFormatCount(); i = GetFormatCount())
|
||||
|
@ -462,7 +462,7 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d
|
|||
}
|
||||
|
||||
bool Exporter::Process(AudacityProject *project, unsigned numChannels,
|
||||
const wxChar *type, const wxString & filename,
|
||||
const FileExtension &type, const wxString & filename,
|
||||
bool selectedOnly, double t0, double t1)
|
||||
{
|
||||
// Save parms
|
||||
|
@ -592,7 +592,7 @@ bool Exporter::GetFilename()
|
|||
mFormat = -1;
|
||||
|
||||
wxString maskString;
|
||||
wxString defaultFormat = mFormatName;
|
||||
auto defaultFormat = mFormatName;
|
||||
if( defaultFormat.empty() )
|
||||
defaultFormat = gPrefs->Read(wxT("/Export/Format"),
|
||||
wxT("WAV"));
|
||||
|
@ -683,7 +683,7 @@ bool Exporter::GetFilename()
|
|||
}
|
||||
}
|
||||
|
||||
auto ext = mFilename.GetExt();
|
||||
const auto ext = mFilename.GetExt();
|
||||
defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();
|
||||
|
||||
//
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
int AddFormat();
|
||||
void SetFormat(const wxString & format, int index);
|
||||
void SetDescription(const TranslatableString & description, int index);
|
||||
void AddExtension(const wxString &extension,int index);
|
||||
void AddExtension(const FileExtension &extension, int index);
|
||||
void SetExtensions(FileExtensions extensions, int index);
|
||||
void SetMask(const wxString & mask, int index);
|
||||
void SetMaxChannels(unsigned maxchannels, unsigned index);
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
virtual unsigned GetMaxChannels(int index);
|
||||
virtual bool GetCanMetaData(int index);
|
||||
|
||||
virtual bool IsExtension(const wxString & ext, int index);
|
||||
virtual bool IsExtension(const FileExtension & ext, int index);
|
||||
|
||||
virtual bool DisplayOptions(wxWindow *parent, int format = 0);
|
||||
|
||||
|
@ -185,12 +185,12 @@ public:
|
|||
virtual ~Exporter();
|
||||
|
||||
void SetFileDialogTitle( const TranslatableString & DialogTitle );
|
||||
void SetDefaultFormat( const wxString & Format ){ mFormatName = Format;};
|
||||
void SetDefaultFormat( const FileExtension & Format ){ mFormatName = Format;};
|
||||
|
||||
bool Process(AudacityProject *project, bool selectedOnly,
|
||||
double t0, double t1);
|
||||
bool Process(AudacityProject *project, unsigned numChannels,
|
||||
const wxChar *type, const wxString & filename,
|
||||
const FileExtension &type, const wxString & filename,
|
||||
bool selectedOnly, double t0, double t1);
|
||||
|
||||
void DisplayOptions(int index);
|
||||
|
@ -227,7 +227,7 @@ private:
|
|||
void OnFilterChanged(wxFileCtrlEvent & evt);
|
||||
|
||||
private:
|
||||
wxString mFormatName;
|
||||
FileExtension mFormatName;
|
||||
FileDialogWrapper *mDialog;
|
||||
TranslatableString mFileDialogTitle;
|
||||
AudacityProject *mProject;
|
||||
|
|
|
@ -214,13 +214,13 @@ ExportFFmpeg::ExportFFmpeg()
|
|||
switch(newfmt)
|
||||
{
|
||||
case FMT_M4A:
|
||||
AddExtension(wxString(wxT("3gp")),fmtindex);
|
||||
AddExtension(wxString(wxT("m4r")),fmtindex);
|
||||
AddExtension(wxString(wxT("mp4")),fmtindex);
|
||||
AddExtension(wxT("3gp"),fmtindex);
|
||||
AddExtension(wxT("m4r"),fmtindex);
|
||||
AddExtension(wxT("mp4"),fmtindex);
|
||||
break;
|
||||
case FMT_WMA2:
|
||||
AddExtension(wxString(wxT("asf")),fmtindex);
|
||||
AddExtension(wxString(wxT("wmv")),fmtindex);
|
||||
AddExtension(wxT("asf"),fmtindex);
|
||||
AddExtension(wxT("wmv"),fmtindex);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -48,7 +48,7 @@ struct ExposedFormat
|
|||
{
|
||||
FFmpegExposedFormat fmtid; //!< one of the FFmpegExposedFormat
|
||||
const wxChar *name; //!< format name (internal, should be unique; if not - export dialog may show unusual behaviour)
|
||||
const wxChar *extension; //!< default extension for this format. More extensions may be added later via AddExtension.
|
||||
const FileExtension extension; //!< default extension for this format. More extensions may be added later via AddExtension.
|
||||
const wxChar *shortname; //!< used to guess the format
|
||||
unsigned maxchannels; //!< how many channels this format could handle
|
||||
const int canmetadata; //!< !=0 if format supports metadata, AV_CANMETA any avformat version, otherwise version support added
|
||||
|
|
|
@ -372,7 +372,7 @@ ExportPCM::ExportPCM()
|
|||
si.format = kFormats[i].format;
|
||||
for (si.channels = 1; sf_format_check(&si); si.channels++)
|
||||
;
|
||||
wxString ext = sf_header_extension(si.format);
|
||||
auto ext = sf_header_extension(si.format);
|
||||
|
||||
SetFormat(kFormats[i].name, format);
|
||||
SetCanMetaData(true, format);
|
||||
|
|
|
@ -350,7 +350,7 @@ bool Importer::Import(const FilePath &fName,
|
|||
AudacityProject *pProj = GetActiveProject();
|
||||
auto cleanup = valueRestorer( pProj->mbBusyImporting, true );
|
||||
|
||||
wxString extension = fName.AfterLast(wxT('.'));
|
||||
const FileExtension extension{ fName.AfterLast(wxT('.')) };
|
||||
|
||||
// Always refuse to import MIDI, even though the FFmpeg plugin pretends to know how (but makes very bad renderings)
|
||||
#ifdef USE_MIDI
|
||||
|
|
|
@ -345,7 +345,7 @@ GStreamerImportPlugin::GetSupportedExtensions()
|
|||
// We refresh the extensions each time this is called in case the
|
||||
// user had installed additional gstreamer plugins while Audacity
|
||||
// was active.
|
||||
mExtensions.Empty();
|
||||
mExtensions.clear();
|
||||
|
||||
// Gather extensions from all factories that support audio
|
||||
{
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
return mFormatName;
|
||||
}
|
||||
|
||||
bool SupportsExtension(const wxString &extension)
|
||||
bool SupportsExtension(const FileExtension &extension)
|
||||
{
|
||||
return mExtensions.Index(extension, false) != wxNOT_FOUND;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
|
||||
// private helper classes and functions
|
||||
namespace {
|
||||
void DoExport
|
||||
(AudacityProject &project, const wxString & Format )
|
||||
void DoExport( AudacityProject &project, const FileExtension & Format )
|
||||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user