mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 21:35:04 +02:00
Handle DDE stopping unexpectedly
This commit is contained in:
parent
3b6a35c38f
commit
b7f7cebb80
2 changed files with 14 additions and 1 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "DdeFaceTracker.h"
|
||||
#include "FaceshiftConstants.h"
|
||||
#include "InterfaceLogging.h"
|
||||
#include "Menu.h"
|
||||
|
||||
|
||||
static const QHostAddress DDE_SERVER_ADDR("127.0.0.1");
|
||||
|
@ -178,6 +179,7 @@ void DdeFaceTracker::setEnabled(bool enabled) {
|
|||
if (enabled && !_ddeProcess) {
|
||||
qDebug() << "[Info] DDE Face Tracker Starting";
|
||||
_ddeProcess = new QProcess(qApp);
|
||||
connect(_ddeProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus)));
|
||||
_ddeProcess->start(QCoreApplication::applicationDirPath() + DDE_PROGRAM_PATH, DDE_ARGUMENTS);
|
||||
}
|
||||
|
||||
|
@ -195,6 +197,16 @@ void DdeFaceTracker::setEnabled(bool enabled) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void DdeFaceTracker::processFinished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
if (_ddeProcess) {
|
||||
// DDE crashed or was manually terminated
|
||||
qDebug() << "[Info] DDE Face Tracker Stopped Unexpectedly";
|
||||
_udpSocket.close();
|
||||
_ddeProcess = NULL;
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::NoFaceTracking, true);
|
||||
}
|
||||
}
|
||||
|
||||
void DdeFaceTracker::resetTracking() {
|
||||
qDebug() << "[Info] Reset DDE Tracking";
|
||||
const char* DDE_RESET_COMMAND = "reset";
|
||||
|
|
|
@ -53,6 +53,7 @@ public slots:
|
|||
void resetTracking();
|
||||
|
||||
private slots:
|
||||
void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
//sockets
|
||||
void socketErrorOccurred(QAbstractSocket::SocketError socketError);
|
||||
|
|
Loading…
Reference in a new issue