1 |
// qsamplerMessages.h |
// qsamplerMessages.h |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2003-2004, rncbc aka Rui Nuno Capela. All rights reserved. |
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 |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
GNU General Public License for more details. |
GNU General Public License for more details. |
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License along |
18 |
along with this program; if not, write to the Free Software |
with this program; if not, write to the Free Software Foundation, Inc., |
19 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
|
21 |
*****************************************************************************/ |
*****************************************************************************/ |
22 |
|
|
23 |
#ifndef __qsamplerMessages_h |
#ifndef __qsamplerMessages_h |
24 |
#define __qsamplerMessages_h |
#define __qsamplerMessages_h |
25 |
|
|
26 |
#include <qdockwindow.h> |
#include <QDockWidget> |
27 |
|
|
28 |
class QSocketNotifier; |
class QSocketNotifier; |
29 |
class QTextEdit; |
class QTextEdit; |
30 |
|
|
31 |
|
namespace QSampler { |
32 |
|
|
33 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
34 |
// qsamplerMessages - Messages log dockable window. |
// QSampler::Messages - Messages log dockable window. |
35 |
// |
// |
36 |
|
|
37 |
class qsamplerMessages : public QDockWindow |
class Messages : public QDockWidget |
38 |
{ |
{ |
39 |
Q_OBJECT |
Q_OBJECT |
40 |
|
|
41 |
public: |
public: |
42 |
|
|
43 |
// Constructor. |
// Constructor. |
44 |
qsamplerMessages(QWidget *pParent, const char *pszName = 0); |
Messages(QWidget *pParent); |
45 |
// Destructor. |
// Destructor. |
46 |
~qsamplerMessages(); |
~Messages(); |
47 |
|
|
48 |
// Stdout/stderr capture accessors. |
// Stdout/stderr capture accessors. |
49 |
bool isCaptureEnabled(); |
bool isCaptureEnabled(); |
50 |
void setCaptureEnabled(bool bCapture); |
void setCaptureEnabled(bool bCapture); |
51 |
|
|
52 |
// Message font accessors. |
// Message font accessors. |
53 |
QFont messagesFont(); |
QFont messagesFont(); |
54 |
void setMessagesFont(const QFont & font); |
void setMessagesFont(const QFont & font); |
55 |
|
|
56 |
// Maximum number of message lines accessors. |
// Maximum number of message lines accessors. |
57 |
int messagesLimit(); |
int messagesLimit(); |
58 |
void setMessagesLimit(int iMessagesLimit); |
void setMessagesLimit(int iMessagesLimit); |
59 |
|
|
60 |
// The main utility methods. |
// The main utility methods. |
61 |
void appendMessages(const QString& s); |
void appendMessages(const QString& s); |
62 |
void appendMessagesColor(const QString& s, const QString &c); |
void appendMessagesColor(const QString& s, const QString &c); |
63 |
void appendMessagesText(const QString& s); |
void appendMessagesText(const QString& s); |
64 |
|
|
65 |
void scrollToBottom(); |
// Stdout capture functions. |
66 |
|
void appendStdoutBuffer(const QString& s); |
67 |
// Stdout capture functions. |
void flushStdoutBuffer(); |
68 |
void appendStdoutBuffer(const QString& s); |
|
69 |
void flushStdoutBuffer(); |
// History reset. |
70 |
|
void clear(); |
71 |
|
|
72 |
|
signals: |
73 |
|
|
74 |
|
void visibilityChanged(bool bVisible); |
75 |
|
|
76 |
protected slots: |
protected slots: |
77 |
|
|
78 |
// Stdout capture slot. |
// overridden method of QWidget |
79 |
void stdoutNotify(int fd); |
void showEvent(QShowEvent* event); |
80 |
|
|
81 |
|
// Stdout capture slot. |
82 |
|
void stdoutNotify(int fd); |
83 |
|
|
84 |
private: |
private: |
85 |
|
|
86 |
// The maximum number of message lines. |
// The maximum number of message lines. |
87 |
int m_iMessagesLimit; |
int m_iMessagesLines; |
88 |
int m_iMessagesHigh; |
int m_iMessagesLimit; |
89 |
|
int m_iMessagesHigh; |
90 |
// The textview main widget. |
|
91 |
QTextEdit *m_pTextView; |
// The textview main widget. |
92 |
|
QTextEdit *m_pTextView; |
93 |
// Stdout capture variables. |
|
94 |
QSocketNotifier *m_pStdoutNotifier; |
// Stdout capture variables. |
95 |
QString m_sStdoutBuffer; |
QSocketNotifier *m_pStdoutNotifier; |
96 |
int m_fdStdout[2]; |
QString m_sStdoutBuffer; |
97 |
|
int m_fdStdout[2]; |
98 |
}; |
}; |
99 |
|
|
100 |
|
} // namespace QSampler |
101 |
|
|
102 |
#endif // __qsamplerMessages_h |
#endif // __qsamplerMessages_h |
103 |
|
|