NDEVR
API Documentation
ApplicationLauncherButtonManager

Creates a button for launching a 3rd party application. More...

Collaboration diagram for ApplicationLauncherButtonManager:
[legend]

Public Member Functions

 ApplicationLauncherButtonManager ()
 Constructs an ApplicationLauncherButtonManager with no application or button set.
 ApplicationLauncherButtonManager (Button *button)
 Constructs an ApplicationLauncherButtonManager and associates it with the given button.
 ApplicationLauncherButtonManager (Button *button, const DynamicPointer< LocalApplicationLauncher > &launcher)
 Constructs an ApplicationLauncherButtonManager with a button and an application launcher.
 ApplicationLauncherButtonManager (Button *button, const File &application_file, const StringView &args=StringView())
 Constructs an ApplicationLauncherButtonManager with a button, application file, and optional arguments.
 ApplicationLauncherButtonManager (const DynamicPointer< LocalApplicationLauncher > &launcher)
 Constructs an ApplicationLauncherButtonManager with the given application launcher.
 ApplicationLauncherButtonManager (const File &application_file, const StringView &args=StringView())
 Constructs an ApplicationLauncherButtonManager from an application file path and optional arguments.
ButtoncreateButton ()
 Creates a new Button configured to launch the application.
void killProcess ()
 Kills the currently running application process.
void launch ()
 Launches the application.
const DynamicPointer< LocalApplicationLauncher > & launcher () const
 Returns the current application launcher.
void setAppFinishedCallback (std::function< void()> callback)
 Sets a callback to be invoked when the launched application finishes execution.
void setAppLaunchCallback (std::function< void()> callback)
 Sets a callback to be invoked when the application is launched.
void setApplication (DynamicPointer< LocalApplicationLauncher > launcher)
 Sets the application launcher to use.
void setArgs (const StringView &args)
 Sets the command-line arguments for the launched application.
void setBackupIcon (const StringView &backup_icon)
 Sets a backup icon to use when the application's own icon cannot be found.
void setEnabled (bool enabled)
 Enables or disables the ability to launch the application.
void setEnvironment (const StringView &env)
 Sets the environment variables for the launched application.
void setIconToApp (Button *button)
 Sets the given button's icon to the application's icon.
void setMakeChildProcess (bool is_child_process)
 Sets whether the launched application should run as a child process.
void setNameToApp (Button *button)
 Sets the given button's text to the application's name.
void setOverrideIcon (const StringView &override_icon)
 Sets an icon that overrides the application's default icon.
void setupButton (Button *button)
 Configures an existing button to launch the application and reflect its running state.

Protected Attributes

String m_backup_icon
 Fallback icon name used when the application icon is unavailable.
Buffer< QPointer< Button > > m_buttons
 All buttons associated with this launcher manager.
std::function< void()> m_callback_function
 Callback invoked when the application finishes.
bool m_is_enabled = true
 Whether launching the application is currently enabled.
std::function< void()> m_launch_function
 Callback invoked when the application launches.
BasicThreadm_launch_thread = nullptr
 Thread used to monitor the launched application process.
DynamicPointer< LocalApplicationLauncherm_launcher
 The application launcher instance.
String m_override_icon
 Icon name that overrides the application's default icon.

Detailed Description

Creates a button for launching a 3rd party application.


While the application is running the button is pressed. When application terminates button is unpressed automatically.

Definition at line 14 of file ApplicationLauncherButton.h.

Constructor & Destructor Documentation

◆ ApplicationLauncherButtonManager() [1/5]

ApplicationLauncherButtonManager::ApplicationLauncherButtonManager ( const DynamicPointer< LocalApplicationLauncher > & launcher)

Constructs an ApplicationLauncherButtonManager with the given application launcher.

Parameters
[in]launcherThe application launcher to manage.

References launcher().

◆ ApplicationLauncherButtonManager() [2/5]

ApplicationLauncherButtonManager::ApplicationLauncherButtonManager ( const File & application_file,
const StringView & args = StringView() )

Constructs an ApplicationLauncherButtonManager from an application file path and optional arguments.

Parameters
[in]application_fileThe file path to the application executable.
[in]argsOptional command-line arguments to pass to the application.

◆ ApplicationLauncherButtonManager() [3/5]

ApplicationLauncherButtonManager::ApplicationLauncherButtonManager ( Button * button)

Constructs an ApplicationLauncherButtonManager and associates it with the given button.

Parameters
[in]buttonThe button to associate with the application launch.

◆ ApplicationLauncherButtonManager() [4/5]

ApplicationLauncherButtonManager::ApplicationLauncherButtonManager ( Button * button,
const File & application_file,
const StringView & args = StringView() )

Constructs an ApplicationLauncherButtonManager with a button, application file, and optional arguments.

Parameters
[in]buttonThe button to associate with the application launch.
[in]application_fileThe file path to the application executable.
[in]argsOptional command-line arguments to pass to the application.

◆ ApplicationLauncherButtonManager() [5/5]

ApplicationLauncherButtonManager::ApplicationLauncherButtonManager ( Button * button,
const DynamicPointer< LocalApplicationLauncher > & launcher )

Constructs an ApplicationLauncherButtonManager with a button and an application launcher.

Parameters
[in]buttonThe button to associate with the application launch.
[in]launcherThe application launcher to manage.

References launcher().

Member Function Documentation

◆ createButton()

Button * ApplicationLauncherButtonManager::createButton ( )

Creates a new Button configured to launch the application.

Returns
A pointer to the newly created Button.

◆ launcher()

const DynamicPointer< LocalApplicationLauncher > & ApplicationLauncherButtonManager::launcher ( ) const

Returns the current application launcher.

Returns
A const reference to the managed application launcher.

Referenced by ApplicationLauncherButtonManager(), ApplicationLauncherButtonManager(), and setApplication().

◆ setAppFinishedCallback()

void ApplicationLauncherButtonManager::setAppFinishedCallback ( std::function< void()> callback)

Sets a callback to be invoked when the launched application finishes execution.

Parameters
[in]callbackThe function to call when the application terminates.

◆ setAppLaunchCallback()

void ApplicationLauncherButtonManager::setAppLaunchCallback ( std::function< void()> callback)

Sets a callback to be invoked when the application is launched.

Parameters
[in]callbackThe function to call when the application starts.

◆ setApplication()

void ApplicationLauncherButtonManager::setApplication ( DynamicPointer< LocalApplicationLauncher > launcher)

Sets the application launcher to use.

Parameters
[in]launcherThe application launcher to manage.

References launcher().

◆ setArgs()

void ApplicationLauncherButtonManager::setArgs ( const StringView & args)

Sets the command-line arguments for the launched application.

Parameters
[in]argsThe arguments string.

◆ setBackupIcon()

void ApplicationLauncherButtonManager::setBackupIcon ( const StringView & backup_icon)

Sets a backup icon to use when the application's own icon cannot be found.

Parameters
[in]backup_iconThe name of the backup icon resource.

◆ setEnabled()

void ApplicationLauncherButtonManager::setEnabled ( bool enabled)

Enables or disables the ability to launch the application.

Parameters
[in]enabledWhether launching is enabled.

◆ setEnvironment()

void ApplicationLauncherButtonManager::setEnvironment ( const StringView & env)

Sets the environment variables for the launched application.

Parameters
[in]envThe environment variable string.

◆ setIconToApp()

void ApplicationLauncherButtonManager::setIconToApp ( Button * button)

Sets the given button's icon to the application's icon.

Parameters
[in]buttonThe button whose icon will be updated.

◆ setMakeChildProcess()

void ApplicationLauncherButtonManager::setMakeChildProcess ( bool is_child_process)

Sets whether the launched application should run as a child process.

Parameters
[in]is_child_processWhether to launch as a child process.

◆ setNameToApp()

void ApplicationLauncherButtonManager::setNameToApp ( Button * button)

Sets the given button's text to the application's name.

Parameters
[in]buttonThe button whose text will be updated.

◆ setOverrideIcon()

void ApplicationLauncherButtonManager::setOverrideIcon ( const StringView & override_icon)

Sets an icon that overrides the application's default icon.

Parameters
[in]override_iconThe name of the override icon resource.

◆ setupButton()

void ApplicationLauncherButtonManager::setupButton ( Button * button)

Configures an existing button to launch the application and reflect its running state.

Parameters
[in]buttonThe button to set up.

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