diff options
Diffstat (limited to 'src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp')
-rw-r--r-- | src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp index 8499a10cf0..fd3c0d4f49 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp @@ -32,6 +32,7 @@ #include "jsonfieldpage.h" #include "jsonfilepage.h" +#include "jsonkitspage.h" #include "jsonprojectpage.h" #include "jsonsummarypage.h" #include "jsonwizardfactory.h" @@ -124,6 +125,46 @@ bool FilePageFactory::validateData(Core::Id typeId, const QVariant &data, QStrin } // -------------------------------------------------------------------- +// KitsPageFactory: +// -------------------------------------------------------------------- + +KitsPageFactory::KitsPageFactory() +{ + setTypeIdsSuffix(QLatin1String("Kits")); +} + +Utils::WizardPage *KitsPageFactory::create(JsonWizard *wizard, Core::Id typeId, const QVariant &data) +{ + Q_UNUSED(wizard); + QTC_ASSERT(canCreate(typeId), return 0); + + JsonKitsPage *page = new JsonKitsPage; + page->setProjectFilePath(data.toMap().value(QLatin1String("projectFilePath")).toString()); + + return page; +} + +bool KitsPageFactory::validateData(Core::Id typeId, const QVariant &data, QString *errorMessage) +{ + QTC_ASSERT(canCreate(typeId), return false); + + if (data.isNull() || data.type() != QVariant::Map) { + *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard", + "\"data\" must be a JSON object for \"Kits\" pages."); + return false; + } + + QVariantMap tmp = data.toMap(); + if (tmp.value(QLatin1String("projectFilePath")).toString().isEmpty()) { + *errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard", + "\"Kits\" page requires a \"projectFilePath\" set."); + return false; + } + + return true; +} + +// -------------------------------------------------------------------- // ProjectPageFactory: // -------------------------------------------------------------------- |