]> git.lyx.org Git - features.git/commitdiff
also process user input, trigger more processEvents
authorPeter Kümmel <syntheticpp@gmx.net>
Fri, 4 Dec 2009 11:08:24 +0000 (11:08 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Fri, 4 Dec 2009 11:08:24 +0000 (11:08 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32328 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/Systemcall.cpp
src/support/SystemcallPrivate.h

index f1d3e7540825a2085f58b3c367d06362b12f8406..83373d012d5cc37ed0c330ab65623881285714f5 100644 (file)
@@ -28,7 +28,7 @@
 #include <QTime>
 #include <QThread>
 #include <QCoreApplication>
-
+#include <QDebug>
 
 #define USE_QPROCESS
 
@@ -138,7 +138,7 @@ int Systemcall::startscript(Starttype how, string const & what)
 
 
 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()) {
@@ -167,19 +167,28 @@ void SystemcallPrivate::startProcess(const QString& cmd)
        }
 }
 
+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) {
@@ -259,6 +268,7 @@ void SystemcallPrivate::stdOut()
                        }
                }
        }
+       processEvents();
 }
 
 
@@ -276,6 +286,21 @@ void SystemcallPrivate::stdErr()
                        }
                }
        }
+       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;
 }
 
 
@@ -319,20 +344,6 @@ QString SystemcallPrivate::errorMessage() const
 }
 
 
-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_)
index ff4afed0ea88419bb2f2d8505b62b624c4776aff..4151940278386b7794e7f31041d69180a4725d67 100644 (file)
@@ -80,8 +80,10 @@ private:
        bool showout_;
        /// 
        bool showerr_;
+       bool process_events;
 
        void waitAndProcessEvents();
+       void processEvents();
 
        void killProcess();