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:
|
||||
void coreAboutToOpen();
|
||||
void coreOpened();
|
||||
void newItemsDialogRequested();
|
||||
void saveSettingsRequested();
|
||||
void optionsDialogRequested();
|
||||
void coreAboutToClose();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
static bool firstTime = true;
|
||||
if (firstTime) {
|
||||
firstTime = false;
|
||||
foreach(Core::IWizard *cpw, ProjectExplorer::CustomWizard::createWizards())
|
||||
addAutoReleasedObject(cpw);
|
||||
|
||||
d->m_buildManager->extensionsInitialized();
|
||||
}
|
||||
}
|
||||
|
||||
ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user