mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Rework and clarify stopping an existing DDE process
This commit is contained in:
parent
01d7e68dbb
commit
fdcfa9657c
1 changed files with 7 additions and 10 deletions
|
@ -236,28 +236,25 @@ void DdeFaceTracker::setEnabled(bool enabled) {
|
|||
cancelCalibration();
|
||||
}
|
||||
|
||||
|
||||
// isOpen() does not work as one might expect on QUdpSocket; don't test isOpen() before closing socket.
|
||||
_udpSocket.close();
|
||||
if (enabled) {
|
||||
_udpSocket.bind(_host, _serverPort);
|
||||
}
|
||||
|
||||
// Terminate any existing DDE process, perhaps left running after an Interface crash.
|
||||
// Do this even if !enabled in case user reset their settings after crash.
|
||||
const char* DDE_EXIT_COMMAND = "exit";
|
||||
_udpSocket.bind(_host, _serverPort);
|
||||
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
|
||||
|
||||
if (enabled && !_ddeProcess) {
|
||||
// Terminate any existing DDE process, perhaps left running after an Interface crash
|
||||
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
|
||||
_ddeStopping = false;
|
||||
|
||||
qCDebug(interfaceapp) << "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);
|
||||
} else {
|
||||
// Send a command to stop face tracker evening if no _ddeProcess in case DDE has been left running after a crash
|
||||
}
|
||||
|
||||
if (!enabled && _ddeProcess) {
|
||||
_ddeStopping = true;
|
||||
_udpSocket.writeDatagram(DDE_EXIT_COMMAND, DDE_SERVER_ADDR, _controlPort);
|
||||
qCDebug(interfaceapp) << "DDE Face Tracker: Stopping";
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue