Terminal: Lazily open remote terminals

Move the burden of finding the shell of a device from the shell menu
to the TerminalWidget, so that opening the shell menu does not block
the ui.

Change-Id: I7f2e5a891f20faa53a1e3eec879866219f9bee0b
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-08-10 06:44:27 +02:00
parent d611fe6821
commit 92355bf40d
7 changed files with 60 additions and 38 deletions

View File

@@ -17,6 +17,9 @@ FilePath defaultShellForDevice(const FilePath &deviceRoot)
return deviceRoot.withNewPath("cmd.exe").searchInPath();
const Environment env = deviceRoot.deviceEnvironment();
if (!env.hasChanges())
return {};
FilePath shell = FilePath::fromUserInput(env.value_or("SHELL", "/bin/sh"));
if (!shell.isAbsolutePath())
@@ -32,7 +35,6 @@ class HooksPrivate
{
public:
HooksPrivate()
: m_getTerminalCommandsForDevicesHook([] { return QList<NameAndCommandLine>{}; })
{
auto openTerminal = [](const OpenTerminalParameters &parameters) {
DeviceFileHooks::instance().openTerminal(parameters.workingDirectory.value_or(
@@ -79,8 +81,6 @@ public:
return m_openTerminal;
}
Hooks::GetTerminalCommandsForDevicesHook m_getTerminalCommandsForDevicesHook;
private:
Hooks::OpenTerminal m_openTerminal;
Hooks::CreateTerminalProcessInterface m_createTerminalProcessInterface;
@@ -111,11 +111,6 @@ ProcessInterface *Hooks::createTerminalProcessInterface() const
return d->createTerminalProcessInterface()();
}
Hooks::GetTerminalCommandsForDevicesHook &Hooks::getTerminalCommandsForDevicesHook()
{
return d->m_getTerminalCommandsForDevicesHook;
}
void Hooks::addCallbackSet(const QString &name, const CallbackSet &callbackSet)
{
d->addCallbackSet(name, callbackSet);