Audacity 3.2.0
|
Callable object that supplies the chooser
argument of ProjectFileManager::OpenFile.
More...
#include <ProjectManager.h>
Public Member Functions | |
ProjectChooser (AudacityProject *pProject, bool reuseNonemptyProject) | |
ProjectChooser (const ProjectChooser &)=delete | |
Don't copy. Use std::ref to pass it to ProjectFileManager. More... | |
~ProjectChooser () | |
Destroy any fresh project, or rollback the existing project, unless committed. More... | |
AudacityProject & | operator() (bool openingProjectFile) |
May create a fresh project. More... | |
void | Commit () |
Commit the creation of any fresh project or changes to the existing project. More... | |
Private Attributes | |
AudacityProject * | mpGivenProject |
AudacityProject * | mpUsedProject = nullptr |
bool | mReuseNonemptyProject |
Callable object that supplies the chooser
argument of ProjectFileManager::OpenFile.
Its operator(), called lower down in ProjectFileManager, decides which project to put new file data into, using file type information deduced there. It may have the side effect of creating a project.
At the higher level where it is constructed, it provides conditional RAII. One indicates there that the file opening succeeded by calling Commit(). But if that is never called, creation of projects, or changes to a preexisting project, are undone.
Definition at line 65 of file ProjectManager.h.
|
inline |
pProject | if not null, an existing project to reuse if possible |
reuseNonemptyProject | if true, may reuse the given project when nonempty, but only if importing (not for a project file) |
Definition at line 72 of file ProjectManager.h.
|
delete |
Don't copy. Use std::ref to pass it to ProjectFileManager.
ProjectManager::ProjectChooser::~ProjectChooser | ( | ) |
Destroy any fresh project, or rollback the existing project, unless committed.
Definition at line 675 of file ProjectManager.cpp.
References ProjectHistory::Get(), GetProjectFrame(), mpGivenProject, mpUsedProject, and ProjectHistory::RollbackState().
void ProjectManager::ProjectChooser::Commit | ( | ) |
Commit the creation of any fresh project or changes to the existing project.
Definition at line 704 of file ProjectManager.cpp.
AudacityProject & ProjectManager::ProjectChooser::operator() | ( | bool | openingProjectFile | ) |
May create a fresh project.
Definition at line 690 of file ProjectManager.cpp.
References ProjectManager::New(), and ProjectManager::SafeToOpenProjectInto().
|
private |
Definition at line 86 of file ProjectManager.h.
Referenced by ~ProjectChooser().
|
private |
Definition at line 87 of file ProjectManager.h.
Referenced by ~ProjectChooser().
|
private |
Definition at line 88 of file ProjectManager.h.