diff options
| author | 2017-06-02 22:24:29 -0400 | |
|---|---|---|
| committer | 2017-06-02 22:24:29 -0400 | |
| commit | 81449f025a190cd9f931d73cf959ddbfebff497a (patch) | |
| tree | 24a15888dd6ebc515a09eaf00623fa23e2d4665d /src/citra_qt/main.cpp | |
| parent | Merge pull request #2722 from wwylele/cam-ipc-helper (diff) | |
| parent | Addressed Bunnei's review comments, and made some other tweaks: (diff) | |
| download | yuzu-81449f025a190cd9f931d73cf959ddbfebff497a.tar.gz yuzu-81449f025a190cd9f931d73cf959ddbfebff497a.tar.xz yuzu-81449f025a190cd9f931d73cf959ddbfebff497a.zip | |
Merge pull request #2611 from TheKoopaKingdom/missing-file-dialogs
Display QMessageBox Dialogs For Errors
Diffstat (limited to 'src/citra_qt/main.cpp')
| -rw-r--r-- | src/citra_qt/main.cpp | 123 |
1 files changed, 106 insertions, 17 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index eb2c7d613..4f5b2ddab 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -93,6 +93,14 @@ void GMainWindow::InitializeWidgets() { | |||
| 93 | ui.horizontalLayout->addWidget(game_list); | 93 | ui.horizontalLayout->addWidget(game_list); |
| 94 | 94 | ||
| 95 | // Create status bar | 95 | // Create status bar |
| 96 | message_label = new QLabel(); | ||
| 97 | // Configured separately for left alignment | ||
| 98 | message_label->setVisible(false); | ||
| 99 | message_label->setFrameStyle(QFrame::NoFrame); | ||
| 100 | message_label->setContentsMargins(4, 0, 4, 0); | ||
| 101 | message_label->setAlignment(Qt::AlignLeft); | ||
| 102 | statusBar()->addPermanentWidget(message_label, 1); | ||
| 103 | |||
| 96 | emu_speed_label = new QLabel(); | 104 | emu_speed_label = new QLabel(); |
| 97 | emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% " | 105 | emu_speed_label->setToolTip(tr("Current emulation speed. Values higher or lower than 100% " |
| 98 | "indicate emulation is running faster or slower than a 3DS.")); | 106 | "indicate emulation is running faster or slower than a 3DS.")); |
| @@ -108,7 +116,7 @@ void GMainWindow::InitializeWidgets() { | |||
| 108 | label->setVisible(false); | 116 | label->setVisible(false); |
| 109 | label->setFrameStyle(QFrame::NoFrame); | 117 | label->setFrameStyle(QFrame::NoFrame); |
| 110 | label->setContentsMargins(4, 0, 4, 0); | 118 | label->setContentsMargins(4, 0, 4, 0); |
| 111 | statusBar()->addPermanentWidget(label); | 119 | statusBar()->addPermanentWidget(label, 0); |
| 112 | } | 120 | } |
| 113 | statusBar()->setVisible(true); | 121 | statusBar()->setVisible(true); |
| 114 | setStyleSheet("QStatusBar::item{border: none;}"); | 122 | setStyleSheet("QStatusBar::item{border: none;}"); |
| @@ -300,9 +308,8 @@ bool GMainWindow::LoadROM(const QString& filename) { | |||
| 300 | render_window->MakeCurrent(); | 308 | render_window->MakeCurrent(); |
| 301 | 309 | ||
| 302 | if (!gladLoadGL()) { | 310 | if (!gladLoadGL()) { |
| 303 | QMessageBox::critical(this, tr("Error while starting Citra!"), | 311 | QMessageBox::critical(this, tr("Error while initializing OpenGL 3.3 Core!"), |
| 304 | tr("Failed to initialize the video core!\n\n" | 312 | tr("Your GPU may not support OpenGL 3.3, or you do not" |
| 305 | "Please ensure that your GPU supports OpenGL 3.3 and that you " | ||
| 306 | "have the latest graphics driver.")); | 313 | "have the latest graphics driver.")); |
| 307 | return false; | 314 | return false; |
| 308 | } | 315 | } |
| @@ -327,18 +334,17 @@ bool GMainWindow::LoadROM(const QString& filename) { | |||
| 327 | break; | 334 | break; |
| 328 | 335 | ||
| 329 | case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: { | 336 | case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: { |
| 330 | // Build the MessageBox ourselves to have clickable link | 337 | QMessageBox::critical( |
| 331 | QMessageBox popup_error; | 338 | this, tr("Error while loading ROM!"), |
| 332 | popup_error.setTextFormat(Qt::RichText); | ||
| 333 | popup_error.setWindowTitle(tr("Error while loading ROM!")); | ||
| 334 | popup_error.setText( | ||
| 335 | tr("The game that you are trying to load must be decrypted before being used with " | 339 | tr("The game that you are trying to load must be decrypted before being used with " |
| 336 | "Citra.<br/><br/>" | 340 | "Citra. A real 3DS is required.<br/><br/>" |
| 337 | "For more information on dumping and decrypting games, please see: <a " | 341 | "For more information on dumping and decrypting games, please see the following " |
| 338 | "href='https://citra-emu.org/wiki/Dumping-Game-Cartridges'>https://" | 342 | "wiki pages: <ul>" |
| 339 | "citra-emu.org/wiki/Dumping-Game-Cartridges</a>")); | 343 | "<li><a href='https://citra-emu.org/wiki/dumping-game-cartridges/'>Dumping Game " |
| 340 | popup_error.setIcon(QMessageBox::Critical); | 344 | "Cartridges</a></li>" |
| 341 | popup_error.exec(); | 345 | "<li><a href='https://citra-emu.org/wiki/dumping-installed-titles/'>Dumping " |
| 346 | "Installed Titles</a></li>" | ||
| 347 | "</ul>")); | ||
| 342 | break; | 348 | break; |
| 343 | } | 349 | } |
| 344 | case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat: | 350 | case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat: |
| @@ -346,8 +352,23 @@ bool GMainWindow::LoadROM(const QString& filename) { | |||
| 346 | tr("The ROM format is not supported.")); | 352 | tr("The ROM format is not supported.")); |
| 347 | break; | 353 | break; |
| 348 | 354 | ||
| 355 | case Core::System::ResultStatus::ErrorVideoCore: | ||
| 356 | QMessageBox::critical( | ||
| 357 | this, tr("An error occured in the video core."), | ||
| 358 | tr("Citra has encountered an error while running the video core, please see the " | ||
| 359 | "log for more details." | ||
| 360 | "For more information on accessing the log, please see the following page: " | ||
| 361 | "<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How " | ||
| 362 | "to " | ||
| 363 | "Upload the Log File</a>." | ||
| 364 | "Ensure that you have the latest graphics drivers for your GPU.")); | ||
| 365 | |||
| 366 | break; | ||
| 367 | |||
| 349 | default: | 368 | default: |
| 350 | QMessageBox::critical(this, tr("Error while loading ROM!"), tr("Unknown error!")); | 369 | QMessageBox::critical( |
| 370 | this, tr("Error while loading ROM!"), | ||
| 371 | tr("An unknown error occured. Please see the log for more details.")); | ||
| 351 | break; | 372 | break; |
| 352 | } | 373 | } |
| 353 | return false; | 374 | return false; |
| @@ -424,6 +445,7 @@ void GMainWindow::ShutdownGame() { | |||
| 424 | 445 | ||
| 425 | // Disable status bar updates | 446 | // Disable status bar updates |
| 426 | status_bar_update_timer.stop(); | 447 | status_bar_update_timer.stop(); |
| 448 | message_label->setVisible(false); | ||
| 427 | emu_speed_label->setVisible(false); | 449 | emu_speed_label->setVisible(false); |
| 428 | game_fps_label->setVisible(false); | 450 | game_fps_label->setVisible(false); |
| 429 | emu_frametime_label->setVisible(false); | 451 | emu_frametime_label->setVisible(false); |
| @@ -530,6 +552,10 @@ void GMainWindow::OnMenuRecentFile() { | |||
| 530 | 552 | ||
| 531 | void GMainWindow::OnStartGame() { | 553 | void GMainWindow::OnStartGame() { |
| 532 | emu_thread->SetRunning(true); | 554 | emu_thread->SetRunning(true); |
| 555 | qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus"); | ||
| 556 | qRegisterMetaType<std::string>("std::string"); | ||
| 557 | connect(emu_thread.get(), SIGNAL(ErrorThrown(Core::System::ResultStatus, std::string)), this, | ||
| 558 | SLOT(OnCoreError(Core::System::ResultStatus, std::string))); | ||
| 533 | 559 | ||
| 534 | ui.action_Start->setEnabled(false); | 560 | ui.action_Start->setEnabled(false); |
| 535 | ui.action_Start->setText(tr("Continue")); | 561 | ui.action_Start->setText(tr("Continue")); |
| @@ -622,11 +648,74 @@ void GMainWindow::UpdateStatusBar() { | |||
| 622 | emu_frametime_label->setVisible(true); | 648 | emu_frametime_label->setVisible(true); |
| 623 | } | 649 | } |
| 624 | 650 | ||
| 651 | void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) { | ||
| 652 | QMessageBox::StandardButton answer; | ||
| 653 | QString status_message; | ||
| 654 | const QString common_message = | ||
| 655 | tr("The game you are trying to load requires additional files from your 3DS to be dumped " | ||
| 656 | "before playing.<br/><br/>For more information on dumping these files, please see the " | ||
| 657 | "following wiki page: <a " | ||
| 658 | "href='https://citra-emu.org/wiki/" | ||
| 659 | "dumping-system-archives-and-the-shared-fonts-from-a-3ds-console/'>Dumping System " | ||
| 660 | "Archives and the Shared Fonts from a 3DS Console</a>.<br/><br/>Would you like to quit " | ||
| 661 | "back to the game list? Continuing emulation may result in crashes, corrupted save " | ||
| 662 | "data, or other bugs."); | ||
| 663 | switch (result) { | ||
| 664 | case Core::System::ResultStatus::ErrorSystemFiles: { | ||
| 665 | QString message = "Citra was unable to locate a 3DS system archive"; | ||
| 666 | if (!details.empty()) { | ||
| 667 | message.append(tr(": %1. ").arg(details.c_str())); | ||
| 668 | } else { | ||
| 669 | message.append(". "); | ||
| 670 | } | ||
| 671 | message.append(common_message); | ||
| 672 | |||
| 673 | answer = QMessageBox::question(this, tr("System Archive Not Found"), message, | ||
| 674 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); | ||
| 675 | status_message = "System Archive Missing"; | ||
| 676 | break; | ||
| 677 | } | ||
| 678 | |||
| 679 | case Core::System::ResultStatus::ErrorSharedFont: { | ||
| 680 | QString message = tr("Citra was unable to locate the 3DS shared fonts. "); | ||
| 681 | message.append(common_message); | ||
| 682 | answer = QMessageBox::question(this, tr("Shared Fonts Not Found"), message, | ||
| 683 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); | ||
| 684 | status_message = "Shared Font Missing"; | ||
| 685 | break; | ||
| 686 | } | ||
| 687 | |||
| 688 | default: | ||
| 689 | answer = QMessageBox::question( | ||
| 690 | this, tr("Fatal Error"), | ||
| 691 | tr("Citra has encountered a fatal error, please see the log for more details. " | ||
| 692 | "For more information on accessing the log, please see the following page: " | ||
| 693 | "<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How to " | ||
| 694 | "Upload the Log File</a>.<br/><br/>Would you like to quit back to the game list? " | ||
| 695 | "Continuing emulation may result in crashes, corrupted save data, or other bugs."), | ||
| 696 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); | ||
| 697 | status_message = "Fatal Error encountered"; | ||
| 698 | break; | ||
| 699 | } | ||
| 700 | |||
| 701 | if (answer == QMessageBox::Yes) { | ||
| 702 | if (emu_thread) { | ||
| 703 | ShutdownGame(); | ||
| 704 | } | ||
| 705 | } else { | ||
| 706 | // Only show the message if the game is still running. | ||
| 707 | if (emu_thread) { | ||
| 708 | message_label->setText(status_message); | ||
| 709 | message_label->setVisible(true); | ||
| 710 | } | ||
| 711 | } | ||
| 712 | } | ||
| 713 | |||
| 625 | bool GMainWindow::ConfirmClose() { | 714 | bool GMainWindow::ConfirmClose() { |
| 626 | if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) | 715 | if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) |
| 627 | return true; | 716 | return true; |
| 628 | 717 | ||
| 629 | auto answer = | 718 | QMessageBox::StandardButton answer = |
| 630 | QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"), | 719 | QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"), |
| 631 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); | 720 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
| 632 | return answer != QMessageBox::No; | 721 | return answer != QMessageBox::No; |