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

Method browseWorkingDir

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

* @brief Opens a folder dialog to select the working directory for Launch mode. */

Source from the content-addressed store, hash-verified

384 * @brief Opens a folder dialog to select the working directory for Launch mode.
385 */
386void IO::Drivers::Process::browseWorkingDir()
387{
388 const auto start = m_workingDir.isEmpty()
389 ? QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
390 : m_workingDir;
391
392 auto* dialog = new QFileDialog(qApp->activeWindow(), tr("Select Working Directory"), start);
393
394 dialog->setFileMode(QFileDialog::Directory);
395 dialog->setOption(QFileDialog::ShowDirsOnly, true);
396 dialog->setAttribute(Qt::WA_DeleteOnClose);
397
398 connect(dialog, &QFileDialog::fileSelected, this, [this](const QString& path) {
399 if (path.isEmpty())
400 return;
401
402 QMetaObject::invokeMethod(this, [this, path]() { setWorkingDir(path); }, Qt::QueuedConnection);
403 });
404
405 dialog->open();
406}
407
408/**
409 * @brief Opens a file dialog to select the named pipe / FIFO path.

Callers

nothing calls this directly

Calls 3

isEmptyMethod · 0.80
activeWindowMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected