BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
projectchangecontroller.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/projectchangecontroller.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_PROJECTCHANGECONTROLLER_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_PROJECT_PROJECTCHANGECONTROLLER_H
17 
18 #include "mvvm/model_export.h"
19 #include <functional>
20 #include <memory>
21 #include <vector>
22 
23 namespace ModelView {
24 
25 class SessionModel;
26 class ModelHasChangedController;
27 
28 //! Tracks changes in all models.
29 //! Allows to check if one or more models have been changed since last call of ::resetChanged().
30 //! This is intended to work together with the Project class. It will take care of calling
31 //! resetChanged after own saving.
32 
33 //! To avoid extra signaling while being in already "changed" mode, the controller reports only
34 //! once.
35 
36 class MVVM_MODEL_EXPORT ProjectChangedController {
37 public:
38  using callback_t = std::function<void()>;
39  ProjectChangedController(const std::vector<SessionModel*>& models,
40  callback_t project_changed_callback = {});
42 
43  bool hasChanged() const;
44 
45  void resetChanged();
46 
47 private:
49  std::unique_ptr<ProjectChangedControllerImpl> p_impl;
50 };
51 
52 } // namespace ModelView
53 
54 #endif // BORNAGAIN_MVVM_MODEL_MVVM_PROJECT_PROJECTCHANGECONTROLLER_H
std::unique_ptr< ProjectChangedControllerImpl > p_impl
materialitems.h Collection of materials to populate MaterialModel.