diff options
| author | Mat M <mathew1800@gmail.com> | 2019-03-04 17:40:27 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-04 17:40:27 -0500 |
| commit | 147f7ca3213aef22dfe45bfab86e2d221aa248bf (patch) | |
| tree | b32f19c11585ea4e1b205eb2e959e695636e5a19 /Source/Core/DolphinQt/Config | |
| parent | a59010fa29ab10ca031bea87fc5df165e70e2dff (diff) | |
| parent | 70da86f1c3c933ce28d122f95f34ff6c24f89d80 (diff) | |
Merge pull request #7849 from spycrab/qt_modal_again
Qt: Make every messagebox modal
Diffstat (limited to 'Source/Core/DolphinQt/Config')
| -rw-r--r-- | Source/Core/DolphinQt/Config/CheatCodeEditor.cpp | 29 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Config/ControllersWindow.cpp | 19 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Config/FilesystemWidget.cpp | 25 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Config/GameConfigEdit.cpp | 6 | ||||
| -rw-r--r--[-rwxr-xr-x] | Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp | 13 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp | 10 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp | 10 | ||||
| -rw-r--r-- | Source/Core/DolphinQt/Config/NewPatchDialog.cpp | 6 |
9 files changed, 59 insertions, 64 deletions
diff --git a/Source/Core/DolphinQt/Config/CheatCodeEditor.cpp b/Source/Core/DolphinQt/Config/CheatCodeEditor.cpp index a72e4781be..1292e0272d 100644 --- a/Source/Core/DolphinQt/Config/CheatCodeEditor.cpp +++ b/Source/Core/DolphinQt/Config/CheatCodeEditor.cpp @@ -9,7 +9,6 @@ #include <QGridLayout> #include <QLabel> #include <QLineEdit> -#include <QMessageBox> #include <QStringList> #include <QTextEdit> @@ -17,6 +16,8 @@ #include "Core/ActionReplay.h" #include "Core/GeckoCodeConfig.h" +#include "DolphinQt/QtUtils/ModalMessageBox.h" + CheatCodeEditor::CheatCodeEditor(QWidget* parent) : QDialog(parent) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -167,7 +168,7 @@ bool CheatCodeEditor::AcceptAR() if (!good) { - auto result = QMessageBox::warning( + auto result = ModalMessageBox::warning( this, tr("Parsing Error"), tr("Unable to parse line %1 of the entered AR code as a valid " "encrypted or decrypted code. Make sure you typed it correctly.\n\n" @@ -184,7 +185,7 @@ bool CheatCodeEditor::AcceptAR() { if (!entries.empty()) { - auto result = QMessageBox::warning( + auto result = ModalMessageBox::warning( this, tr("Invalid Mixed Code"), tr("This Action Replay code contains both encrypted and unencrypted lines; " "you should check that you have entered it correctly.\n\n" @@ -213,8 +214,8 @@ bool CheatCodeEditor::AcceptAR() if (entries.empty()) { - QMessageBox::critical(this, tr("Error"), - tr("The resulting decrypted AR code doesn't contain any lines.")); + ModalMessageBox::critical(this, tr("Error"), + tr("The resulting decrypted AR code doesn't contain any lines.")); return false; } @@ -253,13 +254,13 @@ bool CheatCodeEditor::AcceptGecko() if (!good) { - auto result = - QMessageBox::warning(this, tr("Parsing Error"), - tr("Unable to parse line %1 of the entered Gecko code as a valid " - "code. Make sure you typed it correctly.\n\n" - "Would you like to ignore this line and continue parsing?") - .arg(i + 1), - QMessageBox::Ok | QMessageBox::Abort); + auto result = ModalMessageBox::warning( + this, tr("Parsing Error"), + tr("Unable to parse line %1 of the entered Gecko code as a valid " + "code. Make sure you typed it correctly.\n\n" + "Would you like to ignore this line and continue parsing?") + .arg(i + 1), + QMessageBox::Ok | QMessageBox::Abort); if (result == QMessageBox::Abort) return false; @@ -277,8 +278,8 @@ bool CheatCodeEditor::AcceptGecko() if (entries.empty()) { - QMessageBox::critical(this, tr("Error"), - tr("The resulting decrypted AR code doesn't contain any lines.")); + ModalMessageBox::critical(this, tr("Error"), + tr("The resulting decrypted AR code doesn't contain any lines.")); return false; } diff --git a/Source/Core/DolphinQt/Config/ControllersWindow.cpp b/Source/Core/DolphinQt/Config/ControllersWindow.cpp index fbedd80b03..75d99495a8 100644 --- a/Source/Core/DolphinQt/Config/ControllersWindow.cpp +++ b/Source/Core/DolphinQt/Config/ControllersWindow.cpp @@ -14,7 +14,6 @@ #include <QGroupBox> #include <QLabel> #include <QLineEdit> -#include <QMessageBox> #include <QPushButton> #include <QRadioButton> #include <QScreen> @@ -34,6 +33,7 @@ #include "DolphinQt/Config/Mapping/GCPadWiiUConfigDialog.h" #include "DolphinQt/Config/Mapping/MappingWindow.h" +#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/WrapInScrollArea.h" #include "DolphinQt/Settings.h" @@ -328,12 +328,9 @@ void ControllersWindow::OnBluetoothPassthroughResetPressed() if (!ios) { - QMessageBox error(this); - error.setIcon(QMessageBox::Warning); - error.setWindowModality(Qt::WindowModal); - error.setWindowTitle(tr("Warning")); - error.setText(tr("Saved Wii Remote pairings can only be reset when a Wii game is running.")); - error.exec(); + ModalMessageBox::warning( + this, tr("Warning"), + tr("Saved Wii Remote pairings can only be reset when a Wii game is running.")); return; } @@ -350,12 +347,8 @@ void ControllersWindow::OnBluetoothPassthroughSyncPressed() if (!ios) { - QMessageBox error(this); - error.setIcon(QMessageBox::Warning); - error.setWindowModality(Qt::WindowModal); - error.setWindowTitle(tr("Warning")); - error.setText(tr("A sync can only be triggered when a Wii game is running.")); - error.exec(); + ModalMessageBox::warning(this, tr("Warning"), + tr("A sync can only be triggered when a Wii game is running.")); return; } diff --git a/Source/Core/DolphinQt/Config/FilesystemWidget.cpp b/Source/Core/DolphinQt/Config/FilesystemWidget.cpp index 8f274c3bf9..3ff72d8e06 100644 --- a/Source/Core/DolphinQt/Config/FilesystemWidget.cpp +++ b/Source/Core/DolphinQt/Config/FilesystemWidget.cpp @@ -10,7 +10,6 @@ #include <QFileInfo> #include <QHeaderView> #include <QMenu> -#include <QMessageBox> #include <QProgressDialog> #include <QStandardItemModel> #include <QStyleFactory> @@ -23,6 +22,7 @@ #include "DiscIO/Filesystem.h" #include "DiscIO/Volume.h" +#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/Resources.h" #include "UICommon/UICommon.h" @@ -199,9 +199,10 @@ void FilesystemWidget::ShowContextMenu(const QPoint&) return; if (ExtractSystemData(partition, folder)) - QMessageBox::information(this, tr("Success"), tr("Successfully extracted system data.")); + ModalMessageBox::information(this, tr("Success"), + tr("Successfully extracted system data.")); else - QMessageBox::critical(this, tr("Error"), tr("Failed to extract system data.")); + ModalMessageBox::critical(this, tr("Error"), tr("Failed to extract system data.")); }); } @@ -323,9 +324,9 @@ void FilesystemWidget::ExtractFile(const DiscIO::Partition& partition, const QSt *m_volume, partition, filesystem->FindFileInfo(path.toStdString()).get(), out.toStdString()); if (success) - QMessageBox::information(this, tr("Success"), tr("Successfully extracted file.")); + ModalMessageBox::information(this, tr("Success"), tr("Successfully extracted file.")); else - QMessageBox::critical(this, tr("Error"), tr("Failed to extract file.")); + ModalMessageBox::critical(this, tr("Error"), tr("Failed to extract file.")); } void FilesystemWidget::CheckIntegrity(const DiscIO::Partition& partition) @@ -348,10 +349,14 @@ void FilesystemWidget::CheckIntegrity(const DiscIO::Partition& partition) dialog->close(); if (is_valid.get()) - QMessageBox::information(this, tr("Success"), - tr("Integrity check completed. No errors have been found.")); + { + ModalMessageBox::information(this, tr("Success"), + tr("Integrity check completed. No errors have been found.")); + } else - QMessageBox::critical(this, tr("Error"), - tr("Integrity check for partition failed. The disc image is most " - "likely corrupted or has been patched incorrectly.")); + { + ModalMessageBox::critical(this, tr("Error"), + tr("Integrity check for partition failed. The disc image is most " + "likely corrupted or has been patched incorrectly.")); + } } diff --git a/Source/Core/DolphinQt/Config/GameConfigEdit.cpp b/Source/Core/DolphinQt/Config/GameConfigEdit.cpp index 3d0474a02f..71712defbf 100644 --- a/Source/Core/DolphinQt/Config/GameConfigEdit.cpp +++ b/Source/Core/DolphinQt/Config/GameConfigEdit.cpp @@ -10,7 +10,6 @@ #include <QFile> #include <QMenu> #include <QMenuBar> -#include <QMessageBox> #include <QScrollBar> #include <QStringListModel> #include <QTextCursor> @@ -20,6 +19,7 @@ #include <QWhatsThis> #include "DolphinQt/Config/GameConfigHighlighter.h" +#include "DolphinQt/QtUtils/ModalMessageBox.h" GameConfigEdit::GameConfigEdit(QWidget* parent, const QString& path, bool read_only) : m_path(path), m_read_only(read_only) @@ -122,14 +122,14 @@ void GameConfigEdit::SaveFile() if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { - QMessageBox::warning(this, tr("Warning"), tr("Failed to open config file!")); + ModalMessageBox::warning(this, tr("Warning"), tr("Failed to open config file!")); return; } const QByteArray contents = m_edit->toPlainText().toUtf8(); if (file.write(contents) == -1) - QMessageBox::warning(this, tr("Warning"), tr("Failed to write config file!")); + ModalMessageBox::warning(this, tr("Warning"), tr("Failed to write config file!")); } void GameConfigEdit::ConnectWidgets() diff --git a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp index e320b32347..69295680d0 100755..100644 --- a/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp +++ b/Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp @@ -9,7 +9,6 @@ #include <QHBoxLayout> #include <QLabel> #include <QListWidget> -#include <QMessageBox> #include <QPushButton> #include <QTextEdit> #include <QVBoxLayout> @@ -22,6 +21,7 @@ #include "DolphinQt/Config/CheatCodeEditor.h" #include "DolphinQt/Config/CheatWarningWidget.h" +#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "UICommon/GameFile.h" @@ -255,13 +255,13 @@ void GeckoCodeWidget::DownloadCodes() if (!success) { - QMessageBox::critical(this, tr("Error"), tr("Failed to download codes.")); + ModalMessageBox::critical(this, tr("Error"), tr("Failed to download codes.")); return; } if (codes.empty()) { - QMessageBox::critical(this, tr("Error"), tr("File contained no codes.")); + ModalMessageBox::critical(this, tr("Error"), tr("File contained no codes.")); return; } @@ -281,7 +281,8 @@ void GeckoCodeWidget::DownloadCodes() UpdateList(); SaveCodes(); - QMessageBox::information(this, tr("Download complete"), - tr("Downloaded %1 codes. (added %2)") - .arg(QString::number(codes.size()), QString::number(added_count))); + ModalMessageBox::information( + this, tr("Download complete"), + tr("Downloaded %1 codes. (added %2)") + .arg(QString::number(codes.size()), QString::number(added_count))); } diff --git a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp index 7ca5e61e54..3b7a3d3166 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp @@ -10,7 +10,6 @@ #include <QGroupBox> #include <QHBoxLayout> #include <QLabel> -#include <QMessageBox> #include <QRadioButton> #include <QSignalBlocker> #include <QVBoxLayout> @@ -23,6 +22,7 @@ #include "DolphinQt/Config/Graphics/GraphicsChoice.h" #include "DolphinQt/Config/Graphics/GraphicsRadio.h" #include "DolphinQt/Config/Graphics/GraphicsWindow.h" +#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/Settings.h" #include "UICommon/VideoUtils.h" @@ -172,10 +172,9 @@ void GeneralWidget::SaveSettings() { if (current_backend == "Software Renderer") { - QMessageBox confirm_sw(this); + ModalMessageBox confirm_sw(this); confirm_sw.setIcon(QMessageBox::Warning); - confirm_sw.setWindowModality(Qt::WindowModal); confirm_sw.setStandardButtons(QMessageBox::Yes | QMessageBox::No); confirm_sw.setWindowTitle(tr("Confirm backend change")); confirm_sw.setText(tr("The software renderer is significantly slower than other " diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp index 0e03543dc7..09cc4657e5 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp @@ -10,7 +10,6 @@ #include <QAction> #include <QDateTime> -#include <QMessageBox> #include <QPainter> #include <QTimer> @@ -23,6 +22,7 @@ #include "InputCommon/ControllerEmu/Setting/NumericSetting.h" #include "InputCommon/ControllerInterface/Device.h" +#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/Settings.h" // Color constants to keep things looking consistent: @@ -480,11 +480,9 @@ CalibrationWidget::CalibrationWidget(ControllerEmu::ReshapableInput& input, if (*std::max_element(m_calibration_data.begin(), m_calibration_data.end()) > 0.5) return; - QMessageBox msg(QMessageBox::Information, tr("Calibration"), - tr("For best results please slowly move your input to all possible regions."), - QMessageBox::Ok, this); - msg.setWindowModality(Qt::WindowModal); - msg.exec(); + ModalMessageBox::information( + this, tr("Calibration"), + tr("For best results please slowly move your input to all possible regions.")); }); m_informative_timer->setSingleShot(true); } diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp index f902de35e5..bbbdbfb4ee 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp @@ -9,7 +9,6 @@ #include <QDialogButtonBox> #include <QGroupBox> #include <QHBoxLayout> -#include <QMessageBox> #include <QPushButton> #include <QTabWidget> #include <QVBoxLayout> @@ -36,6 +35,7 @@ #include "DolphinQt/Config/Mapping/WiimoteEmuExtension.h" #include "DolphinQt/Config/Mapping/WiimoteEmuGeneral.h" #include "DolphinQt/Config/Mapping/WiimoteEmuMotionControl.h" +#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/WrapInScrollArea.h" #include "DolphinQt/Settings.h" @@ -161,19 +161,17 @@ void MappingWindow::OnDeleteProfilePressed() if (!File::Exists(profile_path.toStdString())) { - QMessageBox error(this); + ModalMessageBox error(this); error.setIcon(QMessageBox::Critical); - error.setWindowModality(Qt::WindowModal); error.setWindowTitle(tr("Error")); error.setText(tr("The profile '%1' does not exist").arg(profile_name)); error.exec(); return; } - QMessageBox confirm(this); + ModalMessageBox confirm(this); confirm.setIcon(QMessageBox::Warning); - confirm.setWindowModality(Qt::WindowModal); confirm.setWindowTitle(tr("Confirm")); confirm.setText(tr("Are you sure that you want to delete '%1'?").arg(profile_name)); confirm.setInformativeText(tr("This cannot be undone!")); @@ -188,7 +186,7 @@ void MappingWindow::OnDeleteProfilePressed() File::Delete(profile_path.toStdString()); - QMessageBox result(this); + ModalMessageBox result(this); result.setIcon(QMessageBox::Information); result.setWindowModality(Qt::WindowModal); result.setWindowTitle(tr("Success")); diff --git a/Source/Core/DolphinQt/Config/NewPatchDialog.cpp b/Source/Core/DolphinQt/Config/NewPatchDialog.cpp index 4b786b693d..429cab888d 100644 --- a/Source/Core/DolphinQt/Config/NewPatchDialog.cpp +++ b/Source/Core/DolphinQt/Config/NewPatchDialog.cpp @@ -9,13 +9,13 @@ #include <QGroupBox> #include <QLabel> #include <QLineEdit> -#include <QMessageBox> #include <QPushButton> #include <QRadioButton> #include <QScrollArea> #include <QVBoxLayout> #include "Core/PatchEngine.h" +#include "DolphinQt/QtUtils/ModalMessageBox.h" NewPatchDialog::NewPatchDialog(QWidget* parent, PatchEngine::Patch& patch) : QDialog(parent), m_patch(patch) @@ -191,7 +191,7 @@ void NewPatchDialog::accept() { if (m_name_edit->text().isEmpty()) { - QMessageBox::critical(this, tr("Error"), tr("You have to enter a name.")); + ModalMessageBox::critical(this, tr("Error"), tr("You have to enter a name.")); return; } @@ -206,7 +206,7 @@ void NewPatchDialog::accept() if (!valid) { - QMessageBox::critical( + ModalMessageBox::critical( this, tr("Error"), tr("Some values you provided are invalid.\nPlease check the highlighted values.")); return; |
