process.cpp
author insilmaril
Thu, 23 Nov 2006 13:53:08 +0000
changeset 406 1c8ff1928b97
parent 216 d5a0ea67c91d
child 408 c2a05fa925a1
permissions -rw-r--r--
Removed more QT3 stuff. Drag & Drop not 100% functional at the moment
insilmaril@0
     1
#include "process.h"
insilmaril@0
     2
insilmaril@0
     3
/////////////////////////////////////////////////////////////////
insilmaril@0
     4
// Process
insilmaril@0
     5
/////////////////////////////////////////////////////////////////
insilmaril@0
     6
Process::Process()
insilmaril@0
     7
{
insilmaril@0
     8
	connect( this, SIGNAL(readyReadStderr()),
insilmaril@0
     9
			 this, SLOT(readProcErrout()) );
insilmaril@0
    10
	connect( this, SIGNAL(readyReadStdout()),
insilmaril@0
    11
			 this, SLOT(readProcStdout()) );
insilmaril@0
    12
	clear();		 
insilmaril@0
    13
}
insilmaril@0
    14
insilmaril@0
    15
Process::~Process()
insilmaril@0
    16
{
insilmaril@0
    17
}
insilmaril@0
    18
insilmaril@0
    19
void Process::clear()
insilmaril@0
    20
{
insilmaril@0
    21
	errOut="";
insilmaril@0
    22
	stdOut="";
insilmaril@0
    23
}
insilmaril@0
    24
insilmaril@0
    25
void Process::waitFinished()
insilmaril@0
    26
{
insilmaril@0
    27
	while (isRunning())
insilmaril@0
    28
	{
insilmaril@216
    29
		// FIXME use some kind of sleep here...
insilmaril@216
    30
		system ("sleep 1");
insilmaril@0
    31
	}
insilmaril@0
    32
}
insilmaril@0
    33
insilmaril@0
    34
void Process::readProcErrout()
insilmaril@0
    35
{
insilmaril@0
    36
	errOut+=readStderr();
insilmaril@0
    37
}
insilmaril@0
    38
insilmaril@0
    39
void Process::readProcStdout()
insilmaril@0
    40
{
insilmaril@0
    41
	stdOut+=readStdout();
insilmaril@0
    42
}
insilmaril@0
    43
insilmaril@0
    44
QString Process::getErrout()
insilmaril@0
    45
{
insilmaril@0
    46
	return errOut;
insilmaril@0
    47
}
insilmaril@0
    48
insilmaril@0
    49
QString Process::getStdout()
insilmaril@0
    50
{
insilmaril@0
    51
	return stdOut;
insilmaril@0
    52
}