ButtonProcessAdministrator.h
Go to the documentation of this file.
00001 #ifndef BUTTONPROCESSADMINISTRATOR_H
00002 #define BUTTONPROCESSADMINISTRATOR_H
00003 
00004 #include <QPushButton>
00005 #include <QProcess>
00006 #include <QMetaType>
00007 #include "rosprocessbutton.h"
00008 
00009 class ButtonProcessAdministrator : public QObject
00010 {
00011     Q_OBJECT
00012 public:
00013 
00014     ButtonProcessAdministrator(QObject *parent = 0);
00015 
00020     ButtonProcessAdministrator(QString getName, QString command_, QStringList arguments_, QObject *parent = 0);
00021 
00025     ButtonProcessAdministrator(const ButtonProcessAdministrator &copy);
00026     ~ButtonProcessAdministrator();
00027 
00028     QString getName() const;
00029     QString getCommand()const;
00030     QStringList getArguments()const;
00031 
00035     void addButton(QAbstractButton* button);
00036 
00041     void addButton(QPushButton* button);
00042 
00047     void addButton(RosProcessButton* button);
00048 
00052     void setCommand(QString, QStringList);
00053 
00057     QProcess::ProcessState getState()const;
00058 
00063     QString getCombinedString()const;
00064 
00069     QString getStderrString()const;
00070 
00075     QString getStdcoutString()const;
00076 
00080     void stopProcess();
00081 
00085     void startProcess();
00086 
00090     enum ProcessState{
00091         NotRunning,
00092         Starting,
00093         Running,
00094         ShuttingDown
00095     };
00096 
00097 
00098 private:
00099     void setName(QString name_);
00100     void setButtonText(QString);
00101     void connectProcess();
00102     ProcessState current_process_state_;
00103 
00104 
00105 public slots:
00106     void handleClick();
00107     void handleProcessError(QProcess::ProcessError error);
00108     void startInExternalTerminal();
00109 
00110 private slots:
00114     void readStdoutProcess();
00115 
00119     void readStderrProcess();
00120 
00124     void setButtonTextStop();
00125 
00129     void setButtonTextStart();
00130 
00134     void setButtonTextStarting();
00135 
00139     void setButtonTextShuttingDown();
00140 
00144     void handleProcessStateChange(QProcess::ProcessState state);
00145 
00146 signals:
00150     void combinedStringChanged(QString text);
00151     void combinedStringChanged();
00155     void stderrStringChanged(QString text);
00156     void stderrStringChanged();
00157 
00161     void stdcoutStringChanged(QString text);
00162 
00166     void stdcoutStringChanged();
00167 
00168 private:
00169 
00171     QVector<QAbstractButton*> buttons_;
00172 
00174     QString name_;
00175 
00177     QProcess* process_;
00178 
00180     QString command_;
00181 
00182 
00184     QStringList arguments_;
00185 
00187     QString stdcout_string_;
00189     QString stderr_string_;
00191     QString combined_string_;
00192 };
00193 Q_DECLARE_METATYPE(ButtonProcessAdministrator)
00194 Q_DECLARE_METATYPE(ButtonProcessAdministrator*)
00195 #endif // BUTTONPROCESSADMINISTRATOR_H


obj_rec_gui
Author(s): AGAS/agas@uni-koblenz.de
autogenerated on Mon Oct 6 2014 02:53:43