Major reorganization of the project files
FossilOrigin-Name: 821239471319fdd5d530f54b7f67f473dcf7bd8e
This commit is contained in:
22
src/LoggedProcess.cpp
Normal file
22
src/LoggedProcess.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "LoggedProcess.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
LoggedProcess::LoggedProcess(QObject *parent) : QProcess(parent)
|
||||
{
|
||||
setProcessChannelMode(QProcess::MergedChannels);
|
||||
connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(onReadyReadStandardOutput()));
|
||||
}
|
||||
|
||||
void LoggedProcess::getLogAndClear(QByteArray &buffer)
|
||||
{
|
||||
QMutexLocker lck(&mutex);
|
||||
buffer = log;
|
||||
log.clear();
|
||||
}
|
||||
|
||||
void LoggedProcess::onReadyReadStandardOutput()
|
||||
{
|
||||
QMutexLocker lck(&mutex);
|
||||
log.append(readAllStandardOutput());
|
||||
}
|
||||
|
Reference in New Issue
Block a user