* 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.
*/
#include "qt_helpers.h"
+#include "support/debug.h"
#include "support/Systemcall.h"
#include <QApplication>
};
-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 &)));
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);
}
} // namespace frontend
} // namespace lyx
-#include "moc_GuiProgress.cpp"
\ No newline at end of file
+#include "moc_GuiProgress.cpp"