processwidget.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 1999-2001 Bernd Gehrmann <bernd@kdevelop.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef _PROCESSWIDGET_H_ 00021 #define _PROCESSWIDGET_H_ 00022 00023 #include <klistbox.h> 00024 #include <kprocess.h> 00025 00026 class ProcessLineMaker; 00027 00028 class ProcessListBoxItem : public QListBoxText 00029 { 00030 public: 00031 enum Type { Diagnostic, Normal, Error }; 00032 00033 ProcessListBoxItem(const QString &s, Type type); 00034 00035 virtual bool isCustomItem(); 00036 00037 private: 00038 virtual void paint(QPainter *p); 00039 Type t; 00040 }; 00041 00042 00047 class ProcessWidget : public KListBox 00048 { 00049 Q_OBJECT 00050 00051 public: 00052 ProcessWidget(QWidget *parent, const char *name=0); 00053 ~ProcessWidget(); 00054 00058 bool isRunning(); 00059 00060 public slots: 00064 void startJob(const QString &dir, const QString &command); 00068 void killJob( int signo = SIGTERM ); 00074 virtual void insertStdoutLine(const QString &line); 00081 virtual void insertStderrLine(const QString &line); 00082 00083 protected: 00090 virtual void childFinished(bool normal, int status); 00091 00092 signals: 00093 void processExited(KProcess *); 00094 void rowSelected(int row); 00095 00096 protected: 00097 virtual QSize minimumSizeHint() const; 00098 void maybeScrollToBottom(); 00099 00100 protected slots: 00101 void slotProcessExited(KProcess*); 00102 00103 private: 00104 KProcess *childproc; 00105 ProcessLineMaker* procLineMaker; 00106 }; 00107 00108 00109 #endif