jtkorhonen@0: #ifndef HGRUNNER_H jtkorhonen@0: #define HGRUNNER_H jtkorhonen@0: jtkorhonen@30: /**************************************************************************** jtkorhonen@30: ** Copyright (C) Jari Korhonen, 2010 (under lgpl) jtkorhonen@30: ****************************************************************************/ jtkorhonen@0: jtkorhonen@0: #include jtkorhonen@0: #include jtkorhonen@0: #include jtkorhonen@0: #include jtkorhonen@0: jtkorhonen@0: class HgRunner : public QProgressBar jtkorhonen@0: { jtkorhonen@0: Q_OBJECT jtkorhonen@0: jtkorhonen@0: public: jtkorhonen@0: HgRunner(QWidget * parent = 0); jtkorhonen@0: ~HgRunner(); jtkorhonen@0: jtkorhonen@0: void startProc(QString hgExePathAndName, QString workingDir, QStringList params, bool reportErrors = true); jtkorhonen@0: bool isProcRunning(); jtkorhonen@0: void killProc(); jtkorhonen@0: int getExitCode(); jtkorhonen@0: void hideProgBar(); jtkorhonen@0: QString getStdOut(); jtkorhonen@0: jtkorhonen@0: private: jtkorhonen@0: void setProcExitInfo(int procExitCode, QProcess::ExitStatus procExitStatus); jtkorhonen@0: QString getLastCommandLine(); jtkorhonen@0: void presentErrorToUser(); jtkorhonen@0: jtkorhonen@0: bool reportErrors; jtkorhonen@0: bool isRunning; jtkorhonen@0: QProcess *proc; jtkorhonen@0: QString stdOut; jtkorhonen@0: QString stdErr; jtkorhonen@0: int exitCode; jtkorhonen@0: QProcess::ExitStatus exitStatus; jtkorhonen@0: QString lastHgCommand; jtkorhonen@0: QString lastParams; jtkorhonen@0: jtkorhonen@0: jtkorhonen@0: private slots: jtkorhonen@0: void started(); jtkorhonen@0: void error(QProcess::ProcessError error); jtkorhonen@0: void finished(int procExitCode, QProcess::ExitStatus procExitStatus); jtkorhonen@0: }; jtkorhonen@0: jtkorhonen@0: #endif // HGRUNNER_H