forked from qt-creator/qt-creator
Kits: Allow for mutable KitInformation
Mutable KitInformation are those that are supposed to be editable in more user-accessible places (e.g. like the Mini Target Selector or similar) than the normal kit options page. The functionality to display these settings is not part of this patch. Change-Id: I13446c49abf89eaf739a60dbcd01c97e2144de45 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -52,6 +52,7 @@ const char AUTODETECTED_KEY[] = "PE.Profile.AutoDetected";
|
||||
const char SDK_PROVIDED_KEY[] = "PE.Profile.SDK";
|
||||
const char DATA_KEY[] = "PE.Profile.Data";
|
||||
const char ICON_KEY[] = "PE.Profile.Icon";
|
||||
const char MUTABLE_INFO_KEY[] = "PE.Profile.MutableInfo";
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -94,6 +95,7 @@ public:
|
||||
|
||||
QHash<Core::Id, QVariant> m_data;
|
||||
QSet<Core::Id> m_sticky;
|
||||
QSet<Core::Id> m_mutable;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
@@ -150,6 +152,7 @@ Kit *Kit::clone(bool keepName) const
|
||||
k->d->m_icon = d->m_icon;
|
||||
k->d->m_iconPath = d->m_iconPath;
|
||||
k->d->m_sticky = d->m_sticky;
|
||||
k->d->m_mutable = d->m_mutable;
|
||||
return k;
|
||||
}
|
||||
|
||||
@@ -164,6 +167,7 @@ void Kit::copyFrom(const Kit *k)
|
||||
d->m_mustNotify = true;
|
||||
d->m_mustNotifyAboutDisplayName = true;
|
||||
d->m_sticky = k->d->m_sticky;
|
||||
d->m_mutable = k->d->m_mutable;
|
||||
}
|
||||
|
||||
bool Kit::isValid() const
|
||||
@@ -336,6 +340,7 @@ void Kit::removeKey(Id key)
|
||||
return;
|
||||
d->m_data.remove(key);
|
||||
d->m_sticky.remove(key);
|
||||
d->m_mutable.remove(key);
|
||||
kitUpdated();
|
||||
}
|
||||
|
||||
@@ -353,7 +358,9 @@ bool Kit::isEqual(const Kit *other) const
|
||||
{
|
||||
return isDataEqual(other)
|
||||
&& d->m_iconPath == other->d->m_iconPath
|
||||
&& d->m_displayName == other->d->m_displayName;
|
||||
&& d->m_displayName == other->d->m_displayName
|
||||
&& d->m_mutable == other->d->m_mutable;
|
||||
|
||||
}
|
||||
|
||||
QVariantMap Kit::toMap() const
|
||||
@@ -367,6 +374,11 @@ QVariantMap Kit::toMap() const
|
||||
data.insert(QLatin1String(SDK_PROVIDED_KEY), d->m_sdkProvided);
|
||||
data.insert(QLatin1String(ICON_KEY), d->m_iconPath.toString());
|
||||
|
||||
QStringList mutableInfo;
|
||||
foreach (const Core::Id &id, d->m_mutable.values())
|
||||
mutableInfo << id.toString();
|
||||
data.insert(QLatin1String(MUTABLE_INFO_KEY), mutableInfo);
|
||||
|
||||
QVariantMap extra;
|
||||
|
||||
const IdVariantConstIt cend = d->m_data.constEnd();
|
||||
@@ -455,6 +467,11 @@ bool Kit::fromMap(const QVariantMap &data)
|
||||
for (QVariantMap::ConstIterator it = extra.constBegin(); it != cend; ++it)
|
||||
setValue(Id::fromString(it.key()), it.value());
|
||||
|
||||
QStringList mutableInfoList = data.value(QLatin1String(MUTABLE_INFO_KEY)).toStringList();
|
||||
foreach (const QString &mutableInfo, mutableInfoList) {
|
||||
d->m_mutable.insert(Core::Id::fromString(mutableInfo));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -489,6 +506,19 @@ void Kit::makeUnSticky()
|
||||
d->m_sticky.clear();
|
||||
}
|
||||
|
||||
void Kit::setMutable(Id id, bool b)
|
||||
{
|
||||
if (b)
|
||||
d->m_mutable.insert(id);
|
||||
else
|
||||
d->m_mutable.remove(id);
|
||||
}
|
||||
|
||||
bool Kit::isMutable(Id id) const
|
||||
{
|
||||
return d->m_mutable.contains(id);
|
||||
}
|
||||
|
||||
void Kit::kitUpdated()
|
||||
{
|
||||
if (d->m_nestedBlockingLevel > 0 && !d->m_mustNotifyAboutDisplayName) {
|
||||
|
||||
Reference in New Issue
Block a user