1 |
// qsamplerMessages.h |
// qsamplerMessages.h |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2008, 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 |
27 |
|
|
28 |
class QSocketNotifier; |
class QSocketNotifier; |
29 |
class QTextEdit; |
class QTextEdit; |
30 |
|
class QFile; |
31 |
|
|
32 |
|
namespace QSampler { |
33 |
|
|
34 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
35 |
// qsamplerMessages - Messages log dockable window. |
// QSampler::Messages - Messages log dockable window. |
36 |
// |
// |
37 |
|
|
38 |
class qsamplerMessages : public QDockWidget |
class Messages : public QDockWidget |
39 |
{ |
{ |
40 |
Q_OBJECT |
Q_OBJECT |
41 |
|
|
42 |
public: |
public: |
43 |
|
|
44 |
// Constructor. |
// Constructor. |
45 |
qsamplerMessages(QWidget *pParent, const char *pszName = 0); |
Messages(QWidget *pParent); |
46 |
// Destructor. |
// Destructor. |
47 |
~qsamplerMessages(); |
~Messages(); |
48 |
|
|
49 |
// Stdout/stderr capture accessors. |
// Stdout/stderr capture accessors. |
50 |
bool isCaptureEnabled(); |
bool isCaptureEnabled(); |
51 |
void setCaptureEnabled(bool bCapture); |
void setCaptureEnabled(bool bCapture); |
52 |
|
|
53 |
// Message font accessors. |
// Message font accessors. |
54 |
QFont messagesFont(); |
QFont messagesFont(); |
55 |
void setMessagesFont(const QFont & font); |
void setMessagesFont(const QFont & font); |
56 |
|
|
57 |
// Maximum number of message lines accessors. |
// Maximum number of message lines accessors. |
58 |
int messagesLimit(); |
int messagesLimit(); |
59 |
void setMessagesLimit(int iMessagesLimit); |
void setMessagesLimit(int iMessagesLimit); |
60 |
|
|
61 |
// The main utility methods. |
// Logging settings. |
62 |
void appendMessages(const QString& s); |
bool isLogging() const; |
63 |
void appendMessagesColor(const QString& s, const QString &c); |
void setLogging(bool bEnabled, const QString& sFilename = QString()); |
64 |
void appendMessagesText(const QString& s); |
|
65 |
|
// The main utility methods. |
66 |
void scrollToBottom(); |
void appendMessages(const QString& s); |
67 |
|
void appendMessagesColor(const QString& s, const QString &c); |
68 |
// Stdout capture functions. |
void appendMessagesText(const QString& s); |
69 |
void appendStdoutBuffer(const QString& s); |
|
70 |
void flushStdoutBuffer(); |
// Stdout capture functions. |
71 |
|
void appendStdoutBuffer(const QString& s); |
72 |
|
void flushStdoutBuffer(); |
73 |
|
|
74 |
|
// History reset. |
75 |
|
void clear(); |
76 |
|
|
77 |
|
signals: |
78 |
|
|
79 |
|
void visibilityChanged(bool bVisible); |
80 |
|
|
81 |
|
protected: |
82 |
|
|
83 |
|
// Message executives. |
84 |
|
void appendMessagesLine(const QString& s); |
85 |
|
void appendMessagesLog(const QString& s); |
86 |
|
|
87 |
|
// overridden method of QWidget |
88 |
|
void showEvent(QShowEvent *pEvent); |
89 |
|
|
90 |
protected slots: |
protected slots: |
91 |
|
|
92 |
// Stdout capture slot. |
// Stdout capture slot. |
93 |
void stdoutNotify(int fd); |
void stdoutNotify(int fd); |
94 |
|
|
95 |
private: |
private: |
96 |
|
|
97 |
// The maximum number of message lines. |
// The maximum number of message lines. |
98 |
int m_iMessagesLimit; |
int m_iMessagesLines; |
99 |
int m_iMessagesHigh; |
int m_iMessagesLimit; |
100 |
|
int m_iMessagesHigh; |
101 |
// The textview main widget. |
|
102 |
QTextEdit *m_pTextView; |
// The textview main widget. |
103 |
|
QTextEdit *m_pMessagesTextView; |
104 |
// Stdout capture variables. |
|
105 |
QSocketNotifier *m_pStdoutNotifier; |
// Stdout capture variables. |
106 |
QString m_sStdoutBuffer; |
QSocketNotifier *m_pStdoutNotifier; |
107 |
int m_fdStdout[2]; |
QString m_sStdoutBuffer; |
108 |
|
int m_fdStdout[2]; |
109 |
|
|
110 |
|
// Logging stuff. |
111 |
|
QFile *m_pMessagesLog; |
112 |
}; |
}; |
113 |
|
|
114 |
|
} // namespace QSampler |
115 |
|
|
116 |
#endif // __qsamplerMessages_h |
#endif // __qsamplerMessages_h |
117 |
|
|