lib/core/presenter/Presenter.hpp
1 #pragma once
2 #include <score/actions/ActionManager.hpp>
3 #include <score/actions/MenuManager.hpp>
4 #include <score/actions/ToolbarManager.hpp>
5 #include <score/application/ApplicationComponents.hpp>
6 #include <score/application/GUIApplicationContext.hpp>
7 
8 #include <core/presenter/DocumentManager.hpp>
9 #include <core/settings/Settings.hpp>
10 
11 #include <QMenuBar>
12 
13 #include <score_lib_base_export.h>
14 
15 #include <vector>
16 #include <verdigris>
17 class QObject;
18 
19 namespace score
20 {
21 
22 class CoreApplicationPlugin;
23 class View;
24 class Settings;
25 
35 class SCORE_LIB_BASE_EXPORT Presenter final : public QObject
36 {
37  W_OBJECT(Presenter)
38  friend class score::CoreApplicationPlugin;
39 
40 public:
41  Presenter(
43  score::ProjectSettings& pset, score::View* view, QObject* parent);
44  ~Presenter();
45  // Exit score
46  bool exit();
47 
48  View* view() const;
49 
50  auto& menuManager() { return m_menus; }
51  auto& toolbarManager() { return m_toolbars; }
52  auto& actionManager() { return m_actions; }
53 
54  // Called after all the classes
55  // have been loaded from plug-ins.
56  void setupGUI();
57 
58  auto& documentManager() { return m_docManager; }
59  const ApplicationComponents& applicationComponents() { return m_components_readonly; }
60  const GUIApplicationContext& applicationContext() { return m_context; }
61 
62  auto& components() { return m_components; }
63  auto& settings() { return m_settings; }
64 
65  void optimize();
66 
67 private:
68  void setupMenus();
69  View* m_view{};
70  Settings& m_settings;
71  ProjectSettings& m_projectSettings;
72 
73  DocumentManager m_docManager;
74  ApplicationComponentsData m_components;
75  ApplicationComponents m_components_readonly;
76 
77  QMenuBar* m_menubar{};
78  GUIApplicationContext m_context;
79 
80  MenuManager m_menus;
81  ToolbarManager m_toolbars;
82  ActionManager m_actions;
83 };
84 }
The ActionManager class.
Definition: ActionManager.hpp:19
Definition: ApplicationComponents.hpp:68
Base actions for the score software.
Definition: CoreApplicationPlugin.hpp:16
Owns the documents.
Definition: DocumentManager.hpp:49
The MenuManager class.
Definition: MenuManager.hpp:15
The Presenter class.
Definition: lib/core/presenter/Presenter.hpp:36
Definition: lib/core/settings/Settings.hpp:70
Application-wide user settings registering and handling.
Definition: lib/core/settings/Settings.hpp:42
The ToolbarManager class.
Definition: ToolbarManager.hpp:15
The main display of the application.
Definition: lib/core/view/Window.hpp:41
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: ApplicationComponents.hpp:46
Load-time settings.
Definition: ApplicationSettings.hpp:17
Specializes ApplicationContext with the QMainWindow.
Definition: GUIApplicationContext.hpp:15