WebAssembly: Improve browser selection combobox of run configuation

This adds a "Default Browser" entry to the browser selection combobox in
WebAssembly' run configuration. Choosing that omits the "--browser"
parameter and let's emrun determine which browser to launch (should by
the system default browser).

In order to implement that, the combobox items now got user data in
addition to have display data. The parsing of emrun's output was
extended to retrieve the long form of a browser name as display data:
"Mozilla Firefox 96.0.0.8041" instead of just "firefox".
The parsing of emrun's outout received a dedicated plugin test.

Turning the result in parseEmrunOutput() non-static fixed
QTCREATORBUG-26562

Fixes: QTCREATORBUG-25028
Fixes: QTCREATORBUG-26559
Change-Id: I18891b88b063903d1a9eeb88a6c906e596e561c1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Alessandro Portale
2022-01-12 22:55:10 +01:00
parent 4d9245b001
commit 0bbc465f61
4 changed files with 118 additions and 41 deletions

View File

@@ -66,14 +66,18 @@ static CommandLine emrunCommand(const RunConfiguration *rc, const QString &brows
const FilePath target = rc->buildTargetInfo().targetFilePath;
const FilePath html = target.absolutePath() / target.baseName() + ".html";
return CommandLine(pythonInterpreter(env), {
emrunPy.path(),
"--browser", browser,
"--port", port,
"--no_emrun_detect",
"--serve_after_close",
html.toString()
});
QStringList args(emrunPy.path());
if (!browser.isEmpty()) {
args.append("--browser");
args.append(browser);
}
args.append("--port");
args.append(port);
args.append("--no_emrun_detect");
args.append("--serve_after_close");
args.append(html.toString());
return CommandLine(pythonInterpreter(env), args);
}
return {};
}
@@ -99,6 +103,7 @@ public:
"<port>").toUserOutput());
});
connect(webBrowserAspect, &BaseAspect::changed, this, &RunConfiguration::update);
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
}
};
@@ -114,8 +119,10 @@ public:
setStarter([this, runControl, portsGatherer] {
Runnable r;
const QString browserId =
runControl->aspect<WebBrowserSelectionAspect>()->currentBrowser();
r.command = emrunCommand(runControl->runConfiguration(),
runControl->aspect<WebBrowserSelectionAspect>()->currentBrowser(),
browserId,
QString::number(portsGatherer->findEndPoint().port()));
SimpleTargetRunner::doStart(r, {});
});