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
This commit is contained in:
Peter Kümmel 2010-06-07 20:25:41 +00:00
parent fea446303d
commit ddc38c93ca
3 changed files with 18 additions and 5 deletions

View File

@ -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("");

View File

@ -17,7 +17,7 @@
#include "DockView.h"
#include <QTextEdit>
#include <QSplashScreen>
#include <QTimer>
@ -42,7 +42,7 @@ public:
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_;
QTimer flushDelay_;
};

View File

@ -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();
}