forked from qt-creator/qt-creator
StudioWelcome: Ensure only wizards with the QtSudio feature are shown
This is is easiest way to hide all unrelated wizards and we do not have to maintain any list. Change-Id: Id3f3b710b670cbe4e670d9dd86526daecab3fa9b Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -30,11 +30,6 @@
|
||||
#include "wizardfactories.h"
|
||||
#include <qmldesigner/components/componentcore/theme.h>
|
||||
|
||||
namespace {
|
||||
// TODO: should be extern, check coreplugin/dialogs/newdialogwidget.cpp
|
||||
const char BLACKLISTED_CATEGORIES_KEY[] = "Core/NewDialog/BlacklistedCategories";
|
||||
}
|
||||
|
||||
using namespace StudioWelcome;
|
||||
|
||||
WizardFactories::WizardFactories(QList<Core::IWizardFactory *> &factories, QWidget *wizardParent, const Utils::Id &platform)
|
||||
@@ -42,9 +37,6 @@ WizardFactories::WizardFactories(QList<Core::IWizardFactory *> &factories, QWidg
|
||||
, m_platform{platform}
|
||||
, m_factories{factories}
|
||||
{
|
||||
QVariant value = Core::ICore::settings()->value(BLACKLISTED_CATEGORIES_KEY);
|
||||
m_blacklist = Utils::Id::fromStringList(value.toStringList());
|
||||
|
||||
sortByCategoryAndId();
|
||||
filter();
|
||||
m_projectItems = makeProjectItemsGroupedByCategory();
|
||||
@@ -66,10 +58,10 @@ void WizardFactories::filter()
|
||||
// TODO: perhaps I could use Utils::filtered here.
|
||||
std::copy_if(std::begin(m_factories), std::end(m_factories), std::back_inserter(acceptedFactories),
|
||||
[&](auto *wizard) {
|
||||
return wizard->isAvailable(m_platform)
|
||||
&& wizard->kind() == Core::IWizardFactory::ProjectWizard
|
||||
&& !m_blacklist.contains(Utils::Id::fromString(wizard->category()));
|
||||
});
|
||||
return wizard->isAvailable(m_platform)
|
||||
&& wizard->kind() == Core::IWizardFactory::ProjectWizard
|
||||
&& wizard->requiredFeatures().contains("QtStudio");
|
||||
});
|
||||
|
||||
m_factories = acceptedFactories;
|
||||
}
|
||||
|
@@ -55,7 +55,6 @@ private:
|
||||
std::map<QString, ProjectCategory> makeProjectItemsGroupedByCategory();
|
||||
|
||||
private:
|
||||
QSet<Utils::Id> m_blacklist;
|
||||
QWidget *m_wizardParent;
|
||||
Utils::Id m_platform;
|
||||
|
||||
|
Reference in New Issue
Block a user