forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -50,6 +50,8 @@ namespace {
|
|||||||
const int ICON_SIZE = 48;
|
const int ICON_SIZE = 48;
|
||||||
const char LAST_CATEGORY_KEY[] = "Core/NewDialog/LastCategory";
|
const char LAST_CATEGORY_KEY[] = "Core/NewDialog/LastCategory";
|
||||||
const char LAST_PLATFORM_KEY[] = "Core/NewDialog/LastPlatform";
|
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
|
class WizardFactoryContainer
|
||||||
{
|
{
|
||||||
@@ -269,7 +271,10 @@ void NewDialog::setWizardFactories(QList<IWizardFactory *> factories,
|
|||||||
m_dummyIcon = QIcon(":/utils/images/wizardicon-file.png");
|
m_dummyIcon = QIcon(":/utils/images/wizardicon-file.png");
|
||||||
|
|
||||||
QSet<Id> availablePlatforms = IWizardFactory::allAvailablePlatforms();
|
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) {
|
foreach (Id platform, availablePlatforms) {
|
||||||
const QString displayNameForPlatform = IWizardFactory::displayNameForPlatform(platform);
|
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->setCurrentIndex(0); // "All templates"
|
||||||
m_ui->comboBox->setEnabled(!availablePlatforms.isEmpty());
|
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) {
|
foreach (IWizardFactory *factory, factories) {
|
||||||
QStandardItem *kindItem;
|
QStandardItem *kindItem;
|
||||||
switch (factory->kind()) {
|
switch (factory->kind()) {
|
||||||
|
Reference in New Issue
Block a user