Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm_application.h
1// SPDX-FileCopyrightText: © 2019-2025 Alexandros Theodotou <alex@zrythm.org>
2/* SPDX-License-Identifier: LicenseRef-ZrythmLicense */
3
4#pragma once
5
6#include "engine/session/control_room.h"
7#include "engine/session/midi_mapping.h"
8#include "gui/backend/alert_manager.h"
9#include "gui/backend/backend/theme_manager.h"
10#include "gui/backend/device_manager.h"
11#include "gui/backend/file_system_model.h"
12#include "gui/backend/plugin_manager.h"
13#include "gui/backend/project_manager.h"
14#include "gui/backend/translation_manager.h"
15#include "utils/app_settings.h"
16#include "utils/directory_manager.h"
17#include "utils/qt.h"
18#include "utils/rt_thread_id.h"
19
20#include <QApplication>
21#include <QCommandLineParser>
22#include <QLocalSocket>
23#include <QProcess>
24#include <QQmlApplicationEngine>
25#include <QTranslator>
26
27namespace backward
28{
29class SignalHandling;
30}
31
32namespace zrythm::gui
33{
34
35class ZrythmApplication final : public QApplication
36{
37 Q_OBJECT
38 Q_PROPERTY (
39 zrythm::gui::ThemeManager * themeManager READ themeManager CONSTANT FINAL)
40 Q_PROPERTY (
41 zrythm::utils::AppSettings * appSettings READ appSettings CONSTANT FINAL)
42 Q_PROPERTY (
43 zrythm::gui::ProjectManager * projectManager READ projectManager CONSTANT
44 FINAL)
45 Q_PROPERTY (
47 pluginManager CONSTANT FINAL)
48 Q_PROPERTY (
49 zrythm::gui::AlertManager * alertManager READ alertManager CONSTANT FINAL)
50 Q_PROPERTY (
51 zrythm::gui::TranslationManager * translationManager READ translationManager
52 CONSTANT FINAL)
53 Q_PROPERTY (
54 zrythm::gui::backend::DeviceManager * deviceManager READ deviceManager
55 CONSTANT FINAL)
56 Q_PROPERTY (
57 zrythm::gui::FileSystemModel * fileSystemModel READ fileSystemModel CONSTANT
58 FINAL)
59 Q_PROPERTY (
60 zrythm::engine::session::ControlRoom * controlRoom READ controlRoom CONSTANT
61 FINAL)
62 QML_ELEMENT
63 QML_UNCREATABLE ("")
64
65public:
66 ZrythmApplication (int &argc, char ** argv);
67 ~ZrythmApplication () override;
68 Z_DISABLE_COPY_MOVE (ZrythmApplication)
69
70 void setup_ui ();
71 void setup_ipc ();
72 void launch_engine_process ();
73
74 zrythm::gui::ThemeManager * themeManager () const
75 {
76 return theme_manager_.get ();
77 }
78 zrythm::utils::AppSettings * appSettings () const
79 {
80 return app_settings_.get ();
81 }
82 zrythm::gui::ProjectManager * projectManager () const
83 {
84 return project_manager_.get ();
85 }
86 old_dsp::plugins::PluginManager * pluginManager () const
87 {
88 return plugin_manager_.get ();
89 }
90 zrythm::gui::AlertManager * alertManager () const
91 {
92 return alert_manager_.get ();
93 }
94 zrythm::gui::TranslationManager * translationManager () const
95 {
96 return translation_manager_.get ();
97 }
98 zrythm::gui::backend::DeviceManager * deviceManager () const
99 {
100 return device_manager_.get ();
101 }
102 zrythm::gui::FileSystemModel * fileSystemModel () const
103 {
104 return file_system_model_.get ();
105 }
106
107 engine::session::ControlRoom * controlRoom () const
108 {
109 return control_room_.get ();
110 }
111
112 DirectoryManager &get_directory_manager () const { return *dir_manager_; }
113
114 QQmlApplicationEngine * get_qml_engine () const { return qml_engine_; }
115
116 bool notify (QObject * receiver, QEvent * event) override;
117
118 std::shared_ptr<gui::backend::DeviceManager> get_device_manager () const
119 {
120 return device_manager_;
121 }
122
123private:
124 void setup_command_line_options ();
125
126 void post_exec_initialization ();
127
128 void setup_device_manager ();
129
130 void setup_control_room ();
131
132private Q_SLOTS:
133 void onEngineOutput ();
134 void onAboutToQuit ();
135
136public:
137 RTThreadId::IdType qt_thread_id_;
138 QCommandLineParser cmd_line_parser_;
139
140private:
141 std::unique_ptr<backward::SignalHandling> signal_handling_;
142 std::unique_ptr<juce::ScopedJuceInitialiser_GUI>
143 juce_message_handler_initializer_;
144
146
150 QLocalSocket * socket_ = nullptr;
151
152 std::unique_ptr<DirectoryManager> dir_manager_;
159
164 plugin_manager_;
165
169 QProcess * engine_process_ = nullptr;
170
171 QQmlApplicationEngine * qml_engine_ = nullptr;
172
173 QTranslator * translator_ = nullptr;
174
175 std::shared_ptr<gui::backend::DeviceManager> device_manager_;
176
178 std::unique_ptr<engine::session::MidiMappings> midi_mappings_;
179};
180
181} // namespace zrythm::gui
This can just be created on the stack as needed since it uses globally available information.
Abstraction to control the signal coming in from Master and going out into the speakers.
This doesn't work - see https://forum.qt.io/topic/124965/how-to-define-a-property-of-type-palette/8.
Wrapper over juce::AudioDeviceManager that exposes changes as signals.
The PluginManager is responsible for scanning and keeping track of available Plugin's.
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:38