Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #8875 from JosJuice/nkit-warning
DolphinQt: Show a warning when launching an NKit disc image
- Loading branch information
Showing
14 changed files
with
160 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| // Copyright 2020 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #include "DolphinQt/NKitWarningDialog.h" | ||
|
|
||
| #include <QApplication> | ||
| #include <QCheckBox> | ||
| #include <QHBoxLayout> | ||
| #include <QIcon> | ||
| #include <QLabel> | ||
| #include <QPushButton> | ||
| #include <QStyle> | ||
| #include <QVBoxLayout> | ||
|
|
||
| #include "Common/Config/Config.h" | ||
| #include "Core/Config/MainSettings.h" | ||
| #include "DolphinQt/Resources.h" | ||
|
|
||
| bool NKitWarningDialog::ShowUnlessDisabled(QWidget* parent) | ||
| { | ||
| if (Config::Get(Config::MAIN_SKIP_NKIT_WARNING)) | ||
| return true; | ||
| else | ||
| return NKitWarningDialog(parent).exec() == QDialog::Accepted; | ||
| } | ||
|
|
||
| NKitWarningDialog::NKitWarningDialog(QWidget* parent) : QDialog(parent) | ||
| { | ||
| setWindowTitle(tr("NKit Warning")); | ||
| setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); | ||
| setWindowIcon(Resources::GetAppIcon()); | ||
|
|
||
| QVBoxLayout* main_layout = new QVBoxLayout; | ||
|
|
||
| QLabel* warning = new QLabel( | ||
| tr("You are about to run an NKit disc image. NKit disc images cause problems that don't " | ||
| "happen with normal disc images. These problems include:\n" | ||
| "\n" | ||
| "• The emulated loading times are longer\n" | ||
| "• You can't use NetPlay with people who have normal disc images\n" | ||
| "• Input recordings are not compatible between NKit disc images and normal disc images\n" | ||
| "• Savestates are not compatible between NKit disc images and normal disc images\n" | ||
| "• Some games crash, such as Super Paper Mario\n" | ||
| "• Wii games don't work at all in older versions of Dolphin and in many other programs\n" | ||
| "\n" | ||
| "Are you sure you want to continue anyway?\n")); | ||
| warning->setWordWrap(true); | ||
| main_layout->addWidget(warning); | ||
|
|
||
| QCheckBox* checkbox_accept = new QCheckBox(tr("I am aware of the risks and want to continue")); | ||
| main_layout->addWidget(checkbox_accept); | ||
|
|
||
| QCheckBox* checkbox_skip = new QCheckBox(tr("Don't show this again")); | ||
| main_layout->addWidget(checkbox_skip); | ||
|
|
||
| QHBoxLayout* button_layout = new QHBoxLayout; | ||
| QPushButton* ok = new QPushButton(tr("OK")); | ||
| button_layout->addWidget(ok); | ||
| QPushButton* cancel = new QPushButton(tr("Cancel")); | ||
| button_layout->addWidget(cancel); | ||
| main_layout->addLayout(button_layout); | ||
|
|
||
| QHBoxLayout* top_layout = new QHBoxLayout; | ||
|
|
||
| QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning); | ||
| QLabel* icon_label = new QLabel; | ||
| icon_label->setPixmap(icon.pixmap(100)); | ||
| icon_label->setAlignment(Qt::AlignTop); | ||
| top_layout->addWidget(icon_label); | ||
| top_layout->addSpacing(10); | ||
|
|
||
| top_layout->addLayout(main_layout); | ||
|
|
||
| setLayout(top_layout); | ||
|
|
||
| connect(ok, &QPushButton::clicked, this, &QDialog::accept); | ||
| connect(cancel, &QPushButton::clicked, this, &QDialog::reject); | ||
|
|
||
| ok->setEnabled(false); | ||
| connect(checkbox_accept, &QCheckBox::stateChanged, | ||
| [&ok](int state) { ok->setEnabled(state == Qt::Checked); }); | ||
|
|
||
| connect(this, &QDialog::accepted, [checkbox_skip] { | ||
| Config::SetBase(Config::MAIN_SKIP_NKIT_WARNING, checkbox_skip->isChecked()); | ||
| }); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Copyright 2020 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <QDialog> | ||
| #include <QWidget> | ||
|
|
||
| class NKitWarningDialog final : public QDialog | ||
| { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| static bool ShowUnlessDisabled(QWidget* parent = nullptr); | ||
|
|
||
| private: | ||
| explicit NKitWarningDialog(QWidget* parent = nullptr); | ||
| }; |