Commit a19f9f68 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

IWizardFactory: Use Core::Id to identify a wizard



Change-Id: I9e1e9ce9a61d7d06a9869f309ed3089d843137a2
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent bd53d27e
......@@ -244,7 +244,7 @@ static bool wizardFactoryLessThan(const IWizardFactory *f1, const IWizardFactory
{
if (const int cc = f1->category().compare(f2->category()))
return cc < 0;
return f1->id().compare(f2->id()) < 0;
return f1->id().toString().compare(f2->id().toString()) < 0;
}
void NewDialog::setWizardFactories(QList<IWizardFactory *> factories,
......
......@@ -61,7 +61,7 @@ public:
IWizardFactory() : m_kind(FileWizard) { }
QString id() const { return m_id; }
Id id() const { return m_id; }
WizardKind kind() const { return m_kind; }
QIcon icon() const { return m_icon; }
QString description() const { return m_description; }
......@@ -72,7 +72,7 @@ public:
FeatureSet requiredFeatures() const { return m_requiredFeatures; }
WizardFlags flags() const { return m_flags; }
void setId(const QString &id) { m_id = id; }
void setId(const Id id) { m_id = id; }
void setWizardKind(WizardKind kind) { m_kind = kind; }
void setIcon(const QIcon &icon) { m_icon = icon; }
void setDescription(const QString &description) { m_description = description; }
......@@ -108,7 +108,7 @@ private:
QIcon m_icon;
QString m_description;
QString m_displayName;
QString m_id;
Id m_id;
QString m_category;
QString m_displayCategory;
FeatureSet m_requiredFeatures;
......
......@@ -138,7 +138,7 @@ void FormEditorPlugin::initializeTemplates()
wizard->setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
wizard->setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
wizard->setDisplayName(tr("Qt Designer Form Class"));
wizard->setId(QLatin1String("C.FormClass"));
wizard->setId("C.FormClass");
wizard->setDescription(tr("Creates a Qt Designer form along with a matching class (C++ header and source file) "
"for implementation purposes. You can add the form and class to an existing Qt Widget Project."));
addAutoReleasedObject(wizard);
......
......@@ -121,7 +121,7 @@ GenericProjectWizard::GenericProjectWizard()
setIcon(icon);
}
setDisplayName(tr("Import Existing Project"));
setId(QLatin1String("Z.Makefile"));
setId("Z.Makefile");
setDescription(tr("Imports existing projects that do not use qmake, CMake or Autotools. "
"This allows you to use Qt Creator as a code editor."));
setCategory(QLatin1String(ProjectExplorer::Constants::IMPORT_WIZARD_CATEGORY));
......
......@@ -407,7 +407,7 @@ QList<CustomWizard*> CustomWizard::createWizards()
if (CustomWizard *w = createWizard(parameters))
rc.push_back(w);
else
qWarning("Custom wizard factory function failed for %s", qPrintable(parameters->id));
qWarning("Custom wizard factory function failed for %s", qPrintable(parameters->id.toString()));
break;
case CustomWizardParameters::ParseDisabled:
if (CustomWizardPrivate::verbose)
......
......@@ -255,7 +255,7 @@ QWidget *CustomWizardFieldPage::registerPathChooser(const QString &fieldName,
pathChooser->setExpectedKind(PathChooser::Command);
else if (expectedKind == QLatin1String("any"))
pathChooser->setExpectedKind(PathChooser::Any);
pathChooser->setHistoryCompleter(QString::fromLatin1("PE.Custom.") + m_parameters->id + QLatin1Char('.') + field.name);
pathChooser->setHistoryCompleter(QString::fromLatin1("PE.Custom.") + m_parameters->id.toString() + QLatin1Char('.') + field.name);
registerField(fieldName, pathChooser, "path", SIGNAL(changed(QString)));
// Connect to completeChanged() for derived classes that reimplement isComplete()
......
......@@ -583,7 +583,11 @@ CustomWizardParameters::parse(QIODevice &device, const QString &configFileFullPa
case ParseWithinWizard:
if (!booleanAttributeValue(reader, wizardEnabledAttributeC, true))
return ParseDisabled;
id = attributeValue(reader, idAttributeC);
{
const QString idString = attributeValue(reader, idAttributeC);
if (!idString.isEmpty())
id = Core::Id::fromString(idString);
}
category = attributeValue(reader, categoryAttributeC);
kind = kindAttribute(reader);
requiredFeatures = readRequiredFeatures(reader);
......
......@@ -114,7 +114,7 @@ public:
QString *errorMessage);
ParseResult parse(const QString &configFileFullPath, QString *errorMessage);
QString id;
Core::Id id;
QString directory;
QString klass;
QList<CustomWizardFile> files;
......
......@@ -514,7 +514,7 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir,
*errorMessage = tr("No id set.");
return false;
}
setId(strVal);
setId(Core::Id::fromString(strVal));
strVal = data.value(QLatin1String(CATEGORY_KEY)).toString();
if (strVal.isEmpty()) {
......
......@@ -45,7 +45,7 @@ namespace Internal {
CustomWidgetWizard::CustomWidgetWizard()
{
setId(QLatin1String("P.Qt4CustomWidget"));
setId("P.Qt4CustomWidget");
setCategory(QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY));
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY));
......
......@@ -74,7 +74,7 @@ namespace Internal {
GuiAppWizard::GuiAppWizard()
{
setId(QLatin1String("C.Qt4Gui"));
setId("C.Qt4Gui");
setCategory(QLatin1String(ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY));
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
ProjectExplorer::Constants::QT_APPLICATION_WIZARD_CATEGORY_DISPLAY));
......
......@@ -47,7 +47,7 @@ namespace Internal {
LibraryWizard::LibraryWizard()
{
setId(QLatin1String("H.Qt4Library"));
setId("H.Qt4Library");
setCategory(QLatin1String(ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY));
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
ProjectExplorer::Constants::LIBRARIES_WIZARD_CATEGORY_DISPLAY));
......
......@@ -43,7 +43,7 @@ namespace Internal {
SubdirsProjectWizard::SubdirsProjectWizard()
{
setId(QLatin1String("U.Qt4Subdirs"));
setId("U.Qt4Subdirs");
setCategory(QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY));
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY));
......
......@@ -47,7 +47,7 @@ namespace Internal {
TestWizard::TestWizard()
{
setId(QLatin1String("L.Qt4Test"));
setId("L.Qt4Test");
setCategory(QLatin1String(ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY));
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
ProjectExplorer::Constants::QT_PROJECT_WIZARD_CATEGORY_DISPLAY));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment