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

Method openFile

app/src/CSV/Player.cpp:203–221  ·  view source on GitHub ↗

* @brief Prompts the user to select a CSV file to play back. */

Source from the content-addressed store, hash-verified

201 * @brief Prompts the user to select a CSV file to play back.
202 */
203void CSV::Player::openFile()
204{
205 auto* dialog = new QFileDialog(qApp->activeWindow(),
206 tr("Select CSV file"),
207 Misc::WorkspaceManager::instance().path("CSV"),
208 tr("CSV files (*.csv)"));
209
210 dialog->setFileMode(QFileDialog::ExistingFile);
211 dialog->setAttribute(Qt::WA_DeleteOnClose);
212
213 connect(dialog, &QFileDialog::fileSelected, this, [this](const QString& path) {
214 if (path.isEmpty())
215 return;
216
217 QMetaObject::invokeMethod(this, [this, path]() { openFile(path); }, Qt::QueuedConnection);
218 });
219
220 dialog->open();
221}
222
223/**
224 * @brief Closes the current CSV file and resets playback state.

Callers 2

openMethod · 0.45
openMethod · 0.45

Calls 9

isEmptyMethod · 0.80
disconnectDeviceMethod · 0.80
activeWindowMethod · 0.45
pathMethod · 0.45
openMethod · 0.45
isConnectedMethod · 0.45
setFileNameMethod · 0.45
isValidMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected