aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina/ExternalProcess.h
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/libLumina/ExternalProcess.h')
-rw-r--r--src-qt5/core/libLumina/ExternalProcess.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/src-qt5/core/libLumina/ExternalProcess.h b/src-qt5/core/libLumina/ExternalProcess.h
index b1e56af8..e75d6108 100644
--- a/src-qt5/core/libLumina/ExternalProcess.h
+++ b/src-qt5/core/libLumina/ExternalProcess.h
@@ -15,26 +15,31 @@
#include <QString>
#include <QTimer>
#include <QApplication>
+#include <QDebug>
class ExternalProcess : public QProcess{
Q_OBJECT
private:
bool cursorRestored;
+ QString logoutput;
private slots:
void resetCursor(){
+ //qDebug() << "External Process: Reset Mouse Cursor =" << !cursorRestored;
if(!cursorRestored){
QApplication::restoreOverrideCursor();
cursorRestored = true;
}
}
void processStarting(){
+ //qDebug() << "Starting External Process: Mouse Notification =" << !cursorRestored;
if(!cursorRestored){
- QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
- QTimer::singleShot(15000, this, SLOT(resetCursor()) );
+ QApplication::setOverrideCursor( QCursor(Qt::BusyCursor) );
+ QTimer::singleShot(3000, this, SLOT(resetCursor()) );
}
}
void processFinished(){
+ //qDebug() << "External Process Finished: Reset Mouse Cursor =" << !cursorRestored;
if(!cursorRestored){
QApplication::restoreOverrideCursor();
cursorRestored = true;
@@ -42,6 +47,9 @@ private slots:
//Clean up this object
this->deleteLater();
}
+ void updateLog(){
+ logoutput.append( QString(this->readAllStandardOutput()) );
+ }
public:
ExternalProcess(QString logfile = "", bool manageCursors = false) : QProcess(){
@@ -49,10 +57,13 @@ public:
cursorRestored = !manageCursors;
if(logfile.isEmpty()){
this->setStandardOutputFile(QProcess::nullDevice());
+ }else if(logfile=="stdout"){
+ connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(updateLog()) );
}else{
this->setStandardOutputFile(logfile);
}
//Setup the connection for automatic cleanup
+ connect(this, SIGNAL(started()), this, SLOT(processStarting()) );
connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished()) );
}
@@ -62,7 +73,12 @@ public:
}*/
}
- static void launch(QString program, QStringList args = QStringList(), bool manageCursors = false){
+ QString log(){
+ //NOTE: This will only contain output if the "stdout" argument is used as the logfile
+ return logoutput;
+ }
+
+ static void launch(QString program, QStringList args = QStringList(), bool manageCursors = true){
//Quick launch of a process with logging disabled and automatic cleanup
ExternalProcess *tmp = new ExternalProcess("", manageCursors);
if(args.isEmpty()){ tmp->start(program); }
bgstack15