From fc6ff05472b1196edbd8c7744e9386d7770e6e70 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 26 Aug 2013 23:14:44 +0300 Subject: VCS: Update progress bar for commands that output progress Change-Id: I643df94c72068259817092d7d48f71984288fdb5 Reviewed-by: Tobias Hunger --- src/plugins/git/gitclient.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/plugins/git/gitclient.cpp') diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index eb9d562005..c9ce5894ea 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -829,6 +829,26 @@ private: QStringList m_files; }; +class ProgressParser : public VcsBase::ProgressParser +{ +public: + ProgressParser() : + m_progressExp(QLatin1String("\\((\\d+)/(\\d+)\\)")) // e.g. Rebasing (7/42) + { + } + +protected: + void parseProgress(const QString &text) + { + if (m_progressExp.lastIndexIn(text) != -1) + setProgressAndMaximum(m_progressExp.cap(1).toInt(), m_progressExp.cap(2).toInt()); + } + +private: + QRegExp m_progressExp; +}; + + Core::IEditor *locateEditor(const char *property, const QString &entry) { @@ -3487,6 +3507,7 @@ void GitClient::rebase(const QString &workingDirectory, const QString &baseBranc arguments); VcsBase::Command *command = createCommand(workingDirectory, 0, true); new ConflictHandler(command, workingDirectory, gitCommand); + command->setProgressParser(new ProgressParser); command->addJob(arguments, -1); command->execute(); } @@ -3532,6 +3553,7 @@ void GitClient::interactiveRebase(const QString &workingDirectory, const QString m_disableEditor = true; VcsBase::Command *command = createCommand(workingDirectory, 0, true); new ConflictHandler(command, workingDirectory, QLatin1String("rebase")); + command->setProgressParser(new ProgressParser); command->addJob(arguments, -1); command->execute(); command->setCookie(workingDirectory); -- cgit v1.2.1