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

0001 //
0002 // C++ Implementation: dlgoutputwindow
0003 //
0004 // Description: 
0005 //
0006 /*
0007 Copyright 2004 Vladimir Lazarenko <vlad@lazarenko.net>
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 "dlgoutputwindow.h"
0024 #include "cconsole.h"
0025 
0026 #include <KLocalizedString>
0027 
0028 #include <QVBoxLayout>
0029 
0030 dlgOutputWindow::dlgOutputWindow (QWidget *parent) : QDialog(parent, Qt::Tool)
0031 {
0032   //initial size
0033   setWindowTitle (i18n ("Output window"));
0034 
0035   //main widget
0036   QVBoxLayout *layout = new QVBoxLayout (this);
0037   
0038   setFocusPolicy (Qt::StrongFocus);
0039 
0040   owindow = new cConsole(this);
0041 
0042   //no session information yet, will set it when it's available
0043   sess = 0;
0044   owindow->setSession (0);
0045 
0046   layout->setMargin (0);
0047   layout->addWidget(owindow);
0048 }
0049 
0050 dlgOutputWindow::~dlgOutputWindow()
0051 {
0052 }
0053 
0054 QSize dlgOutputWindow::sizeHint() const
0055 {
0056   return QSize (250, 300);
0057 }
0058 
0059 void dlgOutputWindow::setSession (int _sess)
0060 {
0061   sess = _sess;
0062   //also inform console about the new session
0063   owindow->setSession (sess);
0064 }
0065 
0066 void dlgOutputWindow::addLine (cTextChunk *chunk)
0067 {
0068   if (owindow)
0069     owindow->addLine (chunk);
0070 }
0071 
0072 void dlgOutputWindow::setOutputWindowName(const QString &name)
0073 {
0074   if(!name.isEmpty())
0075     this->setWindowTitle(name);
0076 }
0077 
0078 void dlgOutputWindow::setFont(const QFont &font)
0079 {
0080   owindow->setFont(font);
0081 }
0082 
0083 #include "moc_dlgoutputwindow.cpp"