forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user