1 |
// qsamplerMessages.h |
2 |
// |
3 |
/**************************************************************************** |
4 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, Christian Schoenebeck |
6 |
|
7 |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
9 |
as published by the Free Software Foundation; either version 2 |
10 |
of the License, or (at your option) any later version. |
11 |
|
12 |
This program is distributed in the hope that it will be useful, |
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
GNU General Public License for more details. |
16 |
|
17 |
You should have received a copy of the GNU General Public License along |
18 |
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
21 |
*****************************************************************************/ |
22 |
|
23 |
#ifndef __qsamplerMessages_h |
24 |
#define __qsamplerMessages_h |
25 |
|
26 |
#include <QDockWidget> |
27 |
|
28 |
class QSocketNotifier; |
29 |
class QTextEdit; |
30 |
|
31 |
|
32 |
//------------------------------------------------------------------------- |
33 |
// qsamplerMessages - Messages log dockable window. |
34 |
// |
35 |
|
36 |
class qsamplerMessages : public QDockWidget |
37 |
{ |
38 |
Q_OBJECT |
39 |
|
40 |
public: |
41 |
|
42 |
// Constructor. |
43 |
qsamplerMessages(QWidget *pParent, const char *pszName = 0); |
44 |
// Destructor. |
45 |
~qsamplerMessages(); |
46 |
|
47 |
// Stdout/stderr capture accessors. |
48 |
bool isCaptureEnabled(); |
49 |
void setCaptureEnabled(bool bCapture); |
50 |
|
51 |
// Message font accessors. |
52 |
QFont messagesFont(); |
53 |
void setMessagesFont(const QFont & font); |
54 |
|
55 |
// Maximum number of message lines accessors. |
56 |
int messagesLimit(); |
57 |
void setMessagesLimit(int iMessagesLimit); |
58 |
|
59 |
// The main utility methods. |
60 |
void appendMessages(const QString& s); |
61 |
void appendMessagesColor(const QString& s, const QString &c); |
62 |
void appendMessagesText(const QString& s); |
63 |
|
64 |
void scrollToBottom(); |
65 |
|
66 |
// Stdout capture functions. |
67 |
void appendStdoutBuffer(const QString& s); |
68 |
void flushStdoutBuffer(); |
69 |
|
70 |
protected slots: |
71 |
|
72 |
// Stdout capture slot. |
73 |
void stdoutNotify(int fd); |
74 |
|
75 |
private: |
76 |
|
77 |
// The maximum number of message lines. |
78 |
int m_iMessagesLimit; |
79 |
int m_iMessagesHigh; |
80 |
|
81 |
// The textview main widget. |
82 |
QTextEdit *m_pTextView; |
83 |
|
84 |
// Stdout capture variables. |
85 |
QSocketNotifier *m_pStdoutNotifier; |
86 |
QString m_sStdoutBuffer; |
87 |
int m_fdStdout[2]; |
88 |
}; |
89 |
|
90 |
|
91 |
#endif // __qsamplerMessages_h |
92 |
|
93 |
|
94 |
// end of qsamplerMessages.h |