void SettingsPage::addCustomFilter() { ILocatorFilter *filter = new DirectoryFilter; bool needsRefresh = false; if (filter->openConfigDialog(m_page, needsRefresh)) { m_filters.append(filter); m_addedFilters.append(filter); m_customFilters.append(filter); m_refreshFilters.append(filter); updateFilterList(); } }
void LocatorSettingsPage::addCustomFilter() { ILocatorFilter *filter = new DirectoryFilter( Id(Constants::CUSTOM_FILTER_BASEID).withSuffix(m_customFilters.size() + 1)); bool needsRefresh = false; if (filter->openConfigDialog(m_widget, needsRefresh)) { m_filters.append(filter); m_addedFilters.append(filter); m_customFilters.append(filter); m_refreshFilters.append(filter); m_customFilterRoot->appendChild(new FilterItem(filter)); } }
void SettingsPage::configureFilter(QListWidgetItem *item) { if (!item) item = m_ui.filterList->currentItem(); QTC_ASSERT(item, return); ILocatorFilter *filter = item->data(Qt::UserRole).value<ILocatorFilter *>(); QTC_ASSERT(filter, return); if (!filter->isConfigurable()) return; bool needsRefresh = false; filter->openConfigDialog(m_page, needsRefresh); if (needsRefresh && !m_refreshFilters.contains(filter)) m_refreshFilters.append(filter); updateFilterList(); }
void LocatorSettingsPage::configureFilter(const QModelIndex &proxyIndex) { const QModelIndex index = m_proxyModel->mapToSource(proxyIndex); QTC_ASSERT(index.isValid(), return); auto item = dynamic_cast<FilterItem *>(m_model->itemForIndex(index)); QTC_ASSERT(item, return); ILocatorFilter *filter = item->filter(); QTC_ASSERT(filter->isConfigurable(), return); bool includedByDefault = filter->isIncludedByDefault(); QString shortcutString = filter->shortcutString(); bool needsRefresh = false; filter->openConfigDialog(m_widget, needsRefresh); if (needsRefresh && !m_refreshFilters.contains(filter)) m_refreshFilters.append(filter); if (filter->isIncludedByDefault() != includedByDefault) item->updateColumn(FilterIncludedByDefault); if (filter->shortcutString() != shortcutString) item->updateColumn(FilterPrefix); }