MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / browseExecutable

Method browseExecutable

app/src/IO/Drivers/Process.cpp:362–381  ·  view source on GitHub ↗

* @brief Opens a file dialog to select the executable for Launch mode. */

Source from the content-addressed store, hash-verified

360 * @brief Opens a file dialog to select the executable for Launch mode.
361 */
362void IO::Drivers::Process::browseExecutable()
363{
364 const auto start = m_executable.isEmpty()
365 ? QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
366 : QFileInfo(m_executable).absolutePath();
367
368 auto* dialog = new QFileDialog(qApp->activeWindow(), tr("Select Executable"), start);
369
370 dialog->setFileMode(QFileDialog::ExistingFile);
371 dialog->setAttribute(Qt::WA_DeleteOnClose);
372
373 connect(dialog, &QFileDialog::fileSelected, this, [this](const QString& path) {
374 if (path.isEmpty())
375 return;
376
377 QMetaObject::invokeMethod(this, [this, path]() { setExecutable(path); }, Qt::QueuedConnection);
378 });
379
380 dialog->open();
381}
382
383/**
384 * @brief Opens a folder dialog to select the working directory for Launch mode.

Callers

nothing calls this directly

Calls 3

isEmptyMethod · 0.80
activeWindowMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected