programsensor.h
00001 /*************************************************************************** 00002 * Copyright (C) 2003 by Hans Karlsson * 00003 * karlsson.h@home.se * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 #ifndef PROGRAMSENSOR_H 00011 #define PROGRAMSENSOR_H 00012 #include "sensor.h" 00013 #include <kprocess.h> 00014 #include <kprocio.h> 00015 #include <tqstring.h> 00016 #include <tqstringlist.h> 00017 #include <tqvaluevector.h> 00018 #include <tqtextcodec.h> 00019 class ProgramSensor : public Sensor 00020 { 00021 Q_OBJECT 00022 00023 public: 00024 ProgramSensor(const TQString &programName, int msec=1000, TQString encoding="" ); 00025 ~ProgramSensor(); 00026 void update(); 00027 00028 private: 00029 TQTextCodec *codec; 00030 KShellProcess ksp; 00031 TQString programName; 00032 TQString sensorResult; 00033 00034 public slots: 00035 void receivedStdout(TDEProcess *proc, char *buffer, int buflen); 00036 void processExited(TDEProcess *proc); 00037 }; 00038 00039 #endif // PROGRAMSENSOR_H