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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 338 - (show annotations) (download) (as text)
Wed Jan 12 10:43:37 2005 UTC (19 years, 2 months ago) by capela
File MIME type: text/x-c++hdr
File size: 2567 byte(s)
~Messages limit optimization with Qt::LogText format (QTextEdit).

1 // qsamplerMessages.h
2 //
3 /****************************************************************************
4 Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved.
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 *****************************************************************************/
21
22 #ifndef __qsamplerMessages_h
23 #define __qsamplerMessages_h
24
25 #include <qdockwindow.h>
26
27 class QSocketNotifier;
28 class QTextEdit;
29
30
31 //-------------------------------------------------------------------------
32 // qsamplerMessages - Messages log dockable window.
33 //
34
35 class qsamplerMessages : public QDockWindow
36 {
37 Q_OBJECT
38
39 public:
40
41 // Constructor.
42 qsamplerMessages(QWidget *pParent, const char *pszName = 0);
43 // Destructor.
44 ~qsamplerMessages();
45
46 // Stdout/stderr capture accessors.
47 bool isCaptureEnabled();
48 void setCaptureEnabled(bool bCapture);
49
50 // Message font accessors.
51 QFont messagesFont();
52 void setMessagesFont(const QFont & font);
53
54 // Maximum number of message lines accessors.
55 int messagesLimit();
56 void setMessagesLimit(int iMessagesLimit);
57
58 // The main utility methods.
59 void appendMessages(const QString& s);
60 void appendMessagesColor(const QString& s, const QString &c);
61 void appendMessagesText(const QString& s);
62
63 void scrollToBottom();
64
65 // Stdout capture functions.
66 void appendStdoutBuffer(const QString& s);
67 void flushStdoutBuffer();
68
69 protected slots:
70
71 // Stdout capture slot.
72 void stdoutNotify(int fd);
73
74 private:
75
76 // The maximum number of message lines.
77 int m_iMessagesLimit;
78 int m_iMessagesHigh;
79
80 // The textview main widget.
81 QTextEdit *m_pTextView;
82
83 // Stdout capture variables.
84 QSocketNotifier *m_pStdoutNotifier;
85 QString m_sStdoutBuffer;
86 int m_fdStdout[2];
87 };
88
89
90 #endif // __qsamplerMessages_h
91
92
93 // end of qsamplerMessages.h

  ViewVC Help
Powered by ViewVC