/[svn]/qsampler/trunk/src/qsamplerMessages.h
ViewVC logotype

Contents of /qsampler/trunk/src/qsamplerMessages.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3853 - (show annotations) (download) (as text)
Mon Jan 25 10:07:17 2021 UTC (3 years, 2 months ago) by capela
File MIME type: text/x-c++hdr
File size: 3013 byte(s)
- Silence some compiler warnings.
1 // qsamplerMessages.h
2 //
3 /****************************************************************************
4 Copyright (C) 2004-2021, 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
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 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
21 *****************************************************************************/
22
23 #ifndef __qsamplerMessages_h
24 #define __qsamplerMessages_h
25
26 #include <QDockWidget>
27
28 class QSocketNotifier;
29 class QTextBrowser;
30 class QFile;
31
32 namespace QSampler {
33
34 //-------------------------------------------------------------------------
35 // QSampler::Messages - Messages log dockable window.
36 //
37
38 class Messages : public QDockWidget
39 {
40 Q_OBJECT
41
42 public:
43
44 // Constructor.
45 Messages(QWidget *pParent);
46 // Destructor.
47 ~Messages();
48
49 // Stdout/stderr capture accessors.
50 bool isCaptureEnabled();
51 void setCaptureEnabled(bool bCapture);
52
53 // Message font accessors.
54 QFont messagesFont();
55 void setMessagesFont(const QFont& font);
56
57 // Maximum number of message lines accessors.
58 int messagesLimit();
59 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.
66 void appendMessages(const QString& s);
67 void appendMessagesColor(const QString& s, const QColor& rgb);
68 void appendMessagesText(const QString& s);
69
70 // Stdout capture functions.
71 void appendStdoutBuffer(const QString& s);
72 void flushStdoutBuffer();
73
74 // History reset.
75 void clear();
76
77 protected:
78
79 // Message executives.
80 void appendMessagesLine(const QString& s);
81 void appendMessagesLog(const QString& s);
82
83 // Set stdout/stderr blocking mode.
84 bool stdoutBlock(int fd, bool bBlock) const;
85
86 // Split stdout/stderr into separate lines...
87 void processStdoutBuffer();
88
89 protected slots:
90
91 // Stdout capture slot.
92 void stdoutNotify(int fd);
93
94 private:
95
96 // The maximum number of message lines.
97 int m_iMessagesLines;
98 int m_iMessagesLimit;
99 int m_iMessagesHigh;
100
101 // The textview main widget.
102 QTextBrowser *m_pMessagesTextView;
103
104 // Stdout capture variables.
105 QSocketNotifier *m_pStdoutNotifier;
106 QString m_sStdoutBuffer;
107 int m_fdStdout[2];
108
109 // Logging stuff.
110 QFile *m_pMessagesLog;
111 };
112
113 } // namespace QSampler
114
115 #endif // __qsamplerMessages_h
116
117
118 // end of qsamplerMessages.h

  ViewVC Help
Powered by ViewVC