DeviceSupport: Add more error output

Previously most errors when opening shells were completely
opaque to the user. This patch adds error output either via
QMessageBox if there is another modal dialog, or as flashing
disrupting messages.

Change-Id: I54be7a90295b61c23c739294c2d1d37c288ad273
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-10-06 08:51:17 +02:00
parent 113efbfc85
commit 1fabd72514
17 changed files with 185 additions and 104 deletions

View File

@@ -6,27 +6,28 @@
#include "externalterminalprocessimpl.h"
#include "filepath.h"
#include "process.h"
#include "utilstr.h"
#include <QMutex>
namespace Utils::Terminal {
FilePath defaultShellForDevice(const FilePath &deviceRoot)
expected_str<FilePath> defaultShellForDevice(const FilePath &deviceRoot)
{
if (deviceRoot.osType() == OsTypeWindows)
return deviceRoot.withNewPath("cmd.exe").searchInPath();
const Environment env = deviceRoot.deviceEnvironment();
if (!env.hasChanges())
return {};
const expected_str<Environment> env = deviceRoot.deviceEnvironmentWithError();
if (!env)
return make_unexpected(env.error());
FilePath shell = FilePath::fromUserInput(env.value_or("SHELL", "/bin/sh"));
FilePath shell = FilePath::fromUserInput(env->value_or("SHELL", "/bin/sh"));
if (!shell.isAbsolutePath())
shell = env.searchInPath(shell.nativePath());
shell = env->searchInPath(shell.nativePath());
if (shell.isEmpty())
return shell;
return make_unexpected(Tr::tr("Could not find any shell"));
return deviceRoot.withNewMappedPath(shell);
}