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"
15 #include "GuiApplication.h"
17 #include "qt_helpers.h"
19 #include "support/debug.h"
29 ProgressViewWidget::ProgressViewWidget()
36 GuiProgressView::~GuiProgressView()
42 GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
43 Qt::WindowFlags flags) : DockView(parent, "progress", "Debug/Progress window", area, flags)
45 widget_ = new ProgressViewWidget();
48 QFont font(guiApp->typewriterFontName());
49 font.setKerning(false);
50 font.setFixedPitch(true);
51 font.setStyleHint(QFont::TypeWriter);
52 widget_->outTE->setFont(font);
54 GuiProgress* progress = dynamic_cast<GuiProgress*>(support::ProgressInterface::instance());
57 connect(progress, SIGNAL(processStarted(QString const &)), this, SLOT(appendText(QString const &)));
58 //connect(progress, SIGNAL(processFinished(QString const &)), this, SLOT(appendText(QString const &)));
59 connect(progress, SIGNAL(appendMessage(QString const &)), this, SLOT(appendText(QString const &)));
60 connect(progress, SIGNAL(appendError(QString const &)), this, SLOT(appendText(QString const &)));
61 connect(progress, SIGNAL(clearMessages()), this, SLOT(clearText()));
66 void GuiProgressView::clearText()
68 if (widget_->autoClearCB->isChecked())
69 widget_->outTE->clear();
73 void GuiProgressView::appendText(QString const & text)
77 QString time = QTime::currentTime().toString();
78 widget_->outTE->insertPlainText(time + ": " + text.trimmed() + "\n");
79 widget_->outTE->ensureCursorVisible();
82 void GuiProgressView::saveSession() const
84 Dialog::saveSession();
87 sessionKey() + "/autoclear", widget_->autoClearCB->isChecked());
90 void GuiProgressView::restoreSession()
92 DockView::restoreSession();
94 widget_->autoClearCB->setChecked(
95 settings.value(sessionKey() + "/autoclear", true).toBool());
99 Dialog * createGuiProgressView(GuiView & guiview)
102 return new GuiProgressView(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
104 return new GuiProgressView(guiview, Qt::BottomDockWidgetArea);
110 } // namespace frontend
113 #include "moc_GuiProgressView.cpp"