2
* Copyright 2013 Canonical Ltd.
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.
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.
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/>.
16
* Author: Juhapekka Piiroinen <juhapekka.piiroinen@canonical.com>
19
#ifndef UBUNTUPROCESS_H
20
#define UBUNTUPROCESS_H
24
#include <QFutureInterface>
26
#include "ubuntu_global.h"
31
class UBUNTUSHARED_EXPORT UbuntuProcess : public QObject
35
explicit UbuntuProcess(QObject *parent = 0);
37
void clear() { m_pendingProcesses.clear(); }
39
void append(QStringList cmds) { m_pendingProcesses << cmds; }
41
QProcess::ProcessState state() { return m_currentProcess.state(); }
45
void start(QString taskTitle);
48
void message(QString);
50
void finished(QString,int);
51
void started(QString);
54
void processStarted();
55
void processReadyRead();
56
void processFinished(int code);
57
void processError(QProcess::ProcessError error);
58
void processCmdQueue();
64
QList<QStringList> m_pendingProcesses;
65
QProcess m_currentProcess;
66
QFutureInterface<void> *m_futureInterface;
68
void initializeProgressBar(QString title, int max);
69
void setProgressBarFinished();
70
void increaseProgress(QString msg);
71
void setProgressBarCancelled();
72
void setProgressBarStarted();
82
#endif // UBUNTUPROCESS_H