]> git.lyx.org Git - features.git/commitdiff
don't block GUI when showing all debug messages
authorPeter Kümmel <syntheticpp@gmx.net>
Mon, 7 Jun 2010 20:25:41 +0000 (20:25 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Mon, 7 Jun 2010 20:25:41 +0000 (20:25 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34612 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiProgress.cpp
src/frontends/qt4/GuiProgress.h
src/support/debug.cpp

index 0f6724c95609e9ce1c1c161c8a248228a5e31c91..28367deddbf1cec580d7a0bde444a6e7a1c180e1 100644 (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("");
index 49f1e2b4b887f4017ccd2ef0c40b8974779855ec..9c475ad9a17781b89b259fefd83077126a990a21 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "DockView.h"
 
-#include <QTextEdit>
+
 #include <QSplashScreen>
 #include <QTimer>
 
@@ -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_;
 };
 
 
index a7c64385d4615ad8f41e0545375b76f321fbdd73..1656967e7011cc619299cbaf1d5b9ff1242a2b58 100644 (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();
                }