]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiProgress.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiProgress.cpp
index c43a96922b01e51828ae01b03db830134086ca79..0735265384532e891035c4346f3fecb3a128d498 100644 (file)
@@ -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 <QApplication>
@@ -42,8 +44,7 @@ public:
 GuiProgress::GuiProgress(GuiView * view) : view_(view)
 {
        connect(this, SIGNAL(processStarted(QString const &)), SLOT(doProcessStarted(QString const &)));
-       // Don't overwrite other result messages.
-       //connect(this, SIGNAL(processFinished(QString const &)), SLOT(doProcessFinished(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()));
@@ -65,28 +66,26 @@ GuiProgress::GuiProgress(GuiView * view) : view_(view)
 void GuiProgress::doProcessStarted(QString const & cmd)
 {
        QString time = QTime::currentTime().toString();
-       appendText(time + ": <" + cmd + "> started\n");
+       appendText(time + ": <" + cmd + "> started");
 }
 
 
 void GuiProgress::doProcessFinished(QString const & cmd)
 {
        QString time = QTime::currentTime().toString();
-       appendText(time + ": <" + cmd + "> done\n");
+       appendText(time + ": <" + cmd + "> done");
 }
 
 
 void GuiProgress::doAppendMessage(QString const & msg)
 {
-       QString time = QTime::currentTime().toString();
-       appendText(time + " : " + msg);
+       appendText(msg);
 }
 
 
 void GuiProgress::doAppendError(QString const & msg)
 {
-       QString time = QTime::currentTime().toString();
-       appendText(time + " : " + msg);
+       appendText(msg);
 }
 
 
@@ -96,9 +95,35 @@ void GuiProgress::doClearMessages()
 }
 
 
+void GuiProgress::lyxerrFlush()
+{
+       appendLyXErrMessage(toqstr(lyxerr_stream_.str()));
+       lyxerr_stream_.str("");
+}
+
+
+void GuiProgress::lyxerrConnect()
+{
+       lyxerr.setSecond(&lyxerr_stream_);
+}
+
+
+void GuiProgress::lyxerrDisconnect()
+{
+       lyxerr.setSecond(0);
+}
+
+
+GuiProgress::~GuiProgress()
+{
+       lyxerrDisconnect();
+}
+
+
 void GuiProgress::appendText(QString const & text)
 {
-       view_->updateMessage(text);
+       if (!text.isEmpty())
+               view_->updateMessage(text);
 }