diff options
author | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-05-19 11:44:04 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@theqtcompany.com> | 2015-05-26 10:17:30 +0000 |
commit | 9c1f96d47a65b0c084dc4767308c88527184a8cc (patch) | |
tree | 330d3cda3289275a350e54ac441ff2cee45f7ed4 | |
parent | f895d97b035ab6545c3e6bd8655a5ecbdbc360b5 (diff) | |
download | qt-creator-9c1f96d47a65b0c084dc4767308c88527184a8cc.tar.gz |
IWizardFactory: Remove class wizard kind
Map existing class wizards to file wizards. The separation has never
been clean anyway. Now "file" wizards create one or more files,
"project" wizards create a complete project (something that can be
opened as a project in Qt Creator).
Change-Id: I0562f26019b54a59d46814a13a0b2fa8995c3e0f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
13 files changed, 18 insertions, 35 deletions
diff --git a/doc/api/qtcreator-dev-wizards.qdoc b/doc/api/qtcreator-dev-wizards.qdoc index b9b9aabdae..4a0ccc0889 100644 --- a/doc/api/qtcreator-dev-wizards.qdoc +++ b/doc/api/qtcreator-dev-wizards.qdoc @@ -130,7 +130,7 @@ \row \li Core::IWizard::WizardKind \li kind - \li Enumeration value that indicates the type of the wizard (project, class, file). + \li Enumeration value that indicates the type of the wizard (project or file). \row \li QIcon diff --git a/doc/src/projects/creator-projects-custom-wizards-json.qdoc b/doc/src/projects/creator-projects-custom-wizards-json.qdoc index 9356af878e..331cb04dc6 100644 --- a/doc/src/projects/creator-projects-custom-wizards-json.qdoc +++ b/doc/src/projects/creator-projects-custom-wizards-json.qdoc @@ -113,7 +113,7 @@ \code "version": 1, - "kind": "class", + "kind": "file", "id": "A.Class", "category": "O.C++", \endcode @@ -123,8 +123,8 @@ \li \c version is the version of the file contents. Do not modify this value. - \li \c kind specifies the type of the wizard: \c class, - \c file, or \c project. + \li \c kind specifies the type of the wizard: \c file or + \c project. \li \c id is the unique identifier for your wizard. You can use a leading letter to specify the position of the diff --git a/share/qtcreator/templates/wizards/classes/cpp/wizard.json b/share/qtcreator/templates/wizards/classes/cpp/wizard.json index eb62b0d44a..06de05eb1c 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/wizard.json +++ b/share/qtcreator/templates/wizards/classes/cpp/wizard.json @@ -1,6 +1,6 @@ { "version": 1, - "kind": "class", + "kind": "file", "id": "A.Class", "category": "O.C++", "trDescription": "Creates a C++ header and a source file for a new class that you can add to a C++ project.", diff --git a/share/qtcreator/templates/wizards/classes/python/wizard.json b/share/qtcreator/templates/wizards/classes/python/wizard.json index 7df9bccb4b..682958abd5 100644 --- a/share/qtcreator/templates/wizards/classes/python/wizard.json +++ b/share/qtcreator/templates/wizards/classes/python/wizard.json @@ -1,6 +1,6 @@ { "version": 1, - "kind": "class", + "kind": "file", "id": "P.PyClass", "category": "U.Python", "trDescription": "Creates new Python class file.", diff --git a/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml b/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml index 1590c57a44..9958e691b9 100644 --- a/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml +++ b/share/qtcreator/templates/wizards/listmodel/wizard_sample.xml @@ -31,7 +31,7 @@ ****************************************************************************/ Custom class wizard example configuration file. --> -<wizard version="1" kind="class" id="A.ListModel" category="B.CustomClasses"> +<wizard version="1" kind="file" id="A.ListModel" category="B.CustomClasses"> <description>Creates a QAbstractListModel implementation.</description> <description xml:lang="de">Erzeugt eine Implementierung von QAbstractListModel.</description> <displayname>QAbstractListModel implementation</displayname>; diff --git a/src/plugins/coreplugin/coreconstants.h b/src/plugins/coreplugin/coreconstants.h index e3d3ecb785..15e33c247c 100644 --- a/src/plugins/coreplugin/coreconstants.h +++ b/src/plugins/coreplugin/coreconstants.h @@ -226,7 +226,6 @@ const char WIZARD_CATEGORY_QT[] = "R.Qt"; const char WIZARD_TR_CATEGORY_QT[] = QT_TRANSLATE_NOOP("Core", "Qt"); const char WIZARD_KIND_UNKNOWN[] = "unknown"; const char WIZARD_KIND_PROJECT[] = "project"; -const char WIZARD_KIND_CLASS[] = "class"; const char WIZARD_KIND_FILE[] = "file"; const char SETTINGS_CATEGORY_CORE[] = "A.Core"; diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp index 867c802871..e4b49f734c 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.cpp +++ b/src/plugins/coreplugin/dialogs/newdialog.cpp @@ -261,12 +261,12 @@ void NewDialog::setWizardFactories(QList<IWizardFactory *> factories, QStandardItem *projectKindItem = new QStandardItem(tr("Projects")); projectKindItem->setData(IWizardFactory::ProjectWizard, Qt::UserRole); projectKindItem->setFlags(0); // disable item to prevent focus - QStandardItem *filesClassesKindItem = new QStandardItem(tr("Files and Classes")); - filesClassesKindItem->setData(IWizardFactory::FileWizard, Qt::UserRole); - filesClassesKindItem->setFlags(0); // disable item to prevent focus + QStandardItem *filesKindItem = new QStandardItem(tr("Files and Classes")); + filesKindItem->setData(IWizardFactory::FileWizard, Qt::UserRole); + filesKindItem->setFlags(0); // disable item to prevent focus parentItem->appendRow(projectKindItem); - parentItem->appendRow(filesClassesKindItem); + parentItem->appendRow(filesKindItem); if (m_dummyIcon.isNull()) m_dummyIcon = QIcon(QLatin1String(Core::Constants::ICON_NEWFILE)); @@ -290,10 +290,9 @@ void NewDialog::setWizardFactories(QList<IWizardFactory *> factories, case IWizardFactory::ProjectWizard: kindItem = projectKindItem; break; - case IWizardFactory::ClassWizard: case IWizardFactory::FileWizard: default: - kindItem = filesClassesKindItem; + kindItem = filesKindItem; break; } addItem(kindItem, factory); diff --git a/src/plugins/coreplugin/iwizardfactory.h b/src/plugins/coreplugin/iwizardfactory.h index 95aab8c248..df5a4e8139 100644 --- a/src/plugins/coreplugin/iwizardfactory.h +++ b/src/plugins/coreplugin/iwizardfactory.h @@ -49,10 +49,8 @@ class CORE_EXPORT IWizardFactory public: enum WizardKind { FileWizard = 0x01, - ClassWizard = 0x02, - ProjectWizard = 0x04 + ProjectWizard = 0x02 }; - Q_DECLARE_FLAGS(WizardKinds, WizardKind) enum WizardFlag { PlatformIndependent = 0x01, ForceCapitalLetterForFileName = 0x02 @@ -120,7 +118,6 @@ private: } // namespace Core -Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IWizardFactory::WizardKinds) Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IWizardFactory::WizardFlags) #endif // IWIZARDFACTORY_H diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp index a95413f22f..58bade244a 100644 --- a/src/plugins/designer/formeditorplugin.cpp +++ b/src/plugins/designer/formeditorplugin.cpp @@ -134,7 +134,7 @@ void FormEditorPlugin::initializeTemplates() { #ifdef CPP_ENABLED IWizardFactory *wizard = new FormClassWizard; - wizard->setWizardKind(IWizardFactory::ClassWizard); + wizard->setWizardKind(IWizardFactory::FileWizard); 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")); diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index 37527d49a8..a9a93bf868 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -451,12 +451,8 @@ static ParseState nextClosingState(ParseState in, const QStringRef &name) static inline IWizardFactory::WizardKind kindAttribute(const QXmlStreamReader &r) { const QStringRef value = r.attributes().value(QLatin1String(kindAttributeC)); - if (!value.isEmpty()) { - if (value == QLatin1String("file")) - return IWizardFactory::FileWizard; - if (value == QLatin1String("class")) - return IWizardFactory::ClassWizard; - } + if (value == QLatin1String("file") || value == QLatin1String("class")) + return IWizardFactory::FileWizard; return IWizardFactory::ProjectWizard; } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp index 247336939e..37317bd78d 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp @@ -67,8 +67,6 @@ static IWizardFactory::WizardKind wizardKind(JsonWizard *wiz) const QString kindStr = wiz->stringValue(QLatin1String("kind")); if (kindStr == QLatin1String(Core::Constants::WIZARD_KIND_PROJECT)) kind = IWizardFactory::ProjectWizard; - else if (kindStr == QLatin1String(Core::Constants::WIZARD_KIND_CLASS)) - kind = IWizardFactory::ClassWizard; else if (kindStr == QLatin1String(Core::Constants::WIZARD_KIND_FILE)) kind = IWizardFactory::FileWizard; else diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index 043905a24c..51f8a404a4 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -387,8 +387,6 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS QString kindStr = QLatin1String(Core::Constants::WIZARD_KIND_UNKNOWN); if (kind() == IWizardFactory::FileWizard) kindStr = QLatin1String(Core::Constants::WIZARD_KIND_FILE); - else if (kind() == IWizardFactory::ClassWizard) - kindStr = QLatin1String(Core::Constants::WIZARD_KIND_CLASS); else if (kind() == IWizardFactory::ProjectWizard) kindStr = QLatin1String(Core::Constants::WIZARD_KIND_PROJECT); wizard.setValue(QStringLiteral("kind"), kindStr); @@ -503,9 +501,7 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir, return false; } IWizardFactory::WizardKind kind = IWizardFactory::ProjectWizard; - if (strVal == QLatin1String("class")) - kind = IWizardFactory::ClassWizard; - if (strVal == QLatin1String("file")) + if (strVal == QLatin1String("file") || strVal == QLatin1String("class")) kind = IWizardFactory::FileWizard; setWizardKind(kind); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 1896790a46..609b24bd56 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -528,7 +528,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er addAutoReleasedObject(new CustomWizardMetaFactory<CustomProjectWizard>(IWizardFactory::ProjectWizard)); addAutoReleasedObject(new CustomWizardMetaFactory<CustomWizard>(IWizardFactory::FileWizard)); - addAutoReleasedObject(new CustomWizardMetaFactory<CustomWizard>(IWizardFactory::ClassWizard)); // For JsonWizard: JsonWizardFactory::registerPageFactory(new FieldPageFactory); @@ -2995,8 +2994,7 @@ void ProjectExplorerPluginPrivate::addNewFile() map.insert(QLatin1String(Constants::PROJECT_KIT_IDS), QVariant::fromValue(profileIds)); } ICore::showNewItemDialog(tr("New File", "Title of dialog"), - IWizardFactory::wizardFactoriesOfKind(IWizardFactory::FileWizard) - + IWizardFactory::wizardFactoriesOfKind(IWizardFactory::ClassWizard), + IWizardFactory::wizardFactoriesOfKind(IWizardFactory::FileWizard), location, map); } |