Commit 4ef2fbd4 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Profile -> Kit variable renaming

Change-Id: I6cc06684134030bd527d9dcce21ad17938a56927
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 5aef98bb
......@@ -448,15 +448,15 @@ void CMakeRunPage::runCMake()
int index = m_generatorComboBox->currentIndex();
ProjectExplorer::Kit *p = 0;
ProjectExplorer::Kit *k = 0;
if (index >= 0)
p = static_cast<ProjectExplorer::Kit *>(m_generatorComboBox->itemData(index).value<void *>());
if (!p) {
k = static_cast<ProjectExplorer::Kit *>(m_generatorComboBox->itemData(index).value<void *>());
if (!k) {
m_output->appendPlainText(tr("No generator selected."));
return;
}
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(p);
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
m_runCMake->setEnabled(false);
m_argumentsLineEdit->setEnabled(false);
......
......@@ -209,10 +209,10 @@ enum DebuggerConfigurationErrors {
DebuggerNeedsAbsolutePath = 0x8
};
static unsigned debuggerConfigurationErrors(const ProjectExplorer::Kit *p)
static unsigned debuggerConfigurationErrors(const ProjectExplorer::Kit *k)
{
unsigned result = 0;
const DebuggerKitInformation::DebuggerItem item = DebuggerKitInformation::debuggerItem(p);
const DebuggerKitInformation::DebuggerItem item = DebuggerKitInformation::debuggerItem(k);
if (item.engineType == NoEngineType || item.binary.isEmpty())
return NoDebugger;
......@@ -226,36 +226,36 @@ static unsigned debuggerConfigurationErrors(const ProjectExplorer::Kit *p)
if (!fi.exists() || fi.isDir())
// We need an absolute path to be able to locate Python on Windows.
if (item.engineType == GdbEngineType)
if (const ToolChain *tc = ToolChainKitInformation::toolChain(p))
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
if (tc->targetAbi().os() == Abi::WindowsOS && !fi.isAbsolute())
result |= DebuggerNeedsAbsolutePath;
return result;
}
bool DebuggerKitInformation::isValidDebugger(const ProjectExplorer::Kit *p)
bool DebuggerKitInformation::isValidDebugger(const ProjectExplorer::Kit *k)
{
return debuggerConfigurationErrors(p) == 0;
return debuggerConfigurationErrors(k) == 0;
}
QList<ProjectExplorer::Task> DebuggerKitInformation::validateDebugger(const ProjectExplorer::Kit *p)
QList<ProjectExplorer::Task> DebuggerKitInformation::validateDebugger(const ProjectExplorer::Kit *k)
{
const unsigned errors = debuggerConfigurationErrors(p);
const unsigned errors = debuggerConfigurationErrors(k);
const Core::Id id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
QList<Task> result;
if (errors & NoDebugger)
result << Task(Task::Warning, tr("No debugger set up."), FileName(), -1, id);
if (errors & DebuggerNotFound) {
const QString path = DebuggerKitInformation::debuggerCommand(p).toUserOutput();
const QString path = DebuggerKitInformation::debuggerCommand(k).toUserOutput();
result << Task(Task::Error, tr("Debugger '%1' not found.").arg(path),
FileName(), -1, id);
}
if (errors & DebuggerNotExecutable) {
const QString path = DebuggerKitInformation::debuggerCommand(p).toUserOutput();
const QString path = DebuggerKitInformation::debuggerCommand(k).toUserOutput();
result << Task(Task::Error, tr("Debugger '%1' not executable.").arg(path), FileName(), -1, id);
}
if (errors & DebuggerNeedsAbsolutePath) {
const QString path = DebuggerKitInformation::debuggerCommand(p).toUserOutput();
const QString path = DebuggerKitInformation::debuggerCommand(k).toUserOutput();
const QString message =
tr("The debugger location must be given as an "
"absolute path (%1).").arg(path);
......@@ -309,17 +309,17 @@ QVariant DebuggerKitInformation::itemToVariant(const DebuggerItem &i)
return QVariant(vmap);
}
DebuggerKitInformation::DebuggerItem DebuggerKitInformation::debuggerItem(const ProjectExplorer::Kit *p)
DebuggerKitInformation::DebuggerItem DebuggerKitInformation::debuggerItem(const ProjectExplorer::Kit *k)
{
return p ?
DebuggerKitInformation::variantToItem(p->value(Core::Id(DEBUGGER_INFORMATION))) :
return k ?
DebuggerKitInformation::variantToItem(k->value(Core::Id(DEBUGGER_INFORMATION))) :
DebuggerItem();
}
void DebuggerKitInformation::setDebuggerItem(ProjectExplorer::Kit *p, const DebuggerItem &item)
void DebuggerKitInformation::setDebuggerItem(ProjectExplorer::Kit *k, const DebuggerItem &item)
{
QTC_ASSERT(p, return);
p->setValue(Core::Id(DEBUGGER_INFORMATION), itemToVariant(item));
QTC_ASSERT(k, return);
k->setValue(Core::Id(DEBUGGER_INFORMATION), itemToVariant(item));
}
void DebuggerKitInformation::setDebuggerCommand(ProjectExplorer::Kit *k, const FileName &command)
......@@ -327,9 +327,9 @@ void DebuggerKitInformation::setDebuggerCommand(ProjectExplorer::Kit *k, const F
setDebuggerItem(k, DebuggerItem(engineType(k), command));
}
void DebuggerKitInformation::setEngineType(ProjectExplorer::Kit *p, DebuggerEngineType type)
void DebuggerKitInformation::setEngineType(ProjectExplorer::Kit *k, DebuggerEngineType type)
{
setDebuggerItem(p, DebuggerItem(type, debuggerCommand(p)));
setDebuggerItem(k, DebuggerItem(type, debuggerCommand(k)));
}
QString DebuggerKitInformation::debuggerEngineName(DebuggerEngineType t)
......
......@@ -66,16 +66,16 @@ public:
QList<ProjectExplorer::Task> validate(ProjectExplorer::Kit *k) const
{ return DebuggerKitInformation::validateDebugger(k); }
static QList<ProjectExplorer::Task> validateDebugger(const ProjectExplorer::Kit *p);
static bool isValidDebugger(const ProjectExplorer::Kit *p);
static QList<ProjectExplorer::Task> validateDebugger(const ProjectExplorer::Kit *k);
static bool isValidDebugger(const ProjectExplorer::Kit *k);
ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *k) const;
ItemList toUserOutput(ProjectExplorer::Kit *k) const;
static QString userOutput(const DebuggerItem &item);
static DebuggerItem debuggerItem(const ProjectExplorer::Kit *p);
static void setDebuggerItem(ProjectExplorer::Kit *p, const DebuggerItem &item);
static DebuggerItem debuggerItem(const ProjectExplorer::Kit *k);
static void setDebuggerItem(ProjectExplorer::Kit *k, const DebuggerItem &item);
static Utils::FileName debuggerCommand(const ProjectExplorer::Kit *p)
{ return debuggerItem(p).binary; }
......@@ -85,7 +85,7 @@ public:
static DebuggerEngineType engineType(const ProjectExplorer::Kit *p)
{ return debuggerItem(p).engineType; }
static void setEngineType(ProjectExplorer::Kit *p, DebuggerEngineType type);
static void setEngineType(ProjectExplorer::Kit *k, DebuggerEngineType type);
static QString debuggerEngineName(DebuggerEngineType t);
......
......@@ -565,11 +565,11 @@ class AbiKitMatcher : public KitMatcher
{
public:
explicit AbiKitMatcher(const QList<Abi> &abis) : m_abis(abis) {}
bool matches(const Kit *p) const
bool matches(const Kit *k) const
{
if (const ToolChain *tc = ToolChainKitInformation::toolChain(p)) {
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k)) {
return m_abis.contains(tc->targetAbi())
&& DebuggerKitInformation::isValidDebugger(p);
&& DebuggerKitInformation::isValidDebugger(k);
}
return false;
}
......@@ -582,11 +582,11 @@ class CompatibleAbiKitMatcher : public KitMatcher
{
public:
explicit CompatibleAbiKitMatcher(const QList<Abi> &abis) : m_abis(abis) {}
bool matches(const Kit *p) const
bool matches(const Kit *k) const
{
if (const ToolChain *tc = ToolChainKitInformation::toolChain(p))
if (const ToolChain *tc = ToolChainKitInformation::toolChain(k))
foreach (const Abi &a, m_abis)
if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(p))
if (a.isCompatibleWith(tc->targetAbi()) && DebuggerKitInformation::isValidDebugger(k))
return true;
return false;
}
......
......@@ -68,9 +68,9 @@ bool MaemoGlobal::hasMaemoDevice(const Kit *k)
return type == Maemo5OsType || type == HarmattanOsType;
}
bool MaemoGlobal::supportsMaemoDevice(const Kit *p)
bool MaemoGlobal::supportsMaemoDevice(const Kit *k)
{
const Core::Id type = DeviceTypeKitInformation::deviceTypeId(p);
const Core::Id type = DeviceTypeKitInformation::deviceTypeId(k);
return type == Maemo5OsType || type == HarmattanOsType;
}
......
......@@ -82,7 +82,7 @@ class MaemoGlobal
Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::MaemoGlobal)
public:
static bool hasMaemoDevice(const ProjectExplorer::Kit *k);
static bool supportsMaemoDevice(const ProjectExplorer::Kit *p);
static bool supportsMaemoDevice(const ProjectExplorer::Kit *k);
static bool isValidMaemo5QtVersion(const QString &qmakePath);
static bool isValidHarmattanQtVersion(const QString &qmakePath);
......
......@@ -187,9 +187,9 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
return ProjectConfiguration::fromMap(map);
}
void BuildConfiguration::handleKitUpdate(ProjectExplorer::Kit *p)
void BuildConfiguration::handleKitUpdate(ProjectExplorer::Kit *k)
{
if (p != target()->kit())
if (k != target()->kit())
return;
emit environmentChanged();
}
......
......@@ -112,7 +112,7 @@ protected:
virtual bool fromMap(const QVariantMap &map);
private slots:
void handleKitUpdate(ProjectExplorer::Kit *p);
void handleKitUpdate(ProjectExplorer::Kit *k);
private:
bool m_clearSystemEnvironment;
......
......@@ -103,18 +103,18 @@ Kit::~Kit()
Kit *Kit::clone(bool keepName) const
{
Kit *p = new Kit;
Kit *k = new Kit;
if (keepName)
p->d->m_displayName = d->m_displayName;
k->d->m_displayName = d->m_displayName;
else
p->d->m_displayName = QCoreApplication::translate("ProjectExplorer::Kit", "Clone of %1")
k->d->m_displayName = QCoreApplication::translate("ProjectExplorer::Kit", "Clone of %1")
.arg(d->m_displayName);
p->d->m_autodetected = false;
p->d->m_data = d->m_data;
p->d->m_isValid = d->m_isValid;
p->d->m_icon = d->m_icon;
p->d->m_iconPath = d->m_iconPath;
return p;
k->d->m_autodetected = false;
k->d->m_data = d->m_data;
k->d->m_isValid = d->m_isValid;
k->d->m_icon = d->m_icon;
k->d->m_iconPath = d->m_iconPath;
return k;
}
bool Kit::isValid() const
......@@ -145,18 +145,18 @@ static QString candidateName(const QString &name, const QString &postfix)
void Kit::setDisplayName(const QString &name)
{
KitManager *pm = KitManager::instance();
QList<KitInformation *> kitInfo = pm->kitInformation();
KitManager *km = KitManager::instance();
QList<KitInformation *> kitInfo = km->kitInformation();
QStringList nameList;
foreach (Kit *p, pm->kits()) {
if (p == this)
foreach (Kit *k, km->kits()) {
if (k == this)
continue;
nameList << p->displayName();
nameList << k->displayName();
foreach (KitInformation *ki, kitInfo) {
const QString postfix = ki->displayNamePostfix(p);
const QString postfix = ki->displayNamePostfix(k);
if (!postfix.isEmpty())
nameList << candidateName(p->displayName(), postfix);
nameList << candidateName(k->displayName(), postfix);
}
}
......
......@@ -156,8 +156,8 @@ void KitManager::restoreKits()
KitList system = restoreKits(Utils::FileName::fromString(systemSettingsFile.absolutePath() + QLatin1String(KIT_FILENAME)));
QList<Kit *> readKits = system.kits;
// make sure we mark these as autodetected!
foreach (Kit *p, readKits)
p->setAutoDetected(true);
foreach (Kit *k, readKits)
k->setAutoDetected(true);
kitsToRegister = readKits; // SDK kits are always considered to be up-to-date, so no need to
// recheck them.
......@@ -166,11 +166,11 @@ void KitManager::restoreKits()
KitList userKits = restoreKits(settingsFileName());
readKits = userKits.kits;
foreach (Kit *p, readKits) {
if (p->isAutoDetected())
kitsToCheck.append(p);
foreach (Kit *k, readKits) {
if (k->isAutoDetected())
kitsToCheck.append(k);
else
kitsToRegister.append(p);
kitsToRegister.append(k);
}
readKits.clear();
......@@ -198,8 +198,8 @@ void KitManager::restoreKits()
qDeleteAll(kitsToCheck);
// Store manual kits
foreach (Kit *p, kitsToRegister)
addKit(p);
foreach (Kit *k, kitsToRegister)
addKit(k);
if (kits().isEmpty()) {
Kit *defaultKit = new Kit; // One kit using default values
......@@ -210,9 +210,9 @@ void KitManager::restoreKits()
addKit(defaultKit);
}
Kit *p = find(userKits.defaultKit);
if (p)
setDefaultKit(p);
Kit *k = find(userKits.defaultKit);
if (k)
setDefaultKit(k);
}
KitManager::~KitManager()
......@@ -231,8 +231,8 @@ void KitManager::saveKits()
data.insert(QLatin1String(KIT_FILE_VERSION_KEY), 1);
int count = 0;
foreach (Kit *p, kits()) {
QVariantMap tmp = p->toMap();
foreach (Kit *k, kits()) {
QVariantMap tmp = k->toMap();
if (tmp.isEmpty())
continue;
data.insert(QString::fromLatin1(KIT_DATA_KEY) + QString::number(count), tmp);
......@@ -260,9 +260,9 @@ void KitManager::registerKitInformation(KitInformation *ki)
if (!d->m_initialized)
return;
foreach (Kit *p, kits()) {
if (!p->hasValue(ki->dataId()))
p->setValue(ki->dataId(), ki->defaultValue(p));
foreach (Kit *k, kits()) {
if (!k->hasValue(ki->dataId()))
k->setValue(ki->dataId(), ki->defaultValue(k));
}
return;
......@@ -297,11 +297,11 @@ KitManager::KitList KitManager::restoreKits(const Utils::FileName &fileName)
const QVariantMap stMap = data.value(key).toMap();
Kit *p = new Kit;
if (p->fromMap(stMap)) {
result.kits.append(p);
Kit *k = new Kit;
if (k->fromMap(stMap)) {
result.kits.append(k);
} else {
delete p;
delete k;
qWarning("Warning: Unable to restore kits stored in %s at position %d.",
qPrintable(fileName.toUserOutput()), i);
}
......@@ -311,8 +311,8 @@ KitManager::KitList KitManager::restoreKits(const Utils::FileName &fileName)
return result;
const Core::Id id = Core::Id(defaultId);
foreach (Kit *i, result.kits) {
if (i->id() == id) {
foreach (Kit *k, result.kits) {
if (k->id() == id) {
result.defaultKit = id;
break;
}
......@@ -328,9 +328,9 @@ QList<Kit *> KitManager::kits(const KitMatcher *m) const
}
QList<Kit *> result;
foreach (Kit *p, d->m_kitList) {
if (!m || m->matches(p))
result.append(p);
foreach (Kit *k, d->m_kitList) {
if (!m || m->matches(k))
result.append(k);
}
return result;
}
......@@ -340,9 +340,9 @@ Kit *KitManager::find(const Core::Id &id) const
if (!id.isValid())
return 0;
foreach (Kit *p, kits()) {
if (p->id() == id)
return p;
foreach (Kit *k, kits()) {
if (k->id() == id)
return k;
}
return 0;
}
......@@ -379,12 +379,12 @@ KitConfigWidget *KitManager::createConfigWidget(Kit *k) const
return result;
}
void KitManager::notifyAboutUpdate(ProjectExplorer::Kit *p)
void KitManager::notifyAboutUpdate(ProjectExplorer::Kit *k)
{
if (!p || !kits().contains(p))
if (!k || !kits().contains(k))
return;
d->validateKit(p);
emit kitUpdated(p);
d->validateKit(k);
emit kitUpdated(k);
}
bool KitManager::registerKit(ProjectExplorer::Kit *k)
......@@ -446,8 +446,8 @@ void KitManager::setDefaultKit(Kit *k)
void KitManager::validateKits()
{
foreach (Kit *p, kits())
d->validateKit(p);
foreach (Kit *k, kits())
d->validateKit(k);
}
void KitManager::addKit(Kit *k)
......
......@@ -153,7 +153,7 @@ private:
};
KitList restoreKits(const Utils::FileName &fileName);
void notifyAboutUpdate(ProjectExplorer::Kit *p);
void notifyAboutUpdate(ProjectExplorer::Kit *k);
void addKit(Kit *k);
Internal::KitManagerPrivate *const d;
......
......@@ -46,11 +46,11 @@ namespace Internal {
class KitNode
{
public:
explicit KitNode(KitNode *pn, Kit *k = 0, bool c = false) :
parent(pn), kit(k), changed(c)
explicit KitNode(KitNode *kn, Kit *k = 0, bool c = false) :
parent(kn), kit(k), changed(c)
{
if (pn)
pn->childNodes.append(this);
if (kn)
kn->childNodes.append(this);
widget = KitManager::instance()->createConfigWidget(k);
if (widget) {
if (k && k->isAutoDetected())
......
......@@ -2229,10 +2229,10 @@ Version11Handler::Version11Handler()
Version11Handler::~Version11Handler()
{
KitManager *pm = KitManager::instance();
if (!pm) // Can happen during teardown!
KitManager *km = KitManager::instance();
if (!km) // Can happen during teardown!
return;
QList<Kit *> knownKits = pm->kits();
QList<Kit *> knownKits = km->kits();
foreach (Kit *k, m_targets.keys()) {
if (!knownKits.contains(k))
delete k;
......@@ -2252,8 +2252,8 @@ QVariantMap Version11Handler::update(Project *project, const QVariantMap &map)
parseToolChainFile();
QVariantMap result;
KitManager *pm = KitManager::instance();
foreach (Kit *k, pm->kits())
KitManager *km = KitManager::instance();
foreach (Kit *k, km->kits())
m_targets.insert(k, QVariantMap());
QMapIterator<QString, QVariant> globalIt(map);
......@@ -2426,7 +2426,7 @@ QVariantMap Version11Handler::update(Project *project, const QVariantMap &map)
if (data.isEmpty())
continue;
pm->registerKit(k);
km->registerKit(k);
data.insert(QLatin1String("ProjectExplorer.ProjectConfiguration.Id"), k->id().name());
data.insert(QLatin1String("ProjectExplorer.Target.Profile"), k->id().name());
......
......@@ -119,21 +119,21 @@ QList<DeployConfigurationFactory *> TargetPrivate::deployFactories() const
return ExtensionSystem::PluginManager::getObjects<DeployConfigurationFactory>();
}
Target::Target(Project *project, Kit *p) :
ProjectConfiguration(project, p->id()),
Target::Target(Project *project, Kit *k) :
ProjectConfiguration(project, k->id()),
d(new TargetPrivate)
{
connect(DeviceManager::instance(), SIGNAL(updated()), this, SLOT(updateDeviceState()));
d->m_kit = p;
d->m_kit = k;
setDisplayName(d->m_kit->displayName());
setIcon(d->m_kit->icon());
KitManager *pm = KitManager::instance();
connect(pm, SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
KitManager *km = KitManager::instance();
connect(km, SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
this, SLOT(handleKitUpdates(ProjectExplorer::Kit*)));
connect(pm, SIGNAL(kitRemoved(ProjectExplorer::Kit*)),
connect(km, SIGNAL(kitRemoved(ProjectExplorer::Kit*)),
this, SLOT(handleKitRemoval(ProjectExplorer::Kit*)));
}
......@@ -180,20 +180,20 @@ void Target::onBuildDirectoryChanged()
emit buildDirectoryChanged();
}
void Target::handleKitUpdates(Kit *p)
void Target::handleKitUpdates(Kit *k)
{
if (p != d->m_kit)
if (k != d->m_kit)
return;
setDisplayName(p->displayName());
setIcon(p->icon());
setDisplayName(k->displayName());
setIcon(k->icon());
updateDefaultDeployConfigurations();
emit kitChanged();
}
void Target::handleKitRemoval(Kit *p)
void Target::handleKitRemoval(Kit *k)
{
if (p != d->m_kit)
if (k != d->m_kit)
return;
d->m_kit = 0;
project()->removeTarget(this);
......
......@@ -172,8 +172,8 @@ private slots:
void changeDeployConfigurationEnabled();
void changeRunConfigurationEnabled();
void handleKitUpdates(ProjectExplorer::Kit *p);
void handleKitRemoval(ProjectExplorer::Kit *p);
void handleKitUpdates(ProjectExplorer::Kit *k);
void handleKitRemoval(ProjectExplorer::Kit *k);
private:
TargetPrivate *d;
......
......@@ -269,14 +269,14 @@ ProjectExplorer::IProjectManager *QmlProject::projectManager() const
return m_manager;
}
bool QmlProject::supportsKit(ProjectExplorer::Kit *p) const
bool QmlProject::supportsKit(ProjectExplorer::Kit *k) const
{
Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(p);
Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k);
if (deviceType != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
return false;
// TODO: Limit supported versions?
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(p);
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
return version;
}
......
......@@ -65,7 +65,7 @@ public:
Core::IDocument *document() const;
ProjectExplorer::IProjectManager *projectManager() const;
bool supportsKit(ProjectExplorer::Kit *p) const;
bool supportsKit(ProjectExplorer::Kit *k) const;
QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
......
......@@ -94,9 +94,9 @@ QList<ProjectExplorer::Abi> QnxAbstractQtVersion::detectQtAbis() const
return qtAbisFromLibrary(qtCorePath(versionInfo(), qtVersionString()));
}
void QnxAbstractQtVersion::addToEnvironment(const ProjectExplorer::Kit *p, Utils::Environment &env) const
void QnxAbstractQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
{
QtSupport::BaseQtVersion::addToEnvironment(p, env);
QtSupport::BaseQtVersion::addToEnvironment(k, env);
if (!m_environmentUpToDate)
updateEnvironment();
......
......@@ -64,7 +64,7 @@ public:
QList<ProjectExplorer::Abi> detectQtAbis() const;
void addToEnvironment(const ProjectExplorer::Kit *p, Utils::Environment &env) const;
void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const;