Chris@57
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@57
|
2
|
Chris@57
|
3 /*
|
Chris@57
|
4 EasyMercurial
|
Chris@57
|
5
|
Chris@57
|
6 Based on HgExplorer by Jari Korhonen
|
Chris@57
|
7 Copyright (c) 2010 Jari Korhonen
|
Chris@57
|
8 Copyright (c) 2010 Chris Cannam
|
Chris@57
|
9 Copyright (c) 2010 Queen Mary, University of London
|
Chris@57
|
10
|
Chris@57
|
11 This program is free software; you can redistribute it and/or
|
Chris@57
|
12 modify it under the terms of the GNU General Public License as
|
Chris@57
|
13 published by the Free Software Foundation; either version 2 of the
|
Chris@57
|
14 License, or (at your option) any later version. See the file
|
Chris@57
|
15 COPYING included with this distribution for more information.
|
Chris@57
|
16 */
|
Chris@57
|
17
|
jtkorhonen@0
|
18 #ifndef HGRUNNER_H
|
jtkorhonen@0
|
19 #define HGRUNNER_H
|
jtkorhonen@0
|
20
|
jtkorhonen@0
|
21 #include <QProgressBar>
|
jtkorhonen@0
|
22 #include <QProcess>
|
jtkorhonen@0
|
23 #include <QByteArray>
|
jtkorhonen@0
|
24 #include <QRect>
|
jtkorhonen@0
|
25
|
jtkorhonen@0
|
26 class HgRunner : public QProgressBar
|
jtkorhonen@0
|
27 {
|
jtkorhonen@0
|
28 Q_OBJECT
|
jtkorhonen@0
|
29
|
Chris@62
|
30 public:
|
Chris@62
|
31 HgRunner(QWidget * parent = 0);
|
Chris@62
|
32 ~HgRunner();
|
jtkorhonen@0
|
33
|
Chris@62
|
34 void startHgCommand(QString workingDir, QStringList params);
|
Chris@62
|
35 void startCommand(QString command, QString workingDir, QStringList params);
|
jtkorhonen@0
|
36
|
Chris@62
|
37 bool isCommandRunning();
|
Chris@62
|
38 void killCurrentCommand();
|
jtkorhonen@0
|
39
|
Chris@62
|
40 int getExitCode();
|
Chris@62
|
41 QProcess::ExitStatus getExitStatus();
|
jtkorhonen@0
|
42
|
Chris@62
|
43 void hideProgBar();
|
jtkorhonen@0
|
44
|
Chris@62
|
45 QString getStdOut();
|
Chris@62
|
46
|
Chris@62
|
47 signals:
|
Chris@62
|
48 void commandCompleted();
|
Chris@62
|
49 void commandFailed();
|
Chris@62
|
50
|
Chris@62
|
51 private:
|
Chris@62
|
52 void saveOutput();
|
Chris@62
|
53 void setProcExitInfo(int procExitCode, QProcess::ExitStatus procExitStatus);
|
Chris@62
|
54 QString getLastCommandLine();
|
Chris@62
|
55 void presentErrorToUser();
|
Chris@62
|
56 QString getHgBinaryName();
|
Chris@62
|
57
|
Chris@62
|
58 bool reportErrors;
|
Chris@62
|
59 bool isRunning;
|
Chris@62
|
60 QProcess *proc;
|
Chris@62
|
61 QString stdOut;
|
Chris@62
|
62 QString stdErr;
|
Chris@62
|
63 int exitCode;
|
Chris@62
|
64 QProcess::ExitStatus exitStatus;
|
Chris@62
|
65 QString lastHgCommand;
|
Chris@62
|
66 QString lastParams;
|
Chris@62
|
67
|
Chris@62
|
68 private slots:
|
Chris@62
|
69 void started();
|
Chris@62
|
70 void finished(int procExitCode, QProcess::ExitStatus procExitStatus);
|
jtkorhonen@0
|
71 };
|
jtkorhonen@0
|
72
|
jtkorhonen@0
|
73 #endif // HGRUNNER_H
|