Ardour  8.12
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 class ArdourDialog;
29 class NewUserWizard;
30 class EngineControl;
31 class SessionDialog;
32 class PluginScanDialog;
33 
34 class StartupFSM : public sigc::trackable
35 {
36  public:
37  enum DialogID {
44  };
45 
46  enum Result {
51  };
52 
53  enum MainState {
60  };
61 
64 
65  void start ();
66  void reset ();
67 
68  std::string session_path;
69  std::string session_name;
70  std::string session_template;
77 
79 
80  /* It's not a dialog but we provide this to make it behave like a (non-modal)
81  * dialog
82  */
83 
84  sigc::signal1<void,Result>& signal_response() { return _signal_response; }
85 
86  bool brand_new_user() const { return new_user; }
87  void handle_path (std::string const & path);
88 
89  bool complete() const { return _state == NotWaiting; }
90  void set_complete ();
91 
92  private:
93  bool new_user;
95 
97 
99  void dialog_response_handler (int response, DialogID);
100  template<typename T> void end_dialog (T**);
101  template<typename T> void end_dialog (T&);
102 
108 
111  bool get_session_parameters_from_path (std::string const & path, std::string const & template_name, bool new_session_required);
112  void queue_finish ();
114  int check_session_parameters (bool must_be_new);
116  void engine_running ();
118 
119  /* the Audio/MIDI dialog needs to be persistent and is thus owned by
120  * ARDOUR_UI and we use it by reference. All other dialogs can be
121  * created and destroyed within the scope of startup.
122  */
123 
129 
130  sigc::connection current_dialog_connection;
131  sigc::connection app_quit_connection;
132  sigc::connection hide_quit_connection;
133 
134  sigc::signal1<void,Result> _signal_response;
135 
137 };
138 
139 #endif /* __gtk2_ardour_startup_fsm_h__ */
std::string session_path
Definition: startup_fsm.h:68
void engine_running()
StartupFSM(EngineControl &)
sigc::signal1< void, Result > _signal_response
Definition: startup_fsm.h:134
bool session_loaded
Definition: startup_fsm.h:76
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:78
int session_existing_sample_rate
Definition: startup_fsm.h:72
bool ask_about_loading_existing_session(const std::string &session_path)
XMLNode session_engine_hints
Definition: startup_fsm.h:73
Temporal::TimeDomain session_domain
Definition: startup_fsm.h:71
sigc::connection app_quit_connection
Definition: startup_fsm.h:131
bool new_user
Definition: startup_fsm.h:93
sigc::connection current_dialog_connection
Definition: startup_fsm.h:130
void show_plugin_scan_dialog()
bool get_session_parameters_from_command_line(bool new_session_required)
ArdourDialog * pre_release_dialog
Definition: startup_fsm.h:127
EngineControl & audiomidi_dialog
Definition: startup_fsm.h:124
sigc::connection hide_quit_connection
Definition: startup_fsm.h:132
void show_new_user_dialog()
@ NewSessionDialog
Definition: startup_fsm.h:40
@ PreReleaseDialog
Definition: startup_fsm.h:38
@ AudioMIDISetup
Definition: startup_fsm.h:41
@ ApplicationPseudoDialog
Definition: startup_fsm.h:43
MainState _state
Definition: startup_fsm.h:96
bool complete() const
Definition: startup_fsm.h:89
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:126
void show_pre_release_dialog()
PluginScanDialog * plugin_scan_dialog
Definition: startup_fsm.h:128
bool brand_new_user() const
Definition: startup_fsm.h:86
int check_session_parameters(bool must_be_new)
void start()
@ WaitingForEngineParams
Definition: startup_fsm.h:58
@ WaitingForPlugins
Definition: startup_fsm.h:59
@ WaitingForPreRelease
Definition: startup_fsm.h:55
@ WaitingForSessionPath
Definition: startup_fsm.h:57
@ WaitingForNewUser
Definition: startup_fsm.h:56
void end_dialog(T **)
void handle_path(std::string const &path)
NewUserWizard * new_user_dialog
Definition: startup_fsm.h:125
void dialog_hidden(Gtk::Window *)
void dialog_response_handler(int response, DialogID)
void copy_demo_sessions()
std::string session_template
Definition: startup_fsm.h:70
void set_complete()
void start_audio_midi_setup()
bool new_session_required
Definition: startup_fsm.h:94
sigc::signal1< void, Result > & signal_response()
Definition: startup_fsm.h:84
bool session_is_new
Definition: startup_fsm.h:74
void set_state(MainState)
std::string session_name
Definition: startup_fsm.h:69
void show_audiomidi_dialog()
bool session_name_edited
Definition: startup_fsm.h:75
Definition: xml++.h:114