1 |
// qsamplerMessages.h |
// qsamplerMessages.h |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2017, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, Christian Schoenebeck |
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 |
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); |
Messages(QWidget *pParent); |
46 |
// Destructor. |
// Destructor. |
47 |
~qsamplerMessages(); |
~Messages(); |
48 |
|
|
49 |
// Stdout/stderr capture accessors. |
// Stdout/stderr capture accessors. |
50 |
bool isCaptureEnabled(); |
bool isCaptureEnabled(); |
58 |
int messagesLimit(); |
int messagesLimit(); |
59 |
void setMessagesLimit(int iMessagesLimit); |
void setMessagesLimit(int iMessagesLimit); |
60 |
|
|
61 |
|
// Logging settings. |
62 |
|
bool isLogging() const; |
63 |
|
void setLogging(bool bEnabled, const QString& sFilename = QString()); |
64 |
|
|
65 |
// The main utility methods. |
// The main utility methods. |
66 |
void appendMessages(const QString& s); |
void appendMessages(const QString& s); |
67 |
void appendMessagesColor(const QString& s, const QString &c); |
void appendMessagesColor(const QString& s, const QString &c); |
74 |
// History reset. |
// History reset. |
75 |
void clear(); |
void clear(); |
76 |
|
|
77 |
signals: |
protected: |
78 |
|
|
79 |
void visibilityChanged(bool bVisible); |
// Message executives. |
80 |
|
void appendMessagesLine(const QString& s); |
81 |
|
void appendMessagesLog(const QString& s); |
82 |
|
|
83 |
protected slots: |
// Set stdout/stderr blocking mode. |
84 |
|
bool stdoutBlock(int fd, bool bBlock) const; |
85 |
|
|
86 |
// overridden method of QWidget |
protected slots: |
|
void showEvent(QShowEvent* event); |
|
87 |
|
|
88 |
// Stdout capture slot. |
// Stdout capture slot. |
89 |
void stdoutNotify(int fd); |
void stdoutNotify(int fd); |
96 |
int m_iMessagesHigh; |
int m_iMessagesHigh; |
97 |
|
|
98 |
// The textview main widget. |
// The textview main widget. |
99 |
QTextEdit *m_pTextView; |
QTextEdit *m_pMessagesTextView; |
100 |
|
|
101 |
// Stdout capture variables. |
// Stdout capture variables. |
102 |
QSocketNotifier *m_pStdoutNotifier; |
QSocketNotifier *m_pStdoutNotifier; |
103 |
QString m_sStdoutBuffer; |
QString m_sStdoutBuffer; |
104 |
int m_fdStdout[2]; |
int m_fdStdout[2]; |
105 |
|
|
106 |
|
// Logging stuff. |
107 |
|
QFile *m_pMessagesLog; |
108 |
}; |
}; |
109 |
|
|
110 |
|
} // namespace QSampler |
111 |
|
|
112 |
#endif // __qsamplerMessages_h |
#endif // __qsamplerMessages_h |
113 |
|
|