aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/macroexpander.cpp
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-11-05 10:30:51 +0100
committerhjk <hjk121@nokiamail.com>2014-11-05 12:05:18 +0100
commitbb81a61814397a620ed0ea8de03c0b2d3b89ac46 (patch)
tree16c1b35d8771297a09ecb4d36d5fc9faafa16780 /src/libs/utils/macroexpander.cpp
parenta12344ce61954bb0819f3c507b9ee5fa52e8d722 (diff)
Provide a facility to hide macros in the chooser
... and use it for the Current* fallbacks in the Kit expander. Change-Id: I1d346aa56647f6d3030bd4384eb89e2a27db6418 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/libs/utils/macroexpander.cpp')
-rw-r--r--src/libs/utils/macroexpander.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp
index 8b65275b2df..3bb42e652d2 100644
--- a/src/libs/utils/macroexpander.cpp
+++ b/src/libs/utils/macroexpander.cpp
@@ -101,6 +101,7 @@ public:
QHash<QByteArray, MacroExpander::StringFunction> m_map;
QHash<QByteArray, MacroExpander::PrefixFunction> m_prefixMap;
+ QSet<QByteArray> m_invisbleInChooser;
QVector<MacroExpander::ResolverFunction> m_extraResolvers;
QMap<QByteArray, QString> m_descriptions;
QString m_displayName;
@@ -301,8 +302,10 @@ void MacroExpander::registerPrefix(const QByteArray &prefix, const QString &desc
* \sa registerFileVariables(), registerIntVariable(), registerPrefix()
*/
void MacroExpander::registerVariable(const QByteArray &variable,
- const QString &description, const StringFunction &value)
+ const QString &description, const StringFunction &value, bool visibleInChooser)
{
+ if (!visibleInChooser)
+ d->m_invisbleInChooser.insert(variable);
d->m_descriptions.insert(variable, description);
d->m_map.insert(variable, value);
}
@@ -362,9 +365,15 @@ void MacroExpander::registerExtraResolver(const MacroExpander::ResolverFunction
* \sa registerVariable()
* \sa registerFileVariables()
*/
-QList<QByteArray> MacroExpander::variables() const
+QList<QByteArray> MacroExpander::visibleVariables() const
{
- return d->m_descriptions.keys();
+ QList<QByteArray> res;
+ for (auto it = d->m_descriptions.begin(), end = d->m_descriptions.end(); it != end; ++it) {
+ if (!d->m_invisbleInChooser.contains(it.key()))
+ res.append(it.key());
+ }
+
+ return res;
}
/*!