VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtAppLauncherComponent Class Reference

Detailed Description

DtAppLauncherComponent allows the system to launch external applications when a player engages in a role. It provides capabilities to configure application paths, working directories, command-line arguments, as well as control the window positioning, sizing, and lifecycle management of the launched application.

#include <appLauncherComponent.h>

Inheritance diagram for makVre::DtAppLauncherComponent:
[legend]

Public Slots

void handleProcessStarted ()
 
void handleProcessFailed (QProcess::ProcessError error)
 
void handleProcessFinished (int exitCode, QProcess::ExitStatus exitStatus)
 

Public Member Functions

 DtAppLauncherComponent ()
 
virtual ~DtAppLauncherComponent () override
 
virtual bool initialize (DtPlayerStation *station, DtInitTable &config) override
 
virtual void tick (double dt) override
 
virtual bool repositionAndResizeWindow ()
 
virtual void shutdown () override
 
virtual const char * type () const override
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual bool postInitialize ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual void onCurrentStateChanged (std::string state)
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

bool myShutdownOnDisengage
 
QProcess * myProcess
 
bool myWindowPositioned
 
int myHeight
 
int myWidth
 
int myPositionX
 
int myPositionY
 
std::string myWindowTitle
 
float myBackOnTopDelay
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Constructor & Destructor Documentation

◆ DtAppLauncherComponent()

makVre::DtAppLauncherComponent::DtAppLauncherComponent ( )

Constructor for DtAppLauncherComponent.

Initializes component properties with default values.

◆ ~DtAppLauncherComponent()

virtual makVre::DtAppLauncherComponent::~DtAppLauncherComponent ( )
overridevirtual

Virtual destructor for DtAppLauncherComponent.

Ensures proper cleanup of resources when the component is destroyed.

Member Function Documentation

◆ initialize()

virtual bool makVre::DtAppLauncherComponent::initialize ( DtPlayerStation * station,
DtInitTable & config )
overridevirtual

Initializes the component with configuration from Lua.

Sets up the component based on provided configuration, including application path, working directory, command-line arguments, window geometry, and behavior settings. Launches the configured application and sets up signal connections for process events.

Parameters
stationPointer to the player station this component belongs to
configConfiguration table containing initialization parameters
Returns
True if initialization succeeds, false otherwise

Reimplemented from makVre::DtPlayerComponent.

◆ tick()

virtual void makVre::DtAppLauncherComponent::tick ( double dt)
overridevirtual

Updates the component state.

Called each frame to handle component logic. Manages window positioning and ensures the VR Engage window returns to foreground after a configured delay.

Parameters
dtDelta time in seconds since the last tick

Implements makVre::DtPlayerComponent.

◆ repositionAndResizeWindow()

virtual bool makVre::DtAppLauncherComponent::repositionAndResizeWindow ( )
virtual

Repositions and resizes the launched application window.

Attempts to find the window by title and applies the configured position and size.

Returns
True if the window was found and positioned, false otherwise

◆ shutdown()

virtual void makVre::DtAppLauncherComponent::shutdown ( )
overridevirtual

Shuts down the component.

Removes attribute callbacks and terminates the launched process if configured to do so when disengaging.

Reimplemented from makVre::DtPlayerComponent.

◆ type()

virtual const char * makVre::DtAppLauncherComponent::type ( ) const
overridevirtual

Returns the component type identifier.

Returns
The component type string

Implements makVre::DtPlayerComponent.

◆ handleProcessStarted

void makVre::DtAppLauncherComponent::handleProcessStarted ( )
slot

Slot called when the launched process has started.

Logs a success message when the external process starts successfully.

◆ handleProcessFailed

void makVre::DtAppLauncherComponent::handleProcessFailed ( QProcess::ProcessError error)
slot

Slot called when the launched process fails to start.

Logs a warning when the external process fails to start.

Parameters
errorThe process error that occurred

◆ handleProcessFinished

void makVre::DtAppLauncherComponent::handleProcessFinished ( int exitCode,
QProcess::ExitStatus exitStatus )
slot

Slot called when the launched process finishes execution.

Cleans up resources and removes the process reference from the attribute store.

Parameters
exitCodeThe exit code returned by the process
exitStatusThe exit status of the process

◆ onCurrentStateChanged()

virtual void makVre::DtAppLauncherComponent::onCurrentStateChanged ( std::string state)
protectedvirtual

Called when the current application-level state changes.

Handles state transitions, particularly when entering the ENGAGED state.

Parameters
stateThe new application state

Member Data Documentation

◆ myShutdownOnDisengage

bool makVre::DtAppLauncherComponent::myShutdownOnDisengage
protected

Flag indicating whether to shut down the launched application when disengaging.

◆ myProcess

QProcess* makVre::DtAppLauncherComponent::myProcess
protected

Pointer to the QProcess object representing the launched application.

◆ myWindowPositioned

bool makVre::DtAppLauncherComponent::myWindowPositioned
protected

Flag indicating whether the window has been positioned.

◆ myHeight

int makVre::DtAppLauncherComponent::myHeight
protected

Desired height for the launched application window in pixels.

◆ myWidth

int makVre::DtAppLauncherComponent::myWidth
protected

Desired width for the launched application window in pixels.

◆ myPositionX

int makVre::DtAppLauncherComponent::myPositionX
protected

Desired X position for the launched application window.

◆ myPositionY

int makVre::DtAppLauncherComponent::myPositionY
protected

Desired Y position for the launched application window.

◆ myWindowTitle

std::string makVre::DtAppLauncherComponent::myWindowTitle
protected

Window title of the launched application used for finding the window handle.

◆ myBackOnTopDelay

float makVre::DtAppLauncherComponent::myBackOnTopDelay
protected

Delay in seconds before bringing the VR Engage window back to the foreground.


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