#include <QTime>
#include <QThread>
#include <QCoreApplication>
-
+#include <QDebug>
#define USE_QPROCESS
SystemcallPrivate::SystemcallPrivate(const std::string& of) :
- proc_(new QProcess), outindex_(0),
+ proc_(new QProcess), outindex_(0), process_events(false),
errindex_(0), outfile(of), showout_(false), showerr_(false)
{
if (!outfile.empty()) {
}
}
+void SystemcallPrivate::processEvents()
+{
+ if(process_events) {
+ //static int count = 0; qDebug() << count++ << ": waitAndProcessEvents";
+ QCoreApplication::processEvents(QEventLoop::AllEvents);
+ }
+}
void SystemcallPrivate::waitAndProcessEvents()
{
Sleep::millisec(100);
- QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
+ processEvents();
}
-bool SystemcallPrivate::waitWhile(State waitwhile, bool process_events, int timeout)
+bool SystemcallPrivate::waitWhile(State waitwhile, bool proc_events, int timeout)
{
if (!proc_)
return false;
+ process_events = proc_events;
+
// Block GUI while waiting,
// relay on QProcess' wait functions
if (!process_events) {
}
}
}
+ processEvents();
}
}
}
}
+ processEvents();
+}
+
+
+void SystemcallPrivate::processStarted()
+{
+ state = Running;
+ // why do we get two started signals?
+ //disconnect(proc_, SIGNAL(started()), this, SLOT(processStarted()));
+}
+
+
+void SystemcallPrivate::processFinished(int, QProcess::ExitStatus status)
+{
+ state = Finished;
}
}
-void SystemcallPrivate::processStarted()
-{
- state = Running;
- // why do we get two started signals?
- //disconnect(proc_, SIGNAL(started()), this, SLOT(processStarted()));
-}
-
-
-void SystemcallPrivate::processFinished(int, QProcess::ExitStatus status)
-{
- state = Finished;
-}
-
-
QString SystemcallPrivate::exitStatusMessage() const
{
if (!proc_)