X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiProgress.cpp;h=aec058cf8e66110787aa9fe23ce71a0882b90308;hb=59e0cb8f85f0d2f985b31532dd3308315659c662;hp=7680e9a765f6977992e2f37a651b0581ba20c0b2;hpb=114f245404cfd9764818f071f7e223ac6cf889d8;p=lyx.git diff --git a/src/frontends/qt4/GuiProgress.cpp b/src/frontends/qt4/GuiProgress.cpp index 7680e9a765..aec058cf8e 100644 --- a/src/frontends/qt4/GuiProgress.cpp +++ b/src/frontends/qt4/GuiProgress.cpp @@ -5,6 +5,7 @@ * Licence details can be found in the file COPYING. * * \author Peter Kümmel + * \author Pavel Sanda * * Full author contact details are available in file CREDITS. */ @@ -16,6 +17,7 @@ #include "qt_helpers.h" +#include "support/debug.h" #include "support/Systemcall.h" #include @@ -39,7 +41,7 @@ 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 &))); @@ -56,22 +58,30 @@ 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"); } @@ -89,13 +99,51 @@ void GuiProgress::doAppendError(QString const & msg) void GuiProgress::doClearMessages() { - view_->message(docstring()); + clearMessageText(); +} + + +void GuiProgress::startFlushing() +{ + flushDelay_.start(); +} + + +void GuiProgress::lyxerrFlush() +{ + triggerFlush(); +} + + +void GuiProgress::updateWithLyXErr() +{ + appendLyXErrMessage(toqstr(lyxerr_stream_.str())); + lyxerr_stream_.str(""); +} + + +void GuiProgress::lyxerrConnect() +{ + lyxerr.setSecondStream(&lyxerr_stream_); +} + + +void GuiProgress::lyxerrDisconnect() +{ + lyxerr.setSecondStream(0); +} + + +GuiProgress::~GuiProgress() +{ + lyxerrDisconnect(); } void GuiProgress::appendText(QString const & text) { - view_->updateMessage(text); + if (!text.isEmpty()) + updateStatusBarMessage(text); } @@ -140,4 +188,4 @@ void GuiProgress::doInformation(QString const & title, QString const & message) } // namespace frontend } // namespace lyx -#include "moc_GuiProgress.cpp" \ No newline at end of file +#include "moc_GuiProgress.cpp"