]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiProgress.cpp
Remove the .aux and .bbl files and update the citation labels
[lyx.git] / src / frontends / qt4 / GuiProgress.cpp
index 2d237522fb141300d8377f940854391fce2df5e2..aec058cf8e66110787aa9fe23ce71a0882b90308 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>
@@ -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,48 +58,92 @@ 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");
 }
 
 
 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);
 }
 
 
 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);
 }
 
 
@@ -142,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"