Dissolve KitMacroExpander class

It's a normal MacroExpander by now, with some extra setup code that's
used only in one place.

Change-Id: I97244b93d5c165245b02748508c7fdef1b191582
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
hjk
2014-10-22 17:37:06 +02:00
parent d5246a069b
commit 3ce62fc59e

View File

@@ -63,22 +63,6 @@ const char STICKY_INFO_KEY[] = "PE.Profile.StickyInfo";
namespace ProjectExplorer {
namespace Internal {
// --------------------------------------------------------------------
// KitMacroExpander:
// --------------------------------------------------------------------
class KitMacroExpander : public MacroExpander
{
public:
explicit KitMacroExpander(Kit *kit)
{
setAccumulating(true);
foreach (KitInformation *ki, KitManager::kitInformation())
ki->addToMacroExpander(kit, this);
}
};
// -------------------------------------------------------------------------
// KitPrivate
// -------------------------------------------------------------------------
@@ -89,7 +73,7 @@ class KitPrivate
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Kit)
public:
KitPrivate(Id id, Kit *k) :
KitPrivate(Id id, Kit *kit) :
m_id(id),
m_nestedBlockingLevel(0),
m_autodetected(false),
@@ -97,8 +81,7 @@ public:
m_isValid(true),
m_hasWarning(false),
m_hasValidityInfo(false),
m_mustNotify(false),
m_macroExpander(k)
m_mustNotify(false)
{
if (!id.isValid())
m_id = Id::fromString(QUuid::createUuid().toString());
@@ -107,10 +90,13 @@ public:
m_iconPath = FileName::fromLatin1(":///DESKTOP///");
m_macroExpander.setDisplayName(tr("Kit"));
m_macroExpander.setAccumulating(true);
m_macroExpander.registerVariable("Kit:Id", tr("Kit ID"),
[this]() { return m_id.toString(); });
m_macroExpander.registerVariable("Kit:FileSystemName", tr("Kit filesystem-friendly name"),
[this]() { return m_fileSystemFriendlyName; });
foreach (KitInformation *ki, KitManager::kitInformation())
ki->addToMacroExpander(kit, &m_macroExpander);
}
QString m_unexpandedDisplayName;
@@ -130,7 +116,7 @@ public:
QHash<Core::Id, QVariant> m_data;
QSet<Core::Id> m_sticky;
QSet<Core::Id> m_mutable;
KitMacroExpander m_macroExpander;
MacroExpander m_macroExpander;
};
} // namespace Internal