BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Decorator for ProjectManager to provide interaction with the user on open/save-as requests. More...
Classes | |
struct | ProjectManagerImpl |
Public Member Functions | |
ProjectManagerDecorator (const ProjectContext &project_context, const UserInteractionContext &user_context) | |
Constructor for ProjectManagerDecorator. More... | |
ProjectManagerDecorator (const ProjectManagerDecorator &other)=delete | |
~ProjectManagerDecorator () override | |
bool | closeCurrentProject () const override |
Closes current project, returns 'true' if succeeded. More... | |
bool | createNewProject (const std::string &dirname={}) override |
Creates a new project in the directory 'dirname', returns 'true' in the case of success. More... | |
std::string | currentProjectDir () const override |
Returns current project directory. More... | |
bool | isModified () const override |
Returns true if project was modified since last save. More... | |
bool | openExistingProject (const std::string &dirname={}) override |
Opens existing project, returns 'true' in the case of success. More... | |
ProjectManagerDecorator & | operator= (const ProjectManagerDecorator &other)=delete |
bool | saveCurrentProject () override |
Saves current project, returns 'true' in the case of success. More... | |
bool | saveProjectAs (const std::string &dirname={}) override |
Saves the project under a given directory, returns true in the case of success. More... | |
Private Attributes | |
std::unique_ptr< ProjectManagerImpl > | p_impl |
Decorator for ProjectManager to provide interaction with the user on open/save-as requests.
It relies on the same interface and adds additional logic related to "unsaved" data. For example, on createNewProject it will check if previous project is saved, and will call external dialog save/discard/cancel via provided callback.
Definition at line 32 of file projectmanagerdecorator.h.
ProjectManagerDecorator::ProjectManagerDecorator | ( | const ProjectContext & | project_context, |
const UserInteractionContext & | user_context | ||
) |
Constructor for ProjectManagerDecorator.
Definition at line 111 of file projectmanagerdecorator.cpp.
|
overridedefault |
|
delete |
|
overridevirtual |
Closes current project, returns 'true' if succeeded.
Will show the dialog, via callback provided, asking the user whether to save/discard/cancel. Returns 'false' only if user has selected 'cancel' button.
Implements ModelView::ProjectManagerInterface.
Definition at line 187 of file projectmanagerdecorator.cpp.
References p_impl.
|
overridevirtual |
Creates a new project in the directory 'dirname', returns 'true' in the case of success.
The directory should exist. If provided name is empty, will call directory selector dialog using callback provided. If current project is in unsaved state, will perform 'save-before-closing' procedure before proceeding further.
Implements ModelView::ProjectManagerInterface.
Definition at line 125 of file projectmanagerdecorator.cpp.
References p_impl.
Referenced by TEST_F().
|
overridevirtual |
Returns current project directory.
Implements ModelView::ProjectManagerInterface.
Definition at line 171 of file projectmanagerdecorator.cpp.
References p_impl.
Referenced by TEST_F().
|
overridevirtual |
Returns true if project was modified since last save.
Implements ModelView::ProjectManagerInterface.
Definition at line 178 of file projectmanagerdecorator.cpp.
References p_impl.
Referenced by TEST_F().
|
overridevirtual |
Opens existing project, returns 'true' in the case of success.
If provided name is empty, will call directory selector dialog using callback provided. If current project is in unsaved state, it will perform 'save-before-closing' procedure before proceeding further.
Implements ModelView::ProjectManagerInterface.
Definition at line 160 of file projectmanagerdecorator.cpp.
References p_impl.
Referenced by TEST_F().
|
delete |
|
overridevirtual |
Saves current project, returns 'true' in the case of success.
The project should have a project directory defined, if it is not the case, it will launch the procedure of directory selection using callback provided.
Implements ModelView::ProjectManagerInterface.
Definition at line 139 of file projectmanagerdecorator.cpp.
References p_impl.
Referenced by TEST_F().
|
overridevirtual |
Saves the project under a given directory, returns true in the case of success.
The directory should exist already. If provided 'dirname' variable is empty, it will acquire a new project directory using dialog provided.
Implements ModelView::ProjectManagerInterface.
Definition at line 148 of file projectmanagerdecorator.cpp.
References p_impl.
Referenced by TEST_F().
|
private |
Definition at line 57 of file projectmanagerdecorator.h.
Referenced by closeCurrentProject(), createNewProject(), currentProjectDir(), isModified(), openExistingProject(), saveCurrentProject(), and saveProjectAs().