diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2018-02-01 15:13:26 +0100 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2018-02-05 09:06:01 +0000 |
commit | ffb2503a5983f15f86bc065ecadaa9a628aee255 (patch) | |
tree | 830abe0faaff9df0c54581832e6f7f7a5bff68b6 | |
parent | 169e963019214c01b575c26cba0153b829bd856e (diff) |
Add new settings to control new file dialog
* Hide the platform filter combobox
* Disable the "All Templates" filter
Change-Id: I2af1ccba254ff70f28a60d0a1d49590e87791294
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
-rw-r--r-- | src/plugins/coreplugin/dialogs/newdialog.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp index db1a1fb97c..04958c423c 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.cpp +++ b/src/plugins/coreplugin/dialogs/newdialog.cpp @@ -50,6 +50,8 @@ namespace { const int ICON_SIZE = 48; 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"; class WizardFactoryContainer { @@ -269,7 +271,10 @@ void NewDialog::setWizardFactories(QList<IWizardFactory *> factories, m_dummyIcon = QIcon(":/utils/images/wizardicon-file.png"); QSet<Id> availablePlatforms = IWizardFactory::allAvailablePlatforms(); - m_ui->comboBox->addItem(tr("All Templates"), Id().toSetting()); + + const bool allowAllTemplates = ICore::settings()->value(ALLOW_ALL_TEMPLATES, true).toBool(); + if (allowAllTemplates) + m_ui->comboBox->addItem(tr("All Templates"), Id().toSetting()); foreach (Id platform, availablePlatforms) { const QString displayNameForPlatform = IWizardFactory::displayNameForPlatform(platform); @@ -279,6 +284,10 @@ void NewDialog::setWizardFactories(QList<IWizardFactory *> factories, m_ui->comboBox->setCurrentIndex(0); // "All templates" m_ui->comboBox->setEnabled(!availablePlatforms.isEmpty()); + const bool showPlatformFilter = ICore::settings()->value(SHOW_PLATOFORM_FILTER, true).toBool(); + if (!showPlatformFilter) + m_ui->comboBox->hide(); + foreach (IWizardFactory *factory, factories) { QStandardItem *kindItem; switch (factory->kind()) { |