Skip to content
Permalink
Browse files

Merge pull request #7849 from spycrab/qt_modal_again

Qt: Make every messagebox modal
  • Loading branch information...
lioncash committed Mar 4, 2019
2 parents a59010f + 70da86f commit 147f7ca3213aef22dfe45bfab86e2d221aa248bf
Showing with 326 additions and 299 deletions.
  1. +1 −0 Source/Core/DolphinQt/CMakeLists.txt
  2. +15 −14 Source/Core/DolphinQt/Config/CheatCodeEditor.cpp
  3. +6 −13 Source/Core/DolphinQt/Config/ControllersWindow.cpp
  4. +15 −10 Source/Core/DolphinQt/Config/FilesystemWidget.cpp
  5. +3 −3 Source/Core/DolphinQt/Config/GameConfigEdit.cpp
  6. +7 −6 Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp
  7. +2 −3 Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp
  8. +4 −6 Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
  9. +4 −6 Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp
  10. +3 −3 Source/Core/DolphinQt/Config/NewPatchDialog.cpp
  11. +8 −8 Source/Core/DolphinQt/Debugger/MemoryWidget.cpp
  12. +3 −2 Source/Core/DolphinQt/Debugger/NewBreakpointDialog.cpp
  13. +2 −2 Source/Core/DolphinQt/Debugger/RegisterColumn.cpp
  14. +8 −8 Source/Core/DolphinQt/Debugger/WatchWidget.cpp
  15. +4 −1 Source/Core/DolphinQt/DolphinQt.vcxproj
  16. +0 −1 Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp
  17. +2 −5 Source/Core/DolphinQt/FIFO/FIFOPlayerWindow.cpp
  18. +9 −26 Source/Core/DolphinQt/GCMemcardManager.cpp
  19. +15 −33 Source/Core/DolphinQt/GameList/GameList.cpp
  20. +7 −5 Source/Core/DolphinQt/Main.cpp
  21. +25 −25 Source/Core/DolphinQt/MainWindow.cpp
  22. +41 −45 Source/Core/DolphinQt/MenuBar.cpp
  23. +12 −12 Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp
  24. +3 −3 Source/Core/DolphinQt/NetPlay/NetPlaySetupDialog.cpp
  25. +54 −0 Source/Core/DolphinQt/QtUtils/ModalMessageBox.cpp
  26. +23 −0 Source/Core/DolphinQt/QtUtils/ModalMessageBox.h
  27. +2 −2 Source/Core/DolphinQt/RenderWidget.cpp
  28. +4 −4 Source/Core/DolphinQt/ResourcePackManager.cpp
  29. +7 −6 Source/Core/DolphinQt/Settings/GameCubePane.cpp
  30. +2 −3 Source/Core/DolphinQt/Settings/GeneralPane.cpp
  31. +4 −7 Source/Core/DolphinQt/Settings/InterfacePane.cpp
  32. +4 −11 Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp
  33. +3 −2 Source/Core/DolphinQt/Translation.cpp
  34. +0 −1 Source/Core/DolphinQt/Updater.cpp
  35. +24 −23 Source/Core/DolphinQt/WiiUpdate.cpp
@@ -104,6 +104,7 @@ add_executable(dolphin-emu
QtUtils/DoubleClickEventFilter.cpp
QtUtils/ElidedButton.cpp
QtUtils/FlowLayout.cpp
QtUtils/ModalMessageBox.cpp
QtUtils/ImageConverter.cpp
QtUtils/SignalDaemon.cpp
QtUtils/WindowActivationEventFilter.cpp
@@ -9,14 +9,15 @@
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QStringList>
#include <QTextEdit>

#include "Core/ARDecrypt.h"
#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;
}

@@ -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;
}

@@ -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."));
}
}
@@ -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()
@@ -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)));
}
@@ -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 "
@@ -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);
}
@@ -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"));

0 comments on commit 147f7ca

Please sign in to comment.
You can’t perform that action at this time.