comparison hgrunner.h @ 62:68aebc316898

* Some adjustments to process running (avoid timer): caller must now report errors * Function to find user's real name * Locate hg executable in path explicitly, use a setting to remember it
author Chris Cannam
date Wed, 17 Nov 2010 13:32:56 +0000
parents f583e44d9d31
children 295e3ee4a257
comparison
equal deleted inserted replaced
61:bf57a16315bd 62:68aebc316898
25 25
26 class HgRunner : public QProgressBar 26 class HgRunner : public QProgressBar
27 { 27 {
28 Q_OBJECT 28 Q_OBJECT
29 29
30 public: 30 public:
31 HgRunner(QWidget * parent = 0); 31 HgRunner(QWidget * parent = 0);
32 ~HgRunner(); 32 ~HgRunner();
33 33
34 void startProc(QString hgExePathAndName, QString workingDir, QStringList params, bool reportErrors = true); 34 void startHgCommand(QString workingDir, QStringList params);
35 bool isProcRunning(); 35 void startCommand(QString command, QString workingDir, QStringList params);
36 void killProc();
37 int getExitCode();
38 void hideProgBar();
39 QString getStdOut();
40 36
41 private: 37 bool isCommandRunning();
42 void setProcExitInfo(int procExitCode, QProcess::ExitStatus procExitStatus); 38 void killCurrentCommand();
43 QString getLastCommandLine();
44 void presentErrorToUser();
45 39
46 bool reportErrors; 40 int getExitCode();
47 bool isRunning; 41 QProcess::ExitStatus getExitStatus();
48 QProcess *proc;
49 QString stdOut;
50 QString stdErr;
51 int exitCode;
52 QProcess::ExitStatus exitStatus;
53 QString lastHgCommand;
54 QString lastParams;
55 42
43 void hideProgBar();
56 44
57 private slots: 45 QString getStdOut();
58 void started(); 46
59 void error(QProcess::ProcessError error); 47 signals:
60 void finished(int procExitCode, QProcess::ExitStatus procExitStatus); 48 void commandCompleted();
49 void commandFailed();
50
51 private:
52 void saveOutput();
53 void setProcExitInfo(int procExitCode, QProcess::ExitStatus procExitStatus);
54 QString getLastCommandLine();
55 void presentErrorToUser();
56 QString getHgBinaryName();
57
58 bool reportErrors;
59 bool isRunning;
60 QProcess *proc;
61 QString stdOut;
62 QString stdErr;
63 int exitCode;
64 QProcess::ExitStatus exitStatus;
65 QString lastHgCommand;
66 QString lastParams;
67
68 private slots:
69 void started();
70 void finished(int procExitCode, QProcess::ExitStatus procExitStatus);
61 }; 71 };
62 72
63 #endif // HGRUNNER_H 73 #endif // HGRUNNER_H