Audacity 3.2.0
Classes | Typedefs | Functions | Variables
anonymous_namespace{ProjectFileManager.cpp} Namespace Reference

Classes

class  CompactDialog
 

Typedefs

using Pair = std::pair< const char *, const char * >
 

Functions

wxString FindHelpUrl (const TranslatableString &libraryError)
 
bool ImportProject (AudacityProject &dest, const FilePath &fileName)
 

Variables

const char *const defaultHelpUrl
 
const Pair helpURLTable []
 

Typedef Documentation

◆ Pair

using anonymous_namespace{ProjectFileManager.cpp}::Pair = typedef std::pair< const char *, const char * >

Definition at line 108 of file ProjectFileManager.cpp.

Function Documentation

◆ FindHelpUrl()

wxString anonymous_namespace{ProjectFileManager.cpp}::FindHelpUrl ( const TranslatableString libraryError)

Definition at line 126 of file ProjectFileManager.cpp.

127{
128 wxString helpUrl;
129 if ( !libraryError.empty() ) {
130 helpUrl = defaultHelpUrl;
131
132 auto msgid = libraryError.MSGID().GET();
133 auto found = std::find_if( begin(helpURLTable), end(helpURLTable),
134 [&]( const Pair &pair ) {
135 return msgid.Contains( pair.first ); }
136 );
137 if (found != end(helpURLTable)) {
138 auto url = found->second;
139 if (url[0] == '#')
140 helpUrl += url;
141 else
142 helpUrl = url;
143 }
144 }
145
146 return helpUrl;
147}
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
Definition: Identifier.h:66
Identifier MSGID() const
MSGID is the English lookup key in the catalog, not necessarily for user's eyes if locale is some oth...
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:150
std::pair< const char *, const char * > Pair

References PackedArray::begin(), defaultHelpUrl, TranslatableString::empty(), PackedArray::end(), Identifier::GET(), helpURLTable, and TranslatableString::MSGID().

Referenced by ProjectFileManager::ReadProjectFile().

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

◆ ImportProject()

bool anonymous_namespace{ProjectFileManager.cpp}::ImportProject ( AudacityProject dest,
const FilePath fileName 
)

Definition at line 1187 of file ProjectFileManager.cpp.

1188{
1190 auto &project = temp.Project();
1191
1192 auto &projectFileIO = ProjectFileIO::Get(project);
1193 if (!projectFileIO.LoadProject(fileName, false))
1194 return false;
1195 auto &srcTracks = TrackList::Get(project);
1196 auto &destTracks = TrackList::Get(dest);
1197 for (const Track *pTrack : srcTracks.Any()) {
1198 auto destTrack = pTrack->PasteInto(dest);
1199 Track::FinishCopy(pTrack, destTrack.get());
1200 if (destTrack.use_count() == 1)
1201 destTracks.Add(destTrack);
1202 }
1203 Tags::Get(dest).Merge(Tags::Get(project));
1204
1205 return true;
1206}
Makes a temporary project that doesn't display on the screen.
AudacityProject & Project()
static ProjectFileIO & Get(AudacityProject &project)
void Merge(const Tags &other)
Definition: Tags.cpp:246
static Tags & Get(AudacityProject &project)
Definition: Tags.cpp:214
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:226
static void FinishCopy(const Track *n, Track *dest)
Definition: Track.cpp:415
bool Any() const
Definition: Track.cpp:400
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:487

References Track::Any(), Track::FinishCopy(), ProjectFileIO::Get(), Tags::Get(), TrackList::Get(), Tags::Merge(), and InvisibleTemporaryProject::Project().

Referenced by ProjectFileManager::Import().

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

Variable Documentation

◆ defaultHelpUrl

const char* const anonymous_namespace{ProjectFileManager.cpp}::defaultHelpUrl
Initial value:
=
"FAQ:Errors_on_opening_or_recovering_an_Audacity_project"

Definition at line 105 of file ProjectFileManager.cpp.

Referenced by FindHelpUrl().

◆ helpURLTable

const Pair anonymous_namespace{ProjectFileManager.cpp}::helpURLTable[]
Initial value:
= {
{
"not well-formed (invalid token)",
"Error:_not_well-formed_(invalid_token)_at_line_x"
},
{
"reference to invalid character number",
"Error_Opening_Project:_Reference_to_invalid_character_number_at_line_x"
},
{
"mismatched tag",
"#mismatched"
},
}

Definition at line 109 of file ProjectFileManager.cpp.

Referenced by FindHelpUrl().