mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
also process user input, trigger more processEvents
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32328 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6598b9e2a4
commit
74e77476b5
@ -28,7 +28,7 @@
|
|||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#define USE_QPROCESS
|
#define USE_QPROCESS
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ int Systemcall::startscript(Starttype how, string const & what)
|
|||||||
|
|
||||||
|
|
||||||
SystemcallPrivate::SystemcallPrivate(const std::string& of) :
|
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)
|
errindex_(0), outfile(of), showout_(false), showerr_(false)
|
||||||
{
|
{
|
||||||
if (!outfile.empty()) {
|
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()
|
void SystemcallPrivate::waitAndProcessEvents()
|
||||||
{
|
{
|
||||||
Sleep::millisec(100);
|
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_)
|
if (!proc_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
process_events = proc_events;
|
||||||
|
|
||||||
// Block GUI while waiting,
|
// Block GUI while waiting,
|
||||||
// relay on QProcess' wait functions
|
// relay on QProcess' wait functions
|
||||||
if (!process_events) {
|
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
|
QString SystemcallPrivate::exitStatusMessage() const
|
||||||
{
|
{
|
||||||
if (!proc_)
|
if (!proc_)
|
||||||
|
@ -80,8 +80,10 @@ private:
|
|||||||
bool showout_;
|
bool showout_;
|
||||||
///
|
///
|
||||||
bool showerr_;
|
bool showerr_;
|
||||||
|
bool process_events;
|
||||||
|
|
||||||
void waitAndProcessEvents();
|
void waitAndProcessEvents();
|
||||||
|
void processEvents();
|
||||||
|
|
||||||
void killProcess();
|
void killProcess();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user