Commit 5b5bea0c authored by Tobias Hunger's avatar Tobias Hunger
Browse files

BaseFileWizardFactory: rename createWizardDialog method to create



Unify name of parameters object that gets passed into the method while
at it anyway.

Change-Id: I9cfdfe3b7dcdbd5e083b3b91922053be3a63b081
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent a34b0b90
......@@ -164,7 +164,7 @@ void WizardEventLoop::rejected()
The following abstract functions must be implemented:
\list
\li createWizardDialog(): Called to create the QWizard dialog to be shown.
\li create(): Called to create the QWizard dialog to be shown.
\li generateFiles(): Generates file content.
\endlist
......@@ -214,12 +214,12 @@ void BaseFileWizardFactory::runWizard(const QString &path, QWidget *parent, cons
if (flags().testFlag(ForceCapitalLetterForFileName))
dialogParameterFlags |= WizardDialogParameters::ForceCapitalLetterForFileName;
const QScopedPointer<QWizard> wizard(createWizardDialog(parent, WizardDialogParameters(path,
allExtensionPages,
platform,
requiredFeatures(),
dialogParameterFlags,
extraValues)));
const QScopedPointer<QWizard> wizard(create(parent, WizardDialogParameters(path,
allExtensionPages,
platform,
requiredFeatures(),
dialogParameterFlags,
extraValues)));
QTC_ASSERT(!wizard.isNull(), return);
GeneratedFiles files;
......@@ -300,11 +300,10 @@ void BaseFileWizardFactory::runWizard(const QString &path, QWidget *parent, cons
}
/*!
\fn virtual QWizard *Core::BaseFileWizard::createWizardDialog(QWidget *parent,
const WizardDialogParameters &wizardDialogParameters) const
\fn virtual QWizard *Core::BaseFileWizard::create(QWidget *parent,
const WizardDialogParameters &parameters) const
Creates the wizard dialog on the \a parent with the
\a wizardDialogParameters.
Creates the wizard on the \a parent with the \a parameters.
*/
/*!
......@@ -525,15 +524,14 @@ QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType)
Creates a Utils::FileWizardDialog.
*/
QWizard *StandardFileWizardFactory::createWizardDialog(QWidget *parent,
const WizardDialogParameters &wizardDialogParameters) const
QWizard *StandardFileWizardFactory::create(QWidget *parent, const WizardDialogParameters &parameters) const
{
Utils::FileWizardDialog *standardWizardDialog = new Utils::FileWizardDialog(parent);
if (wizardDialogParameters.flags().testFlag(WizardDialogParameters::ForceCapitalLetterForFileName))
if (parameters.flags().testFlag(WizardDialogParameters::ForceCapitalLetterForFileName))
standardWizardDialog->setForceFirstCapitalLetterForFileName(true);
standardWizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
standardWizardDialog->setPath(wizardDialogParameters.defaultPath());
foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
standardWizardDialog->setPath(parameters.defaultPath());
foreach (QWizardPage *p, parameters.extensionPages())
BaseFileWizardFactory::applyExtensionPageShortTitle(standardWizardDialog, standardWizardDialog->addPage(p));
return standardWizardDialog;
}
......
......@@ -120,8 +120,7 @@ protected:
virtual ExtensionList extensions() const;
virtual QWizard *createWizardDialog(QWidget *parent,
const WizardDialogParameters &wizardDialogParameters) const = 0;
virtual QWizard *create(QWidget *parent, const WizardDialogParameters &parameters) const = 0;
virtual GeneratedFiles generateFiles(const QWizard *w,
QString *errorMessage) const = 0;
......@@ -143,7 +142,7 @@ class CORE_EXPORT StandardFileWizardFactory : public BaseFileWizardFactory
Q_OBJECT
protected:
QWizard *createWizardDialog(QWidget *parent, const WizardDialogParameters &wizardDialogParameters) const;
QWizard *create(QWidget *parent, const WizardDialogParameters &parameters) const;
GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
virtual GeneratedFiles generateFilesFromPath(const QString &path, const QString &name,
QString *errorMessage) const = 0;
......
......@@ -153,13 +153,12 @@ QString CppClassWizard::headerSuffix() const
return preferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE));
}
QWizard *CppClassWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
QWizard *CppClassWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
CppClassWizardDialog *wizard = new CppClassWizardDialog(parent);
foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
foreach (QWizardPage *p, parameters.extensionPages())
BaseFileWizardFactory::applyExtensionPageShortTitle(wizard, wizard->addPage(p));
wizard->setPath(wizardDialogParameters.defaultPath());
wizard->setPath(parameters.defaultPath());
return wizard;
}
......
......@@ -95,9 +95,7 @@ public:
CppClassWizard();
private:
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *w,
QString *errorMessage) const;
......
......@@ -60,12 +60,11 @@ QString FormClassWizard::formSuffix() const
return preferredSuffix(QLatin1String(Constants::FORM_MIMETYPE));
}
QWizard *FormClassWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
QWizard *FormClassWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
FormClassWizardDialog *wizardDialog = new FormClassWizardDialog(wizardDialogParameters.extensionPages(),
FormClassWizardDialog *wizardDialog = new FormClassWizardDialog(parameters.extensionPages(),
parent);
wizardDialog->setPath(wizardDialogParameters.defaultPath());
wizardDialog->setPath(parameters.defaultPath());
return wizardDialog;
}
......
......@@ -49,8 +49,7 @@ public:
QString formSuffix() const;
private:
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
};
......
......@@ -42,12 +42,11 @@ FormWizard::FormWizard()
addRequiredFeature(Core::Id(QtSupport::Constants::FEATURE_QWIDGETS));
}
QWizard *FormWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
QWizard *FormWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
FormFileWizardDialog *wizardDialog = new FormFileWizardDialog(wizardDialogParameters.extensionPages(),
FormFileWizardDialog *wizardDialog = new FormFileWizardDialog(parameters.extensionPages(),
parent);
wizardDialog->setPath(wizardDialogParameters.defaultPath());
wizardDialog->setPath(parameters.defaultPath());
return wizardDialog;
}
......
......@@ -43,8 +43,7 @@ public:
FormWizard();
private:
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
};
......
......@@ -132,14 +132,13 @@ GenericProjectWizard::GenericProjectWizard()
setFlags(Core::IWizardFactory::PlatformIndependent);
}
QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
QWizard *GenericProjectWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
GenericProjectWizardDialog *wizard = new GenericProjectWizardDialog(parent);
wizard->setPath(wizardDialogParameters.defaultPath());
wizard->setPath(parameters.defaultPath());
foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
foreach (QWizardPage *p, parameters.extensionPages())
BaseFileWizardFactory::applyExtensionPageShortTitle(wizard, wizard->addPage(p));
return wizard;
......
......@@ -66,8 +66,7 @@ public:
GenericProjectWizard();
protected:
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage);
};
......
......@@ -127,13 +127,12 @@ QString GLSLFileWizard::fileContents(const QString &, ShaderType shaderType) con
return contents;
}
QWizard *GLSLFileWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
QWizard *GLSLFileWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
GLSLFileWizardDialog *wizardDialog = new GLSLFileWizardDialog(parent);
wizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
wizardDialog->setPath(wizardDialogParameters.defaultPath());
foreach (QWizardPage *p, wizardDialogParameters.extensionPages())
wizardDialog->setPath(parameters.defaultPath());
foreach (QWizardPage *p, parameters.extensionPages())
BaseFileWizardFactory::applyExtensionPageShortTitle(wizardDialog, wizardDialog->addPage(p));
return wizardDialog;
}
......
......@@ -52,8 +52,7 @@ public:
private:
QString fileContents(const QString &baseName, ShaderType shaderType) const;
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *w,
QString *errorMessage) const;
......
......@@ -152,12 +152,11 @@ void CustomWizard::initWizardDialog(Utils::Wizard *wizard, const QString &defaul
qDebug() << "initWizardDialog" << wizard << wizard->pageIds();
}
QWizard *CustomWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
QWizard *CustomWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
QTC_ASSERT(!d->m_parameters.isNull(), return 0);
Utils::Wizard *wizard = new Utils::Wizard(parent);
initWizardDialog(wizard, wizardDialogParameters.defaultPath(), wizardDialogParameters.extensionPages());
initWizardDialog(wizard, parameters.defaultPath(), parameters.extensionPages());
return wizard;
}
......@@ -503,14 +502,13 @@ CustomProjectWizard::CustomProjectWizard()
initProjectWizardDialog() needs to be called.
*/
QWizard *CustomProjectWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
QWizard *CustomProjectWizard::create(QWidget *parent,
const Core::WizardDialogParameters &parameters) const
{
QTC_ASSERT(!parameters().isNull(), return 0);
BaseProjectWizardDialog *projectDialog = new BaseProjectWizardDialog(parent, wizardDialogParameters);
BaseProjectWizardDialog *projectDialog = new BaseProjectWizardDialog(parent, parameters);
initProjectWizardDialog(projectDialog,
wizardDialogParameters.defaultPath(),
wizardDialogParameters.extensionPages());
parameters.defaultPath(),
parameters.extensionPages());
return projectDialog;
}
......
......@@ -96,8 +96,7 @@ public:
// Can be reimplemented to create custom wizards. initWizardDialog() needs to be
// called.
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
......@@ -144,8 +143,7 @@ public:
static bool postGenerateOpen(const Core::GeneratedFiles &l, QString *errorMessage = 0);
protected:
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
......
......@@ -55,15 +55,13 @@ ClassWizard::ClassWizard()
setDescription(ClassWizard::tr(Constants::EN_PY_CLASS_DESCRIPTION));
}
QWizard *ClassWizard::createWizardDialog(
QWidget *parent,
const Core::WizardDialogParameters &params) const
QWizard *ClassWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
ClassWizardDialog *wizard = new ClassWizardDialog(parent);
foreach (QWizardPage *p, params.extensionPages())
foreach (QWizardPage *p, parameters.extensionPages())
BaseFileWizardFactory::applyExtensionPageShortTitle(wizard, wizard->addPage(p));
wizard->setPath(params.defaultPath());
wizard->setExtraValues(params.extraValues());
wizard->setPath(parameters.defaultPath());
wizard->setExtraValues(parameters.extraValues());
return wizard;
}
......
......@@ -49,8 +49,7 @@ public:
ClassWizard();
private:
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &params) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *w,
QString *errorMessage) const;
......
......@@ -61,13 +61,12 @@ FileWizard::FileWizard()
* @param params
* @return
*/
QWizard *FileWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &params) const
QWizard *FileWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
Utils::FileWizardDialog *pDialog = new Utils::FileWizardDialog(parent);
pDialog->setWindowTitle(tr("New %1").arg(displayName()));
pDialog->setPath(params.defaultPath());
foreach (QWizardPage *p, params.extensionPages())
pDialog->setPath(parameters.defaultPath());
foreach (QWizardPage *p, parameters.extensionPages())
applyExtensionPageShortTitle(pDialog, pDialog->addPage(p));
return pDialog;
......
......@@ -42,8 +42,7 @@ public:
FileWizard();
protected:
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &params) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *dialog, QString *errorMessage) const;
};
......
......@@ -54,14 +54,13 @@ CustomWidgetWizard::CustomWidgetWizard()
setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QWIDGETS));
}
QWizard *CustomWidgetWizard::createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const
QWizard *CustomWidgetWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
CustomWidgetWizardDialog *rc = new CustomWidgetWizardDialog(displayName(),
icon(),
parent,
wizardDialogParameters);
rc->setProjectName(CustomWidgetWizardDialog::uniqueProjectName(wizardDialogParameters.defaultPath()));
parameters);
rc->setProjectName(CustomWidgetWizardDialog::uniqueProjectName(parameters.defaultPath()));
rc->setFileNamingParameters(FileNamingParameters(headerSuffix(), sourceSuffix(), QtWizard::lowerCaseFiles()));
return rc;
}
......
......@@ -43,8 +43,7 @@ public:
CustomWidgetWizard();
protected:
QWizard *createWizardDialog(QWidget *parent,
const Core::WizardDialogParameters &wizardDialogParameters) const;
QWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment