diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index d859e2828f34ecb0d2f43ba40f11a95684907d48..d1d4ce1668a4a21b2a307d841db47a15e05113f5 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -123,6 +123,7 @@ public: signals: void coreAboutToOpen(); void coreOpened(); + void newItemsDialogRequested(); void saveSettingsRequested(); void optionsDialogRequested(); void coreAboutToClose(); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index c7338cdb1b5159bfaf6c943801092052dea28d86..9463c552d123b0943f03b68072181ce504f2f2fd 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -885,6 +885,7 @@ QStringList MainWindow::showNewItemDialog(const QString &title, const QList<IWizard *> &wizards, const QString &defaultLocation) { + emit m_coreImpl->newItemsDialogRequested(); // Scan for wizards matching the filter and pick one. Don't show // dialog if there is only one. IWizard *wizard = 0; diff --git a/src/plugins/projectexplorer/customwizard/customwizard.cpp b/src/plugins/projectexplorer/customwizard/customwizard.cpp index 98f2eff92703048b1c7af13d350a1bf8cf3244b3..03d2aa5f74b7bbb22bd6d63165da6ba139ac0d9f 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizard.cpp @@ -327,13 +327,13 @@ QList<CustomWizard*> CustomWizard::createWizards() if (CustomWizardPrivate::verbose) verboseLog = QString::fromLatin1("### CustomWizard: Checking '%1'\n").arg(userTemplateDirName); - QList<QFileInfo> dirs = templateDir.entryInfoList(QDir::Dirs|QDir::Readable|QDir::NoDotAndDotDot, - QDir::Name|QDir::IgnoreCase); + const QDir::Filters filters = QDir::Dirs|QDir::Readable|QDir::NoDotAndDotDot; + const QDir::SortFlags sortflags = QDir::Name|QDir::IgnoreCase; + QList<QFileInfo> dirs = templateDir.entryInfoList(filters, sortflags); if (userTemplateDir.exists()) { if (CustomWizardPrivate::verbose) verboseLog = QString::fromLatin1("### CustomWizard: userTemplateDir '%1' found, adding\n").arg(userTemplateDirName); - dirs += userTemplateDir.entryInfoList(QDir::Dirs|QDir::Readable|QDir::NoDotAndDotDot, - QDir::Name|QDir::IgnoreCase); + dirs += userTemplateDir.entryInfoList(filters, sortflags); } const QString configFile = QLatin1String(configFileC); diff --git a/src/plugins/projectexplorer/customwizard/customwizard.h b/src/plugins/projectexplorer/customwizard/customwizard.h index 2df8bda89e02761cccd1a9b3e43a9e6b46940f69..5eb6d37e4be2587a73d2d0333e369cb89512e39d 100644 --- a/src/plugins/projectexplorer/customwizard/customwizard.h +++ b/src/plugins/projectexplorer/customwizard/customwizard.h @@ -56,8 +56,11 @@ namespace Internal { struct CustomWizardContext; } -// Factory for creating wizard. Can be registered under a name -// in CustomWizard. +// Factory for creating custom wizards derived from the base classes +// The factory can be registered under a name in CustomWizard. The name can +// be specified in the <wizard class=''...> attribute in the wizard.xml file +// and thus allows for specifying a C++ derived wizard class (see Qt4ProjectManager). + class ICustomWizardFactory { public: virtual CustomWizard *create(const Core::BaseFileWizardParameters& baseFileParameters, @@ -65,7 +68,7 @@ public: virtual ~ICustomWizardFactory() {} }; -// Convenience template to create wizard classes. +// Convenience template to create wizard factory classes. template <class Wizard> class CustomWizardFactory : public ICustomWizardFactory { virtual CustomWizard *create(const Core::BaseFileWizardParameters& baseFileParameters, QObject *parent = 0) const @@ -134,8 +137,8 @@ private: // A custom project wizard presenting CustomProjectWizardDialog // (Project intro page and fields page) for wizards of type "project". -// Overwrites postGenerateFiles() to open the project file which is the -// last one by convention. Also inserts '%ProjectName%' into the base +// Overwrites postGenerateFiles() to open the project files according to the +// file attributes. Also inserts '%ProjectName%' into the base // replacement map once the intro page is left to have it available // for QLineEdit-type fields' default text. diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index b69649ab313da842be62f9ef0e5c9b4f180a9312..2bc84d6cbbf525eae55ec4fd7422b1bf6c3c82f8 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -249,6 +249,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); + connect(core, SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards())); d->m_welcomePage = new ProjectWelcomePage; connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager())); @@ -944,12 +945,19 @@ void ProjectExplorerPlugin::extensionsInitialized() d->m_profileMimeTypes += pf->mimeTypes(); addAutoReleasedObject(pf); } + d->m_buildManager->extensionsInitialized(); +} + +void ProjectExplorerPlugin::loadCustomWizards() +{ // Add custom wizards, for which other plugins might have registered // class factories - foreach(Core::IWizard *cpw, ProjectExplorer::CustomWizard::createWizards()) - addAutoReleasedObject(cpw); - - d->m_buildManager->extensionsInitialized(); + static bool firstTime = true; + if (firstTime) { + firstTime = false; + foreach(Core::IWizard *cpw, ProjectExplorer::CustomWizard::createWizards()) + addAutoReleasedObject(cpw); + } } ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown() diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 9ca130fbacc2b05e2a2599ccc7c8f32e2e77ac0f..1770f274401bdeef52a4b75fa9aeed3f2728fc69 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -194,6 +194,7 @@ private slots: void loadProject(const QString &project) { openProject(project); } void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode); void updateActions(); + void loadCustomWizards(); #ifdef WITH_TESTS void testGccOutputParsers_data();