API Documentation
Loading...
Searching...
No Matches
ApplicationLauncherButton.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Button.h>
4#include <NDEVR/BasicThread.h>
5#include <NDEVR/File.h>
6#include <NDEVR/Pointer.h>
7#include <NDEVR/LocalApplicationLauncher.h>
8namespace NDEVR
9{
10 /**--------------------------------------------------------------------------------------------------
11 \brief Creates a button for launching a 3rd party application. While the application is
12 running the button is pressed. When application terminates button is unpressed automatically.
13 **/
15 {
16 public:
19 ApplicationLauncherButtonManager(const File& application_file, const String& args = String());
21 ApplicationLauncherButtonManager(Button* button, const File& application_file, const String& args = String());
23 void setAppFinishedCallback(std::function<void()> callback);
24 void setAppLaunchCallback(std::function<void()> callback);
25 void setMakeChildProcess(bool is_child_process);
27 void setEnabled(bool enabled);
29 void launch();
31 void setEnvironment(const String& env);
32 void setArgs(const String& args);
33 void setIconToApp(Button* button);
34 void setNameToApp(Button* button);
36 void setupButton(Button* button);
37 private:
38 void execute();
39 void _setupButton(Button* button);
40 protected:
43 std::function<void()> m_callback_function;
44 std::function<void()> m_launch_function;
45#if NDEVR_SUPPORTS_THREADING
46 BasicThread* m_launch_thread = nullptr;
47#endif
48 bool m_is_enabled = true;
49 };
50}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:59
Creates a button for launching a 3rd party application. While the application is running the button i...
Definition ApplicationLauncherButton.h:15
void setAppLaunchCallback(std::function< void()> callback)
ApplicationLauncherButtonManager(Button *button, const File &application_file, const String &args=String())
void setApplication(DynamicPointer< LocalApplicationLauncher > launcher)
std::function< void()> m_callback_function
Definition ApplicationLauncherButton.h:43
DynamicPointer< LocalApplicationLauncher > m_launcher
Definition ApplicationLauncherButton.h:42
void setAppFinishedCallback(std::function< void()> callback)
ApplicationLauncherButtonManager(Button *button, const DynamicPointer< LocalApplicationLauncher > &launcher)
ApplicationLauncherButtonManager(const DynamicPointer< LocalApplicationLauncher > &launcher)
Buffer< QPointer< Button > > m_buttons
Definition ApplicationLauncherButton.h:41
void setMakeChildProcess(bool is_child_process)
ApplicationLauncherButtonManager(const File &application_file, const String &args=String())
void setArgs(const String &args)
std::function< void()> m_launch_function
Definition ApplicationLauncherButton.h:44
void setEnvironment(const String &env)
const DynamicPointer< LocalApplicationLauncher > & launcher() const
A class that allows user to use a function inline to execute something.
Definition BasicThread.h:45
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A core widget that allows the user to click one of many button types.
Definition Button.h:66
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
Logic for reading or writing to a file as well as navigating filesystems.
Definition File.h:48
The core String class for the NDEVR API.
Definition String.h:69
Definition ACIColor.h:37