3 * \file GuiProgressView.cpp
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
14 #include "GuiProgressView.h"
16 #include "qt_helpers.h"
18 #include "support/debug.h"
28 ProgressViewWidget::ProgressViewWidget()
35 GuiProgressView::~GuiProgressView()
41 GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
42 Qt::WindowFlags flags) : DockView(parent, "progress", "Debug/Progress window", area, flags)
44 widget_ = new ProgressViewWidget();
47 GuiProgress* progress = dynamic_cast<GuiProgress*>(support::ProgressInterface::instance());
50 connect(progress, SIGNAL(processStarted(QString const &)), this, SLOT(appendText(QString const &)));
51 //connect(progress, SIGNAL(processFinished(QString const &)), this, SLOT(appendText(QString const &)));
52 connect(progress, SIGNAL(appendMessage(QString const &)), this, SLOT(appendText(QString const &)));
53 connect(progress, SIGNAL(appendError(QString const &)), this, SLOT(appendText(QString const &)));
54 connect(progress, SIGNAL(clearMessages()), this, SLOT(clearText()));
59 void GuiProgressView::clearText()
61 if (widget_->autoClearCB->isChecked())
62 widget_->outTE->clear();
66 void GuiProgressView::appendText(QString const & text)
70 QString time = QTime::currentTime().toString();
71 widget_->outTE->insertPlainText(time + ": " + text.trimmed() + "\n");
72 widget_->outTE->ensureCursorVisible();
75 void GuiProgressView::saveSession() const
77 Dialog::saveSession();
80 sessionKey() + "/autoclear", widget_->autoClearCB->isChecked());
83 void GuiProgressView::restoreSession()
85 DockView::restoreSession();
87 widget_->autoClearCB->setChecked(
88 settings.value(sessionKey() + "/autoclear", true).toBool());
92 Dialog * createGuiProgressView(GuiView & guiview)
95 return new GuiProgressView(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
97 return new GuiProgressView(guiview, Qt::BottomDockWidgetArea);
103 } // namespace frontend
106 #include "moc_GuiProgressView.cpp"