00001 /********************************************************************** 00002 ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. 00003 ** 00004 ** This file is part of Wellenreiter II. 00005 ** 00006 ** This file may be distributed and/or modified under the terms of the 00007 ** GNU General Public License version 2 as published by the Free Software 00008 ** Foundation and appearing in the file LICENSE.GPL included in the 00009 ** packaging of this file. 00010 ** 00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 ** 00014 **********************************************************************/ 00015 00016 #include "logwindow.h" 00017 00018 /* OPIE */ 00019 #include <opie2/odebug.h> 00020 using namespace Opie::Core; 00021 00022 /* QT */ 00023 #include <qmultilineedit.h> 00024 #include <qdatetime.h> 00025 00026 MLogWindow* MLogWindow::_instance; 00027 00028 MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) 00029 :QVBox( parent, name, f ) 00030 { 00031 ledit = new QMultiLineEdit( this ); 00032 ledit->setReadOnly( true ); 00033 ledit->setUndoEnabled( false ); 00034 00035 00036 MLogWindow::_instance = this; 00037 } 00038 00039 00040 void MLogWindow::log( QString text ) 00041 { 00042 QTime time = QTime::currentTime(); 00043 QString line = QString( "[%1] %2" ).arg(time.toString() ).arg( text ); 00044 ledit->insertLine( line ); 00045 odebug << line << oendl; 00046 } 00047 00048 00049 void MLogWindow::clear() 00050 { 00051 ledit->clear(); 00052 } 00053 00054 00055 const QString MLogWindow::getLog() const 00056 { 00057 return ledit->text(); 00058 }
1.4.2