]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiProgress.cpp
d9109b1c50c394917f6eff2ff99eacc900ddc8d3
[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 "qt_helpers.h"
17
18 #include "support/Systemcall.h"
19
20 #include <QApplication>
21
22
23 namespace lyx {
24 namespace frontend {
25
26
27 GuiProgress::GuiProgress(GuiView & parent, Qt::DockWidgetArea area, 
28         Qt::WindowFlags flags) : DockView(parent, "latex-progress", area, flags)
29 {
30         setWindowTitle(qt_("LaTeX Progress"));
31         setWidget(&text_edit);
32         support::Systemcall::registerProgressInterface(this);
33 }
34
35
36 void GuiProgress::appendMessage(QString const & msg)
37 {
38         text_edit.append(msg);
39         // QEventLoop::ExcludeUserInputEvents: 
40         // don't allow user inputs while processing a document
41         // if we allow it, we open will Pandora's Box of multithreading
42         QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
43 }
44
45
46 void GuiProgress::clearMessages()
47 {
48         text_edit.clear();
49 }
50
51
52 Dialog * createGuiProgress(GuiView & lv)
53 {
54         GuiView & guiview = static_cast<GuiView &>(lv);
55 #ifdef Q_WS_MACX
56         // TODO where to show up on the Mac?
57         //return new GuiProgress(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
58 #else
59         return new GuiProgress(guiview, Qt::BottomDockWidgetArea);
60 #endif
61 }
62
63 } // namespace frontend
64 } // namespace lyx
65
66