File indexing completed on 2024-04-28 04:02:31

0001 //
0002 // C++ Implementation: dlgmxpconsole
0003 //
0004 // Description: 
0005 //
0006 /*
0007 Copyright 2004-2011 Tomas Mecir <kmuddy@kmuddy.com>
0008 
0009 This program is free software; you can redistribute it and/or
0010 modify it under the terms of the GNU General Public License as
0011 published by the Free Software Foundation; either version 2 of 
0012 the License, or (at your option) any later version.
0013 
0014 This program is distributed in the hope that it will be useful,
0015 but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017 GNU General Public License for more details.
0018 
0019 You should have received a copy of the GNU General Public License
0020 along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 
0023 #include "dlgmxpconsole.h"
0024 
0025 #ifdef HAVE_MXP
0026 
0027 #include <KLocalizedString>
0028 #include <QScrollBar>
0029 #include <QTextEdit>
0030 
0031 dlgMXPConsole::dlgMXPConsole (QWidget *parent) : QDockWidget (parent)
0032 {
0033   createDialog ();
0034 }
0035 
0036 
0037 dlgMXPConsole::~dlgMXPConsole ()
0038 {
0039 }
0040 
0041 QSize dlgMXPConsole::sizeHint() const
0042 {
0043   return QSize (500, 300);
0044 }
0045 
0046 void dlgMXPConsole::createDialog ()
0047 {
0048   setWindowTitle (i18n ("MXP Console"));
0049 
0050   viewer = new QTextEdit (this);
0051   viewer->setAcceptRichText (false);
0052   viewer->setReadOnly (true);
0053   
0054   setWidget (viewer);
0055   
0056   //no focus - we don't want this dialog to get focus
0057   setFocusPolicy (Qt::NoFocus);
0058   viewer->setFocusPolicy (Qt::NoFocus);
0059 }
0060 
0061 void dlgMXPConsole::addLine (const QString &line)
0062 {
0063   viewer->append (line);
0064   QScrollBar *sb = viewer->verticalScrollBar();
0065   sb->setValue (sb->maximum ());
0066 }
0067 
0068 #include "moc_dlgmxpconsole.cpp"
0069 
0070 #endif  //HAVE_MXP