pure-cpp 1.0.0
A C++ physics simulation benchmark comparing performance with Python implementations
App::AppManager Class Reference

Orchestrates the application's lifecycle: setup, execution, and cleanup. More...

#include <app_manager.hpp>

Inheritance diagram for App::AppManager:
Inheritance graph
Collaboration diagram for App::AppManager:
Collaboration graph

Public Member Functions

 AppManager ()
 Constructs the application manager and sets application-wide metadata. More...
 
bool setup ()
 Sets up all application components before running. More...
 
int run ()
 Runs the main application event loop. More...
 

Private Slots

void cleanup ()
 Performs cleanup after the event loop has finished. More...
 

Private Attributes

std::unique_ptr< AppUtils::Loggerlogger_
 The logger for the application. More...
 
std::unique_ptr< CmdLine::CmdLineArgsargs_
 The command line arguments for the application. More...
 
std::unique_ptr< Window::QmlBridgebridge_
 The QML bridge for exposing C++ functionality. More...
 
QMainWindow * mainWindow_
 The main window (stored for proper cleanup order). More...
 

Detailed Description

Orchestrates the application's lifecycle: setup, execution, and cleanup.

This class encapsulates the initialisation of translations, argument parsing, logging, and the QML interface, simplifying the global main() function.

Definition at line 25 of file app_manager.hpp.

Constructor & Destructor Documentation

◆ AppManager()

App::AppManager::AppManager ( )

Constructs the application manager and sets application-wide metadata.

Definition at line 26 of file app_manager.cpp.

Member Function Documentation

◆ cleanup

void App::AppManager::cleanup ( )
privateslot

Performs cleanup after the event loop has finished.

According to Qt best practices, we should let QApplication handle widget destruction automatically. However, QWindowContainer has a special requirement: the QWindow (Display) must still be valid when the container is destroyed. Therefore, we must destroy the container explicitly BEFORE QmlBridge (which owns Display) is destroyed.

Definition at line 153 of file app_manager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

int App::AppManager::run ( )

Runs the main application event loop.

Returns
The application exit code.

Definition at line 73 of file app_manager.cpp.

Here is the call graph for this function:

◆ setup()

bool App::AppManager::setup ( )

Sets up all application components before running.

Returns
True on success, false on failure or if –help/–version was requested.

Definition at line 39 of file app_manager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ args_

std::unique_ptr<CmdLine::CmdLineArgs> App::AppManager::args_
private

The command line arguments for the application.

Definition at line 54 of file app_manager.hpp.

◆ bridge_

std::unique_ptr<Window::QmlBridge> App::AppManager::bridge_
private

The QML bridge for exposing C++ functionality.

Definition at line 56 of file app_manager.hpp.

◆ logger_

std::unique_ptr<AppUtils::Logger> App::AppManager::logger_
private

The logger for the application.

Definition at line 52 of file app_manager.hpp.

◆ mainWindow_

QMainWindow* App::AppManager::mainWindow_
private

The main window (stored for proper cleanup order).

Definition at line 58 of file app_manager.hpp.


The documentation for this class was generated from the following files: