2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2012-04-24 15:49:09 +02: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
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-04-24 15:49:09 +02: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.
|
2012-04-24 15:49:09 +02: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
|
2012-04-24 15:49:09 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#ifndef KITINFORMATION_H
|
|
|
|
|
#define KITINFORMATION_H
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "kitmanager.h"
|
|
|
|
|
#include "kit.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
#include "devicesupport/idevice.h"
|
|
|
|
|
|
|
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
2013-03-25 17:13:18 +01:00
|
|
|
class ToolChain;
|
2012-09-03 18:31:44 +02:00
|
|
|
class KitConfigWidget;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
// SysRootInformation:
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
class PROJECTEXPLORER_EXPORT SysRootKitInformation : public KitInformation
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2012-09-03 18:31:44 +02:00
|
|
|
SysRootKitInformation();
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QVariant defaultValue(Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-10-11 13:47:23 +02:00
|
|
|
QList<Task> validate(const Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
KitConfigWidget *createConfigWidget(Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-01-31 16:56:04 +01:00
|
|
|
ItemList toUserOutput(const Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-09-09 17:10:41 +02:00
|
|
|
static Core::Id id();
|
2012-09-03 18:31:44 +02:00
|
|
|
static bool hasSysRoot(const Kit *k);
|
|
|
|
|
static Utils::FileName sysRoot(const Kit *k);
|
|
|
|
|
static void setSysRoot(Kit *k, const Utils::FileName &v);
|
2012-04-24 15:49:09 +02:00
|
|
|
};
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
class PROJECTEXPLORER_EXPORT SysRootMatcher : public KitMatcher
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SysRootMatcher(const Utils::FileName &fn) : m_sysroot(fn)
|
|
|
|
|
{ }
|
|
|
|
|
|
2012-09-27 22:30:29 +02:00
|
|
|
bool matches(const Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-27 22:30:29 +02:00
|
|
|
return SysRootKitInformation::sysRoot(k) == m_sysroot;
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Utils::FileName m_sysroot;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
// ToolChainInformation:
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
class PROJECTEXPLORER_EXPORT ToolChainKitInformation : public KitInformation
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2012-09-03 18:31:44 +02:00
|
|
|
ToolChainKitInformation();
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QVariant defaultValue(Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-10-11 13:47:23 +02:00
|
|
|
QList<Task> validate(const Kit *k) const;
|
|
|
|
|
void fix(Kit *k);
|
2013-01-22 12:47:07 +01:00
|
|
|
void setup(Kit *k);
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
KitConfigWidget *createConfigWidget(Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QString displayNamePostfix(const Kit *k) const;
|
2012-08-07 13:09:56 +02:00
|
|
|
|
2013-01-31 16:56:04 +01:00
|
|
|
ItemList toUserOutput(const Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
void addToEnvironment(const Kit *k, Utils::Environment &env) const;
|
2012-11-02 12:45:09 +01:00
|
|
|
IOutputParser *createOutputParser(const Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-09-09 17:10:41 +02:00
|
|
|
static Core::Id id();
|
2012-09-03 18:31:44 +02:00
|
|
|
static ToolChain *toolChain(const Kit *k);
|
|
|
|
|
static void setToolChain(Kit *k, ToolChain *tc);
|
2012-07-27 15:43:00 +02:00
|
|
|
|
|
|
|
|
static QString msgNoToolChainInTarget();
|
2013-07-24 16:22:37 +02:00
|
|
|
|
2012-10-17 17:27:17 +02:00
|
|
|
private slots:
|
2013-02-28 15:07:01 +01:00
|
|
|
void kitsWereLoaded();
|
2012-10-17 17:27:17 +02:00
|
|
|
void toolChainUpdated(ProjectExplorer::ToolChain *tc);
|
2013-02-28 15:07:01 +01:00
|
|
|
void toolChainRemoved(ProjectExplorer::ToolChain *tc);
|
2012-04-24 15:49:09 +02:00
|
|
|
};
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
class PROJECTEXPLORER_EXPORT ToolChainMatcher : public KitMatcher
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ToolChainMatcher(const ToolChain *tc) : m_tc(tc)
|
|
|
|
|
{ }
|
|
|
|
|
|
2012-09-27 22:30:29 +02:00
|
|
|
bool matches(const Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-27 22:30:29 +02:00
|
|
|
return ToolChainKitInformation::toolChain(k) == m_tc;
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const ToolChain *m_tc;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
// DeviceTypeInformation:
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
class PROJECTEXPLORER_EXPORT DeviceTypeKitInformation : public KitInformation
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2012-09-03 18:31:44 +02:00
|
|
|
DeviceTypeKitInformation();
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QVariant defaultValue(Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-10-11 13:47:23 +02:00
|
|
|
QList<Task> validate(const Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
KitConfigWidget *createConfigWidget(Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-01-31 16:56:04 +01:00
|
|
|
ItemList toUserOutput(const Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-09-09 17:10:41 +02:00
|
|
|
static const Core::Id id();
|
2012-09-03 18:31:44 +02:00
|
|
|
static const Core::Id deviceTypeId(const Kit *k);
|
|
|
|
|
static void setDeviceTypeId(Kit *k, Core::Id type);
|
2012-04-24 15:49:09 +02:00
|
|
|
};
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
class PROJECTEXPLORER_EXPORT DeviceTypeMatcher : public KitMatcher
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
DeviceTypeMatcher(const Core::Id t) : m_type(t)
|
|
|
|
|
{ }
|
|
|
|
|
|
2012-09-27 22:30:29 +02:00
|
|
|
bool matches(const Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-27 22:30:29 +02:00
|
|
|
Core::Id deviceType = DeviceTypeKitInformation::deviceTypeId(k);
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!deviceType.isValid())
|
|
|
|
|
return false;
|
|
|
|
|
return deviceType == m_type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const Core::Id m_type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
// DeviceInformation:
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
class PROJECTEXPLORER_EXPORT DeviceKitInformation : public KitInformation
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2012-09-03 18:31:44 +02:00
|
|
|
DeviceKitInformation();
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QVariant defaultValue(Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-10-11 13:47:23 +02:00
|
|
|
QList<Task> validate(const Kit *k) const;
|
|
|
|
|
void fix(Kit *k);
|
2013-02-28 14:06:17 +01:00
|
|
|
void setup(Kit *k);
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
KitConfigWidget *createConfigWidget(Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QString displayNamePostfix(const Kit *k) const;
|
2012-08-07 13:09:56 +02:00
|
|
|
|
2013-01-31 16:56:04 +01:00
|
|
|
ItemList toUserOutput(const Kit *k) const;
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2013-09-09 17:10:41 +02:00
|
|
|
static Core::Id id();
|
2012-09-03 18:31:44 +02:00
|
|
|
static IDevice::ConstPtr device(const Kit *k);
|
|
|
|
|
static Core::Id deviceId(const Kit *k);
|
|
|
|
|
static void setDevice(Kit *k, IDevice::ConstPtr dev);
|
2013-09-09 17:10:41 +02:00
|
|
|
static void setDeviceId(Kit *k, const Core::Id dataId);
|
2013-07-24 16:22:37 +02:00
|
|
|
|
2012-10-17 17:27:17 +02:00
|
|
|
private slots:
|
2013-02-28 14:06:17 +01:00
|
|
|
void kitsWereLoaded();
|
2013-09-09 17:10:41 +02:00
|
|
|
void deviceUpdated(const Core::Id &dataId);
|
2013-07-08 16:39:03 +02:00
|
|
|
void devicesChanged();
|
2013-02-28 18:29:16 +01:00
|
|
|
void kitUpdated(ProjectExplorer::Kit *k);
|
2012-04-24 15:49:09 +02:00
|
|
|
};
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
class PROJECTEXPLORER_EXPORT DeviceMatcher : public KitMatcher
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
DeviceMatcher(Core::Id id) : m_devId(id)
|
|
|
|
|
{ }
|
|
|
|
|
|
2013-02-28 14:06:17 +01:00
|
|
|
DeviceMatcher() { }
|
|
|
|
|
|
2012-09-27 22:30:29 +02:00
|
|
|
bool matches(const Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-27 22:30:29 +02:00
|
|
|
return DeviceKitInformation::deviceId(k) == m_devId;
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Core::Id m_devId;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace ProjectExplorer
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#endif // KITINFORMATION_H
|