]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiProgressView.cpp
Fix the tab ordering of GuiDocument components.
[lyx.git] / src / frontends / qt4 / GuiProgressView.cpp
index 3413963f3eb2130476f18e4a0995f4de3b580866..2665e46f21fb997d708a0ae007dfaa4c2a446717 100644 (file)
@@ -51,6 +51,7 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
        Qt::WindowFlags flags)
        : DockView(parent, "progress", qt_("Progress/Debug Messages"), area, flags)
 {
+       eol_last_ = true;
        widget_ = new ProgressViewWidget();
        widget_->setMinimumHeight(150);
        widget_->debugMessagesTW->setSizePolicy(QSizePolicy::Ignored,
@@ -104,7 +105,7 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
                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()));
@@ -164,8 +165,10 @@ void GuiProgressView::debugSelectionChanged()
 
 void GuiProgressView::clearText()
 {
-       if (widget_->autoClearCB->isChecked())
+       if (widget_->autoClearCB->isChecked()){
                widget_->outTE->clear();
+               eol_last_ = true;
+       }
 }
 
 
@@ -174,15 +177,17 @@ void GuiProgressView::appendLyXErrText(QString const & text)
        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();
+       }
 }
 
 
@@ -192,8 +197,9 @@ void GuiProgressView::appendText(QString const & text)
                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);