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

Method openJsonFile

app/src/DataModel/ProjectModel.cpp:2334–2352  ·  view source on GitHub ↗

* @brief Shows a file-open dialog and loads the selected project; the selection * handler defers via a queued invoke so the macOS NSSavePanel KVO callback can * unwind before re-entering the model. */

Source from the content-addressed store, hash-verified

2332 * unwind before re-entering the model.
2333 */
2334void DataModel::ProjectModel::openJsonFile()
2335{
2336 auto* dialog = new QFileDialog(qApp->activeWindow(),
2337 tr("Select Project File"),
2338 jsonProjectsPath(),
2339 tr("Project Files (*.json *.ssproj)"));
2340
2341 dialog->setFileMode(QFileDialog::ExistingFile);
2342 dialog->setAttribute(Qt::WA_DeleteOnClose);
2343
2344 connect(dialog, &QFileDialog::fileSelected, this, [this](const QString& path) {
2345 if (path.isEmpty())
2346 return;
2347
2348 QMetaObject::invokeMethod(this, [this, path]() { openJsonFile(path); }, Qt::QueuedConnection);
2349 });
2350
2351 dialog->open();
2352}
2353
2354/**
2355 * @brief Loads a project from the given .ssproj/.json path.

Callers 8

restoreLastProjectMethod · 0.80
endSessionMethod · 0.80
fileOpenMethod · 0.80
eventFilterMethod · 0.80
startDemoMethod · 0.80

Calls 7

isEmptyMethod · 0.80
remapLegacyPathMethod · 0.80
emptyMethod · 0.80
activeWindowMethod · 0.45
openMethod · 0.45
setOperationModeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected