26 #include <QMessageBox>
29 : mProcess( NULL ), mOutput( NULL )
41 connect(
mProcess, SIGNAL( error( QProcess::ProcessError ) ),
this, SLOT(
processError( QProcess::ProcessError ) ) );
47 connect(
mProcess, SIGNAL( finished(
int, QProcess::ExitStatus ) ),
this, SLOT(
processExit(
int, QProcess::ExitStatus ) ) );
57 QObject* mOutputObj =
dynamic_cast<QObject *
>(
mOutput );
60 connect( mOutputObj, SIGNAL( destroyed() ),
this, SLOT(
dialogGone() ) );
68 if ( !
mProcess->startDetached( action ) )
70 QMessageBox::critical( 0,
tr(
"Action" ),
71 tr(
"Unable to run command\n%1" ).arg( action ),
72 QMessageBox::Ok, Qt::NoButton );
93 QString line(
mProcess->readAllStandardOutput() );
101 QString line(
mProcess->readAllStandardError() );
138 disconnect(
mProcess, SIGNAL( error( QProcess::ProcessError ) ),
this, SLOT(
processError( QProcess::ProcessError ) ) );
141 disconnect(
mProcess, SIGNAL( finished(
int, QProcess::ExitStatus ) ),
this, SLOT(
processExit(
int, QProcess::ExitStatus ) ) );
148 if ( err == QProcess::FailedToStart )
157 QgsDebugMsg(
"Got error: " + QString(
"%d" ).arg( err ) );
virtual void setTitle(const QString &title)=0
set title for the messages
static QgsMessageOutput * createMessageOutput()
function that returns new class derived from QgsMessageOutput (don't forget to delete it then) ...
virtual void appendMessage(const QString &message)=0
message to be appended to the current text
virtual void setMessage(const QString &message, MessageType msgType)=0
set message, it won't be displayed until
void processError(QProcess::ProcessError)
virtual void showMessage(bool blocking=true)=0
display the message to the user
void processExit(int, QProcess::ExitStatus)
Interface for showing messages from QGIS in GUI independent way.
QgsRunProcess(const QString &action, bool capture)
QgsMessageOutput * mOutput