UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
LaunchManager Class Reference

#include <launch_manager.hpp>

Inheritance diagram for LaunchManager:
Inheritance graph
Collaboration diagram for LaunchManager:
Collaboration graph

Public Member Functions

 ~LaunchManager ()
 
std::unique_ptr< LaunchContext > extractCurrentCtx ()
 
LaunchContext::Type getCurrentStatus () const
 
void launch (std::unique_ptr< LaunchContext > &&ctx)
 
void reLaunch (std::unique_ptr< LaunchContext > &&ctx)
 
void stop ()
 

Private Slots

void processFinished ()
 

Private Member Functions

void doLaunch (std::unique_ptr< LaunchContext > &&ctx)
 

Private Attributes

std::unique_ptr< LaunchContext > currentLaunch
 
std::unique_ptr< LaunchContext > queuedLaunch
 

Detailed Description

Definition at line 52 of file launch_manager.hpp.

Constructor & Destructor Documentation

◆ ~LaunchManager()

LaunchManager::~LaunchManager ( )

Definition at line 4 of file launch_manager.cpp.

4 {
6 auto& p = currentLaunch->process;
7 p.blockSignals(true);
8 p.terminate();
9 p.waitForFinished(500);
10 if(p.state() != QProcess::NotRunning){
11 p.kill();
12 p.waitForFinished(1000);
13 }
14 }
15 queuedLaunch.reset();
16}
std::unique_ptr< LaunchContext > currentLaunch
std::unique_ptr< LaunchContext > queuedLaunch

References currentLaunch, and queuedLaunch.

Member Function Documentation

◆ doLaunch()

void LaunchManager::doLaunch ( std::unique_ptr< LaunchContext > && ctx)
private

Definition at line 30 of file launch_manager.cpp.

30 {
31 currentLaunch = std::move(ctx);
32
33 connect(&currentLaunch->process,
34 QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
35 this, &LaunchManager::processFinished, Qt::UniqueConnection);
36
37 currentLaunch->process.start(currentLaunch->executablePath, currentLaunch->args);
38
39 if(!currentLaunch->process.waitForStarted()){
40 //Shouldn't happen as we probe ug executability at startup
41 abort_msgBox("Failed to launch process. Did the ug executable disappear?");
42 }
43}
static void abort_msgBox(const char *msg)
Definition debug.hpp:20

References abort_msgBox(), currentLaunch, and processFinished().

Referenced by launch(), and processFinished().

Here is the call graph for this function:

◆ extractCurrentCtx()

std::unique_ptr< LaunchContext > LaunchManager::extractCurrentCtx ( )

Definition at line 59 of file launch_manager.cpp.

59 {
60 auto ret = std::move(currentLaunch);
61 return ret;
62}

References currentLaunch.

◆ getCurrentStatus()

◆ launch()

void LaunchManager::launch ( std::unique_ptr< LaunchContext > && ctx)

Definition at line 18 of file launch_manager.cpp.

18 {
20 doLaunch(std::move(ctx));
21 } else {
23 return;
24 }
25 queuedLaunch = std::move(ctx);
26 currentLaunch->terminate();
27 }
28}
void doLaunch(std::unique_ptr< LaunchContext > &&ctx)
LaunchContext::Type getCurrentStatus() const

References currentLaunch, doLaunch(), getCurrentStatus(), LaunchContext::None, queuedLaunch, and LaunchContext::Run.

Here is the call graph for this function:

◆ processFinished

void LaunchManager::processFinished ( )
privateslot

Definition at line 52 of file launch_manager.cpp.

52 {
53 currentLaunch.reset();
54
55 if(queuedLaunch)
56 doLaunch(std::move(queuedLaunch));
57}

References currentLaunch, doLaunch(), and queuedLaunch.

Referenced by doLaunch().

Here is the call graph for this function:

◆ reLaunch()

void LaunchManager::reLaunch ( std::unique_ptr< LaunchContext > && ctx)

Definition at line 65 of file launch_manager.cpp.

65 {
66 queuedLaunch = std::move(ctx);
67}

References queuedLaunch.

◆ stop()

void LaunchManager::stop ( )

Definition at line 45 of file launch_manager.cpp.

45 {
46 if(!currentLaunch)
47 return;
48
49 currentLaunch->terminate();
50}

References currentLaunch.

Referenced by UltragridWindow::closeEvent(), UltragridWindow::enablePreview(), and UltragridWindow::startStop().

Member Data Documentation

◆ currentLaunch

std::unique_ptr<LaunchContext> LaunchManager::currentLaunch
private

◆ queuedLaunch

std::unique_ptr<LaunchContext> LaunchManager::queuedLaunch
private

Definition at line 71 of file launch_manager.hpp.

Referenced by ~LaunchManager(), launch(), processFinished(), and reLaunch().


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