]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiProgress.h
Add a function to translate QStrings
[lyx.git] / src / frontends / qt4 / GuiProgress.h
1 // -*- C++ -*-
2 /**
3  * \file GuiProgress.h
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  * \author Pavel Sanda
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef GUIPROGRESS_H
14 #define GUIPROGRESS_H
15
16 #include "support/ProgressInterface.h"
17
18 #include "DockView.h"
19
20 #include <QTimer>
21
22 #include <sstream>
23
24
25 namespace lyx {
26 namespace frontend {
27
28
29 class GuiProgress :
30                 public QObject,
31                 public lyx::support::ProgressInterface
32 {
33         Q_OBJECT
34
35 public:
36         GuiProgress();
37         ~GuiProgress();
38
39         void lyxerrConnect();
40         void lyxerrDisconnect();
41         void lyxerrFlush();
42
43         int prompt(docstring const & title, docstring const & question,
44                    int default_button, int cancel_button,
45                    docstring const & b1, docstring const & b2);
46
47         static QString currentTime();
48
49 Q_SIGNALS:
50
51         // ProgressInterface
52         void processStarted(QString const &);
53         void processFinished(QString const &);
54         void appendMessage(QString const &);
55         void appendError(QString const &);
56         void clearMessages();
57         void appendLyXErrMessage(QString const & text);
58
59
60         void clearMessageText();
61         void updateStatusBarMessage(QString const &);
62         void triggerFlush();
63
64         // Alert interface
65         void warning(QString const & title, QString const & message);
66         void toggleWarning(QString const & title, QString const & msg, QString const & formatted);
67         void error(QString const & title, QString const & message);
68         void information(QString const & title, QString const & message);
69
70 private Q_SLOTS:
71         void doProcessStarted(QString const &);
72         void doProcessFinished(QString const &);
73         void doAppendMessage(QString const &);
74         void doAppendError(QString const &);
75         void doClearMessages();
76
77         void doWarning(QString const &, QString const &);
78         void doToggleWarning(QString const & title, QString const & msg, QString const & formatted);
79         void doError(QString const &, QString const &);
80         void doInformation(QString const &, QString const &);
81
82         void updateWithLyXErr();
83         void startFlushing();
84
85
86 private:
87         void appendText(QString const &);
88         std::ostringstream lyxerr_stream_;
89         QTimer flushDelay_;
90 };
91
92
93
94 } // namespace frontend
95 } // namespace lyx
96
97 #endif
98