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