Copilot: Update authenticator widget while changing settings

Use a separate client for the authenticator widget that can react on
changes in the settings widget. This removes the need to manually apply
the settings between setting up the nodejs and agent.js paths and
signing into github.

Change-Id: I6628a3a8906ccbba208f9dac968262df962f93c0
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
David Schulz
2023-03-09 12:26:42 +01:00
parent 27881325a0
commit e25b89ae39
3 changed files with 57 additions and 64 deletions

View File

@@ -54,6 +54,24 @@ file from the Copilot neovim plugin.
st
}.attachTo(this);
// clang-format on
auto updateAuthWidget = [authWidget]() {
authWidget->updateClient(
FilePath::fromUserInput(
CopilotSettings::instance().nodeJsPath.volatileValue().toString()),
FilePath::fromUserInput(
CopilotSettings::instance().distPath.volatileValue().toString()));
};
connect(CopilotSettings::instance().nodeJsPath.pathChooser(),
&PathChooser::textChanged,
authWidget,
updateAuthWidget);
connect(CopilotSettings::instance().distPath.pathChooser(),
&PathChooser::textChanged,
authWidget,
updateAuthWidget);
updateAuthWidget();
}
};