2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-03-04 12:15:18 +01:00
|
|
|
** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
2011-03-04 12:15:18 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2011-03-04 12:15:18 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-03-04 12:15:18 +01:00
|
|
|
|
|
|
|
|
#include "analyzerruncontrol.h"
|
|
|
|
|
#include "ianalyzertool.h"
|
|
|
|
|
#include "analyzermanager.h"
|
2011-04-04 14:39:28 +02:00
|
|
|
#include "analyzerstartparameters.h"
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDebug>
|
2013-05-03 12:41:58 +02:00
|
|
|
#include <QAction>
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2011-07-06 11:57:33 +02:00
|
|
|
using namespace ProjectExplorer;
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2011-07-06 11:57:33 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2013-07-30 14:08:01 +02:00
|
|
|
// AnalyzerRunControl
|
2011-07-06 11:57:33 +02:00
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
namespace Analyzer {
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2013-07-30 14:08:01 +02:00
|
|
|
AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
|
|
|
|
ProjectExplorer::RunConfiguration *runConfiguration)
|
|
|
|
|
: RunControl(runConfiguration, sp.runMode)
|
2011-05-18 15:56:01 +02:00
|
|
|
{
|
2014-05-27 18:50:55 +02:00
|
|
|
setIcon(QLatin1String(":/images/analyzer_start_small.png"));
|
|
|
|
|
|
2013-07-30 14:08:01 +02:00
|
|
|
m_runConfig = runConfiguration;
|
|
|
|
|
m_sp = sp;
|
2013-05-03 12:41:58 +02:00
|
|
|
|
2013-07-30 14:08:01 +02:00
|
|
|
connect(this, SIGNAL(finished()), SLOT(runControlFinished()));
|
2013-05-03 12:41:58 +02:00
|
|
|
connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), SLOT(stopIt()));
|
2011-03-04 12:15:18 +01:00
|
|
|
}
|
|
|
|
|
|
2013-07-30 14:08:01 +02:00
|
|
|
void AnalyzerRunControl::stopIt()
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
2013-07-30 14:08:01 +02:00
|
|
|
if (stop() == RunControl::StoppedSynchronously)
|
|
|
|
|
AnalyzerManager::handleToolFinished();
|
|
|
|
|
}
|
2011-04-04 14:39:28 +02:00
|
|
|
|
2013-07-30 14:08:01 +02:00
|
|
|
void AnalyzerRunControl::runControlFinished()
|
|
|
|
|
{
|
|
|
|
|
m_isRunning = false;
|
|
|
|
|
AnalyzerManager::handleToolFinished();
|
2011-03-04 12:15:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnalyzerRunControl::start()
|
|
|
|
|
{
|
2011-11-11 19:24:04 +01:00
|
|
|
AnalyzerManager::handleToolStarted();
|
|
|
|
|
|
2013-07-30 14:08:01 +02:00
|
|
|
if (startEngine()) {
|
|
|
|
|
m_isRunning = true;
|
2011-07-25 14:49:07 +02:00
|
|
|
emit started();
|
|
|
|
|
}
|
2011-03-04 12:15:18 +01:00
|
|
|
}
|
|
|
|
|
|
2011-07-06 11:57:33 +02:00
|
|
|
RunControl::StopResult AnalyzerRunControl::stop()
|
2011-03-04 12:15:18 +01:00
|
|
|
{
|
2013-07-30 14:08:01 +02:00
|
|
|
if (!m_isRunning)
|
2011-04-04 14:39:28 +02:00
|
|
|
return StoppedSynchronously;
|
|
|
|
|
|
2013-07-30 14:08:01 +02:00
|
|
|
stopEngine();
|
|
|
|
|
m_isRunning = false;
|
2011-03-04 12:15:18 +01:00
|
|
|
return AsynchronousStop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AnalyzerRunControl::isRunning() const
|
|
|
|
|
{
|
2013-07-30 14:08:01 +02:00
|
|
|
return m_isRunning;
|
2011-03-04 12:15:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AnalyzerRunControl::displayName() const
|
|
|
|
|
{
|
2013-07-30 14:08:01 +02:00
|
|
|
return m_runConfig ? m_runConfig->displayName() : m_sp.displayName;
|
2011-03-04 12:15:18 +01:00
|
|
|
}
|
|
|
|
|
|
2011-07-06 11:57:33 +02:00
|
|
|
} // namespace Analyzer
|