forked from qt-creator/qt-creator
VCS: Update progress bar for commands that output progress
Change-Id: I643df94c72068259817092d7d48f71984288fdb5 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
6c582e0180
commit
fc6ff05472
@@ -37,6 +37,7 @@
|
||||
#include <QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QMutex;
|
||||
class QStringList;
|
||||
class QVariant;
|
||||
class QProcessEnvironment;
|
||||
@@ -48,6 +49,24 @@ namespace VcsBase {
|
||||
|
||||
namespace Internal { class CommandPrivate; }
|
||||
|
||||
class VCSBASE_EXPORT ProgressParser
|
||||
{
|
||||
public:
|
||||
ProgressParser();
|
||||
virtual ~ProgressParser();
|
||||
|
||||
protected:
|
||||
virtual void parseProgress(const QString &text) = 0;
|
||||
void setProgressAndMaximum(int value, int maximum);
|
||||
|
||||
private:
|
||||
void setFuture(QFutureInterface<void> *future);
|
||||
|
||||
QFutureInterface<void> *m_future;
|
||||
QMutex *m_futureMutex;
|
||||
friend class Command;
|
||||
};
|
||||
|
||||
class VCSBASE_EXPORT Command : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -80,6 +99,7 @@ public:
|
||||
QTextCodec *codec() const;
|
||||
void setCodec(QTextCodec *codec);
|
||||
|
||||
void setProgressParser(ProgressParser *parser);
|
||||
|
||||
Utils::SynchronousProcessResponse runVcs(const QStringList &arguments, int timeoutMS);
|
||||
// Make sure to not pass through the event loop at all:
|
||||
@@ -90,6 +110,9 @@ private:
|
||||
void run(QFutureInterface<void> &future);
|
||||
Utils::SynchronousProcessResponse runSynchronous(const QStringList &arguments, int timeoutMS);
|
||||
|
||||
private slots:
|
||||
void bufferedOutput(const QString &text);
|
||||
|
||||
signals:
|
||||
void output(const QString &);
|
||||
void errorText(const QString &);
|
||||
|
||||
Reference in New Issue
Block a user