Ardour  9.0-pre0-582-g084a23a80d
startup_fsm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __gtk2_ardour_startup_fsm_h__
20 #define __gtk2_ardour_startup_fsm_h__
21 
22 #include <string>
23 
24 #include <sigc++/trackable.h>
25 
26 #include "ardour/types.h"
27 
28 namespace Gtk
29 {
30 class Window;
31 } // namespace Gtk
32 
33 class ArdourDialog;
34 class NewUserWizard;
35 class EngineControl;
36 class SessionDialog;
37 class PluginScanDialog;
38 
39 class StartupFSM : public sigc::trackable
40 {
41  public:
42  enum DialogID {
49  };
50 
51  enum Result {
56  };
57 
58  enum MainState {
65  };
66 
69 
70  void start ();
71  void reset ();
72 
73  std::string session_path;
74  std::string session_name;
75  std::string session_template;
82 
84 
85  /* It's not a dialog but we provide this to make it behave like a (non-modal)
86  * dialog
87  */
88 
89  sigc::signal1<void,Result>& signal_response() { return _signal_response; }
90 
91  bool brand_new_user() const { return new_user; }
92  void handle_path (std::string const & path);
93 
94  bool complete() const { return _state == NotWaiting; }
95  void set_complete ();
96 
97  private:
98  bool new_user;
100 
102 
104  void dialog_response_handler (int response, DialogID);
105  template<typename T> void end_dialog (T**);
106  template<typename T> void end_dialog (T&);
107 
113 
116  bool get_session_parameters_from_path (std::string const & path, std::string const & template_name, bool new_session_required);
117  void queue_finish ();
119  int check_session_parameters (bool must_be_new);
121  void engine_running ();
123 
124  /* the Audio/MIDI dialog needs to be persistent and is thus owned by
125  * ARDOUR_UI and we use it by reference. All other dialogs can be
126  * created and destroyed within the scope of startup.
127  */
128 
134 
135  sigc::connection current_dialog_connection;
136  sigc::connection app_quit_connection;
137  sigc::connection hide_quit_connection;
138 
139  sigc::signal1<void,Result> _signal_response;
140 
142 };
143 
144 #endif /* __gtk2_ardour_startup_fsm_h__ */
std::string session_path
Definition: startup_fsm.h:73
void engine_running()
StartupFSM(EngineControl &)
sigc::signal1< void, Result > _signal_response
Definition: startup_fsm.h:139
bool session_loaded
Definition: startup_fsm.h:81
void handle_waiting_for_session_path()
void queue_finish()
void show_session_dialog(bool new_session_required)
void end_dialog(T &)
ARDOUR::BusProfile bus_profile
Definition: startup_fsm.h:83
int session_existing_sample_rate
Definition: startup_fsm.h:77
bool ask_about_loading_existing_session(const std::string &session_path)
XMLNode session_engine_hints
Definition: startup_fsm.h:78
Temporal::TimeDomain session_domain
Definition: startup_fsm.h:76
sigc::connection app_quit_connection
Definition: startup_fsm.h:136
bool new_user
Definition: startup_fsm.h:98
sigc::connection current_dialog_connection
Definition: startup_fsm.h:135
void show_plugin_scan_dialog()
bool get_session_parameters_from_command_line(bool new_session_required)
ArdourDialog * pre_release_dialog
Definition: startup_fsm.h:132
EngineControl & audiomidi_dialog
Definition: startup_fsm.h:129
sigc::connection hide_quit_connection
Definition: startup_fsm.h:137
void show_new_user_dialog()
@ NewSessionDialog
Definition: startup_fsm.h:45
@ PreReleaseDialog
Definition: startup_fsm.h:43
@ AudioMIDISetup
Definition: startup_fsm.h:46
@ ApplicationPseudoDialog
Definition: startup_fsm.h:48
MainState _state
Definition: startup_fsm.h:101
bool complete() const
Definition: startup_fsm.h:94
void reset()
bool get_session_parameters_from_path(std::string const &path, std::string const &template_name, bool new_session_required)
SessionDialog * session_dialog
Definition: startup_fsm.h:131
void show_pre_release_dialog()
PluginScanDialog * plugin_scan_dialog
Definition: startup_fsm.h:133
bool brand_new_user() const
Definition: startup_fsm.h:91
int check_session_parameters(bool must_be_new)
void start()
@ WaitingForEngineParams
Definition: startup_fsm.h:63
@ WaitingForPlugins
Definition: startup_fsm.h:64
@ WaitingForPreRelease
Definition: startup_fsm.h:60
@ WaitingForSessionPath
Definition: startup_fsm.h:62
@ WaitingForNewUser
Definition: startup_fsm.h:61
void end_dialog(T **)
void handle_path(std::string const &path)
NewUserWizard * new_user_dialog
Definition: startup_fsm.h:130
void dialog_hidden(Gtk::Window *)
void dialog_response_handler(int response, DialogID)
void copy_demo_sessions()
std::string session_template
Definition: startup_fsm.h:75
void set_complete()
void start_audio_midi_setup()
bool new_session_required
Definition: startup_fsm.h:99
sigc::signal1< void, Result > & signal_response()
Definition: startup_fsm.h:89
bool session_is_new
Definition: startup_fsm.h:79
void set_state(MainState)
std::string session_name
Definition: startup_fsm.h:74
void show_audiomidi_dialog()
bool session_name_edited
Definition: startup_fsm.h:80
Definition: Window.h:41
Definition: xml++.h:114
Definition: ardour_ui.h:188