* @brief Prompts the user to select a CSV file to play back. */
| 201 | * @brief Prompts the user to select a CSV file to play back. |
| 202 | */ |
| 203 | void 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. |
no test coverage detected