BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
projectmanagerdecorator.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/model/mvvm/project/projectmanagerdecorator.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_MVVM_MODEL_MVVM_PROJECT_PROJECTMANAGERDECORATOR_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_PROJECT_PROJECTMANAGERDECORATOR_H
17 
19 #include <memory>
20 
21 namespace ModelView {
22 
23 struct ProjectContext;
24 struct UserInteractionContext;
25 
26 //! Decorator for ProjectManager to provide interaction with the user on open/save-as requests.
27 //! It relies on the same interface and adds additional logic related to "unsaved" data.
28 
29 //! For example, on createNewProject it will check if previous project is saved, and will
30 //! call external dialog save/discard/cancel via provided callback.
31 
32 class MVVM_MODEL_EXPORT ProjectManagerDecorator : public ProjectManagerInterface {
33 public:
34  ProjectManagerDecorator(const ProjectContext& project_context,
35  const UserInteractionContext& user_context);
36 
40 
41  bool createNewProject(const std::string& dirname = {}) override;
42 
43  bool saveCurrentProject() override;
44 
45  bool saveProjectAs(const std::string& dirname = {}) override;
46 
47  bool openExistingProject(const std::string& dirname = {}) override;
48 
49  std::string currentProjectDir() const override;
50 
51  bool isModified() const override;
52 
53  bool closeCurrentProject() const override;
54 
55 private:
56  struct ProjectManagerImpl;
57  std::unique_ptr<ProjectManagerImpl> p_impl;
58 };
59 
60 } // namespace ModelView
61 
62 #endif // BORNAGAIN_MVVM_MODEL_MVVM_PROJECT_PROJECTMANAGERDECORATOR_H
Decorator for ProjectManager to provide interaction with the user on open/save-as requests.
std::unique_ptr< ProjectManagerImpl > p_impl
ProjectManagerDecorator(const ProjectManagerDecorator &other)=delete
ProjectManagerDecorator & operator=(const ProjectManagerDecorator &other)=delete
Interface class for ProjectManager family.
materialitems.h Collection of materials to populate MaterialModel.
Defines class CLASS?
Provides necessary information for Project construction.
Definition: project_types.h:32
Defines the context to interact with the user regarding save/save-as/create-new project scenarious.
Definition: project_types.h:48