![]() |
Audacity 3.2.0
|
Singleton class which actually imports the audio, using ImportPlugin objects that are registered by modules, which in turn are factories of ImportFileHandle. More...
#include <Import.h>
Classes | |
| struct | ImporterItem |
| struct | RegisteredImportPlugin |
| struct | RegisteredUnusableImportPlugin |
| struct | Traits |
Public Member Functions | |
| Importer () | |
| ~Importer () | |
| Importer (const Importer &)=delete | |
| Importer & | operator= (Importer &)=delete |
| bool | Initialize () |
| bool | Terminate () |
| FileNames::FileTypes | GetFileTypes (const FileNames::FileType &extraType={}) |
| void | ReadImportItems () |
| void | WriteImportItems () |
| void | StringToList (wxString &str, wxString &delims, wxArrayString &list, wxStringTokenizerMode mod=wxTOKEN_RET_EMPTY_ALL) |
| ExtImportItems & | GetImportItems () |
| std::unique_ptr< ExtImportItem > | CreateDefaultImportItem () |
| bool | Import (AudacityProject &project, const FilePath &fName, ImportProgressListener *importProgressListener, WaveTrackFactory *trackFactory, TrackHolders &tracks, Tags *tags, std::optional< LibFileFormats::AcidizerTags > &outAcidTags, TranslatableString &errorMessage) |
Static Public Member Functions | |
| static Importer & | Get () |
| static void | SetLastOpenType (const FileNames::FileType &type) |
| static void | SetDefaultOpenType (const FileNames::FileType &type) |
| static size_t | SelectDefaultOpenType (const FileNames::FileTypes &fileTypes) |
Static Private Member Functions | |
| static ImportPluginList & | sImportPluginList () |
| static UnusableImportPluginList & | sUnusableImportPluginList () |
Private Attributes | |
| ExtImportItems | mExtImportItems |
Static Private Attributes | |
| static Importer | mInstance |
Singleton class which actually imports the audio, using ImportPlugin objects that are registered by modules, which in turn are factories of ImportFileHandle.
| Importer::Importer | ( | ) |
Definition at line 108 of file Import.cpp.
| Importer::~Importer | ( | ) |
Definition at line 112 of file Import.cpp.
|
delete |
| std::unique_ptr< ExtImportItem > Importer::CreateDefaultImportItem | ( | ) |
Allocates NEW ExtImportItem, fills it with default data and returns a pointer to it.
Definition at line 471 of file Import.cpp.
References sImportPluginList(), and wxT().
Referenced by ExtImportPrefs::OnAddRule().
|
static |
Return instance reference
Definition at line 103 of file Import.cpp.
References mInstance.
Referenced by ExtImportPrefs::Commit(), ProjectFileManager::DoImport(), ExtImportPrefs::DoOnPluginKeyDown(), ExtImportPrefs::DoOnRuleTableSelect(), AudacityApp::InitPart2(), ExtImportPrefs::OnAddRule(), ApplyMacroDialog::OnApplyToFiles(), ExtImportPrefs::OnDelRule(), AudacityApp::OnExit(), ExtImportPrefs::OnRuleTableEdit(), ExtImportPrefs::Populate(), ExtImportPrefs::PopulateOrExchange(), ProjectFileManager::ShowOpenDialog(), ExtImportPrefs::SwapPluginRows(), and ExtImportPrefs::SwapRows().
| FileNames::FileTypes Importer::GetFileTypes | ( | const FileNames::FileType & | extraType = {} | ) |
Constructs a list of types, for use by file opening dialogs, that includes all supported file types
Definition at line 209 of file Import.cpp.
References FileNames::AllFiles, FileNames::AudacityProjects, anonymous_namespace{CloudProjectFileIOExtensions.cpp}::extension, FileNames::FileType::extensions, anonymous_namespace{ExportPCM.cpp}::format, wxArrayStringEx::insert(), sImportPluginList(), and XO().
Referenced by ApplyMacroDialog::OnApplyToFiles(), and ProjectFileManager::ShowOpenDialog().
|
inline |
Returns a pointer to internal items array. External objects are allowed to change the array contents.
Definition at line 169 of file Import.h.
Referenced by ExtImportPrefs::DoOnPluginKeyDown(), ExtImportPrefs::DoOnRuleTableSelect(), ExtImportPrefs::OnAddRule(), ExtImportPrefs::OnDelRule(), ExtImportPrefs::OnRuleTableEdit(), ExtImportPrefs::PopulateOrExchange(), ExtImportPrefs::SwapPluginRows(), and ExtImportPrefs::SwapRows().
| bool Importer::Import | ( | AudacityProject & | project, |
| const FilePath & | fName, | ||
| ImportProgressListener * | importProgressListener, | ||
| WaveTrackFactory * | trackFactory, | ||
| TrackHolders & | tracks, | ||
| Tags * | tags, | ||
| std::optional< LibFileFormats::AcidizerTags > & | outAcidTags, | ||
| TranslatableString & | errorMessage | ||
| ) |
Definition at line 487 of file Import.cpp.
References ImportProgressListener::Cancelled, ExtImportItem::divider, TranslatableString::empty(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::extension, ExtImportItem::extensions, ExtImportItem::filter_objects, gPrefs, BasicUI::MakeGenericProgress(), AudacityProject::mbBusyImporting, mExtImportItems, ExtImportItem::mime_types, BasicUI::ProgressAppModal, BasicUI::ProgressCanAbort, BasicUI::ProgressShowElapsedTime, BasicUI::ProgressSmooth, project, audacity::BasicSettings::Read(), sImportPluginList(), ImportProgressListener::Stopped, BasicUI::Success, ImportProgressListener::Success, sUnusableImportPluginList(), tracks, valueRestorer(), Verbatim(), wxT(), XO(), and BasicUI::Yield().
Referenced by ProjectFileManager::DoImport().
| bool Importer::Initialize | ( | ) |
Initialization/Termination
Definition at line 167 of file Import.cpp.
References flag, mExtImportItems, Importer::ImporterItem::mpPlugin, anonymous_namespace{Import.cpp}::PathStart, ReadImportItems(), Importer::ImporterItem::Registry(), sImportPluginList(), Registry::Visit(), and wxT().
Referenced by AudacityApp::InitPart2().
| void Importer::ReadImportItems | ( | ) |
Reads extended import filters from gPrefs into internal list mExtImportItems
Definition at line 299 of file Import.cpp.
References gPrefs, mExtImportItems, audacity::BasicSettings::Read(), sImportPluginList(), StringToList(), and wxT().
Referenced by Initialize(), and ExtImportPrefs::Populate().
|
static |
Choose index of preferred type
Definition at line 274 of file Import.cpp.
References details::begin(), gPrefs, audacity::BasicSettings::Read(), and wxT().
Referenced by ApplyMacroDialog::OnApplyToFiles(), and ProjectFileManager::ShowOpenDialog().
|
static |
Remember a file type in preferences
Definition at line 264 of file Import.cpp.
References FileNames::FileType::description, audacity::BasicSettings::Flush(), gPrefs, TranslatableString::Translation(), audacity::BasicSettings::Write(), and wxT().
Referenced by ProjectFileManager::ShowOpenDialog().
|
static |
Remember a file type in preferences
Definition at line 254 of file Import.cpp.
References FileNames::FileType::description, audacity::BasicSettings::Flush(), gPrefs, TranslatableString::Translation(), audacity::BasicSettings::Write(), and wxT().
Referenced by anonymous_namespace{FileMenus.cpp}::DoImport(), ProjectManager::OpenFiles(), and ProjectFileManager::ShowOpenDialog().
|
staticprivate |
Definition at line 116 of file Import.cpp.
Referenced by CreateDefaultImportItem(), GetFileTypes(), Import(), Initialize(), and ReadImportItems().
| void Importer::StringToList | ( | wxString & | str, |
| wxString & | delims, | ||
| wxArrayString & | list, | ||
| wxStringTokenizerMode | mod = wxTOKEN_RET_EMPTY_ALL |
||
| ) |
Helper function - uses wxStringTokenizer to tokenize @str string and appends string-tokens to a list @list. @mod defines tokenizer's behaviour.
Definition at line 291 of file Import.cpp.
References str.
Referenced by ExtImportPrefs::OnRuleTableEdit(), and ReadImportItems().
|
staticprivate |
Definition at line 154 of file Import.cpp.
Referenced by Import(), and Importer::RegisteredUnusableImportPlugin::RegisteredUnusableImportPlugin().
| bool Importer::Terminate | ( | ) |
Definition at line 201 of file Import.cpp.
References WriteImportItems().
Referenced by AudacityApp::OnExit().
| void Importer::WriteImportItems | ( | ) |
Writes mExtImportItems into gPrefs
Definition at line 410 of file Import.cpp.
References audacity::BasicSettings::DeleteEntry(), ExtImportItem::divider, ExtImportItem::extensions, ExtImportItem::filters, audacity::BasicSettings::Flush(), gPrefs, mExtImportItems, ExtImportItem::mime_types, name, audacity::BasicSettings::Read(), audacity::BasicSettings::Write(), and wxT().
Referenced by ExtImportPrefs::Commit(), and Terminate().
|
private |
Definition at line 200 of file Import.h.
Referenced by Import(), Initialize(), ReadImportItems(), and WriteImportItems().
|
staticprivate |