]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiProgress.cpp
694a45ef8ea626bf72dd2738b264c5a5b24677a7
[lyx.git] / src / frontends / qt4 / GuiProgress.cpp
1 // -*- C++ -*-
2 /**
3  * \file GuiProgress.cpp
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Peter Kümmel
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "GuiProgress.h"
15
16 #include "support/Systemcall.h"
17
18 #include <QApplication>
19
20
21 namespace lyx {
22 namespace frontend {
23
24
25 GuiProgress::GuiProgress(GuiView & parent, Qt::DockWidgetArea area, 
26         Qt::WindowFlags flags) : DockView(parent, "latex-progress", area, flags)
27 {
28         setWindowTitle(qt_("LaTeX Progress"));
29         setWidget(&text_edit);
30         lyx::support::Systemcall::registerProgressInterface(this);
31 }
32
33
34 void GuiProgress::appendMessage(QString const & msg)
35 {
36         text_edit.append(msg);
37         // QEventLoop::ExcludeUserInputEvents: 
38         // don't allow user inputs while processing a document
39         // if we allow it, we open will Pandora's Box of multithreading
40         QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
41 }
42
43
44 void GuiProgress::clearMessages()
45 {
46         text_edit.clear();
47 }
48
49
50 Dialog * createGuiProgress(GuiView & lv)
51 {
52         GuiView & guiview = static_cast<GuiView &>(lv);
53 #ifdef Q_WS_MACX
54         // TODO where to show up on the Mac?
55         //return new GuiProgress(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
56 #else
57         return new GuiProgress(guiview, Qt::BottomDockWidgetArea);
58 #endif
59 }
60
61 } // namespace frontend
62 } // namespace lyx
63
64