From ddc38c93ca7c8e96ab1988626903c39b484cacca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20K=C3=BCmmel?= Date: Mon, 7 Jun 2010 20:25:41 +0000 Subject: [PATCH] don't block GUI when showing all debug messages git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34612 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiProgress.cpp | 10 ++++++++++ src/frontends/qt4/GuiProgress.h | 11 +++++++---- src/support/debug.cpp | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/frontends/qt4/GuiProgress.cpp b/src/frontends/qt4/GuiProgress.cpp index 0f6724c956..28367deddb 100644 --- a/src/frontends/qt4/GuiProgress.cpp +++ b/src/frontends/qt4/GuiProgress.cpp @@ -58,6 +58,10 @@ GuiProgress::GuiProgress() SLOT(doError(QString const &, QString const &))); connect(this, SIGNAL(information(QString const &, QString const &)), SLOT(doInformation(QString const &, QString const &))); + + flushDelay_.setInterval(200); + flushDelay_.setSingleShot(true); + connect(&flushDelay_, SIGNAL(timeout()), this, SLOT(updateWithLyXErr())); } @@ -98,6 +102,12 @@ void GuiProgress::doClearMessages() void GuiProgress::lyxerrFlush() +{ + flushDelay_.start(); +} + + +void GuiProgress::updateWithLyXErr() { appendLyXErrMessage(toqstr(lyxerr_stream_.str())); lyxerr_stream_.str(""); diff --git a/src/frontends/qt4/GuiProgress.h b/src/frontends/qt4/GuiProgress.h index 49f1e2b4b8..9c475ad9a1 100644 --- a/src/frontends/qt4/GuiProgress.h +++ b/src/frontends/qt4/GuiProgress.h @@ -17,7 +17,7 @@ #include "DockView.h" -#include + #include #include @@ -41,8 +41,8 @@ public: void lyxerrConnect(); void lyxerrDisconnect(); void lyxerrFlush(); - - static QString currentTime(); + + static QString currentTime(); Q_SIGNALS: @@ -76,10 +76,13 @@ private Q_SLOTS: void doError(QString const &, QString const &); void doInformation(QString const &, QString const &); + void updateWithLyXErr(); + private: void appendText(QString const &); - std::ostringstream lyxerr_stream_; + std::ostringstream lyxerr_stream_; + QTimer flushDelay_; }; diff --git a/src/support/debug.cpp b/src/support/debug.cpp index a7c64385d4..1656967e70 100644 --- a/src/support/debug.cpp +++ b/src/support/debug.cpp @@ -202,7 +202,7 @@ LyXErr & toStream(LyXErr & l, T t) { if (l.enabled()){ l.stream() << t; - if (l.second_used()){ + if (l.second_used()) { l.second() << t; ProgressInterface::instance()->lyxerrFlush(); } -- 2.39.2