Customwizard: Add a simple preprocessor.

Allowing for nesting sections depending on Javascript expression using
the (expanded) wizard field variables as in:

-- test.pro.template:
QT = core
@if "%NETWORK_CHECKBOX%" == "true"
QT += network
@endif
Rubber-stamped-by: Alessandro Portale <alessandro.portale@nokia.com>
This commit is contained in:
Friedemann Kleint
2010-07-09 08:31:46 +02:00
parent c4e9559c44
commit ba6b52ce14
8 changed files with 364 additions and 8 deletions

View File

@@ -28,6 +28,7 @@
**************************************************************************/
#include "customwizardparameters.h"
#include "customwizardpreprocessor.h"
#include <coreplugin/mimedatabase.h>
#include <coreplugin/icore.h>
@@ -644,5 +645,24 @@ void CustomWizardContext::reset()
mdb->preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)));
}
QString CustomWizardContext::processFile(const FieldReplacementMap &fm, QString in)
{
if (in.isEmpty())
return in;
if (!fm.isEmpty())
replaceFields(fm, &in);
QString out;
QString errorMessage;
if (!customWizardPreprocess(in, &out, &errorMessage)) {
qWarning("Error preprocessing custom widget file: %s\nFile:\n%s",
qPrintable(errorMessage), qPrintable(in));
return QString();
}
return out;
}
} // namespace Internal
} // namespace ProjectExplorer