mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-13 14:13:32 +02:00
Use type aliases FilePath, FilePaths...
... for wxString and wxArrayStringEx, holding file paths (absolute or relative, directory or plain file); to be replaced later with different types (not yet using std::vector, becase of some uses of wxArrayString::Index with two arguments)
This commit is contained in:
@@ -325,7 +325,7 @@ std::unique_ptr<ExtImportItem> Importer::CreateDefaultImportItem()
|
||||
return new_item;
|
||||
}
|
||||
|
||||
bool Importer::IsMidi(const wxString &fName)
|
||||
bool Importer::IsMidi(const FilePath &fName)
|
||||
{
|
||||
const auto extension = fName.AfterLast(wxT('.'));
|
||||
return
|
||||
@@ -335,7 +335,7 @@ bool Importer::IsMidi(const wxString &fName)
|
||||
}
|
||||
|
||||
// returns number of tracks imported
|
||||
bool Importer::Import(const wxString &fName,
|
||||
bool Importer::Import(const FilePath &fName,
|
||||
TrackFactory *trackFactory,
|
||||
TrackHolders &tracks,
|
||||
Tags *tags,
|
||||
|
@@ -138,10 +138,10 @@ public:
|
||||
*/
|
||||
std::unique_ptr<ExtImportItem> CreateDefaultImportItem();
|
||||
|
||||
static bool IsMidi(const wxString &fName);
|
||||
static bool IsMidi(const FilePath &fName);
|
||||
|
||||
// if false, the import failed and errorMessage will be set.
|
||||
bool Import(const wxString &fName,
|
||||
bool Import(const FilePath &fName,
|
||||
TrackFactory *trackFactory,
|
||||
TrackHolders &tracks,
|
||||
Tags *tags,
|
||||
|
@@ -182,7 +182,7 @@ public:
|
||||
wxString GetPluginFormatDescription() override;
|
||||
|
||||
///! Probes the file and opens it if appropriate
|
||||
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
};
|
||||
|
||||
///! Does acual import, returned by FFmpegImportPlugin::Open
|
||||
@@ -190,7 +190,7 @@ class FFmpegImportFileHandle final : public ImportFileHandle
|
||||
{
|
||||
|
||||
public:
|
||||
FFmpegImportFileHandle(const wxString & name);
|
||||
FFmpegImportFileHandle(const FilePath & name);
|
||||
~FFmpegImportFileHandle();
|
||||
|
||||
///! Format initialization
|
||||
@@ -271,7 +271,7 @@ private:
|
||||
|
||||
bool mCancelled; //!< True if importing was canceled by user
|
||||
bool mStopped; //!< True if importing was stopped by user
|
||||
wxString mName;
|
||||
FilePath mName;
|
||||
TrackHolders mChannels; //!< 2-dimensional array of WaveTrack's.
|
||||
//!< First dimension - streams,
|
||||
//!< second - channels of a stream.
|
||||
@@ -295,7 +295,7 @@ wxString FFmpegImportPlugin::GetPluginFormatDescription()
|
||||
return DESC;
|
||||
}
|
||||
|
||||
std::unique_ptr<ImportFileHandle> FFmpegImportPlugin::Open(const wxString &filename)
|
||||
std::unique_ptr<ImportFileHandle> FFmpegImportPlugin::Open(const FilePath &filename)
|
||||
{
|
||||
auto handle = std::make_unique<FFmpegImportFileHandle>(filename);
|
||||
|
||||
@@ -338,7 +338,7 @@ std::unique_ptr<ImportFileHandle> FFmpegImportPlugin::Open(const wxString &filen
|
||||
}
|
||||
|
||||
|
||||
FFmpegImportFileHandle::FFmpegImportFileHandle(const wxString & name)
|
||||
FFmpegImportFileHandle::FFmpegImportFileHandle(const FilePath & name)
|
||||
: ImportFileHandle(name)
|
||||
{
|
||||
PickFFmpegLibs();
|
||||
|
@@ -140,7 +140,7 @@ class FLACImportPlugin final : public ImportPlugin
|
||||
|
||||
wxString GetPluginStringID() override { return wxT("libflac"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ class FLACImportFileHandle final : public ImportFileHandle
|
||||
{
|
||||
friend class MyFLACFile;
|
||||
public:
|
||||
FLACImportFileHandle(const wxString & name);
|
||||
FLACImportFileHandle(const FilePath & name);
|
||||
~FLACImportFileHandle();
|
||||
|
||||
bool Init();
|
||||
@@ -302,7 +302,7 @@ wxString FLACImportPlugin::GetPluginFormatDescription()
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<ImportFileHandle> FLACImportPlugin::Open(const wxString &filename)
|
||||
std::unique_ptr<ImportFileHandle> FLACImportPlugin::Open(const FilePath &filename)
|
||||
{
|
||||
// First check if it really is a FLAC file
|
||||
|
||||
@@ -344,7 +344,7 @@ std::unique_ptr<ImportFileHandle> FLACImportPlugin::Open(const wxString &filenam
|
||||
}
|
||||
|
||||
|
||||
FLACImportFileHandle::FLACImportFileHandle(const wxString & name)
|
||||
FLACImportFileHandle::FLACImportFileHandle(const FilePath & name)
|
||||
: ImportFileHandle(name),
|
||||
mSamplesDone(0),
|
||||
mStreamInfoDone(false),
|
||||
|
@@ -112,14 +112,14 @@ public:
|
||||
|
||||
wxString GetPluginStringID() override { return wxT("lof"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
};
|
||||
|
||||
|
||||
class LOFImportFileHandle final : public ImportFileHandle
|
||||
{
|
||||
public:
|
||||
LOFImportFileHandle(const wxString & name, std::unique_ptr<wxTextFile> &&file);
|
||||
LOFImportFileHandle(const FilePath & name, std::unique_ptr<wxTextFile> &&file);
|
||||
~LOFImportFileHandle();
|
||||
|
||||
wxString GetFileDescription() override;
|
||||
@@ -161,7 +161,7 @@ private:
|
||||
};
|
||||
|
||||
LOFImportFileHandle::LOFImportFileHandle
|
||||
(const wxString & name, std::unique_ptr<wxTextFile> &&file)
|
||||
(const FilePath & name, std::unique_ptr<wxTextFile> &&file)
|
||||
: ImportFileHandle(name),
|
||||
mTextFile(std::move(file))
|
||||
, mLOFFileName{name}
|
||||
@@ -179,7 +179,7 @@ wxString LOFImportPlugin::GetPluginFormatDescription()
|
||||
return DESC;
|
||||
}
|
||||
|
||||
std::unique_ptr<ImportFileHandle> LOFImportPlugin::Open(const wxString &filename)
|
||||
std::unique_ptr<ImportFileHandle> LOFImportPlugin::Open(const FilePath &filename)
|
||||
{
|
||||
// Check if it is a binary file
|
||||
{
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include "../NoteTrack.h"
|
||||
#include "../widgets/ErrorDialog.h"
|
||||
|
||||
bool ImportMIDI(const wxString &fName, NoteTrack * dest)
|
||||
bool ImportMIDI(const FilePath &fName, NoteTrack * dest)
|
||||
{
|
||||
if (fName.length() <= 4){
|
||||
AudacityMessageBox( wxString::Format(
|
||||
|
@@ -19,13 +19,14 @@ into a NoteTrack.
|
||||
#define _IMPORT_MIDI_
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "audacity/Types.h"
|
||||
|
||||
#if defined(USE_MIDI)
|
||||
|
||||
class wxString;
|
||||
class NoteTrack;
|
||||
|
||||
bool ImportMIDI(const wxString &fName, NoteTrack * dest);
|
||||
bool ImportMIDI(const FilePath &fName, NoteTrack * dest);
|
||||
|
||||
class MIDIParser {
|
||||
public:
|
||||
|
@@ -121,13 +121,13 @@ public:
|
||||
|
||||
wxString GetPluginStringID() override { return wxT("libmad"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
};
|
||||
|
||||
class MP3ImportFileHandle final : public ImportFileHandle
|
||||
{
|
||||
public:
|
||||
MP3ImportFileHandle(std::unique_ptr<wxFile> &&file, wxString filename):
|
||||
MP3ImportFileHandle(std::unique_ptr<wxFile> &&file, const FilePath &filename):
|
||||
ImportFileHandle(filename),
|
||||
mFile(std::move(file))
|
||||
{
|
||||
@@ -187,7 +187,7 @@ wxString MP3ImportPlugin::GetPluginFormatDescription()
|
||||
return DESC;
|
||||
}
|
||||
|
||||
std::unique_ptr<ImportFileHandle> MP3ImportPlugin::Open(const wxString &Filename)
|
||||
std::unique_ptr<ImportFileHandle> MP3ImportPlugin::Open(const FilePath &Filename)
|
||||
{
|
||||
auto file = std::make_unique<wxFile>(Filename);
|
||||
|
||||
|
@@ -93,14 +93,14 @@ public:
|
||||
|
||||
wxString GetPluginStringID() override { return wxT("liboggvorbis"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
};
|
||||
|
||||
|
||||
class OggImportFileHandle final : public ImportFileHandle
|
||||
{
|
||||
public:
|
||||
OggImportFileHandle(const wxString & filename,
|
||||
OggImportFileHandle(const FilePath & filename,
|
||||
std::unique_ptr<wxFFile> &&file,
|
||||
std::unique_ptr<OggVorbis_File> &&vorbisFile)
|
||||
: ImportFileHandle(filename),
|
||||
@@ -170,7 +170,7 @@ wxString OggImportPlugin::GetPluginFormatDescription()
|
||||
return DESC;
|
||||
}
|
||||
|
||||
std::unique_ptr<ImportFileHandle> OggImportPlugin::Open(const wxString &filename)
|
||||
std::unique_ptr<ImportFileHandle> OggImportPlugin::Open(const FilePath &filename)
|
||||
{
|
||||
// Suppress some compiler warnings about unused global variables in the library header
|
||||
wxUnusedVar(OV_CALLBACKS_DEFAULT);
|
||||
|
@@ -81,14 +81,14 @@ public:
|
||||
|
||||
wxString GetPluginStringID() override { return wxT("libsndfile"); }
|
||||
wxString GetPluginFormatDescription() override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) override;
|
||||
std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) override;
|
||||
};
|
||||
|
||||
|
||||
class PCMImportFileHandle final : public ImportFileHandle
|
||||
{
|
||||
public:
|
||||
PCMImportFileHandle(wxString name, SFFile &&file, SF_INFO info);
|
||||
PCMImportFileHandle(const FilePath &name, SFFile &&file, SF_INFO info);
|
||||
~PCMImportFileHandle();
|
||||
|
||||
wxString GetFileDescription() override;
|
||||
@@ -124,7 +124,7 @@ wxString PCMImportPlugin::GetPluginFormatDescription()
|
||||
return DESC;
|
||||
}
|
||||
|
||||
std::unique_ptr<ImportFileHandle> PCMImportPlugin::Open(const wxString &filename)
|
||||
std::unique_ptr<ImportFileHandle> PCMImportPlugin::Open(const FilePath &filename)
|
||||
{
|
||||
SF_INFO info;
|
||||
wxFile f; // will be closed when it goes out of scope
|
||||
@@ -188,7 +188,7 @@ std::unique_ptr<ImportFileHandle> PCMImportPlugin::Open(const wxString &filename
|
||||
return std::make_unique<PCMImportFileHandle>(filename, std::move(file), info);
|
||||
}
|
||||
|
||||
PCMImportFileHandle::PCMImportFileHandle(wxString name,
|
||||
PCMImportFileHandle::PCMImportFileHandle(const FilePath &name,
|
||||
SFFile &&file, SF_INFO info)
|
||||
: ImportFileHandle(name),
|
||||
mFile(std::move(file)),
|
||||
|
@@ -102,7 +102,7 @@ public:
|
||||
// Open the given file, returning true if it is in a recognized
|
||||
// format, false otherwise. This puts the importer into the open
|
||||
// state.
|
||||
virtual std::unique_ptr<ImportFileHandle> Open(const wxString &Filename) = 0;
|
||||
virtual std::unique_ptr<ImportFileHandle> Open(const FilePath &Filename) = 0;
|
||||
|
||||
virtual ~ImportPlugin() { }
|
||||
|
||||
@@ -120,7 +120,7 @@ protected:
|
||||
class ImportFileHandle /* not final */
|
||||
{
|
||||
public:
|
||||
ImportFileHandle(const wxString & filename)
|
||||
ImportFileHandle(const FilePath & filename)
|
||||
: mFilename(filename),
|
||||
mProgress{}
|
||||
{
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
virtual void SetStreamUsage(wxInt32 StreamID, bool Use) = 0;
|
||||
|
||||
protected:
|
||||
wxString mFilename;
|
||||
FilePath mFilename;
|
||||
Maybe<ProgressDialog> mProgress;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user