diff options
Diffstat (limited to 'src-qt5/core/libLumina/ExternalProcess.h')
-rw-r--r-- | src-qt5/core/libLumina/ExternalProcess.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src-qt5/core/libLumina/ExternalProcess.h b/src-qt5/core/libLumina/ExternalProcess.h index 1325247f..8329c361 100644 --- a/src-qt5/core/libLumina/ExternalProcess.h +++ b/src-qt5/core/libLumina/ExternalProcess.h @@ -13,17 +13,40 @@ #include <QProcess> #include <QString> +#include <QTimer> +#include <QApplication> class ExternalProcess : public QProcess{ Q_OBJECT +private: + bool cursorRestored; + private slots: + void resetCursor(){ + if(!cursorRestored){ + QApplication::restoreOverrideCursor(); + cursorRestored = true; + } + } + void processStarting(){ + if(!cursorRestored){ + QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) ); + QTimer::singleShot(15000, this, SLOT(resetCursor()) ); + } + } void processFinished(){ + if(!cursorRestored){ + QApplication::restoreOverrideCursor(); + cursorRestored = true; + } //Clean up this object this->deleteLater(); } + public: - ExternalProcess(QString logfile = "") : QProcess(){ + ExternalProcess(QString logfile = "", bool manageCursors = true) : QProcess(){ this->setProcessChannelMode(QProcess::MergedChannels); + cursorRestored = !manageCursors; if(logfile.isEmpty()){ this->setStandardOutputFile(QProcess::nullDevice()); }else{ @@ -32,6 +55,7 @@ public: //Setup the connection for automatic cleanup connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished()) ); } + ~ExternalProcess(){ /*if(this->state() == QProcess::Running){ this->detach(); //about to close down the QProcess - detach the other program so it can continue functioning normally. |