harbour-fernschreiber/src/processlauncher.cpp
Slava Monich 162e1ca996 Take logging categories into use
Logging can be enabled in release build like this:

QT_LOGGING_RULES="fernschreiber.*=true" harbour-fernschreiber

See https://doc.qt.io/qt-5/qloggingcategory.html for more details.
2020-11-22 16:40:55 +02:00

23 lines
667 B
C++

#include "processlauncher.h"
#include <QProcess>
#include <QStandardPaths>
#define DEBUG_MODULE ProcessLauncher
#include "debuglog.h"
ProcessLauncher::ProcessLauncher(QObject *parent) : QObject(parent)
{
}
bool ProcessLauncher::launchProgram(const QString &program, const QStringList &arguments)
{
const QString executablePath(QStandardPaths::findExecutable(program));
if (executablePath.isEmpty()) {
LOG("Program" << program << "not found");
return false;
}
QProcess *process = new QProcess(this);
connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
return process->startDetached(program, arguments);
}