Audacity  3.0.3
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 96 of file ProjectFileManager.cpp.

Function Documentation

◆ FindHelpUrl()

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

Definition at line 114 of file ProjectFileManager.cpp.

115 {
116  wxString helpUrl;
117  if ( !libraryError.empty() ) {
118  helpUrl = defaultHelpUrl;
119 
120  auto msgid = libraryError.MSGID().GET();
121  auto found = std::find_if( begin(helpURLTable), end(helpURLTable),
122  [&]( const Pair &pair ) {
123  return msgid.Contains( pair.first ); }
124  );
125  if (found != end(helpURLTable)) {
126  auto url = found->second;
127  if (url[0] == '#')
128  helpUrl += url;
129  else
130  helpUrl = url;
131  }
132  }
133 
134  return helpUrl;
135 }

References defaultHelpUrl, TranslatableString::empty(), 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 1176 of file ProjectFileManager.cpp.

1177 {
1179  auto &project = temp.Project();
1180 
1181  auto &projectFileIO = ProjectFileIO::Get(project);
1182  if (!projectFileIO.LoadProject(fileName, false))
1183  return false;
1184  auto &srcTracks = TrackList::Get(project);
1185  auto &destTracks = TrackList::Get(dest);
1186  for (const Track *pTrack : srcTracks.Any()) {
1187  auto destTrack = pTrack->PasteInto(dest);
1188  Track::FinishCopy(pTrack, destTrack.get());
1189  if (destTrack.use_count() == 1)
1190  destTracks.Add(destTrack);
1191  }
1192  Tags::Get(dest).Merge(Tags::Get(project));
1193 
1194  return true;
1195 }

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 93 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 97 of file ProjectFileManager.cpp.

Referenced by FindHelpUrl().

TranslatableString::empty
bool empty() const
Definition: TranslatableString.h:72
InvisibleTemporaryProject
Makes a temporary project that doesn't display on the screen.
Definition: ProjectFileIO.h:331
anonymous_namespace{ProjectFileManager.cpp}::defaultHelpUrl
const char *const defaultHelpUrl
Definition: ProjectFileManager.cpp:93
ProjectFileIO::Get
static ProjectFileIO & Get(AudacityProject &project)
Definition: ProjectFileIO.cpp:268
Track::Any
bool Any() const
Definition: Track.cpp:361
Tags::Get
static Tags & Get(AudacityProject &project)
Definition: Tags.cpp:236
anonymous_namespace{ProjectFileManager.cpp}::Pair
std::pair< const char *, const char * > Pair
Definition: ProjectFileManager.cpp:96
Identifier::GET
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
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:495
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:238
anonymous_namespace{ProjectFileManager.cpp}::helpURLTable
const Pair helpURLTable[]
Definition: ProjectFileManager.cpp:97
Track::FinishCopy
static void FinishCopy(const Track *n, Track *dest)
Definition: Track.cpp:377
TranslatableString::MSGID
Identifier MSGID() const
MSGID is the English lookup key in the catalog, not necessarily for user's eyes if locale is some oth...
Definition: TranslatableString.cpp:17
InvisibleTemporaryProject::Project
AudacityProject & Project()
Definition: ProjectFileIO.h:335
Tags::Merge
void Merge(const Tags &other)
Definition: Tags.cpp:271