aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@theqtcompany.com>2014-10-15 15:09:11 +0200
committerTobias Hunger <tobias.hunger@theqtcompany.com>2014-10-23 17:05:19 +0200
commit3cb4f6dbf383a337df850c91d858b51cdea8e53e (patch)
tree6c0e564eed0f83d92927cdb63470a55cb9027bb7 /src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp
parent06d7d58c88cd5fb5d539549ee038b9163f91a5dd (diff)
JsonWizard: Make TargetSetupPage available to JsonWizards
Change-Id: I59cf128635c28f5cbc45336bef82f63ee5da4e6c Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp')
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizardpagefactory_p.cpp41
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:
// --------------------------------------------------------------------