1 |
// qsamplerMessages.cpp |
// qsamplerMessages.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
7 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
GNU General Public License for more details. |
15 |
|
|
16 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License along |
17 |
along with this program; if not, write to the Free Software |
with this program; if not, write to the Free Software Foundation, Inc., |
18 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 |
|
|
20 |
*****************************************************************************/ |
*****************************************************************************/ |
21 |
|
|
28 |
#include <qtooltip.h> |
#include <qtooltip.h> |
29 |
#include <qpixmap.h> |
#include <qpixmap.h> |
30 |
|
|
31 |
|
#include <QDockWidget> |
32 |
|
#include <QScrollBar> |
33 |
|
|
34 |
#include "config.h" |
#include "config.h" |
35 |
|
|
36 |
#if !defined(WIN32) |
#if !defined(WIN32) |
52 |
|
|
53 |
// Constructor. |
// Constructor. |
54 |
qsamplerMessages::qsamplerMessages ( QWidget *pParent, const char *pszName ) |
qsamplerMessages::qsamplerMessages ( QWidget *pParent, const char *pszName ) |
55 |
: QDockWindow(pParent, pszName) |
: QDockWidget(pszName, pParent) |
56 |
{ |
{ |
57 |
// Intialize stdout capture stuff. |
// Intialize stdout capture stuff. |
58 |
m_pStdoutNotifier = NULL; |
m_pStdoutNotifier = NULL; |
61 |
|
|
62 |
// Surely a name is crucial (e.g.for storing geometry settings) |
// Surely a name is crucial (e.g.for storing geometry settings) |
63 |
if (pszName == 0) |
if (pszName == 0) |
64 |
QDockWindow::setName("qsamplerMessages"); |
QDockWidget::setName("qsamplerMessages"); |
65 |
|
|
66 |
// Create local text view widget. |
// Create local text view widget. |
67 |
m_pTextView = new QTextEdit(this); |
m_pTextView = new QTextEdit(this); |
68 |
// QFont font(m_pTextView->font()); |
// QFont font(m_pTextView->font()); |
69 |
// font.setFamily("Fixed"); |
// font.setFamily("Fixed"); |
70 |
// m_pTextView->setFont(font); |
// m_pTextView->setFont(font); |
71 |
m_pTextView->setWordWrap(QTextEdit::NoWrap); |
m_pTextView->setWordWrapMode(QTextOption::NoWrap); |
72 |
m_pTextView->setReadOnly(true); |
m_pTextView->setReadOnly(true); |
73 |
m_pTextView->setUndoRedoEnabled(false); |
m_pTextView->setUndoRedoEnabled(false); |
74 |
#if QT_VERSION >= 0x030200 |
#if QT_VERSION >= 0x030200 |
78 |
setMessagesLimit(QSAMPLER_MESSAGES_MAXLINES); |
setMessagesLimit(QSAMPLER_MESSAGES_MAXLINES); |
79 |
|
|
80 |
// Prepare the dockable window stuff. |
// Prepare the dockable window stuff. |
81 |
QDockWindow::setWidget(m_pTextView); |
QDockWidget::setWidget(m_pTextView); |
82 |
QDockWindow::setOrientation(Qt::Horizontal); |
//QDockWidget::setOrientation(Qt::Horizontal); |
83 |
QDockWindow::setCloseMode(QDockWindow::Always); |
QDockWidget::setFeatures( |
84 |
QDockWindow::setResizeEnabled(true); |
QDockWidget::DockWidgetClosable |
85 |
|
); |
86 |
|
//QDockWidget::setResizeEnabled(true); |
87 |
|
// Some specialties to this kind of dock window... |
88 |
|
//QDockWidget::setFixedExtentHeight(120); |
89 |
|
|
90 |
// Finally set the default caption and tooltip. |
// Finally set the default caption and tooltip. |
91 |
QString sCaption = tr("Messages"); |
QString sCaption = tr("Messages"); |
92 |
QToolTip::add(this, sCaption); |
QToolTip::add(this, sCaption); |
93 |
QDockWindow::setCaption(sCaption); |
QDockWidget::setWindowIconText(sCaption); |
94 |
} |
} |
95 |
|
|
96 |
|
|
205 |
m_iMessagesLimit = iMessagesLimit; |
m_iMessagesLimit = iMessagesLimit; |
206 |
m_iMessagesHigh = iMessagesLimit + (iMessagesLimit / 3); |
m_iMessagesHigh = iMessagesLimit + (iMessagesLimit / 3); |
207 |
#if QT_VERSION >= 0x030200 |
#if QT_VERSION >= 0x030200 |
208 |
m_pTextView->setMaxLogLines(iMessagesLimit); |
//m_pTextView->setMaxLogLines(iMessagesLimit); |
209 |
#endif |
#endif |
210 |
} |
} |
211 |
|
|
246 |
void qsamplerMessages::scrollToBottom (void) |
void qsamplerMessages::scrollToBottom (void) |
247 |
{ |
{ |
248 |
flushStdoutBuffer(); |
flushStdoutBuffer(); |
249 |
m_pTextView->scrollToBottom(); |
//m_pTextView->scrollToBottom(); |
250 |
|
m_pTextView->verticalScrollBar()->setValue(m_pTextView->verticalScrollBar()->maximum()); |
251 |
} |
} |
252 |
|
|
253 |
|
|