| 331 | } |
| 332 | |
| 333 | void LaunchController::readyForLaunch() |
| 334 | { |
| 335 | if (!m_profiler) |
| 336 | { |
| 337 | m_launcher->proceed(); |
| 338 | return; |
| 339 | } |
| 340 | |
| 341 | QString error; |
| 342 | if (!m_profiler->check(&error)) |
| 343 | { |
| 344 | m_launcher->abort(); |
| 345 | QMessageBox::critical(m_parentWidget, tr("Error!"), tr("Couldn't start profiler: %1").arg(error)); |
| 346 | emitFailed("Profiler startup failed!"); |
| 347 | return; |
| 348 | } |
| 349 | BaseProfiler *profilerInstance = m_profiler->createProfiler(m_launcher->instance(), this); |
| 350 | |
| 351 | connect(profilerInstance, &BaseProfiler::readyToLaunch, [this](const QString & message) |
| 352 | { |
| 353 | QMessageBox msg; |
| 354 | msg.setText(tr("The game launch is delayed until you press the " |
| 355 | "button. This is the right time to setup the profiler, as the " |
| 356 | "profiler server is running now.\n\n%1").arg(message)); |
| 357 | msg.setWindowTitle(tr("Waiting.")); |
| 358 | msg.setIcon(QMessageBox::Information); |
| 359 | msg.addButton(tr("Launch"), QMessageBox::AcceptRole); |
| 360 | msg.setModal(true); |
| 361 | msg.exec(); |
| 362 | m_launcher->proceed(); |
| 363 | }); |
| 364 | connect(profilerInstance, &BaseProfiler::abortLaunch, [this](const QString & message) |
| 365 | { |
| 366 | QMessageBox msg; |
| 367 | msg.setText(tr("Couldn't start the profiler: %1").arg(message)); |
| 368 | msg.setWindowTitle(tr("Error")); |
| 369 | msg.setIcon(QMessageBox::Critical); |
| 370 | msg.addButton(QMessageBox::Ok); |
| 371 | msg.setModal(true); |
| 372 | msg.exec(); |
| 373 | m_launcher->abort(); |
| 374 | emitFailed("Profiler startup failed!"); |
| 375 | }); |
| 376 | profilerInstance->beginProfiling(m_launcher); |
| 377 | } |
| 378 | |
| 379 | void LaunchController::onSucceeded() |
| 380 | { |
nothing calls this directly
no test coverage detected