X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiProgress.cpp;h=aec058cf8e66110787aa9fe23ce71a0882b90308;hb=59e0cb8f85f0d2f985b31532dd3308315659c662;hp=7347f30ace4a5287a0786baddde2c95b2991a8e5;hpb=7a0c8c7df8c77a242653867d5b131e7b537bde9e;p=lyx.git diff --git a/src/frontends/qt4/GuiProgress.cpp b/src/frontends/qt4/GuiProgress.cpp index 7347f30ace..aec058cf8e 100644 --- a/src/frontends/qt4/GuiProgress.cpp +++ b/src/frontends/qt4/GuiProgress.cpp @@ -41,14 +41,13 @@ public: }; -GuiProgress::GuiProgress(GuiView * view) : view_(view) +GuiProgress::GuiProgress() { connect(this, SIGNAL(processStarted(QString const &)), SLOT(doProcessStarted(QString const &))); connect(this, SIGNAL(processFinished(QString const &)), SLOT(doProcessFinished(QString const &))); connect(this, SIGNAL(appendMessage(QString const &)), SLOT(doAppendMessage(QString const &))); connect(this, SIGNAL(appendError(QString const &)), SLOT(doAppendError(QString const &))); connect(this, SIGNAL(clearMessages()), SLOT(doClearMessages())); - connect(this, SIGNAL(lyxerrFlush()), SLOT(dolyxerrFlush())); // Alert interface connect(this, SIGNAL(warning(QString const &, QString const &)), @@ -59,28 +58,36 @@ GuiProgress::GuiProgress(GuiView * view) : view_(view) SLOT(doError(QString const &, QString const &))); connect(this, SIGNAL(information(QString const &, QString const &)), SLOT(doInformation(QString const &, QString const &))); + connect(this, SIGNAL(triggerFlush()), + SLOT(startFlushing())); - support::ProgressInterface::setInstance(this); + flushDelay_.setInterval(200); + flushDelay_.setSingleShot(true); + connect(&flushDelay_, SIGNAL(timeout()), this, SLOT(updateWithLyXErr())); +} + + +QString GuiProgress::currentTime() +{ + return QTime::currentTime().toString("hh:mm:ss.zzz"); } void GuiProgress::doProcessStarted(QString const & cmd) { - QString time = QTime::currentTime().toString(); - appendText(time + ": <" + cmd + "> started\n"); + appendText(currentTime() + ": <" + cmd + "> started"); } void GuiProgress::doProcessFinished(QString const & cmd) { - QString time = QTime::currentTime().toString(); - appendText(time + ": <" + cmd + "> done\n"); + appendText(currentTime() + ": <" + cmd + "> done"); } void GuiProgress::doAppendMessage(QString const & msg) { - appendText(msg + "\n"); + appendText(msg); } @@ -92,29 +99,38 @@ void GuiProgress::doAppendError(QString const & msg) void GuiProgress::doClearMessages() { - view_->message(docstring()); + clearMessageText(); +} + + +void GuiProgress::startFlushing() +{ + flushDelay_.start(); +} + + +void GuiProgress::lyxerrFlush() +{ + triggerFlush(); } -void GuiProgress::dolyxerrFlush() +void GuiProgress::updateWithLyXErr() { - appendError(toqstr(lyxerr_stream_.str())); + appendLyXErrMessage(toqstr(lyxerr_stream_.str())); lyxerr_stream_.str(""); - // give the user a chance to disable debug messages because - // showing Debug::ANY messages completely blocks the GUI - QApplication::processEvents(); } void GuiProgress::lyxerrConnect() { - lyxerr.setSecond(&lyxerr_stream_); + lyxerr.setSecondStream(&lyxerr_stream_); } void GuiProgress::lyxerrDisconnect() { - lyxerr.setSecond(0); + lyxerr.setSecondStream(0); } @@ -127,7 +143,7 @@ GuiProgress::~GuiProgress() void GuiProgress::appendText(QString const & text) { if (!text.isEmpty()) - view_->updateMessage(text); + updateStatusBarMessage(text); }