aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2018-02-06 13:29:41 +0100
committerAlessandro Portale <alessandro.portale@qt.io>2018-02-09 16:23:06 +0000
commit7bca91cd230c3da106ebe67305828b27dd5f035a (patch)
treeb336fd4b760d5385b9c4f8e5bf6ae168c4254588
parentd595896ea439fc77b4ca3bc7a92fd8a5debf8461 (diff)
NewDialog: Add setting to blacklist categories
Change-Id: I307ae05f08bf3bdbfc1b1a69bb10d8201ecf8436 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
-rw-r--r--src/plugins/coreplugin/dialogs/newdialog.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp
index 43c2b2efe6..0bc113a42f 100644
--- a/src/plugins/coreplugin/dialogs/newdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/newdialog.cpp
@@ -52,6 +52,10 @@ const char LAST_CATEGORY_KEY[] = "Core/NewDialog/LastCategory";
const char LAST_PLATFORM_KEY[] = "Core/NewDialog/LastPlatform";
const char ALLOW_ALL_TEMPLATES[] = "Core/NewDialog/AllowAllTemplates";
const char SHOW_PLATOFORM_FILTER[] = "Core/NewDialog/ShowPlatformFilter";
+const char BLACKLISTED_CATEGORIES_KEY[] = "Core/NewDialog/BlacklistedCategories";
+
+using namespace Core;
+using namespace Core::Internal;
class WizardFactoryContainer
{
@@ -73,7 +77,11 @@ class PlatformFilterProxyModel : public QSortFilterProxyModel
{
// Q_OBJECT
public:
- PlatformFilterProxyModel(QObject *parent = nullptr): QSortFilterProxyModel(parent) {}
+ PlatformFilterProxyModel(QObject *parent = nullptr): QSortFilterProxyModel(parent)
+ {
+ m_blacklistedCategories =
+ Id::fromStringList(ICore::settings()->value(BLACKLISTED_CATEGORIES_KEY).toStringList());
+ }
void setPlatform(Core::Id platform)
{
@@ -103,13 +111,18 @@ public:
QModelIndex sourceIndex = sourceModel()->index(sourceRow, 0, sourceParent);
Core::IWizardFactory *wizard =
factoryOfItem(qobject_cast<QStandardItemModel*>(sourceModel())->itemFromIndex(sourceIndex));
- if (wizard)
+
+ if (wizard) {
+ if (m_blacklistedCategories.contains(Core::Id::fromString(wizard->category())))
+ return false;
return wizard->isAvailable(m_platform);
+ }
return true;
}
private:
Core::Id m_platform;
+ QSet<Id> m_blacklistedCategories;
};
#define ROW_HEIGHT 24