Core etc: Use dialogParent() for several wizards

This was de-facto the case almost always, only the tests used a local
dummy and StudioWelcome::WizardFactories.

Change-Id: I20191d050d14664c95d9676098f90db76b25d57f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2024-12-04 09:48:00 +01:00
parent 2a990b84fa
commit 23c0ae336f
33 changed files with 88 additions and 118 deletions

View File

@@ -46,8 +46,7 @@ static int indexOfFile(const GeneratedFiles &f, const FilePath &path)
\sa Core::BaseFileWizardFactory
*/
Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const FilePath &path, QWidget *parent,
Id platform,
Wizard *BaseFileWizardFactory::runWizardImpl(const FilePath &path, Id platform,
const QVariantMap &extraValues,
bool showWizard)
{
@@ -63,7 +62,7 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const FilePath &path, QWidge
if (flags().testFlag(ForceCapitalLetterForFileName))
dialogParameterFlags |= WizardDialogParameters::ForceCapitalLetterForFileName;
Wizard *wizard = create(parent, WizardDialogParameters(path,
Wizard *wizard = create(WizardDialogParameters(path,
platform,
requiredFeatures(),
dialogParameterFlags,

View File

@@ -67,7 +67,7 @@ public:
static Utils::FilePath buildFileName(const Utils::FilePath &path, const QString &baseName, const QString &extension);
protected:
virtual BaseFileWizard *create(QWidget *parent, const WizardDialogParameters &parameters) const = 0;
virtual BaseFileWizard *create(const WizardDialogParameters &parameters) const = 0;
virtual GeneratedFiles generateFiles(const QWizard *w,
QString *errorMessage) const = 0;
@@ -84,7 +84,7 @@ protected:
static bool postGenerateOpenEditors(const GeneratedFiles &l, QString *errorMessage = nullptr);
private:
Utils::Wizard *runWizardImpl(const Utils::FilePath &path, QWidget *parent, Utils::Id platform,
Utils::Wizard *runWizardImpl(const Utils::FilePath &path, Utils::Id platform,
const QVariantMap &extraValues, bool showWizard = true) final;
};

View File

@@ -544,7 +544,7 @@ static void runWizard(IWizardFactory *wizard, const FilePath &defaultLocation, I
const QVariantMap &variables)
{
const FilePath path = wizard->runPath(defaultLocation);
wizard->runWizard(path, ICore::dialogParent(), platform, variables);
wizard->runWizard(path, platform, variables);
}
void NewDialogWidget::accept()

View File

@@ -209,7 +209,7 @@ QList<IWizardFactory*> IWizardFactory::allWizardFactories()
.addOnTriggered(newFactory, [newFactory] {
if (!ICore::isNewItemDialogRunning()) {
FilePath path = newFactory->runPath({});
newFactory->runWizard(path, ICore::dialogParent(), Id(), QVariantMap());
newFactory->runWizard(path, Id(), QVariantMap());
}
});
@@ -247,7 +247,6 @@ FilePath IWizardFactory::runPath(const FilePath &defaultPath) const
Creates the wizard that the user selected for execution on the operating
system \a platform with \a variables.
Any dialogs the wizard opens should use the given \a parent.
The \a path argument is a suggestion for the location where files should be
created. The wizard should fill this in its path selection elements as a
default path.
@@ -255,7 +254,7 @@ FilePath IWizardFactory::runPath(const FilePath &defaultPath) const
When \a showWizard is \c false, the wizard instance is created and set up
but not actually shown.
*/
Wizard *IWizardFactory::runWizard(const FilePath &path, QWidget *parent, Id platform,
Wizard *IWizardFactory::runWizard(const FilePath &path, Id platform,
const QVariantMap &variables,
bool showWizard)
{
@@ -264,7 +263,7 @@ Wizard *IWizardFactory::runWizard(const FilePath &path, QWidget *parent, Id plat
s_isWizardRunning = true;
ICore::updateNewItemDialogState();
Utils::Wizard *wizard = runWizardImpl(path, parent, platform, variables, showWizard);
Wizard *wizard = runWizardImpl(path, platform, variables, showWizard);
if (wizard) {

View File

@@ -71,7 +71,7 @@ public:
Utils::FilePath runPath(const Utils::FilePath &defaultPath) const;
// Does bookkeeping and the calls runWizardImpl. Please implement that.
Utils::Wizard *runWizard(const Utils::FilePath &path, QWidget *parent, Utils::Id platform,
Utils::Wizard *runWizard(const Utils::FilePath &path, Utils::Id platform,
const QVariantMap &variables, bool showWizard = true);
virtual bool isAvailable(Utils::Id platformId) const;
@@ -103,7 +103,6 @@ protected:
static QSet<Utils::Id> availableFeatures(Utils::Id platformId);
virtual Utils::Wizard *runWizardImpl(const Utils::FilePath &path,
QWidget *parent,
Utils::Id platform,
const QVariantMap &variables,
bool showWizard = true) = 0;

View File

@@ -42,9 +42,9 @@ QString FormClassWizard::formSuffix() const
return preferredSuffix(Utils::Constants::FORM_MIMETYPE);
}
Core::BaseFileWizard *FormClassWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
Core::BaseFileWizard *FormClassWizard::create(const Core::WizardDialogParameters &parameters) const
{
auto wizardDialog = new FormClassWizardDialog(this, parent);
auto wizardDialog = new FormClassWizardDialog(this);
wizardDialog->setFilePath(parameters.defaultPath());
return wizardDialog;
}

View File

@@ -22,7 +22,7 @@ public:
QString formSuffix() const;
private:
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const final;
Core::BaseFileWizard *create(const Core::WizardDialogParameters &parameters) const final;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const final;
};

View File

@@ -98,8 +98,8 @@ class GenericProjectWizard final : public BaseFileWizard
Q_OBJECT
public:
GenericProjectWizard(const BaseFileWizardFactory *factory, QWidget *parent)
: BaseFileWizard(factory, QVariantMap(), parent)
GenericProjectWizard(const BaseFileWizardFactory *factory)
: BaseFileWizard(factory, QVariantMap(), Core::ICore::dialogParent())
{
setWindowTitle(Tr::tr("Import Existing Project"));
@@ -172,9 +172,9 @@ public:
}
protected:
BaseFileWizard *create(QWidget *parent, const WizardDialogParameters &parameters) const final
BaseFileWizard *create(const WizardDialogParameters &parameters) const final
{
auto wizard = new GenericProjectWizard(this, parent);
auto wizard = new GenericProjectWizard(this);
wizard->setFilePath(parameters.defaultPath());
const QList<QWizardPage *> pages = wizard->extensionPages();
for (QWizardPage *p : pages)

View File

@@ -39,9 +39,8 @@ struct BaseProjectWizardDialogPrivate
BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
QWidget *parent,
const Core::WizardDialogParameters &parameters) :
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
Core::BaseFileWizard(factory, parameters.extraValues()),
d(std::make_unique<BaseProjectWizardDialogPrivate>(new ProjectIntroPage))
{
setFilePath(parameters.defaultPath());
@@ -52,9 +51,8 @@ BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFacto
BaseProjectWizardDialog::BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
ProjectIntroPage *introPage, int introId,
QWidget *parent,
const Core::WizardDialogParameters &parameters) :
Core::BaseFileWizard(factory, parameters.extraValues(), parent),
Core::BaseFileWizard(factory, parameters.extraValues()),
d(std::make_unique<BaseProjectWizardDialogPrivate>(introPage, introId))
{
setFilePath(parameters.defaultPath());

View File

@@ -26,10 +26,10 @@ class PROJECTEXPLORER_EXPORT BaseProjectWizardDialog : public Core::BaseFileWiza
protected:
explicit BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
Utils::ProjectIntroPage *introPage, int introId,
QWidget *parent, const Core::WizardDialogParameters &parameters);
const Core::WizardDialogParameters &parameters);
public:
explicit BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent,
explicit BaseProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
const Core::WizardDialogParameters &parameters);
~BaseProjectWizardDialog() override;

View File

@@ -138,10 +138,10 @@ void CustomWizard::setParameters(const CustomWizardParametersPtr &p)
setFlags(p->flags);
}
BaseFileWizard *CustomWizard::create(QWidget *parent, const WizardDialogParameters &p) const
BaseFileWizard *CustomWizard::create(const WizardDialogParameters &p) const
{
QTC_ASSERT(d->m_parameters, return nullptr);
auto wizard = new BaseFileWizard(this, p.extraValues(), parent);
auto wizard = new BaseFileWizard(this, p.extraValues());
d->m_context->reset();
auto customPage = new CustomWizardPage(d->m_context, parameters());
@@ -461,10 +461,9 @@ CustomProjectWizard::CustomProjectWizard() = default;
initProjectWizardDialog() needs to be called.
*/
BaseFileWizard *CustomProjectWizard::create(QWidget *parent,
const WizardDialogParameters &parameters) const
BaseFileWizard *CustomProjectWizard::create(const WizardDialogParameters &parameters) const
{
auto projectDialog = new BaseProjectWizardDialog(this, parent, parameters);
auto projectDialog = new BaseProjectWizardDialog(this, parameters);
initProjectWizardDialog(projectDialog,
parameters.defaultPath(),
projectDialog->extensionPages());

View File

@@ -64,7 +64,7 @@ public:
// Can be reimplemented to create custom wizards. initWizardDialog() needs to be
// called.
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const override;
Core::BaseFileWizard *create(const Core::WizardDialogParameters &parameters) const override;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
@@ -110,7 +110,7 @@ signals:
void projectLocationChanged(const Utils::FilePath &path);
protected:
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const override;
Core::BaseFileWizard *create(const Core::WizardDialogParameters &parameters) const override;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;

View File

@@ -127,8 +127,8 @@ private:
} // namespace Internal
JsonWizard::JsonWizard(QWidget *parent)
: Wizard(parent)
JsonWizard::JsonWizard()
: Wizard(Core::ICore::dialogParent())
{
setMinimumSize(800, 500);
m_expander.registerExtraResolver([this](const QString &name, QString *ret) -> bool {

View File

@@ -61,7 +61,7 @@ public:
using GeneratorFiles = QList<GeneratorFile>;
Q_PROPERTY(GeneratorFiles generateFileList READ generateFileList)
explicit JsonWizard(QWidget *parent = nullptr);
JsonWizard();
~JsonWizard() override;
void addGenerator(JsonWizardGenerator *gen);

View File

@@ -138,7 +138,6 @@ void ProjectExplorerTest::testJsonWizardsCheckBox()
{
QString errorMessage;
QWidget parent;
const QJsonArray widgets({
createWidget("CheckBox", "Default", QJsonObject()),
createWidget("CheckBox", "Checked", QJsonObject({{"checked", true}})),
@@ -155,21 +154,21 @@ void ProjectExplorerTest::testJsonWizardsCheckBox()
const FactoryPtr factory(JsonWizardFactory::createWizardFactory(wizardObject.toVariantMap(), {}, &errorMessage));
QVERIFY2(factory, qPrintable(errorMessage));
Wizard *wizard = factory->runWizard({}, &parent, Id(), QVariantMap());
std::unique_ptr<Wizard> wizard{factory->runWizard({}, Id(), QVariantMap())};
QVERIFY(!findCheckBox(wizard, "Default")->isChecked());
QVERIFY(!findCheckBox(wizard.get(), "Default")->isChecked());
QCOMPARE(wizard->field("DefaultCheckBox"), QVariant(false));
QVERIFY(findCheckBox(wizard, "Checked")->isChecked());
QVERIFY(findCheckBox(wizard.get(), "Checked")->isChecked());
QCOMPARE(wizard->field("CheckedCheckBox"), QVariant(true));
QVERIFY(!findCheckBox(wizard, "UnChecked")->isChecked());
QVERIFY(!findCheckBox(wizard.get(), "UnChecked")->isChecked());
QCOMPARE(wizard->field("UnCheckedCheckBox"), QVariant(false));
QVERIFY(!findCheckBox(wizard, "SpecialValueUnChecked")->isChecked());
QVERIFY(!findCheckBox(wizard.get(), "SpecialValueUnChecked")->isChecked());
QCOMPARE(qPrintable(wizard->field("SpecialValueUnCheckedCheckBox").toString()), "SpecialUnCheckedValue");
QVERIFY(findCheckBox(wizard, "SpecialValueChecked")->isChecked());
QVERIFY(findCheckBox(wizard.get(), "SpecialValueChecked")->isChecked());
QCOMPARE(qPrintable(wizard->field("SpecialValueCheckedCheckBox").toString()), "SpecialCheckedValue");
}
@@ -177,7 +176,6 @@ void ProjectExplorerTest::testJsonWizardsLineEdit()
{
QString errorMessage;
QWidget parent;
const QJsonArray widgets({
createWidget("LineEdit", "Default", QJsonObject()),
createWidget("LineEdit", "WithText", QJsonObject({{"trText", "some text"}}))
@@ -187,20 +185,20 @@ void ProjectExplorerTest::testJsonWizardsLineEdit()
const FactoryPtr factory(JsonWizardFactory::createWizardFactory(wizardObject.toVariantMap(), {}, &errorMessage));
QVERIFY2(factory, qPrintable(errorMessage));
Wizard *wizard = factory->runWizard({}, &parent, Id(), QVariantMap());
QVERIFY(findLineEdit(wizard, "Default"));
QVERIFY(findLineEdit(wizard, "Default")->text().isEmpty());
QCOMPARE(qPrintable(findLineEdit(wizard, "WithText")->text()), "some text");
std::unique_ptr<Wizard> wizard{factory->runWizard({}, Id(), QVariantMap())};
QVERIFY(wizard);
QVERIFY(findLineEdit(wizard.get(), "Default"));
QVERIFY(findLineEdit(wizard.get(), "Default")->text().isEmpty());
QCOMPARE(qPrintable(findLineEdit(wizard.get(), "WithText")->text()), "some text");
QVERIFY(!wizard->page(0)->isComplete());
findLineEdit(wizard, "Default")->setText("enable isComplete");
findLineEdit(wizard.get(), "Default")->setText("enable isComplete");
QVERIFY(wizard->page(0)->isComplete());
}
void ProjectExplorerTest::testJsonWizardsComboBox()
{
QString errorMessage;
QWidget parent;
const QJsonArray items({"abc", "cde", "fgh"});
QJsonObject disabledComboBoxObject = createWidget("ComboBox", "Disabled", QJsonObject({ {{"disabledIndex", 2}, {"items", items}} }));
@@ -215,9 +213,9 @@ void ProjectExplorerTest::testJsonWizardsComboBox()
const QJsonObject wizardObject = createGeneralWizard(pages);
const FactoryPtr factory(JsonWizardFactory::createWizardFactory(wizardObject.toVariantMap(), {}, &errorMessage));
QVERIFY2(factory, qPrintable(errorMessage));
Wizard *wizard = factory->runWizard({}, &parent, Id(), QVariantMap());
std::unique_ptr<Wizard> wizard{factory->runWizard({}, Id(), QVariantMap())};
QComboBox *defaultComboBox = findComboBox(wizard, "Default");
QComboBox *defaultComboBox = findComboBox(wizard.get(), "Default");
QVERIFY(defaultComboBox);
QCOMPARE(defaultComboBox->count(), items.count());
QCOMPARE(qPrintable(defaultComboBox->currentText()), "abc");
@@ -225,11 +223,11 @@ void ProjectExplorerTest::testJsonWizardsComboBox()
defaultComboBox->setCurrentIndex(2);
QCOMPARE(qPrintable(defaultComboBox->currentText()), "fgh");
QComboBox *index2ComboBox = findComboBox(wizard, "Index2");
QComboBox *index2ComboBox = findComboBox(wizard.get(), "Index2");
QVERIFY(index2ComboBox);
QCOMPARE(qPrintable(index2ComboBox->currentText()), "fgh");
QComboBox *disabledComboBox = findComboBox(wizard, "Disabled");
QComboBox *disabledComboBox = findComboBox(wizard.get(), "Disabled");
QVERIFY(disabledComboBox);
QCOMPARE(qPrintable(disabledComboBox->currentText()), "fgh");
}
@@ -242,7 +240,6 @@ static QString iconInsideResource(const QString &relativePathToIcon)
void ProjectExplorerTest::testJsonWizardsIconList()
{
QString errorMessage;
QWidget parent;
const QJsonArray items({
QJsonObject{
@@ -272,7 +269,7 @@ void ProjectExplorerTest::testJsonWizardsIconList()
const QJsonObject wizardObject = createGeneralWizard(pages);
const FactoryPtr factory(JsonWizardFactory::createWizardFactory(wizardObject.toVariantMap(), {}, &errorMessage));
QVERIFY2(factory, qPrintable(errorMessage));
Wizard *wizard = factory->runWizard({}, &parent, Id(), QVariantMap());
std::unique_ptr<Wizard> wizard{factory->runWizard({}, Id(), QVariantMap())};
auto view = wizard->findChild<QListView *>("FancyIconList");
QCOMPARE(view->model()->rowCount(), 2);

View File

@@ -653,11 +653,10 @@ static QString qmlProjectName(const FilePath &folder)
return {};
}
Wizard *JsonWizardFactory::runWizardImpl(const FilePath &path, QWidget *parent,
Id platform,
Wizard *JsonWizardFactory::runWizardImpl(const FilePath &path, Id platform,
const QVariantMap &variables, bool showWizard)
{
auto wizard = new JsonWizard(parent);
auto wizard = new JsonWizard;
wizard->setWindowIcon(icon());
wizard->setWindowTitle(displayName());

View File

@@ -62,7 +62,7 @@ public:
static void setInstalledWizardsPath(const Utils::FilePath &path);
private:
Utils::Wizard *runWizardImpl(const Utils::FilePath &path, QWidget *parent, Utils::Id platform,
Utils::Wizard *runWizardImpl(const Utils::FilePath &path, Utils::Id platform,
const QVariantMap &variables, bool showWizard = true) override;
// Create all wizards. As other plugins might register factories for derived

View File

@@ -3621,7 +3621,7 @@ void ProjectExplorerPluginPrivate::addNewHeaderOrSource()
IWizardFactory::allWizardFactories(),
[factoryId](const IWizardFactory *f) { return f->id() == factoryId; });
QTC_ASSERT(factory, return);
factory->runWizard(folderNode->directory(), ICore::dialogParent(), {}, map);
factory->runWizard(folderNode->directory(), {}, map);
}
void ProjectExplorerPluginPrivate::addNewSubproject()

View File

@@ -110,8 +110,8 @@ class SimpleProjectWizardDialog : public BaseFileWizard
Q_OBJECT
public:
SimpleProjectWizardDialog(const BaseFileWizardFactory *factory, QWidget *parent)
: BaseFileWizard(factory, QVariantMap(), parent)
explicit SimpleProjectWizardDialog(const BaseFileWizardFactory *factory)
: BaseFileWizard(factory, QVariantMap())
{
setWindowTitle(Tr::tr("Import Existing Project"));
@@ -162,10 +162,9 @@ SimpleProjectWizard::SimpleProjectWizard()
setFlags(IWizardFactory::PlatformIndependent);
}
BaseFileWizard *SimpleProjectWizard::create(QWidget *parent,
const WizardDialogParameters &parameters) const
BaseFileWizard *SimpleProjectWizard::create(const WizardDialogParameters &parameters) const
{
auto wizard = new SimpleProjectWizardDialog(this, parent);
auto wizard = new SimpleProjectWizardDialog(this);
wizard->setProjectDir(parameters.defaultPath());
for (QWizardPage *p : wizard->extensionPages())

View File

@@ -16,7 +16,7 @@ public:
SimpleProjectWizard();
private:
Core::BaseFileWizard *create(QWidget *parent, const Core::WizardDialogParameters &parameters) const override;
Core::BaseFileWizard *create(const Core::WizardDialogParameters &parameters) const override;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l,
QString *errorMessage) const override;

View File

@@ -29,10 +29,9 @@ CustomWidgetWizard::CustomWidgetWizard()
setRequiredFeatures({QtSupport::Constants::FEATURE_QWIDGETS});
}
Core::BaseFileWizard *CustomWidgetWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
Core::BaseFileWizard *CustomWidgetWizard::create(const Core::WizardDialogParameters &parameters) const
{
CustomWidgetWizardDialog *rc = new CustomWidgetWizardDialog(this, displayName(),
icon(), parent, parameters);
auto rc = new CustomWidgetWizardDialog(this, displayName(), icon(), parameters);
rc->setProjectName(CustomWidgetWizardDialog::uniqueProjectName(parameters.defaultPath()));
rc->setFileNamingParameters(FileNamingParameters(headerSuffix(), sourceSuffix(), QtWizard::lowerCaseFiles()));
return rc;

View File

@@ -16,8 +16,7 @@ public:
CustomWidgetWizard();
protected:
Core::BaseFileWizard *create(QWidget *parent,
const Core::WizardDialogParameters &parameters) const override;
Core::BaseFileWizard *create(const Core::WizardDialogParameters &parameters) const override;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
};

View File

@@ -19,9 +19,8 @@ enum { IntroPageId = 0};
CustomWidgetWizardDialog::CustomWidgetWizardDialog(const Core::BaseFileWizardFactory *factory,
const QString &templateName,
const QIcon &icon, QWidget *parent,
const Core::WizardDialogParameters &parameters) :
BaseQmakeProjectWizardDialog(factory, parent, parameters),
const QIcon &icon, const Core::WizardDialogParameters &parameters) :
BaseQmakeProjectWizardDialog(factory, parameters),
m_widgetsPage(new CustomWidgetWidgetsWizardPage),
m_pluginPage(new CustomWidgetPluginWizardPage)
{

View File

@@ -19,7 +19,6 @@ class CustomWidgetWizardDialog : public BaseQmakeProjectWizardDialog
public:
explicit CustomWidgetWizardDialog(const Core::BaseFileWizardFactory *factory,
const QString &templateName, const QIcon &icon,
QWidget *parent,
const Core::WizardDialogParameters &parameters);
std::shared_ptr<PluginOptions> pluginOptions() const;

View File

@@ -97,10 +97,9 @@ bool QtWizard::lowerCaseFiles()
// ------------ CustomQmakeProjectWizard
CustomQmakeProjectWizard::CustomQmakeProjectWizard() = default;
Core::BaseFileWizard *CustomQmakeProjectWizard::create(QWidget *parent,
const Core::WizardDialogParameters &parameters) const
Core::BaseFileWizard *CustomQmakeProjectWizard::create(const Core::WizardDialogParameters &parameters) const
{
auto *wizard = new BaseQmakeProjectWizardDialog(this, parent, parameters);
auto *wizard = new BaseQmakeProjectWizardDialog(this, parameters);
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
wizard->addTargetSetupPage(targetPageId);
@@ -118,9 +117,8 @@ bool CustomQmakeProjectWizard::postGenerateFiles(const QWizard *w, const Core::G
// ----------------- BaseQmakeProjectWizardDialog
BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(
const Core::BaseFileWizardFactory *factory,
QWidget *parent,
const Core::WizardDialogParameters &parameters)
: ProjectExplorer::BaseProjectWizardDialog(factory, parent, parameters)
: ProjectExplorer::BaseProjectWizardDialog(factory, parameters)
{
m_profileIds = Utils::transform(parameters.extraValues()
.value(ProjectExplorer::Constants::PROJECT_KIT_IDS)
@@ -135,9 +133,8 @@ BaseQmakeProjectWizardDialog::BaseQmakeProjectWizardDialog(
const Core::BaseFileWizardFactory *factory,
Utils::ProjectIntroPage *introPage,
int introId,
QWidget *parent,
const Core::WizardDialogParameters &parameters)
: ProjectExplorer::BaseProjectWizardDialog(factory, introPage, introId, parent, parameters)
: ProjectExplorer::BaseProjectWizardDialog(factory, introPage, introId, parameters)
{
m_profileIds = Utils::transform(parameters.extraValues()
.value(ProjectExplorer::Constants::PROJECT_KIT_IDS)

View File

@@ -60,8 +60,7 @@ public:
CustomQmakeProjectWizard();
private:
Core::BaseFileWizard *create(QWidget *parent,
const Core::WizardDialogParameters &parameters) const override;
Core::BaseFileWizard *create(const Core::WizardDialogParameters &parameters) const override;
bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l,
QString *errorMessage) const override;
@@ -81,11 +80,10 @@ class BaseQmakeProjectWizardDialog : public ProjectExplorer::BaseProjectWizardDi
protected:
explicit BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
Utils::ProjectIntroPage *introPage,
int introId, QWidget *parent,
int introId,
const Core::WizardDialogParameters &parameters);
public:
explicit BaseQmakeProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
QWidget *parent,
const Core::WizardDialogParameters &parameters);
~BaseQmakeProjectWizardDialog() override;

View File

@@ -33,11 +33,9 @@ SubdirsProjectWizard::SubdirsProjectWizard()
setRequiredFeatures({QtSupport::Constants::FEATURE_QT_PREFIX});
}
Core::BaseFileWizard *SubdirsProjectWizard::create(QWidget *parent,
const Core::WizardDialogParameters &parameters) const
Core::BaseFileWizard *SubdirsProjectWizard::create(const Core::WizardDialogParameters &parameters) const
{
SubdirsProjectWizardDialog *dialog = new SubdirsProjectWizardDialog(this, displayName(), icon(),
parent, parameters);
auto dialog = new SubdirsProjectWizardDialog(this, displayName(), icon(), parameters);
dialog->setProjectName(SubdirsProjectWizardDialog::uniqueProjectName(parameters.defaultPath()));
const QString buttonText = dialog->wizardStyle() == QWizard::MacStyle

View File

@@ -16,8 +16,7 @@ public:
SubdirsProjectWizard();
private:
Core::BaseFileWizard *create(QWidget *parent,
const Core::WizardDialogParameters &parameters) const override;
Core::BaseFileWizard *create(const Core::WizardDialogParameters &parameters) const override;
Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage) const override;
bool postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l,

View File

@@ -13,9 +13,8 @@ namespace Internal {
SubdirsProjectWizardDialog::SubdirsProjectWizardDialog(const Core::BaseFileWizardFactory *factory,
const QString &templateName,
const QIcon &icon, QWidget *parent,
const Core::WizardDialogParameters &parameters) :
BaseQmakeProjectWizardDialog(factory, parent, parameters)
const QIcon &icon, const Core::WizardDialogParameters &parameters) :
BaseQmakeProjectWizardDialog(factory, parameters)
{
setWindowIcon(icon);
setWindowTitle(templateName);

View File

@@ -14,9 +14,8 @@ class SubdirsProjectWizardDialog : public BaseQmakeProjectWizardDialog
{
Q_OBJECT
public:
explicit SubdirsProjectWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
SubdirsProjectWizardDialog(const Core::BaseFileWizardFactory *factory, const QString &templateName,
const QIcon &icon,
QWidget *parent,
const Core::WizardDialogParameters &parameters);
QtProjectParameters parameters() const;

View File

@@ -340,7 +340,7 @@ void QdsNewDialog::setWizardFactories(QList<Core::IWizardFactory *> factories_,
{
Utils::Id platform = Utils::Id::fromSetting("Desktop");
WizardFactories factories{factories_, m_dialog.get(), platform};
WizardFactories factories{factories_, platform};
std::vector<UserPresetData> recents = m_recentsStore.fetchAll();
std::vector<UserPresetData> userPresets = m_userPresetsStore.fetchAll();

View File

@@ -17,10 +17,8 @@ using namespace StudioWelcome;
WizardFactories::GetIconUnicodeFunc WizardFactories::m_getIconUnicode = &QmlDesigner::Theme::getIconUnicode;
WizardFactories::WizardFactories(const QList<Core::IWizardFactory *> &factories,
QWidget *wizardParent,
const Utils::Id &platform)
: m_wizardParent{wizardParent}
, m_platform{platform}
: m_platform{platform}
{
m_factories = Utils::filtered(Utils::transform(factories, [](Core::IWizardFactory *f) {
return qobject_cast<JsonWizardFactory *>(f);
@@ -56,8 +54,7 @@ void WizardFactories::filter()
m_factories = acceptedFactories;
}
std::shared_ptr<PresetItem> WizardFactories::makePresetItem(JsonWizardFactory *f, QWidget *parent,
const Utils::Id &platform)
std::shared_ptr<PresetItem> WizardFactories::makePresetItem(JsonWizardFactory *f, const Utils::Id &platform)
{
using namespace std::placeholders;
@@ -77,7 +74,7 @@ std::shared_ptr<PresetItem> WizardFactories::makePresetItem(JsonWizardFactory *f
result->qmlPath = f->detailsPageQmlPath();
result->fontIconCode = m_getIconUnicode(f->fontIconName());
result->create
= std::bind(&JsonWizardFactory::runWizard, f, _1, parent, platform, QVariantMap(), false);
= std::bind(&JsonWizardFactory::runWizard, f, _1, platform, QVariantMap(), false);
return result;
}
@@ -93,11 +90,11 @@ std::map<QString, WizardCategory> WizardFactories::makePresetItemsGroupedByCateg
/*.name =*/ f->displayCategory(),
/*.items = */
{
makePresetItem(f, m_wizardParent, m_platform),
makePresetItem(f, m_platform),
},
};
} else {
auto presetItem = makePresetItem(f, m_wizardParent, m_platform);
auto presetItem = makePresetItem(f, m_platform);
categories[f->category()].items.push_back(presetItem);
}
}

View File

@@ -25,8 +25,7 @@ public:
using GetIconUnicodeFunc = QString (*)(const QString &);
public:
WizardFactories(const QList<Core::IWizardFactory *> &factories, QWidget *wizardParent,
const Utils::Id &platform);
WizardFactories(const QList<Core::IWizardFactory *> &factories, const Utils::Id &platform);
const Core::IWizardFactory *front() const;
const std::map<QString, WizardCategory> &presetsGroupedByCategory() const
@@ -42,11 +41,10 @@ private:
void sortByCategoryAndId();
void filter();
std::shared_ptr<PresetItem> makePresetItem(JsonWizardFactory *f, QWidget *parent, const Utils::Id &platform);
std::shared_ptr<PresetItem> makePresetItem(JsonWizardFactory *f, const Utils::Id &platform);
std::map<QString, WizardCategory> makePresetItemsGroupedByCategory();
private:
QWidget *m_wizardParent;
Utils::Id m_platform; // filter wizards to only those supported by this platform.
QList<JsonWizardFactory *> m_factories;