~zeller-benjamin/qtcreator-plugin-ubuntu/qtc41-beta

« back to all changes in this revision

Viewing changes to ubuntuprocess.h

  • Committer: Juhapekka Piiroinen
  • Date: 2013-09-04 15:30:00 UTC
  • mto: (23.1.14 binary-plugin)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: juhapekka.piiroinen@canonical.com-20130904153000-r4lhfhrjlwmop277
Added cordova plugin from ubuntu-qtcreator-plugins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2013 Canonical Ltd.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify
5
 
 * it under the terms of the GNU Lesser General Public License as published by
6
 
 * the Free Software Foundation; version 2.1.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful,
9
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 * GNU Lesser General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU Lesser General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Author: Juhapekka Piiroinen <juhapekka.piiroinen@canonical.com>
17
 
 */
18
 
 
19
 
#ifndef UBUNTUPROCESS_H
20
 
#define UBUNTUPROCESS_H
21
 
 
22
 
#include <QObject>
23
 
#include <QProcess>
24
 
#include <QFutureInterface>
25
 
 
26
 
#include "ubuntu_global.h"
27
 
 
28
 
namespace Ubuntu {
29
 
namespace Internal {
30
 
 
31
 
class UBUNTUSHARED_EXPORT UbuntuProcess : public QObject
32
 
{
33
 
    Q_OBJECT
34
 
public:
35
 
    explicit UbuntuProcess(QObject *parent = 0);
36
 
 
37
 
    void clear() { m_pendingProcesses.clear(); }
38
 
 
39
 
    void append(QStringList cmds) { m_pendingProcesses << cmds; }
40
 
 
41
 
    QProcess::ProcessState state() { return m_currentProcess.state(); }
42
 
 
43
 
public slots:
44
 
    void stop();
45
 
    void start(QString taskTitle);
46
 
 
47
 
signals:
48
 
    void message(QString);
49
 
    void error(QString);
50
 
    void finished(QString,int);
51
 
    void started(QString);
52
 
 
53
 
protected slots:
54
 
    void processStarted();
55
 
    void processReadyRead();
56
 
    void processFinished(int code);
57
 
    void processError(QProcess::ProcessError error);
58
 
    void processCmdQueue();
59
 
 
60
 
protected:
61
 
    void close();
62
 
    void kill();
63
 
 
64
 
    QList<QStringList> m_pendingProcesses;
65
 
    QProcess m_currentProcess;
66
 
    QFutureInterface<void> *m_futureInterface;
67
 
 
68
 
    void initializeProgressBar(QString title, int max);
69
 
    void setProgressBarFinished();
70
 
    void increaseProgress(QString msg);
71
 
    void setProgressBarCancelled();
72
 
    void setProgressBarStarted();
73
 
 
74
 
    bool m_bForceStop;
75
 
 
76
 
};
77
 
 
78
 
 
79
 
} // Internal
80
 
} // Ubuntu
81
 
 
82
 
#endif // UBUNTUPROCESS_H