3 * \file GuiProgress.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 "GuiProgress.h"
16 #include "qt_helpers.h"
18 #include "support/Systemcall.h"
20 #include <QApplication>
29 GuiProgress::GuiProgress(GuiView & parent, Qt::DockWidgetArea area,
30 Qt::WindowFlags flags) : DockView(parent, "progress", "External tools", area, flags)
32 setWindowTitle(qt_("Tool monitoring"));
33 setWidget(&text_edit);
34 text_edit.setReadOnly(true);
36 connect(this, SIGNAL(processStarted(QString const &)), SLOT(doProcessStarted(QString const &)));
37 connect(this, SIGNAL(processFinished(QString const &)), SLOT(doProcessFinished(QString const &)));
38 connect(this, SIGNAL(appendMessage(QString const &)), SLOT(doAppendMessage(QString const &)));
39 connect(this, SIGNAL(appendError(QString const &)), SLOT(doAppendError(QString const &)));
40 connect(this, SIGNAL(clearMessages()), SLOT(doClearMessages()));
44 void GuiProgress::doProcessStarted(QString const & cmd)
46 appendText("Process started : " + cmd + "\n");
50 void GuiProgress::doProcessFinished(QString const & cmd)
52 appendText("Process finished: " + cmd + "\n");
56 void GuiProgress::doAppendMessage(QString const & msg)
58 // No good messages from the processes
63 void GuiProgress::doAppendError(QString const & msg)
69 void GuiProgress::doClearMessages()
75 void GuiProgress::appendText(QString const & text)
77 text_edit.insertPlainText(text);
78 text_edit.ensureCursorVisible();
82 void GuiProgress::showEvent(QShowEvent*)
84 support::ProgressInterface::setInstance(this);
88 void GuiProgress::hideEvent(QHideEvent*)
90 support::ProgressInterface::setInstance(0);
95 Dialog * createGuiProgress(GuiView & lv)
97 GuiView & guiview = static_cast<GuiView &>(lv);
99 // TODO where to show up on the Mac?
100 //return new GuiProgress(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
102 return new GuiProgress(guiview, Qt::BottomDockWidgetArea);
108 } // namespace frontend
111 #include "moc_GuiProgress.cpp"