JsonWizard: Expand repeatedly when filling out templates

This makes macros work that expand to more macros.

Change-Id: I44770fb59cec6cd80606cd341a92938c50e9e1fd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2015-09-15 15:34:26 +02:00
parent 9324ef6eb1
commit 61e590a971

View File

@@ -56,16 +56,24 @@ static QString processTextFileContents(Utils::MacroExpander *expander,
if (input.isEmpty()) if (input.isEmpty())
return input; return input;
QString tmp; // Recursively expand macros:
if (!customWizardPreprocess(expander->expand(input), &tmp, errorMessage)) QString in = input;
QString oldIn;
for (int i = 0; i < 5 && in != oldIn; ++i) {
oldIn = in;
in = expander->expand(oldIn);
}
QString out;
if (!customWizardPreprocess(in, &out, errorMessage))
return QString(); return QString();
// Expand \n, \t and handle line continuation: // Expand \n, \t and handle line continuation:
QString result; QString result;
result.reserve(tmp.count()); result.reserve(out.count());
bool isEscaped = false; bool isEscaped = false;
for (int i = 0; i < tmp.count(); ++i) { for (int i = 0; i < out.count(); ++i) {
const QChar c = tmp.at(i); const QChar c = out.at(i);
if (isEscaped) { if (isEscaped) {
if (c == QLatin1Char('n')) if (c == QLatin1Char('n'))