forked from qt-creator/qt-creator
Wizards: Delay parsing of custom wizards.
... by introducing signal ICore::showNewItemsDialog(). Reviewed-by: Kai Köhne <kai.koehne@nokia.com>
This commit is contained in:
@@ -123,6 +123,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void coreAboutToOpen();
|
void coreAboutToOpen();
|
||||||
void coreOpened();
|
void coreOpened();
|
||||||
|
void newItemsDialogRequested();
|
||||||
void saveSettingsRequested();
|
void saveSettingsRequested();
|
||||||
void optionsDialogRequested();
|
void optionsDialogRequested();
|
||||||
void coreAboutToClose();
|
void coreAboutToClose();
|
||||||
|
|||||||
@@ -885,6 +885,7 @@ QStringList MainWindow::showNewItemDialog(const QString &title,
|
|||||||
const QList<IWizard *> &wizards,
|
const QList<IWizard *> &wizards,
|
||||||
const QString &defaultLocation)
|
const QString &defaultLocation)
|
||||||
{
|
{
|
||||||
|
emit m_coreImpl->newItemsDialogRequested();
|
||||||
// Scan for wizards matching the filter and pick one. Don't show
|
// Scan for wizards matching the filter and pick one. Don't show
|
||||||
// dialog if there is only one.
|
// dialog if there is only one.
|
||||||
IWizard *wizard = 0;
|
IWizard *wizard = 0;
|
||||||
|
|||||||
@@ -327,13 +327,13 @@ QList<CustomWizard*> CustomWizard::createWizards()
|
|||||||
if (CustomWizardPrivate::verbose)
|
if (CustomWizardPrivate::verbose)
|
||||||
verboseLog = QString::fromLatin1("### CustomWizard: Checking '%1'\n").arg(userTemplateDirName);
|
verboseLog = QString::fromLatin1("### CustomWizard: Checking '%1'\n").arg(userTemplateDirName);
|
||||||
|
|
||||||
QList<QFileInfo> dirs = templateDir.entryInfoList(QDir::Dirs|QDir::Readable|QDir::NoDotAndDotDot,
|
const QDir::Filters filters = QDir::Dirs|QDir::Readable|QDir::NoDotAndDotDot;
|
||||||
QDir::Name|QDir::IgnoreCase);
|
const QDir::SortFlags sortflags = QDir::Name|QDir::IgnoreCase;
|
||||||
|
QList<QFileInfo> dirs = templateDir.entryInfoList(filters, sortflags);
|
||||||
if (userTemplateDir.exists()) {
|
if (userTemplateDir.exists()) {
|
||||||
if (CustomWizardPrivate::verbose)
|
if (CustomWizardPrivate::verbose)
|
||||||
verboseLog = QString::fromLatin1("### CustomWizard: userTemplateDir '%1' found, adding\n").arg(userTemplateDirName);
|
verboseLog = QString::fromLatin1("### CustomWizard: userTemplateDir '%1' found, adding\n").arg(userTemplateDirName);
|
||||||
dirs += userTemplateDir.entryInfoList(QDir::Dirs|QDir::Readable|QDir::NoDotAndDotDot,
|
dirs += userTemplateDir.entryInfoList(filters, sortflags);
|
||||||
QDir::Name|QDir::IgnoreCase);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString configFile = QLatin1String(configFileC);
|
const QString configFile = QLatin1String(configFileC);
|
||||||
|
|||||||
@@ -56,8 +56,11 @@ namespace Internal {
|
|||||||
struct CustomWizardContext;
|
struct CustomWizardContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Factory for creating wizard. Can be registered under a name
|
// Factory for creating custom wizards derived from the base classes
|
||||||
// in CustomWizard.
|
// 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 {
|
class ICustomWizardFactory {
|
||||||
public:
|
public:
|
||||||
virtual CustomWizard *create(const Core::BaseFileWizardParameters& baseFileParameters,
|
virtual CustomWizard *create(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||||
@@ -65,7 +68,7 @@ public:
|
|||||||
virtual ~ICustomWizardFactory() {}
|
virtual ~ICustomWizardFactory() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Convenience template to create wizard classes.
|
// Convenience template to create wizard factory classes.
|
||||||
template <class Wizard> class CustomWizardFactory : public ICustomWizardFactory {
|
template <class Wizard> class CustomWizardFactory : public ICustomWizardFactory {
|
||||||
virtual CustomWizard *create(const Core::BaseFileWizardParameters& baseFileParameters,
|
virtual CustomWizard *create(const Core::BaseFileWizardParameters& baseFileParameters,
|
||||||
QObject *parent = 0) const
|
QObject *parent = 0) const
|
||||||
@@ -134,8 +137,8 @@ private:
|
|||||||
|
|
||||||
// A custom project wizard presenting CustomProjectWizardDialog
|
// A custom project wizard presenting CustomProjectWizardDialog
|
||||||
// (Project intro page and fields page) for wizards of type "project".
|
// (Project intro page and fields page) for wizards of type "project".
|
||||||
// Overwrites postGenerateFiles() to open the project file which is the
|
// Overwrites postGenerateFiles() to open the project files according to the
|
||||||
// last one by convention. Also inserts '%ProjectName%' into the base
|
// file attributes. Also inserts '%ProjectName%' into the base
|
||||||
// replacement map once the intro page is left to have it available
|
// replacement map once the intro page is left to have it available
|
||||||
// for QLineEdit-type fields' default text.
|
// for QLineEdit-type fields' default text.
|
||||||
|
|
||||||
|
|||||||
@@ -249,6 +249,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
Core::ICore *core = Core::ICore::instance();
|
Core::ICore *core = Core::ICore::instance();
|
||||||
Core::ActionManager *am = core->actionManager();
|
Core::ActionManager *am = core->actionManager();
|
||||||
|
connect(core, SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards()));
|
||||||
|
|
||||||
d->m_welcomePage = new ProjectWelcomePage;
|
d->m_welcomePage = new ProjectWelcomePage;
|
||||||
connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
|
connect(d->m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
|
||||||
@@ -944,12 +945,19 @@ void ProjectExplorerPlugin::extensionsInitialized()
|
|||||||
d->m_profileMimeTypes += pf->mimeTypes();
|
d->m_profileMimeTypes += pf->mimeTypes();
|
||||||
addAutoReleasedObject(pf);
|
addAutoReleasedObject(pf);
|
||||||
}
|
}
|
||||||
|
d->m_buildManager->extensionsInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectExplorerPlugin::loadCustomWizards()
|
||||||
|
{
|
||||||
// Add custom wizards, for which other plugins might have registered
|
// Add custom wizards, for which other plugins might have registered
|
||||||
// class factories
|
// class factories
|
||||||
foreach(Core::IWizard *cpw, ProjectExplorer::CustomWizard::createWizards())
|
static bool firstTime = true;
|
||||||
addAutoReleasedObject(cpw);
|
if (firstTime) {
|
||||||
|
firstTime = false;
|
||||||
d->m_buildManager->extensionsInitialized();
|
foreach(Core::IWizard *cpw, ProjectExplorer::CustomWizard::createWizards())
|
||||||
|
addAutoReleasedObject(cpw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
|
ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ private slots:
|
|||||||
void loadProject(const QString &project) { openProject(project); }
|
void loadProject(const QString &project) { openProject(project); }
|
||||||
void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
|
void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
|
||||||
void updateActions();
|
void updateActions();
|
||||||
|
void loadCustomWizards();
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
void testGccOutputParsers_data();
|
void testGccOutputParsers_data();
|
||||||
|
|||||||
Reference in New Issue
Block a user