* @brief Prompts the user to pick a .db file from the SQLite workspace folder. */
| 256 | * @brief Prompts the user to pick a .db file from the SQLite workspace folder. |
| 257 | */ |
| 258 | void Sessions::Player::openFile() |
| 259 | { |
| 260 | auto* dialog = new QFileDialog(qApp->activeWindow(), |
| 261 | tr("Open Session File"), |
| 262 | Misc::WorkspaceManager::instance().path("Session Databases"), |
| 263 | tr("Session files (*.db)")); |
| 264 | |
| 265 | dialog->setFileMode(QFileDialog::ExistingFile); |
| 266 | dialog->setAttribute(Qt::WA_DeleteOnClose); |
| 267 | |
| 268 | connect(dialog, &QFileDialog::fileSelected, this, [this](const QString& path) { |
| 269 | if (path.isEmpty()) |
| 270 | return; |
| 271 | |
| 272 | QMetaObject::invokeMethod(this, [this, path]() { openFile(path); }, Qt::QueuedConnection); |
| 273 | }); |
| 274 | |
| 275 | dialog->open(); |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * @brief Closes the active database, cancels any pending load, restores prior state. |
no test coverage detected