BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
projecthandler.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/welcomeview/projecthandler.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 Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI2_WELCOMEVIEW_PROJECTHANDLER_H
16 #define BORNAGAIN_GUI2_WELCOMEVIEW_PROJECTHANDLER_H
17 
18 #include "darefl_export.h"
19 #include <QObject>
20 #include <memory>
21 #include <vector>
22 
23 class QWidget;
24 
25 namespace ModelView {
26 class ProjectManagerInterface;
27 }
28 
29 namespace gui2 {
30 
31 class RecentProjectSettings;
32 class UserInteractor;
33 class ApplicationModels;
34 class RecentProjectWidget;
35 
36 //! Main class to coordinate all activity on user's request to create new project,
37 //! open existing one, or choose one of recent projects on disk.
38 
39 class DAREFLCORE_EXPORT ProjectHandler : public QObject {
40  Q_OBJECT
41 
42 public:
43  explicit ProjectHandler(ApplicationModels* models, QWidget* parent);
44  ~ProjectHandler() override;
45 
46 signals:
47  void currentProjectModified(const QString& project_dir, bool is_modified);
48  void recentProjectsListModified(const QStringList& projects);
49 
50 public slots:
51  void updateNames();
52  bool canCloseProject() const;
53  void onCreateNewProject();
54  void onOpenExistingProject(const QString& dirname = {});
55  void onSaveCurrentProject();
56  void onSaveProjectAs();
57 
58  void clearRecentProjectsList();
59 
60 private:
61  void initProjectManager();
62  void updateCurrentProjectName();
63  void updateRecentProjectNames();
64 
65  std::unique_ptr<RecentProjectSettings> m_recentProjectSettings;
66  std::unique_ptr<UserInteractor> m_userInteractor;
67  std::unique_ptr<ModelView::ProjectManagerInterface> m_projectManager;
68  ApplicationModels* m_models{nullptr};
69 };
70 
71 } // namespace gui2
72 
73 #endif // BORNAGAIN_GUI2_WELCOMEVIEW_PROJECTHANDLER_H
Main class to holds all models of GUI session.
Main class to coordinate all activity on user's request to create new project, open existing one,...
std::unique_ptr< ModelView::ProjectManagerInterface > m_projectManager
void recentProjectsListModified(const QStringList &projects)
std::unique_ptr< RecentProjectSettings > m_recentProjectSettings
~ProjectHandler() override
std::unique_ptr< UserInteractor > m_userInteractor
void currentProjectModified(const QString &project_dir, bool is_modified)
materialitems.h Collection of materials to populate MaterialModel.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20