#include "GuiProgressView.h"
#include "GuiApplication.h"
+#include "GuiProgress.h"
#include "qt_helpers.h"
#include "FuncRequest.h"
Qt::WindowFlags flags)
: DockView(parent, "progress", qt_("Progress/Debug Messages"), area, flags)
{
- widget_ = new ProgressViewWidget();
+ eol_last_ = true;
+ widget_ = new ProgressViewWidget;
widget_->setMinimumHeight(150);
widget_->debugMessagesTW->setSizePolicy(QSizePolicy::Ignored,
QSizePolicy::Expanding);
connect(progress, SIGNAL(appendMessage(QString const &)),
this, SLOT(appendText(QString const &)));
connect(progress, SIGNAL(appendLyXErrMessage(QString const &)),
- this, SLOT(appendLyXErrText(QString const &)));
+ this, SLOT(appendLyXErrText(QString const &)), Qt::QueuedConnection);
connect(progress, SIGNAL(appendError(QString const &)),
this, SLOT(appendText(QString const &)));
connect(progress, SIGNAL(clearMessages()), this, SLOT(clearText()));
void GuiProgressView::clearText()
{
- if (widget_->autoClearCB->isChecked())
+ if (widget_->autoClearCB->isChecked()){
widget_->outTE->clear();
+ eol_last_ = true;
+ }
}
widget_->outTE->moveCursor(QTextCursor::End);
widget_->outTE->insertPlainText(text);
widget_->outTE->ensureCursorVisible();
-
+ eol_last_ = false;
// Give the user a chance to disable debug messages because
// showing Debug::ANY messages completely blocks the GUI.
// Text is not always send as the whole line, so we must be
// careful about eolns.
// WARNING: processing events could cause crashes!
// TODO: find a better solution
- if (text.endsWith("\n"))
+ if (text.endsWith("\n")) {
+ eol_last_ = true;
QApplication::processEvents();
+ }
}
return;
QString str = GuiProgress::currentTime();
str += ": " + text;
- if (!text.endsWith("\n"))
- str += "\n";
+ if (!eol_last_)
+ str = "\n" + str;
+ eol_last_ = text.endsWith("\n");
widget_->outTE->moveCursor(QTextCursor::End);
widget_->outTE->insertPlainText(str);
Dialog * createGuiProgressView(GuiView & guiview)
{
-#ifdef Q_WS_MACX
- return new GuiProgressView(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
-#else
return new GuiProgressView(guiview, Qt::BottomDockWidgetArea);
-#endif
}