diff hgrunner.h @ 0:a9098eba2ee5

Initial commit.
author Jari Korhonen <jtkorhonen@gmail.com>
date Thu, 22 Apr 2010 03:15:35 +0300
parents
children 45bfb8dc1faf
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgrunner.h	Thu Apr 22 03:15:35 2010 +0300
@@ -0,0 +1,48 @@
+#ifndef HGRUNNER_H
+#define HGRUNNER_H
+
+//** Copyright (C) Jari Korhonen, 2010 (under lgpl)
+
+#include <QProgressBar>
+#include <QProcess>
+#include <QByteArray>
+#include <QRect>
+
+class HgRunner : public QProgressBar
+{
+    Q_OBJECT
+
+    public:
+        HgRunner(QWidget * parent = 0);
+        ~HgRunner();
+
+        void startProc(QString hgExePathAndName, QString workingDir, QStringList params, bool reportErrors = true);
+        bool isProcRunning();
+        void killProc();
+        int  getExitCode();
+        void hideProgBar();
+        QString getStdOut();
+
+    private:
+        void setProcExitInfo(int procExitCode, QProcess::ExitStatus procExitStatus);
+        QString getLastCommandLine();
+        void presentErrorToUser();
+
+        bool                    reportErrors;
+        bool                    isRunning;
+        QProcess                *proc;
+        QString                 stdOut;
+        QString                 stdErr;
+        int                     exitCode;
+        QProcess::ExitStatus    exitStatus;
+        QString                 lastHgCommand;
+        QString                 lastParams;
+
+
+    private slots:
+        void started();
+        void error(QProcess::ProcessError error);
+        void finished(int procExitCode, QProcess::ExitStatus procExitStatus);
+};
+
+#endif // HGRUNNER_H