1 |
capela |
91 |
// qsamplerMessages.h |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
schoenebeck |
1461 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
capela |
1464 |
Copyright (C) 2007, Christian Schoenebeck |
6 |
capela |
91 |
|
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 |
capela |
920 |
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 |
capela |
91 |
|
21 |
|
|
*****************************************************************************/ |
22 |
|
|
|
23 |
|
|
#ifndef __qsamplerMessages_h |
24 |
|
|
#define __qsamplerMessages_h |
25 |
|
|
|
26 |
schoenebeck |
1461 |
#include <QDockWidget> |
27 |
capela |
91 |
|
28 |
|
|
class QSocketNotifier; |
29 |
|
|
class QTextEdit; |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
//------------------------------------------------------------------------- |
33 |
|
|
// qsamplerMessages - Messages log dockable window. |
34 |
|
|
// |
35 |
|
|
|
36 |
schoenebeck |
1461 |
class qsamplerMessages : public QDockWidget |
37 |
capela |
91 |
{ |
38 |
capela |
1465 |
Q_OBJECT |
39 |
capela |
91 |
|
40 |
|
|
public: |
41 |
|
|
|
42 |
capela |
1465 |
// Constructor. |
43 |
|
|
qsamplerMessages(QWidget *pParent); |
44 |
|
|
// Destructor. |
45 |
|
|
~qsamplerMessages(); |
46 |
capela |
91 |
|
47 |
capela |
1465 |
// Stdout/stderr capture accessors. |
48 |
|
|
bool isCaptureEnabled(); |
49 |
|
|
void setCaptureEnabled(bool bCapture); |
50 |
capela |
91 |
|
51 |
capela |
1465 |
// Message font accessors. |
52 |
|
|
QFont messagesFont(); |
53 |
|
|
void setMessagesFont(const QFont & font); |
54 |
capela |
91 |
|
55 |
capela |
1465 |
// Maximum number of message lines accessors. |
56 |
|
|
int messagesLimit(); |
57 |
|
|
void setMessagesLimit(int iMessagesLimit); |
58 |
schoenebeck |
1461 |
|
59 |
capela |
1465 |
// 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 |
capela |
91 |
|
64 |
capela |
1465 |
// Stdout capture functions. |
65 |
|
|
void appendStdoutBuffer(const QString& s); |
66 |
|
|
void flushStdoutBuffer(); |
67 |
capela |
91 |
|
68 |
capela |
1465 |
// History reset. |
69 |
|
|
void clear(); |
70 |
schoenebeck |
1470 |
|
71 |
|
|
signals: |
72 |
|
|
|
73 |
|
|
void visibilityChanged(bool bVisible); |
74 |
|
|
|
75 |
capela |
91 |
protected slots: |
76 |
|
|
|
77 |
schoenebeck |
1470 |
// overridden method of QWidget |
78 |
|
|
void showEvent(QShowEvent* event); |
79 |
|
|
|
80 |
capela |
1465 |
// Stdout capture slot. |
81 |
|
|
void stdoutNotify(int fd); |
82 |
capela |
91 |
|
83 |
|
|
private: |
84 |
|
|
|
85 |
capela |
1465 |
// The maximum number of message lines. |
86 |
|
|
int m_iMessagesLines; |
87 |
|
|
int m_iMessagesLimit; |
88 |
|
|
int m_iMessagesHigh; |
89 |
capela |
327 |
|
90 |
capela |
1465 |
// The textview main widget. |
91 |
|
|
QTextEdit *m_pTextView; |
92 |
schoenebeck |
1461 |
|
93 |
capela |
1465 |
// Stdout capture variables. |
94 |
|
|
QSocketNotifier *m_pStdoutNotifier; |
95 |
|
|
QString m_sStdoutBuffer; |
96 |
|
|
int m_fdStdout[2]; |
97 |
capela |
91 |
}; |
98 |
|
|
|
99 |
|
|
|
100 |
|
|
#endif // __qsamplerMessages_h |
101 |
|
|
|
102 |
|
|
|
103 |
|
|
// end of qsamplerMessages.h |