aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/coreplugin/locator/ilocatorfilter.cpp13
-rw-r--r--src/plugins/coreplugin/locator/ilocatorfilter.h3
-rw-r--r--src/plugins/coreplugin/locator/locator.cpp6
-rw-r--r--src/plugins/coreplugin/locator/locator.h1
-rw-r--r--src/plugins/coreplugin/locator/locatorwidget.cpp30
-rw-r--r--src/plugins/coreplugin/locator/locatorwidget.h3
-rw-r--r--src/plugins/debugger/debuggeritemmanager.cpp90
-rw-r--r--src/plugins/projectexplorer/allprojectsfilter.cpp19
-rw-r--r--src/plugins/projectexplorer/currentprojectfilter.cpp11
9 files changed, 99 insertions, 77 deletions
diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.cpp b/src/plugins/coreplugin/locator/ilocatorfilter.cpp
index 5c52e5d90f0..dad818137c6 100644
--- a/src/plugins/coreplugin/locator/ilocatorfilter.cpp
+++ b/src/plugins/coreplugin/locator/ilocatorfilter.cpp
@@ -3,6 +3,8 @@
#include "ilocatorfilter.h"
+#include "locator.h"
+
#include "../coreplugintr.h"
#include <QtTaskTree/QSingleTaskTreeRunner>
@@ -452,6 +454,9 @@ ILocatorFilter::ILocatorFilter(QObject *parent)
: QObject(parent)
{
g_locatorFilters.append(this);
+ Internal::locatorSettings().ignoreGeneratedFiles.addOnChanged(this, [this] {
+ emit ignoreGeneratedFilesChanged();
+ });
}
ILocatorFilter::~ILocatorFilter()
@@ -684,6 +689,14 @@ QString ILocatorFilter::msgIncludeByDefaultToolTip()
}
/*!
+ Returns if the user requests to ignore generated files in project related searches.
+*/
+bool ILocatorFilter::ignoreGeneratedFiles()
+{
+ return Internal::locatorSettings().ignoreGeneratedFiles();
+}
+
+/*!
Returns whether a configuration dialog is available for this filter.
The default is \c true.
diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.h b/src/plugins/coreplugin/locator/ilocatorfilter.h
index 8098ebbb5f2..fb04834cb8d 100644
--- a/src/plugins/coreplugin/locator/ilocatorfilter.h
+++ b/src/plugins/coreplugin/locator/ilocatorfilter.h
@@ -247,11 +247,14 @@ public:
static QString msgIncludeByDefault();
static QString msgIncludeByDefaultToolTip();
+ static bool ignoreGeneratedFiles();
+
public slots:
void setEnabled(bool enabled);
signals:
void enabledChanged(bool enabled);
+ void ignoreGeneratedFilesChanged();
protected:
void setHidden(bool hidden);
diff --git a/src/plugins/coreplugin/locator/locator.cpp b/src/plugins/coreplugin/locator/locator.cpp
index 0e530b47960..359273708da 100644
--- a/src/plugins/coreplugin/locator/locator.cpp
+++ b/src/plugins/coreplugin/locator/locator.cpp
@@ -67,6 +67,12 @@ LocatorSettings::LocatorSettings()
relativePaths.setToolTip(
Tr::tr("Locator filters show relative paths to the active project when possible."));
+ ignoreGeneratedFiles.setSettingsKey("IgnoreGeneratedFiles");
+ ignoreGeneratedFiles.setDefaultValue(true);
+ ignoreGeneratedFiles.setLabelText(Tr::tr("Ignore Generated Files"));
+ ignoreGeneratedFiles.setToolTip(
+ Tr::tr("Ignore generated files when using project related filters."));
+
refreshInterval.setSettingsKey("RefreshInterval");
refreshInterval.setRange(0, 320);
refreshInterval.setSingleStep(5);
diff --git a/src/plugins/coreplugin/locator/locator.h b/src/plugins/coreplugin/locator/locator.h
index 1bc36eab95c..c91bbae6366 100644
--- a/src/plugins/coreplugin/locator/locator.h
+++ b/src/plugins/coreplugin/locator/locator.h
@@ -27,6 +27,7 @@ struct LocatorSettings : public Utils::AspectContainer
Utils::BoolAspect useCenteredPopup{this};
Utils::BoolAspect useTabCompletion{this};
Utils::BoolAspect relativePaths{this};
+ Utils::BoolAspect ignoreGeneratedFiles{this};
Utils::IntegerAspect refreshInterval{this}; // minutes
};
diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp
index cb238bb60c2..1692d0c2058 100644
--- a/src/plugins/coreplugin/locator/locatorwidget.cpp
+++ b/src/plugins/coreplugin/locator/locatorwidget.cpp
@@ -576,8 +576,9 @@ bool CompletionList::eventFilter(QObject *watched, QEvent *event)
LocatorWidget::LocatorWidget(Locator *locator)
: m_locatorModel(new LocatorModel(this))
, m_filterMenu(new QMenu(this))
- , m_centeredPopupAction(new QAction(locatorSettings().useCenteredPopup.labelText(), this))
+ , m_useCenteredPopup(new QAction(locatorSettings().useCenteredPopup.labelText(), this))
, m_useTabCompletion(new QAction(locatorSettings().useTabCompletion.labelText(), this))
+ , m_ignoreGeneratedFiles(new QAction(locatorSettings().ignoreGeneratedFiles.labelText(), this))
, m_refreshAction(new QAction(Tr::tr("Refresh"), this))
, m_configureAction(new QAction(ICore::msgShowOptionsDialog(), this))
, m_fileLineEdit(new FancyLineEdit)
@@ -609,19 +610,21 @@ LocatorWidget::LocatorWidget(Locator *locator)
m_fileLineEdit->installEventFilter(this);
this->installEventFilter(this);
- m_centeredPopupAction->setCheckable(true);
- m_centeredPopupAction->setChecked(locatorSettings().useCenteredPopup());
+ m_useCenteredPopup->setCheckable(true);
m_useTabCompletion->setCheckable(true);
- m_useTabCompletion->setChecked(locatorSettings().useTabCompletion());
+ m_ignoreGeneratedFiles->setCheckable(true);
- connect(m_filterMenu, &QMenu::aboutToShow, this, [this] {
- m_centeredPopupAction->setChecked(locatorSettings().useCenteredPopup());
+ const auto updateActions = [this] {
+ m_useCenteredPopup->setChecked(locatorSettings().useCenteredPopup());
m_useTabCompletion->setChecked(locatorSettings().useTabCompletion());
- });
+ m_ignoreGeneratedFiles->setChecked(locatorSettings().ignoreGeneratedFiles());
+ };
+ updateActions();
+ connect(m_filterMenu, &QMenu::aboutToShow, this, updateActions);
Utils::addToolTipsToMenu(m_filterMenu);
- connect(m_centeredPopupAction, &QAction::toggled, locator, [locator](bool toggled) {
+ connect(m_useCenteredPopup, &QAction::toggled, locator, [locator](bool toggled) {
if (toggled != locatorSettings().useCenteredPopup()) {
locatorSettings().useCenteredPopup.setValue(toggled);
QMetaObject::invokeMethod(locator, [] { LocatorManager::show({}); });
@@ -630,11 +633,9 @@ LocatorWidget::LocatorWidget(Locator *locator)
connect(m_useTabCompletion, &QAction::toggled, locator, [](bool checked) {
locatorSettings().useTabCompletion.setValue(checked);
});
-
- m_filterMenu->addAction(m_centeredPopupAction);
- m_filterMenu->addAction(m_useTabCompletion);
- m_filterMenu->addAction(m_refreshAction);
- m_filterMenu->addAction(m_configureAction);
+ connect(m_ignoreGeneratedFiles, &QAction::toggled, locator, [](bool checked) {
+ locatorSettings().ignoreGeneratedFiles.setValue(checked);
+ });
m_fileLineEdit->setButtonMenu(FancyLineEdit::Left, m_filterMenu);
@@ -700,8 +701,9 @@ void LocatorWidget::updateFilterList()
});
}
m_filterMenu->addSeparator();
- m_filterMenu->addAction(m_centeredPopupAction);
+ m_filterMenu->addAction(m_useCenteredPopup);
m_filterMenu->addAction(m_useTabCompletion);
+ m_filterMenu->addAction(m_ignoreGeneratedFiles);
m_filterMenu->addAction(m_refreshAction);
m_filterMenu->addAction(m_configureAction);
}
diff --git a/src/plugins/coreplugin/locator/locatorwidget.h b/src/plugins/coreplugin/locator/locatorwidget.h
index 2e59d1e22ae..8e37d8eb5b3 100644
--- a/src/plugins/coreplugin/locator/locatorwidget.h
+++ b/src/plugins/coreplugin/locator/locatorwidget.h
@@ -76,8 +76,9 @@ private:
LocatorModel *m_locatorModel = nullptr;
QMenu *m_filterMenu = nullptr;
- QAction *m_centeredPopupAction = nullptr;
+ QAction *m_useCenteredPopup = nullptr;
QAction *m_useTabCompletion = nullptr;
+ QAction *m_ignoreGeneratedFiles = nullptr;
QAction *m_refreshAction = nullptr;
QAction *m_configureAction = nullptr;
Utils::FancyLineEdit *m_fileLineEdit = nullptr;
diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp
index 67009dd517f..d4312e47b6f 100644
--- a/src/plugins/debugger/debuggeritemmanager.cpp
+++ b/src/plugins/debugger/debuggeritemmanager.cpp
@@ -211,13 +211,14 @@ public:
QVariant registerDebugger(const DebuggerItem &item);
void readDebuggers(const FilePath &fileName, bool isSdk);
void autoDetectCdbDebuggers();
- void autoDetectGdbOrLldbDebuggers(const FilePaths &searchPaths, const QString &detectionSource);
+ void autoDetectGdbOrLldbDebuggers(const FilePaths &searchPaths,
+ const QString &detectionSource,
+ QString *logMessage = nullptr);
void autoDetectUvscDebuggers();
QString uniqueDisplayName(const QString &base);
PersistentSettingsWriter m_writer{userSettingsFileName(), "QtCreatorDebuggers"};
QPersistentModelIndex m_currentIndex;
- QSingleTaskTreeRunner m_detectGdbLldbRunner;
};
static DebuggerItemModel &itemModel()
@@ -635,12 +636,9 @@ static Utils::FilePaths searchGdbPathsFromRegistry()
return searchPaths;
}
-static QList<DebuggerItem> autoDetectGdbOrLldbDebuggersImpl(
- const FilePaths &searchPaths,
- const QString &detectionSourceId,
- const QList<DebuggerItem> &existingDebuggers)
+void DebuggerItemModel::autoDetectGdbOrLldbDebuggers(
+ const FilePaths &searchPaths, const QString &detectionSourceId, QString *logMessage)
{
- QList<DebuggerItem> result;
const DetectionSource detectionSource{DetectionSource::FromSystem, detectionSourceId};
QStringList filters
@@ -667,7 +665,7 @@ static QList<DebuggerItem> autoDetectGdbOrLldbDebuggersImpl(
}
if (searchPaths.isEmpty())
- return result;
+ return;
FilePaths suspects;
@@ -698,23 +696,15 @@ static QList<DebuggerItem> autoDetectGdbOrLldbDebuggersImpl(
for (const FilePath &path : paths)
suspects.append(path.dirEntries({filters, QDir::Files | QDir::Executable}));
- auto findItem = [&](auto predicate) -> DebuggerItem {
- return Utils::findOrDefault(existingDebuggers + result, predicate);
- };
-
+ QStringList logMessages{Tr::tr("Searching debuggers...")};
for (const FilePath &command : std::as_const(suspects)) {
- const auto commandMatches = [command](const DebuggerItem item) {
- return item.command() == command;
+ const auto commandMatches = [command](const DebuggerTreeItem *titem) {
+ return titem->m_item.command() == command;
};
- DebuggerItem existingItem = findItem(commandMatches);
- if (existingItem.isValid()) {
- if (command.lastModified() != existingItem.lastModified()) {
- DebuggerItem updatedItem = existingItem;
- updatedItem.reinitializeFromFile();
- if (updatedItem != existingItem)
- result.append(updatedItem);
- existingItem = updatedItem;
- }
+ if (DebuggerTreeItem *existingTreeItem = findItemAtLevel<2>(commandMatches)) {
+ DebuggerItem &existingItem = existingTreeItem->m_item;
+ if (command.lastModified() != existingItem.lastModified())
+ existingItem.reinitializeFromFile();
if (doEnableNativeDapDebuggers()) {
if (existingItem.engineType() != GdbEngineType)
@@ -727,14 +717,16 @@ static QList<DebuggerItem> autoDetectGdbOrLldbDebuggersImpl(
continue;
// This is the "update" path: there's already a capable GDB in the settings,
// we only need to add a corresponding DAP entry if it's missing.
- const auto commandMatchesAndIsDap = [commandMatches](const DebuggerItem item) {
- return commandMatches(item) && item.engineType() == GdbDapEngineType;
+ const auto commandMatchesAndIsDap = [command, commandMatches](
+ const DebuggerTreeItem *titem) {
+ return commandMatches(titem) && titem->m_item.engineType() == GdbDapEngineType;
};
- DebuggerItem dapItem = findItem(commandMatchesAndIsDap);
- if (dapItem.isValid())
+ const DebuggerTreeItem *existingDapTreeItem = findItemAtLevel<2>(
+ commandMatchesAndIsDap);
+ if (existingDapTreeItem)
continue;
- dapItem = makeAutoDetectedDebuggerItem(
+ const DebuggerItem dapItem = makeAutoDetectedDebuggerItem(
command,
{
.engineType = GdbDapEngineType,
@@ -742,17 +734,23 @@ static QList<DebuggerItem> autoDetectGdbOrLldbDebuggersImpl(
.version = existingItem.version(),
},
detectionSource);
- result.append(dapItem);
+ addDebuggerItem(dapItem);
+ logMessages.append(
+ Tr::tr("Added a surrogate GDB DAP item for existing entry \"%1\".")
+ .arg(command.toUserOutput()));
}
continue;
}
const Result<DebuggerItem> item
= makeAutoDetectedDebuggerItem(command, detectionSource);
- if (!item)
+ if (!item) {
+ logMessages.append(item.error());
continue;
+ }
- result.append(*item);
+ addDebuggerItem(*item);
+ logMessages.append(Tr::tr("Found: \"%1\".").arg(command.toUserOutput()));
if (doEnableNativeDapDebuggers()) {
if (item->engineType() != GdbEngineType)
continue;
@@ -771,33 +769,13 @@ static QList<DebuggerItem> autoDetectGdbOrLldbDebuggersImpl(
.version = item->version(),
},
detectionSource);
- result.append(dapItem);
+ addDebuggerItem(dapItem);
+ logMessages.append(
+ Tr::tr("Added a surrogate GDB DAP item for \"%1\".").arg(command.toUserOutput()));
}
}
-
- return result;
-}
-
-void DebuggerItemModel::autoDetectGdbOrLldbDebuggers(
- const FilePaths &searchPaths, const QString &detectionSourceId)
-{
- auto setupSearch = [searchPaths, detectionSourceId](Async<QList<DebuggerItem>> &async) {
- async.setConcurrentCallData(
- &autoDetectGdbOrLldbDebuggersImpl,
- searchPaths,
- detectionSourceId,
- DebuggerItemManager::debuggers());
- };
-
- auto searchDone = [this](const Async<QList<DebuggerItem>> &async) {
- const QList<DebuggerItem> items = async.result();
- for (const DebuggerItem &item : items) {
- if (item.isValid() && item.engineType() != NoEngineType)
- registerDebugger(item);
- }
- };
-
- m_detectGdbLldbRunner.start({AsyncTask<QList<DebuggerItem>>(setupSearch, searchDone)});
+ if (logMessage)
+ *logMessage = logMessages.join('\n');
}
void DebuggerItemModel::autoDetectUvscDebuggers()
diff --git a/src/plugins/projectexplorer/allprojectsfilter.cpp b/src/plugins/projectexplorer/allprojectsfilter.cpp
index c46358ea770..f595b618240 100644
--- a/src/plugins/projectexplorer/allprojectsfilter.cpp
+++ b/src/plugins/projectexplorer/allprojectsfilter.cpp
@@ -26,15 +26,26 @@ AllProjectsFilter::AllProjectsFilter()
"\"+<number>\" or \":<number>\" to jump to the column number as well."));
setDefaultShortcutString("a");
setDefaultIncludedByDefault(true);
- setRefreshRecipe(QSyncTask([this] { m_cache.invalidate(); }));
- connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::fileListChanged,
- this, [this] { m_cache.invalidate(); });
+ const auto invalidateCache = [this] { m_cache.invalidate(); };
+
+ setRefreshRecipe(QSyncTask(invalidateCache));
+
+ connect(
+ ProjectExplorerPlugin::instance(),
+ &ProjectExplorerPlugin::fileListChanged,
+ this,
+ invalidateCache);
+ connect(this, &ILocatorFilter::ignoreGeneratedFilesChanged, this, invalidateCache);
+
m_cache.setGeneratorProvider([] {
// This body runs in main thread
+ const Project::NodeMatcher matcher = ILocatorFilter::ignoreGeneratedFiles()
+ ? Project::SourceFiles
+ : Project::AllFiles;
FilePaths filePaths;
for (Project *project : ProjectManager::projects())
- filePaths.append(project->files(Project::SourceFiles));
+ filePaths.append(project->files(matcher));
return [filePaths](const QFuture<void> &future) {
// This body runs in non-main thread
FilePaths sortedPaths = filePaths;
diff --git a/src/plugins/projectexplorer/currentprojectfilter.cpp b/src/plugins/projectexplorer/currentprojectfilter.cpp
index 36732acfdce..557a60856fa 100644
--- a/src/plugins/projectexplorer/currentprojectfilter.cpp
+++ b/src/plugins/projectexplorer/currentprojectfilter.cpp
@@ -20,13 +20,20 @@ CurrentProjectFilter::CurrentProjectFilter()
"or \":<number>\" to jump to the given line number. Append another "
"\"+<number>\" or \":<number>\" to jump to the column number as well."));
setDefaultShortcutString("p");
- setRefreshRecipe(QSyncTask([this] { invalidate(); }));
+
+ const auto invalidateCache = [this] { invalidate(); };
+
+ setRefreshRecipe(QSyncTask(invalidateCache));
connect(ProjectTree::instance(), &ProjectTree::currentProjectChanged,
this, &CurrentProjectFilter::currentProjectChanged);
+ connect(this, &ILocatorFilter::ignoreGeneratedFilesChanged, this, invalidateCache);
m_cache.setGeneratorProvider([this] {
- const FilePaths paths = m_project ? m_project->files(Project::SourceFiles) : FilePaths();
+ const Project::NodeMatcher matcher = ILocatorFilter::ignoreGeneratedFiles()
+ ? Project::SourceFiles
+ : Project::AllFiles;
+ const FilePaths paths = m_project ? m_project->files(matcher) : FilePaths();
return LocatorFileCache::filePathsGenerator(paths);
});
}