2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "runconfiguration.h"
|
2010-01-07 18:17:24 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "project.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include "target.h"
|
2011-02-01 18:36:00 +01:00
|
|
|
#include "toolchain.h"
|
2011-08-18 13:46:52 +02:00
|
|
|
#include "abi.h"
|
2009-10-28 17:21:27 +01:00
|
|
|
#include "buildconfiguration.h"
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "kitinformation.h"
|
2010-02-08 15:50:06 +01:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2011-01-17 13:52:14 +01:00
|
|
|
|
2011-08-18 13:46:52 +02:00
|
|
|
#include <utils/outputformatter.h>
|
2011-01-17 13:52:14 +01:00
|
|
|
#include <utils/checkablemessagebox.h>
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
2013-03-26 11:32:14 +01:00
|
|
|
#include <coreplugin/icontext.h>
|
2010-02-08 15:50:06 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QPushButton>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-02-01 12:15:44 +01:00
|
|
|
#ifdef Q_OS_OSX
|
2012-02-23 17:40:48 +01:00
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif
|
|
|
|
|
|
2015-06-29 10:36:29 +03:00
|
|
|
namespace ProjectExplorer {
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-05-31 09:48:00 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::ProcessHandle
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The ProcessHandle class is a helper class to describe a process.
|
2011-05-31 09:48:00 +02:00
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
Encapsulates parameters of a running process, local (PID) or remote (to be
|
|
|
|
|
done, address, port, and so on).
|
2011-05-31 09:48:00 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-07-06 10:25:18 +02:00
|
|
|
ProcessHandle::ProcessHandle(quint64 pid) :
|
|
|
|
|
m_pid(pid)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ProcessHandle::isValid() const
|
|
|
|
|
{
|
|
|
|
|
return m_pid != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProcessHandle::setPid(quint64 pid)
|
|
|
|
|
{
|
|
|
|
|
m_pid = pid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
quint64 ProcessHandle::pid() const
|
|
|
|
|
{
|
|
|
|
|
return m_pid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString ProcessHandle::toString() const
|
|
|
|
|
{
|
|
|
|
|
if (m_pid)
|
|
|
|
|
return RunControl::tr("PID %1").arg(m_pid);
|
|
|
|
|
//: Invalid process handle.
|
|
|
|
|
return RunControl::tr("Invalid");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ProcessHandle::equals(const ProcessHandle &rhs) const
|
|
|
|
|
{
|
|
|
|
|
return m_pid == rhs.m_pid;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-12 17:04:10 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// ISettingsAspect
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
ISettingsAspect *ISettingsAspect::clone() const
|
|
|
|
|
{
|
|
|
|
|
ISettingsAspect *other = create();
|
|
|
|
|
QVariantMap data;
|
|
|
|
|
toMap(data);
|
|
|
|
|
other->fromMap(data);
|
|
|
|
|
return other;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// IRunConfigurationAspect
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
IRunConfigurationAspect::IRunConfigurationAspect(RunConfiguration *runConfig) :
|
|
|
|
|
m_runConfiguration(runConfig)
|
|
|
|
|
{ }
|
2013-08-12 17:04:10 +02:00
|
|
|
|
|
|
|
|
IRunConfigurationAspect::~IRunConfigurationAspect()
|
|
|
|
|
{
|
|
|
|
|
delete m_projectSettings;
|
|
|
|
|
}
|
2012-02-17 19:05:11 +01:00
|
|
|
|
2013-06-05 08:43:52 +03:00
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Returns the widget used to configure this run configuration. Ownership is
|
|
|
|
|
transferred to the caller.
|
2013-06-05 08:43:52 +03:00
|
|
|
*/
|
2013-08-12 17:04:10 +02:00
|
|
|
|
2016-04-21 19:07:07 +02:00
|
|
|
RunConfigWidget *IRunConfigurationAspect::createConfigurationWidget() const
|
2013-03-27 17:17:24 +01:00
|
|
|
{
|
2016-04-21 19:07:07 +02:00
|
|
|
return m_runConfigWidgetCreator ? m_runConfigWidgetCreator() : nullptr;
|
2013-03-27 17:17:24 +01:00
|
|
|
}
|
|
|
|
|
|
2013-08-12 17:04:10 +02:00
|
|
|
void IRunConfigurationAspect::setProjectSettings(ISettingsAspect *settings)
|
|
|
|
|
{
|
|
|
|
|
m_projectSettings = settings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IRunConfigurationAspect::setGlobalSettings(ISettingsAspect *settings)
|
|
|
|
|
{
|
|
|
|
|
m_globalSettings = settings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IRunConfigurationAspect::setUsingGlobalSettings(bool value)
|
|
|
|
|
{
|
|
|
|
|
m_useGlobalSettings = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ISettingsAspect *IRunConfigurationAspect::currentSettings() const
|
|
|
|
|
{
|
|
|
|
|
return m_useGlobalSettings ? m_globalSettings : m_projectSettings;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IRunConfigurationAspect::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
m_projectSettings->fromMap(map);
|
|
|
|
|
m_useGlobalSettings = map.value(m_id.toString() + QLatin1String(".UseGlobalSettings"), true).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IRunConfigurationAspect::toMap(QVariantMap &map) const
|
|
|
|
|
{
|
|
|
|
|
m_projectSettings->toMap(map);
|
|
|
|
|
map.insert(m_id.toString() + QLatin1String(".UseGlobalSettings"), m_useGlobalSettings);
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-21 19:07:07 +02:00
|
|
|
void IRunConfigurationAspect::setRunConfigWidgetCreator(const RunConfigWidgetCreator &runConfigWidgetCreator)
|
|
|
|
|
{
|
|
|
|
|
m_runConfigWidgetCreator = runConfigWidgetCreator;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-12 16:41:29 +01:00
|
|
|
IRunConfigurationAspect *IRunConfigurationAspect::clone(RunConfiguration *runConfig) const
|
2013-08-12 17:04:10 +02:00
|
|
|
{
|
2014-12-12 16:41:29 +01:00
|
|
|
IRunConfigurationAspect *other = create(runConfig);
|
2013-08-24 23:39:47 +03:00
|
|
|
if (m_projectSettings)
|
|
|
|
|
other->m_projectSettings = m_projectSettings->clone();
|
2013-08-12 17:04:10 +02:00
|
|
|
other->m_globalSettings = m_globalSettings;
|
|
|
|
|
other->m_useGlobalSettings = m_useGlobalSettings;
|
|
|
|
|
return other;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IRunConfigurationAspect::resetProjectToGlobalSettings()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(m_globalSettings, return);
|
|
|
|
|
QVariantMap map;
|
|
|
|
|
m_globalSettings->toMap(map);
|
|
|
|
|
m_projectSettings->fromMap(map);
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-27 17:17:24 +01:00
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::RunConfiguration
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The RunConfiguration class is the base class for a run configuration.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
A run configuration specifies how a target should be run, while a runner
|
|
|
|
|
does the actual running.
|
|
|
|
|
|
|
|
|
|
All RunControls and the target hold a shared pointer to the run
|
|
|
|
|
configuration. That is, the lifetime of the run configuration might exceed
|
|
|
|
|
the life of the target.
|
2011-04-14 12:58:14 +02:00
|
|
|
The user might still have a RunControl running (or output tab of that RunControl open)
|
|
|
|
|
and yet unloaded the target.
|
|
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
Also, a run configuration might be already removed from the list of run
|
|
|
|
|
configurations
|
2011-04-14 12:58:14 +02:00
|
|
|
for a target, but still be runnable via the output tab.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
RunConfiguration::RunConfiguration(Target *target, Core::Id id) :
|
2010-09-01 11:34:34 +02:00
|
|
|
ProjectConfiguration(target, id),
|
2013-03-26 16:39:41 +01:00
|
|
|
m_aspectsInitialized(false)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(target);
|
2013-03-27 13:03:15 +01:00
|
|
|
ctor();
|
2010-01-19 13:41:02 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
RunConfiguration::RunConfiguration(Target *target, RunConfiguration *source) :
|
2010-09-08 11:20:56 +02:00
|
|
|
ProjectConfiguration(target, source),
|
2013-03-26 16:39:41 +01:00
|
|
|
m_aspectsInitialized(true)
|
2010-01-19 13:41:02 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
Q_ASSERT(target);
|
2013-03-27 13:03:15 +01:00
|
|
|
ctor();
|
2012-09-20 14:42:57 +02:00
|
|
|
foreach (IRunConfigurationAspect *aspect, source->m_aspects) {
|
2013-03-22 15:18:52 +01:00
|
|
|
IRunConfigurationAspect *clone = aspect->clone(this);
|
|
|
|
|
if (clone)
|
|
|
|
|
m_aspects.append(clone);
|
2012-09-20 14:42:57 +02:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RunConfiguration::~RunConfiguration()
|
|
|
|
|
{
|
2011-02-28 12:23:12 +01:00
|
|
|
qDeleteAll(m_aspects);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunConfiguration::addExtraAspects()
|
|
|
|
|
{
|
2013-03-26 16:39:41 +01:00
|
|
|
if (m_aspectsInitialized)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-06-18 11:34:15 +02:00
|
|
|
foreach (IRunControlFactory *factory, ExtensionSystem::PluginManager::getObjects<IRunControlFactory>())
|
2013-04-05 17:27:45 +02:00
|
|
|
addExtraAspect(factory->createRunConfigurationAspect(this));
|
2013-03-26 16:39:41 +01:00
|
|
|
m_aspectsInitialized = true;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2013-04-05 17:27:45 +02:00
|
|
|
void RunConfiguration::addExtraAspect(IRunConfigurationAspect *aspect)
|
|
|
|
|
{
|
|
|
|
|
if (aspect)
|
|
|
|
|
m_aspects += aspect;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-27 13:03:15 +01:00
|
|
|
void RunConfiguration::ctor()
|
|
|
|
|
{
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(this, &RunConfiguration::enabledChanged,
|
|
|
|
|
this, &RunConfiguration::requestRunActionsUpdate);
|
2014-11-05 14:01:26 +01:00
|
|
|
|
2014-11-05 15:45:56 +01:00
|
|
|
Utils::MacroExpander *expander = macroExpander();
|
|
|
|
|
expander->setDisplayName(tr("Run Settings"));
|
|
|
|
|
expander->setAccumulating(true);
|
|
|
|
|
expander->registerSubProvider([this]() -> Utils::MacroExpander * {
|
|
|
|
|
BuildConfiguration *bc = target()->activeBuildConfiguration();
|
|
|
|
|
return bc ? bc->macroExpander() : target()->macroExpander();
|
|
|
|
|
});
|
2016-03-31 17:09:56 +03:00
|
|
|
expander->registerVariable(Constants::VAR_CURRENTRUN_NAME,
|
|
|
|
|
QCoreApplication::translate("ProjectExplorer", "The currently active run configuration's name."),
|
|
|
|
|
[this] { return displayName(); }, false);
|
2013-03-27 13:03:15 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Checks whether a run configuration is enabled.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-05-26 15:33:24 +02:00
|
|
|
bool RunConfiguration::isEnabled() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-01-19 13:41:02 +01:00
|
|
|
return true;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-26 16:30:35 +02:00
|
|
|
QString RunConfiguration::disabledReason() const
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
bool RunConfiguration::isConfigured() const
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-30 17:31:49 +02:00
|
|
|
RunConfiguration::ConfigurationState RunConfiguration::ensureConfigured(QString *errorMessage)
|
2012-09-13 11:27:15 +02:00
|
|
|
{
|
|
|
|
|
if (isConfigured())
|
2014-07-30 17:31:49 +02:00
|
|
|
return Configured;
|
2012-09-13 11:27:15 +02:00
|
|
|
if (errorMessage)
|
|
|
|
|
*errorMessage = tr("Unknown error.");
|
2014-07-30 17:31:49 +02:00
|
|
|
return UnConfigured;
|
2012-09-13 11:27:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
BuildConfiguration *RunConfiguration::activeBuildConfiguration() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-02-08 15:50:06 +01:00
|
|
|
if (!target())
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2010-02-08 15:50:06 +01:00
|
|
|
return target()->activeBuildConfiguration();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
Target *RunConfiguration::target() const
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-07-16 14:00:41 +02:00
|
|
|
return static_cast<Target *>(parent());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
QVariantMap RunConfiguration::toMap() const
|
|
|
|
|
{
|
2012-02-22 11:56:08 +01:00
|
|
|
QVariantMap map = ProjectConfiguration::toMap();
|
|
|
|
|
|
2011-02-28 12:23:12 +01:00
|
|
|
foreach (IRunConfigurationAspect *aspect, m_aspects)
|
2013-08-12 17:05:52 +02:00
|
|
|
aspect->toMap(map);
|
2011-02-28 12:23:12 +01:00
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-03 23:59:04 +02:00
|
|
|
Abi RunConfiguration::abi() const
|
2011-02-01 18:36:00 +01:00
|
|
|
{
|
|
|
|
|
BuildConfiguration *bc = target()->activeBuildConfiguration();
|
|
|
|
|
if (!bc)
|
|
|
|
|
return Abi::hostAbi();
|
2016-07-12 16:27:45 +02:00
|
|
|
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ToolChain::Language::Cxx);
|
2011-02-01 18:36:00 +01:00
|
|
|
if (!tc)
|
|
|
|
|
return Abi::hostAbi();
|
|
|
|
|
return tc->targetAbi();
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
bool RunConfiguration::fromMap(const QVariantMap &map)
|
|
|
|
|
{
|
2013-03-26 16:39:41 +01:00
|
|
|
addExtraAspects();
|
2010-09-09 17:00:26 +02:00
|
|
|
|
2011-02-28 12:23:12 +01:00
|
|
|
foreach (IRunConfigurationAspect *aspect, m_aspects)
|
2012-02-22 12:36:39 +01:00
|
|
|
aspect->fromMap(map);
|
2011-02-28 12:23:12 +01:00
|
|
|
|
2010-09-01 11:34:34 +02:00
|
|
|
return ProjectConfiguration::fromMap(map);
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::IRunConfigurationAspect
|
|
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The IRunConfigurationAspect class provides an additional
|
|
|
|
|
configuration aspect.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
Aspects are a mechanism to add RunControl-specific options to a run
|
|
|
|
|
configuration without subclassing the run configuration for every addition.
|
|
|
|
|
This prevents a combinatorial explosion of subclasses and eliminates
|
|
|
|
|
the need to add all options to the base class.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Returns extra aspects.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
|
|
|
|
\sa ProjectExplorer::IRunConfigurationAspect
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-28 12:23:12 +01:00
|
|
|
QList<IRunConfigurationAspect *> RunConfiguration::extraAspects() const
|
|
|
|
|
{
|
2013-03-26 16:39:41 +01:00
|
|
|
QTC_ASSERT(m_aspectsInitialized, return QList<IRunConfigurationAspect *>());
|
2011-02-28 12:23:12 +01:00
|
|
|
return m_aspects;
|
|
|
|
|
}
|
2013-08-12 17:04:10 +02:00
|
|
|
IRunConfigurationAspect *RunConfiguration::extraAspect(Core::Id id) const
|
|
|
|
|
{
|
2016-04-13 15:52:14 +02:00
|
|
|
QTC_ASSERT(m_aspectsInitialized, return nullptr);
|
2013-08-12 17:04:10 +02:00
|
|
|
foreach (IRunConfigurationAspect *aspect, m_aspects)
|
|
|
|
|
if (aspect->id() == id)
|
|
|
|
|
return aspect;
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2013-08-12 17:04:10 +02:00
|
|
|
}
|
2011-02-28 12:23:12 +01:00
|
|
|
|
2016-01-20 14:50:34 +01:00
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
|
|
|
|
|
\class ProjectExplorer::Runnable
|
|
|
|
|
|
|
|
|
|
\brief The ProjectExplorer::Runnable class wraps information needed
|
|
|
|
|
to execute a process on a target device.
|
|
|
|
|
|
|
|
|
|
A target specific \l RunConfiguration implementation can specify
|
|
|
|
|
what information it considers necessary to execute a process
|
|
|
|
|
on the target. Target specific) \n IRunControlFactory implementation
|
|
|
|
|
can use that information either unmodified or tweak it or ignore
|
|
|
|
|
it when setting up a RunControl.
|
|
|
|
|
|
|
|
|
|
From Qt Creator's core perspective a Runnable object is opaque.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\internal
|
|
|
|
|
|
|
|
|
|
\brief Returns a \l Runnable described by this RunConfiguration.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Runnable RunConfiguration::runnable() const
|
|
|
|
|
{
|
|
|
|
|
return Runnable();
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-15 12:59:44 +02:00
|
|
|
Utils::OutputFormatter *RunConfiguration::createOutputFormatter() const
|
2010-07-13 15:02:37 +02:00
|
|
|
{
|
2011-04-15 12:59:44 +02:00
|
|
|
return new Utils::OutputFormatter();
|
2010-07-13 15:02:37 +02:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 09:48:00 +02:00
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::IRunConfigurationFactory
|
|
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The IRunConfigurationFactory class restores run configurations from
|
|
|
|
|
settings.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
|
|
|
|
The run configuration factory is used for restoring run configurations from
|
2013-09-10 17:16:10 +02:00
|
|
|
settings and for creating new run configurations in the \gui {Run Settings}
|
|
|
|
|
dialog.
|
|
|
|
|
To restore run configurations, use the
|
|
|
|
|
\c {bool canRestore(Target *parent, const QString &id)}
|
|
|
|
|
and \c {RunConfiguration* create(Target *parent, const QString &id)}
|
|
|
|
|
functions.
|
|
|
|
|
|
|
|
|
|
To generate a list of creatable run configurations, use the
|
|
|
|
|
\c {QStringList availableCreationIds(Target *parent)} and
|
|
|
|
|
\c {QString displayNameForType(const QString&)} functions. To create a
|
|
|
|
|
run configuration, use \c create().
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn QStringList ProjectExplorer::IRunConfigurationFactory::availableCreationIds(Target *parent) const
|
|
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
Shows the list of possible additions to a target. Returns a list of types.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2014-07-01 11:08:26 +02:00
|
|
|
\fn QString ProjectExplorer::IRunConfigurationFactory::displayNameForId(Core::Id id) const
|
2013-09-10 17:16:10 +02:00
|
|
|
Translates the types to names to display to the user.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2010-01-19 13:41:02 +01:00
|
|
|
IRunConfigurationFactory::IRunConfigurationFactory(QObject *parent) :
|
|
|
|
|
QObject(parent)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-01 11:08:26 +02:00
|
|
|
RunConfiguration *IRunConfigurationFactory::create(Target *parent, Core::Id id)
|
2013-03-26 16:39:41 +01:00
|
|
|
{
|
|
|
|
|
if (!canCreate(parent, id))
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2013-03-26 16:39:41 +01:00
|
|
|
RunConfiguration *rc = doCreate(parent, id);
|
|
|
|
|
if (!rc)
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2013-03-26 16:39:41 +01:00
|
|
|
rc->addExtraAspects();
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-28 14:53:12 +01:00
|
|
|
RunConfiguration *IRunConfigurationFactory::restore(Target *parent, const QVariantMap &map)
|
|
|
|
|
{
|
|
|
|
|
if (!canRestore(parent, map))
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2013-03-28 14:53:12 +01:00
|
|
|
RunConfiguration *rc = doRestore(parent, map);
|
|
|
|
|
if (!rc->fromMap(map)) {
|
|
|
|
|
delete rc;
|
2016-04-13 15:52:14 +02:00
|
|
|
rc = nullptr;
|
2013-03-28 14:53:12 +01:00
|
|
|
}
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
2014-05-08 11:58:23 +02:00
|
|
|
return ExtensionSystem::PluginManager::getObject<IRunConfigurationFactory>(
|
|
|
|
|
[&parent, &map](IRunConfigurationFactory *factory) {
|
|
|
|
|
return factory->canRestore(parent, map);
|
|
|
|
|
});
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2012-09-20 14:42:57 +02:00
|
|
|
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, RunConfiguration *rc)
|
|
|
|
|
{
|
2014-05-08 11:58:23 +02:00
|
|
|
return ExtensionSystem::PluginManager::getObject<IRunConfigurationFactory>(
|
|
|
|
|
[&parent, rc](IRunConfigurationFactory *factory) {
|
|
|
|
|
return factory->canClone(parent, rc);
|
|
|
|
|
});
|
2012-09-20 14:42:57 +02:00
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
QList<IRunConfigurationFactory *> IRunConfigurationFactory::find(Target *parent)
|
2010-02-08 15:50:06 +01:00
|
|
|
{
|
2014-05-08 11:58:23 +02:00
|
|
|
return ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>(
|
|
|
|
|
[&parent](IRunConfigurationFactory *factory) {
|
|
|
|
|
return !factory->availableCreationIds(parent).isEmpty();
|
|
|
|
|
});
|
2010-02-08 15:50:06 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::IRunControlFactory
|
|
|
|
|
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The IRunControlFactory class creates RunControl objects matching a
|
|
|
|
|
run configuration.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
2013-05-23 16:13:55 +02:00
|
|
|
\fn RunConfigWidget *ProjectExplorer::IRunConfigurationAspect::createConfigurationWidget()
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
Returns a widget used to configure this runner. Ownership is transferred to
|
|
|
|
|
the caller.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
Returns null if @p \a runConfiguration is not suitable for RunControls from this
|
2013-09-10 17:16:10 +02:00
|
|
|
factory, or no user-accessible
|
2011-04-14 12:58:14 +02:00
|
|
|
configuration is required.
|
|
|
|
|
*/
|
|
|
|
|
|
2009-09-25 11:35:44 +02:00
|
|
|
IRunControlFactory::IRunControlFactory(QObject *parent)
|
2009-06-16 15:11:47 +02:00
|
|
|
: QObject(parent)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
/*!
|
|
|
|
|
Returns an IRunConfigurationAspect to carry options for RunControls this
|
|
|
|
|
factory can create.
|
|
|
|
|
|
|
|
|
|
If no extra options are required, it is allowed to return null like the
|
|
|
|
|
default implementation does. This function is intended to be called from the
|
|
|
|
|
RunConfiguration constructor, so passing a RunConfiguration pointer makes
|
|
|
|
|
no sense because that object is under construction at the time.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-03-26 16:39:41 +01:00
|
|
|
IRunConfigurationAspect *IRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
|
2011-02-28 12:23:12 +01:00
|
|
|
{
|
2013-03-26 16:39:41 +01:00
|
|
|
Q_UNUSED(rc);
|
2016-04-13 15:52:14 +02:00
|
|
|
return nullptr;
|
2011-02-28 12:23:12 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
|
|
|
|
\class ProjectExplorer::RunControl
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The RunControl class instances represent one item that is run.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn QIcon ProjectExplorer::RunControl::icon() const
|
2013-09-10 17:16:10 +02:00
|
|
|
Returns the icon to be shown in the Outputwindow.
|
2011-04-14 12:58:14 +02:00
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
TODO the icon differs currently only per "mode", so this is more flexible
|
|
|
|
|
than it needs to be.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2016-02-01 12:15:44 +01:00
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class RunControlPrivate
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
public:
|
|
|
|
|
RunControlPrivate(RunConfiguration *runConfiguration, Core::Id mode)
|
|
|
|
|
: runMode(mode), runConfiguration(runConfiguration)
|
|
|
|
|
{
|
|
|
|
|
if (runConfiguration) {
|
|
|
|
|
displayName = runConfiguration->displayName();
|
|
|
|
|
outputFormatter = runConfiguration->createOutputFormatter();
|
2016-02-01 12:37:35 +01:00
|
|
|
device = DeviceKitInformation::device(runConfiguration->target()->kit());
|
|
|
|
|
project = runConfiguration->target()->project();
|
2016-02-01 12:15:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We need to ensure that there's always a OutputFormatter
|
|
|
|
|
if (!outputFormatter)
|
|
|
|
|
outputFormatter = new Utils::OutputFormatter();
|
|
|
|
|
}
|
2015-09-17 15:24:32 +02:00
|
|
|
|
2016-02-01 12:15:44 +01:00
|
|
|
~RunControlPrivate()
|
|
|
|
|
{
|
|
|
|
|
delete outputFormatter;
|
2010-07-13 15:02:37 +02:00
|
|
|
}
|
2015-09-17 15:24:32 +02:00
|
|
|
|
2016-02-01 12:15:44 +01:00
|
|
|
QString displayName;
|
|
|
|
|
Runnable runnable;
|
2016-02-01 12:37:35 +01:00
|
|
|
IDevice::ConstPtr device;
|
2016-02-01 12:15:44 +01:00
|
|
|
Connection connection;
|
|
|
|
|
Core::Id runMode;
|
|
|
|
|
Utils::Icon icon;
|
|
|
|
|
const QPointer<RunConfiguration> runConfiguration;
|
|
|
|
|
QPointer<Project> project;
|
2016-04-13 15:52:14 +02:00
|
|
|
Utils::OutputFormatter *outputFormatter = nullptr;
|
2016-02-01 12:15:44 +01:00
|
|
|
|
|
|
|
|
// A handle to the actual application process.
|
|
|
|
|
ProcessHandle applicationProcessHandle;
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_OSX
|
|
|
|
|
//these two are used to bring apps in the foreground on Mac
|
|
|
|
|
qint64 internalPid;
|
|
|
|
|
int foregroundCount;
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
RunControl::RunControl(RunConfiguration *runConfiguration, Core::Id mode) :
|
|
|
|
|
d(new Internal::RunControlPrivate(runConfiguration, mode))
|
|
|
|
|
{ }
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-08 18:37:18 +02:00
|
|
|
RunControl::~RunControl()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
delete d;
|
2010-07-13 15:02:37 +02:00
|
|
|
}
|
2009-10-08 18:37:18 +02:00
|
|
|
|
2011-04-15 12:59:44 +02:00
|
|
|
Utils::OutputFormatter *RunControl::outputFormatter()
|
2010-07-13 15:02:37 +02:00
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
return d->outputFormatter;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2015-06-29 10:36:29 +03:00
|
|
|
Core::Id RunControl::runMode() const
|
2010-04-30 13:19:31 +02:00
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
return d->runMode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Runnable &RunControl::runnable() const
|
|
|
|
|
{
|
|
|
|
|
return d->runnable;
|
2010-04-30 13:19:31 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-18 17:11:31 +01:00
|
|
|
void RunControl::setRunnable(const Runnable &runnable)
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
d->runnable = runnable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Connection &RunControl::connection() const
|
|
|
|
|
{
|
|
|
|
|
return d->connection;
|
2016-01-18 17:11:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunControl::setConnection(const Connection &connection)
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
d->connection = connection;
|
2016-01-18 17:11:31 +01:00
|
|
|
}
|
|
|
|
|
|
2009-10-08 18:37:18 +02:00
|
|
|
QString RunControl::displayName() const
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
return d->displayName;
|
2009-10-08 18:37:18 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-21 18:19:23 +01:00
|
|
|
void RunControl::setDisplayName(const QString &displayName)
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
d->displayName = displayName;
|
2016-01-21 18:19:23 +01:00
|
|
|
}
|
|
|
|
|
|
2015-11-23 16:41:54 +01:00
|
|
|
void RunControl::setIcon(const Utils::Icon &icon)
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
d->icon = icon;
|
2015-11-23 16:41:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::Icon RunControl::icon() const
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
return d->icon;
|
2015-11-23 16:41:54 +01:00
|
|
|
}
|
|
|
|
|
|
2011-08-17 09:06:59 +02:00
|
|
|
Abi RunControl::abi() const
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
if (const RunConfiguration *rc = d->runConfiguration.data())
|
2011-08-17 09:06:59 +02:00
|
|
|
return rc->abi();
|
|
|
|
|
return Abi();
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-01 12:37:35 +01:00
|
|
|
IDevice::ConstPtr RunControl::device() const
|
|
|
|
|
{
|
|
|
|
|
return d->device;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-31 15:06:07 +02:00
|
|
|
RunConfiguration *RunControl::runConfiguration() const
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
return d->runConfiguration.data();
|
2012-08-31 15:06:07 +02:00
|
|
|
}
|
|
|
|
|
|
2015-09-17 15:24:32 +02:00
|
|
|
Project *RunControl::project() const
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
return d->project.data();
|
2015-09-17 15:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
2016-02-01 14:30:13 +01:00
|
|
|
bool RunControl::canReUseOutputPane(const RunControl *other) const
|
|
|
|
|
{
|
|
|
|
|
if (other->isRunning())
|
|
|
|
|
return false;
|
|
|
|
|
|
2016-05-11 16:29:03 +02:00
|
|
|
return d->runnable.canReUseOutputPane(other->d->runnable);
|
2016-02-01 14:30:13 +01:00
|
|
|
}
|
|
|
|
|
|
2011-05-31 09:48:00 +02:00
|
|
|
ProcessHandle RunControl::applicationProcessHandle() const
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
return d->applicationProcessHandle;
|
2011-05-31 09:48:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunControl::setApplicationProcessHandle(const ProcessHandle &handle)
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
if (d->applicationProcessHandle != handle) {
|
|
|
|
|
d->applicationProcessHandle = handle;
|
2011-07-06 10:25:18 +02:00
|
|
|
emit applicationProcessHandleChanged();
|
|
|
|
|
}
|
2011-05-31 09:48:00 +02:00
|
|
|
}
|
|
|
|
|
|
2013-09-10 17:16:10 +02:00
|
|
|
/*!
|
|
|
|
|
Prompts to stop. If \a optionalPrompt is passed, a \gui {Do not ask again}
|
|
|
|
|
checkbox is displayed and the result is returned in \a *optionalPrompt.
|
|
|
|
|
*/
|
|
|
|
|
|
2011-01-17 13:52:14 +01:00
|
|
|
bool RunControl::promptToStop(bool *optionalPrompt) const
|
2010-08-20 14:19:25 +02:00
|
|
|
{
|
2012-04-17 08:01:25 +02:00
|
|
|
QTC_ASSERT(isRunning(), return true);
|
2010-08-20 14:19:25 +02:00
|
|
|
|
2011-01-17 13:52:14 +01:00
|
|
|
if (optionalPrompt && !*optionalPrompt)
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
const QString msg = tr("<html><head/><body><center><i>%1</i> is still running.<center/>"
|
|
|
|
|
"<center>Force it to quit?</center></body></html>").arg(displayName());
|
|
|
|
|
return showPromptToStopDialog(tr("Application Still Running"), msg,
|
|
|
|
|
tr("Force Quit"), tr("Keep Running"),
|
|
|
|
|
optionalPrompt);
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-14 12:58:14 +02:00
|
|
|
/*!
|
2013-09-10 17:16:10 +02:00
|
|
|
Prompts to terminate the application with the \gui {Do not ask again}
|
|
|
|
|
checkbox.
|
2011-04-14 12:58:14 +02:00
|
|
|
*/
|
|
|
|
|
|
2011-01-17 13:52:14 +01:00
|
|
|
bool RunControl::showPromptToStopDialog(const QString &title,
|
|
|
|
|
const QString &text,
|
|
|
|
|
const QString &stopButtonText,
|
|
|
|
|
const QString &cancelButtonText,
|
|
|
|
|
bool *prompt) const
|
|
|
|
|
{
|
2012-04-17 08:01:25 +02:00
|
|
|
QTC_ASSERT(isRunning(), return true);
|
2011-01-17 13:52:14 +01:00
|
|
|
// Show a question message box where user can uncheck this
|
|
|
|
|
// question for this class.
|
2012-01-24 15:36:40 +01:00
|
|
|
Utils::CheckableMessageBox messageBox(Core::ICore::mainWindow());
|
2011-01-17 13:52:14 +01:00
|
|
|
messageBox.setWindowTitle(title);
|
|
|
|
|
messageBox.setText(text);
|
|
|
|
|
messageBox.setStandardButtons(QDialogButtonBox::Yes|QDialogButtonBox::Cancel);
|
|
|
|
|
if (!stopButtonText.isEmpty())
|
|
|
|
|
messageBox.button(QDialogButtonBox::Yes)->setText(stopButtonText);
|
|
|
|
|
if (!cancelButtonText.isEmpty())
|
|
|
|
|
messageBox.button(QDialogButtonBox::Cancel)->setText(cancelButtonText);
|
|
|
|
|
messageBox.setDefaultButton(QDialogButtonBox::Yes);
|
|
|
|
|
if (prompt) {
|
2013-10-31 15:39:49 +01:00
|
|
|
messageBox.setCheckBoxText(Utils::CheckableMessageBox::msgDoNotAskAgain());
|
2011-01-17 13:52:14 +01:00
|
|
|
messageBox.setChecked(false);
|
|
|
|
|
} else {
|
|
|
|
|
messageBox.setCheckBoxVisible(false);
|
|
|
|
|
}
|
|
|
|
|
messageBox.exec();
|
|
|
|
|
const bool close = messageBox.clickedStandardButton() == QDialogButtonBox::Yes;
|
|
|
|
|
if (close && prompt && messageBox.isChecked())
|
|
|
|
|
*prompt = false;
|
|
|
|
|
return close;
|
2010-08-20 14:19:25 +02:00
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void RunControl::bringApplicationToForeground(qint64 pid)
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
#ifdef Q_OS_OSX
|
|
|
|
|
d->internalPid = pid;
|
|
|
|
|
d->foregroundCount = 0;
|
2008-12-02 12:01:29 +01:00
|
|
|
bringApplicationToForegroundInternal();
|
2008-12-02 12:21:14 +01:00
|
|
|
#else
|
|
|
|
|
Q_UNUSED(pid)
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RunControl::bringApplicationToForegroundInternal()
|
|
|
|
|
{
|
2016-02-01 12:15:44 +01:00
|
|
|
#ifdef Q_OS_OSX
|
2008-12-02 12:01:29 +01:00
|
|
|
ProcessSerialNumber psn;
|
2016-02-01 12:15:44 +01:00
|
|
|
GetProcessForPID(d->internalPid, &psn);
|
|
|
|
|
if (SetFrontProcess(&psn) == procNotFound && d->foregroundCount < 15) {
|
2008-12-02 12:01:29 +01:00
|
|
|
// somehow the mac/carbon api says
|
|
|
|
|
// "-600 no eligible process with specified process id"
|
|
|
|
|
// if we call SetFrontProcess too early
|
2016-02-01 12:15:44 +01:00
|
|
|
++d->foregroundCount;
|
2016-01-29 16:38:37 +02:00
|
|
|
QTimer::singleShot(200, this, &RunControl::bringApplicationToForegroundInternal);
|
2008-12-02 12:01:29 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2011-01-07 18:57:54 +01:00
|
|
|
|
2011-04-15 12:59:44 +02:00
|
|
|
void RunControl::appendMessage(const QString &msg, Utils::OutputFormat format)
|
2011-01-07 18:57:54 +01:00
|
|
|
{
|
2016-05-13 11:27:51 +02:00
|
|
|
emit appendMessageRequested(this, msg, format);
|
2011-01-07 18:57:54 +01:00
|
|
|
}
|
2015-06-29 10:36:29 +03:00
|
|
|
|
2016-05-11 16:29:03 +02:00
|
|
|
bool Runnable::canReUseOutputPane(const Runnable &other) const
|
2016-02-01 14:30:13 +01:00
|
|
|
{
|
2016-05-11 16:29:03 +02:00
|
|
|
return d ? d->canReUseOutputPane(other.d) : (other.d.get() == 0);
|
2016-02-01 14:30:13 +01:00
|
|
|
}
|
|
|
|
|
|
2015-06-29 10:36:29 +03:00
|
|
|
} // namespace ProjectExplorer
|