forked from qt-creator/qt-creator
JsonWizard: Make TargetSetupPage available to JsonWizards
Change-Id: I59cf128635c28f5cbc45336bef82f63ee5da4e6c Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "jsonfieldpage.h"
|
||||
#include "jsonfilepage.h"
|
||||
#include "jsonkitspage.h"
|
||||
#include "jsonprojectpage.h"
|
||||
#include "jsonsummarypage.h"
|
||||
#include "jsonwizardfactory.h"
|
||||
@@ -123,6 +124,46 @@ bool FilePageFactory::validateData(Core::Id typeId, const QVariant &data, QStrin
|
||||
return true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// 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:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user