summaryrefslogtreecommitdiff
path: root/src/lib/buildgraph/artifactvisitor.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2012-11-01 17:52:06 +0100
committerChristian Kandeler <christian.kandeler@digia.com>2012-11-02 17:43:24 +0100
commitb17a51ac6df09ffab5643b9609ce542dd3bb81cf (patch)
tree2110d83e40952bf4361e2507bae486c73b6aa1ba /src/lib/buildgraph/artifactvisitor.cpp
parent2477c391134f1e49b9a41c18f2765585d4818622 (diff)
downloadqbs-b17a51ac6df09ffab5643b9609ce542dd3bb81cf.tar.gz
Add a progress indicator for the command-line client.
This is considered useful especially for larger projects. Along the way, fix some progress observer problems uncovered by this addition. Change-Id: I520a50d74ca10a1a125b0c11318613c23ffc17d2 Task-number: QBS-156 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/buildgraph/artifactvisitor.cpp')
-rw-r--r--src/lib/buildgraph/artifactvisitor.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/lib/buildgraph/artifactvisitor.cpp b/src/lib/buildgraph/artifactvisitor.cpp
new file mode 100644
index 000000000..2c7770e36
--- /dev/null
+++ b/src/lib/buildgraph/artifactvisitor.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Build Suite.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+#include "artifactvisitor.h"
+
+namespace qbs {
+
+ArtifactVisitor::ArtifactVisitor(Artifact::ArtifactType artifactType) : m_artifactType(artifactType)
+{
+}
+
+void ArtifactVisitor::visit(const Artifact *artifact)
+{
+ if (artifact->artifactType == m_artifactType)
+ doVisit(artifact);
+ else if (m_artifactType == Artifact::Generated)
+ return;
+ foreach (const Artifact * const child, artifact->children)
+ visit(child);
+}
+
+void ArtifactVisitor::visit(const BuildProduct::ConstPtr &product)
+{
+ foreach (const Artifact * const artifact, product->targetArtifacts)
+ visit(artifact);
+}
+
+void ArtifactVisitor::visit(const BuildProject::ConstPtr &project)
+{
+ foreach (const BuildProduct::ConstPtr &product, project->buildProducts())
+ visit(product);
+}
+
+void ArtifactVisitor::visit(const QList<BuildProject::ConstPtr> &projects)
+{
+ foreach (const BuildProject::ConstPtr &project, projects)
+ visit(project);
+}
+
+void ArtifactVisitor::visit(const QList<BuildProject::Ptr> &projects)
+{
+ foreach (const BuildProject::ConstPtr &project, projects)
+ visit(project);
+}
+
+} // namespace qbs