Analyzer: Separate out run control factories

Separating out the run control factories is the initial
step towards separation of run control from QML profiler
engine. The goal is to to make the engine agnostic of
the run control.

Change-Id: Ic8279755f0188ab53253a62322fcccf1c17b6aaf
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
This commit is contained in:
Aurindam Jana
2013-07-19 16:08:54 +02:00
parent 2001fe982b
commit c57160eda6
13 changed files with 200 additions and 41 deletions

View File

@@ -16,8 +16,7 @@ SOURCES += \
analyzeroptionspage.cpp \
analyzerrunconfigwidget.cpp \
analyzerutils.cpp \
startremotedialog.cpp \
analyzerruncontrolfactory.cpp
startremotedialog.cpp
HEADERS += \
ianalyzerengine.h \
@@ -32,8 +31,7 @@ HEADERS += \
analyzeroptionspage.h \
analyzerrunconfigwidget.h \
analyzerutils.h \
startremotedialog.h \
analyzerruncontrolfactory.h
startremotedialog.h
RESOURCES += \
analyzerbase.qrc

View File

@@ -26,8 +26,6 @@ QtcPlugin {
"analyzerrunconfigwidget.h",
"analyzerruncontrol.cpp",
"analyzerruncontrol.h",
"analyzerruncontrolfactory.cpp",
"analyzerruncontrolfactory.h",
"analyzersettings.cpp",
"analyzersettings.h",
"analyzerstartparameters.h",

View File

@@ -30,7 +30,6 @@
#include "analyzerplugin.h"
#include "analyzermanager.h"
#include "analyzerruncontrolfactory.h"
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/taskhub.h>
@@ -65,8 +64,6 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri
(void) new AnalyzerManager(this);
addAutoReleasedObject(new AnalyzerRunControlFactory());
// Task integration.
//: Category under which Analyzer tasks are listed in Issues view
ProjectExplorer::ProjectExplorerPlugin::instance()->taskHub()

View File

@@ -1,84 +0,0 @@
/**************************************************************************
**
** Copyright (C) 2013 Kläralvdalens Datakonsult AB, a KDAB Group company.
** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** 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 "analyzerruncontrolfactory.h"
#include "analyzersettings.h"
#include "analyzerruncontrol.h"
#include "analyzermanager.h"
#include "ianalyzertool.h"
#include "analyzerstartparameters.h"
#include <utils/qtcassert.h>
#include <QAction>
using namespace ProjectExplorer;
namespace Analyzer {
namespace Internal {
AnalyzerRunControlFactory::AnalyzerRunControlFactory(QObject *parent) :
IRunControlFactory(parent)
{
}
bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode mode) const
{
IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
if (tool)
return tool->canRun(runConfiguration, mode);
return false;
}
RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, RunMode mode, QString *errorMessage)
{
IAnalyzerTool *tool = AnalyzerManager::toolFromRunMode(mode);
if (!tool) {
if (errorMessage)
*errorMessage = tr("No analyzer tool selected"); // never happens
return 0;
}
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
AnalyzerStartParameters sp = tool->createStartParameters(runConfiguration, mode);
sp.toolId = tool->id();
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
return rc;
}
IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
{
Q_UNUSED(rc);
return new AnalyzerRunConfigurationAspect;
}
} // namespace Internal
} // namespace Analyzer

View File

@@ -1,57 +0,0 @@
/**************************************************************************
**
** Copyright (C) 2013 Kläralvdalens Datakonsult AB, a KDAB Group company.
** Contact: Kläralvdalens Datakonsult AB (info@kdab.com)
**
** This file is part of Qt Creator.
**
** 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.
**
****************************************************************************/
#ifndef ANALYZERRUNCONTROLFACTORY_H
#define ANALYZERRUNCONTROLFACTORY_H
#include <analyzerbase/analyzerruncontrol.h>
namespace Analyzer {
namespace Internal {
class AnalyzerRunControlFactory : public ProjectExplorer::IRunControlFactory
{
Q_OBJECT
public:
typedef ProjectExplorer::RunConfiguration RunConfiguration;
explicit AnalyzerRunControlFactory(QObject *parent = 0);
// IRunControlFactory implementation
bool canRun(RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const;
ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration,
ProjectExplorer::RunMode mode,
QString *errorMessage);
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc);
};
} // namespace Internal
} // namespace Analyzer
#endif // ANALYZERRUNCONTROLFACTORY_H