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