Debugger: enable dependency action only if we can find depends

Change-Id: I1f8c8d4108a1e3c6a03b93c9cf280c005806fc44
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
David Schulz
2023-03-23 11:43:23 +01:00
parent cd3c7e368d
commit 75bdaf25d0

View File

@@ -140,6 +140,12 @@ public:
DebuggerEngine *engine;
};
static bool dependsCanBeFound()
{
static bool dependsInPath = Environment::systemEnvironment().searchInPath("depends").isEmpty();
return dependsInPath;
}
bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev)
{
ModuleItem *item = itemForIndexAtLevel<1>(ev.sourceModelIndex());
@@ -163,11 +169,13 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev)
moduleNameValid && enabled && canReload,
[this, modulePath] { engine->loadSymbols(modulePath); });
// FIXME: Dependencies only available on Windows, when "depends" is installed.
addAction(this, menu, Tr::tr("Show Dependencies of \"%1\"").arg(moduleName),
Tr::tr("Show Dependencies"),
moduleNameValid && !moduleName.isEmpty() && HostOsInfo::isWindowsHost(),
[modulePath] { QtcProcess::startDetached({{"depends"}, {modulePath.toString()}}); });
moduleNameValid && !modulePath.needsDevice() && modulePath.exists()
&& dependsCanBeFound(),
[modulePath] {
QtcProcess::startDetached({{"depends"}, {modulePath.toString()}});
});
addAction(this, menu, Tr::tr("Load Symbols for All Modules"),
enabled && canLoadSymbols,