Class Application#
Defined in File application.hpp
Inheritance Relationships#
Base Type#
public QObject
Class Documentation#
-
class Application : public QObject#
Top-level application object — owns all subsystem managers and orchestrates startup and shutdown ordering.
Created once in
main()(inside the auth loop) and destroyed when the user quits or switches profiles. All subsystem managers are owned here and accessible via typed accessors.See also
ProfileManager, AppSettings, RecordManager
- Lifecycle
Application app; app.initialize("cognitive_lab"); // loads settings, opens cameras, shows window QApplication::exec(); // run the event loop // shutdown() is called automatically via QCoreApplication::aboutToQuit
Note
Not a singleton — a fresh instance is created for each profile session so there is no stale state when the user switches profiles.
Public Functions
-
explicit Application(QObject *parent = nullptr)#
-
~Application() override#
-
void initialize(const QString &username = "guest", bool isAdmin = false)#
Initialises all subsystems and shows the main window.
Must be called exactly once after
QApplicationis constructed. The method:Opens a per-profile log file.
Loads
AppSettingsfrom the profile’ssettings.json(falls back to defaults if the file does not exist).Creates
TriggerManagerand installs keyboard event filters.Creates
AudioManager.Creates
VideoManagerand opens configured cameras.Creates
RecordManager.Creates and shows
MainWindow.
- Parameters:
username – Active profile name. Pass
"guest"for an unauthenticated session that uses default paths.isAdmin – Whether
username'sprofile hasProfile::Role::Admin. Gates per-user recording access control: an admin’s session browser/Analysis tab aggregate every known profile’s recordings instead of being scoped to just their own, and a one-time flat-session-folder migration runs only when this is true.
-
void shutdown()#
Saves settings and closes the window.
Connected to
QCoreApplication::aboutToQuitautomatically — calling it manually is safe but unnecessary in normal usage.
-
AppSettings &settings()#
- Returns:
A mutable reference to the current session’s AppSettings.
-
const AppSettings &settings() const#
- Returns:
An immutable reference to the current session’s AppSettings.
-
QString active_username() const#
- Returns:
The username of the currently active profile (
"guest"if no profile was selected at login).
-
TriggerManager *trigger_manager() const#
- Returns:
The application-wide TriggerManager, or
nullptrbefore initialize() has been called.
-
AudioManager *audio_manager() const#
- Returns:
The application-wide AudioManager.
-
VideoManager *video_manager() const#
- Returns:
The application-wide VideoManager.
-
RecordManager *record_manager() const#
- Returns:
The application-wide RecordManager.
Signals
-
void initialized()#
Emitted at the end of initialize() when all subsystems are ready.
-
void shutdown_complete()#
Emitted at the end of shutdown() after all resources are released.