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,
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()));
levelChanged();
return;
}
+ QTreeWidgetItemIterator it(widget_->debugMessagesTW);
+ while (*it) {
+ (*it)->setText(1, level == Debug::NONE ?
+ qt_("No") : qt_("Yes"));
+ ++it;
+ }
widget_->debugMessagesTW->setEnabled(false);
dispatch(FuncRequest(LFUN_DEBUG_LEVEL_SET, convert<string>(level)));
}
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.
- if (text.endsWith("\n"))
+ // WARNING: processing events could cause crashes!
+ // TODO: find a better solution
+ if (text.endsWith("\n")) {
+ eol_last_ = true;
QApplication::processEvents();
+ }
}
{
if (text.isEmpty() || !widget_->sbarCB->isChecked())
return;
- QString str = QTime::currentTime().toString();
+ 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
}