forked from qt-creator/qt-creator
Wizards: Fix custom wizards (fix up delayed creation).
Fixes e5f60a956f
This commit is contained in:
@@ -233,3 +233,7 @@ void CoreImpl::openFiles(const QStringList &arguments)
|
||||
m_mainwindow->openFiles(arguments);
|
||||
}
|
||||
|
||||
void CoreImpl::emitNewItemsDialogRequested()
|
||||
{
|
||||
emit newItemsDialogRequested();
|
||||
}
|
||||
|
||||
@@ -90,6 +90,8 @@ public:
|
||||
|
||||
void openFiles(const QStringList &fileNames);
|
||||
|
||||
void emitNewItemsDialogRequested();
|
||||
|
||||
private:
|
||||
MainWindow *m_mainwindow;
|
||||
friend class MainWindow;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "iwizard.h"
|
||||
#include "coreimpl.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
@@ -139,6 +140,9 @@ using namespace Core;
|
||||
template <class Predicate>
|
||||
QList<IWizard*> findWizards(Predicate predicate)
|
||||
{
|
||||
// Hack: Trigger delayed creation of wizards
|
||||
if (Core::Internal::CoreImpl *ci = qobject_cast<Core::Internal::CoreImpl*>(ICore::instance()))
|
||||
ci->emitNewItemsDialogRequested();
|
||||
// Filter all wizards
|
||||
const QList<IWizard*> allWizards = IWizard::allWizards();
|
||||
QList<IWizard*> rc;
|
||||
@@ -151,6 +155,9 @@ template <class Predicate>
|
||||
|
||||
QList<IWizard*> IWizard::allWizards()
|
||||
{
|
||||
// Hack: Trigger delayed creation of wizards
|
||||
if (Core::Internal::CoreImpl *ci = qobject_cast<Core::Internal::CoreImpl*>(ICore::instance()))
|
||||
ci->emitNewItemsDialogRequested();
|
||||
return ExtensionSystem::PluginManager::instance()->getObjects<IWizard>();
|
||||
}
|
||||
|
||||
|
||||
@@ -885,7 +885,6 @@ 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;
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
@@ -350,9 +351,17 @@ QList<CustomWizard*> CustomWizard::createWizards()
|
||||
case Internal::CustomWizardParameters::ParseOk:
|
||||
parameters->directory = dir.absolutePath();
|
||||
if (CustomWizardPrivate::verbose)
|
||||
verboseLog += parameters->toString();
|
||||
if (CustomWizard *w = createWizard(parameters, baseFileParameters))
|
||||
QTextStream(&verboseLog)
|
||||
<< "\n### Adding: " << baseFileParameters.id() << " / " << baseFileParameters.displayName() << '\n'
|
||||
<< baseFileParameters.category() << " / " <<baseFileParameters.displayCategory() << '\n'
|
||||
<< " (" << baseFileParameters.description() << ")\n"
|
||||
<< parameters->toString();
|
||||
if (CustomWizard *w = createWizard(parameters, baseFileParameters)) {
|
||||
rc.push_back(w);
|
||||
} else {
|
||||
qWarning("Custom wizard factory function failed for %s", qPrintable(baseFileParameters.id()));
|
||||
}
|
||||
break;
|
||||
case Internal::CustomWizardParameters::ParseDisabled:
|
||||
if (CustomWizardPrivate::verbose)
|
||||
qWarning("Ignoring disabled wizard %s...", qPrintable(dir.absolutePath()));
|
||||
@@ -360,6 +369,7 @@ QList<CustomWizard*> CustomWizard::createWizards()
|
||||
case Internal::CustomWizardParameters::ParseFailed:
|
||||
qWarning("Failed to initialize custom project wizard in %s: %s",
|
||||
qPrintable(dir.absolutePath()), qPrintable(errorMessage));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (CustomWizardPrivate::verbose)
|
||||
|
||||
Reference in New Issue
Block a user