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

Diff of /qsampler/trunk/src/qsamplerMessages.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 338 by capela, Wed Jan 12 10:43:37 2005 UTC revision 1464 by capela, Thu Nov 1 17:14:21 2007 UTC
# Line 1  Line 1 
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       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
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 13  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.     GNU General Public License for more details.
16    
17     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
18     along with this program; if not, write to the Free Software     with this program; if not, write to the Free Software Foundation, Inc.,
19     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20    
21  *****************************************************************************/  *****************************************************************************/
22    
# Line 28  Line 29 
29  #include <qtooltip.h>  #include <qtooltip.h>
30  #include <qpixmap.h>  #include <qpixmap.h>
31    
32    #include <QDockWidget>
33    #include <QScrollBar>
34    
35  #include "config.h"  #include "config.h"
36    
37  #if !defined(WIN32)  #if !defined(WIN32)
# Line 49  Line 53 
53    
54  // Constructor.  // Constructor.
55  qsamplerMessages::qsamplerMessages ( QWidget *pParent, const char *pszName )  qsamplerMessages::qsamplerMessages ( QWidget *pParent, const char *pszName )
56      : QDockWindow(pParent, pszName)      : QDockWidget(pszName, pParent)
57  {  {
 #if QT_VERSION >= 0x030200  
     m_pTextView->setTextFormat(Qt::LogText);  
 #endif  
     // Initialize default message limit.  
     setMessagesLimit(QSAMPLER_MESSAGES_MAXLINES);  
   
58      // Intialize stdout capture stuff.      // Intialize stdout capture stuff.
59      m_pStdoutNotifier = NULL;      m_pStdoutNotifier = NULL;
60      m_fdStdout[QSAMPLER_MESSAGES_FDREAD]  = QSAMPLER_MESSAGES_FDNIL;      m_fdStdout[QSAMPLER_MESSAGES_FDREAD]  = QSAMPLER_MESSAGES_FDNIL;
# Line 64  qsamplerMessages::qsamplerMessages ( QWi Line 62  qsamplerMessages::qsamplerMessages ( QWi
62    
63      // Surely a name is crucial (e.g.for storing geometry settings)      // Surely a name is crucial (e.g.for storing geometry settings)
64      if (pszName == 0)      if (pszName == 0)
65          QDockWindow::setName("qsamplerMessages");          QDockWidget::setName("qsamplerMessages");
66    
67      // Create local text view widget.      // Create local text view widget.
68      m_pTextView = new QTextEdit(this);      m_pTextView = new QTextEdit(this);
69  //  QFont font(m_pTextView->font());  //  QFont font(m_pTextView->font());
70  //  font.setFamily("Fixed");  //  font.setFamily("Fixed");
71  //  m_pTextView->setFont(font);  //  m_pTextView->setFont(font);
72      m_pTextView->setWordWrap(QTextEdit::NoWrap);      m_pTextView->setWordWrapMode(QTextOption::NoWrap);
73      m_pTextView->setReadOnly(true);      m_pTextView->setReadOnly(true);
74      m_pTextView->setUndoRedoEnabled(false);      m_pTextView->setUndoRedoEnabled(false);
75    #if QT_VERSION >= 0x030200
76        m_pTextView->setTextFormat(Qt::LogText);
77    #endif
78        // Initialize default message limit.
79        setMessagesLimit(QSAMPLER_MESSAGES_MAXLINES);
80    
81      // Prepare the dockable window stuff.      // Prepare the dockable window stuff.
82      QDockWindow::setWidget(m_pTextView);      QDockWidget::setWidget(m_pTextView);
83      QDockWindow::setOrientation(Qt::Horizontal);      //QDockWidget::setOrientation(Qt::Horizontal);
84      QDockWindow::setCloseMode(QDockWindow::Always);      QDockWidget::setFeatures(
85      QDockWindow::setResizeEnabled(true);          QDockWidget::DockWidgetClosable
86        );
87        //QDockWidget::setResizeEnabled(true);
88            // Some specialties to this kind of dock window...
89            //QDockWidget::setFixedExtentHeight(120);
90    
91      // Finally set the default caption and tooltip.      // Finally set the default caption and tooltip.
92      QString sCaption = tr("Messages");      QString sCaption = tr("Messages");
93      QToolTip::add(this, sCaption);      QToolTip::add(this, sCaption);
94      QDockWindow::setCaption(sCaption);      QDockWidget::setWindowIconText(sCaption);
95  }  }
96    
97    
# Line 199  void qsamplerMessages::setMessagesLimit Line 206  void qsamplerMessages::setMessagesLimit
206      m_iMessagesLimit = iMessagesLimit;      m_iMessagesLimit = iMessagesLimit;
207      m_iMessagesHigh  = iMessagesLimit + (iMessagesLimit / 3);      m_iMessagesHigh  = iMessagesLimit + (iMessagesLimit / 3);
208  #if QT_VERSION >= 0x030200  #if QT_VERSION >= 0x030200
209          m_pTextView->setMaxLogLines(iMessagesLimit);          //m_pTextView->setMaxLogLines(iMessagesLimit);
210  #endif  #endif
211  }  }
212    
# Line 240  void qsamplerMessages::appendMessagesTex Line 247  void qsamplerMessages::appendMessagesTex
247  void qsamplerMessages::scrollToBottom (void)  void qsamplerMessages::scrollToBottom (void)
248  {  {
249      flushStdoutBuffer();      flushStdoutBuffer();
250      m_pTextView->scrollToBottom();      //m_pTextView->scrollToBottom();
251        m_pTextView->verticalScrollBar()->setValue(m_pTextView->verticalScrollBar()->maximum());
252  }  }
253    
254    

Legend:
Removed from v.338  
changed lines
  Added in v.1464

  ViewVC Help
Powered by ViewVC