Merge pull request #7849 from spycrab/qt_modal_again

Qt: Make every messagebox modal
This commit is contained in:
Mat M
2019-03-04 17:40:27 -05:00
committed by GitHub
35 changed files with 326 additions and 299 deletions
+1
View File
@@ -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,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;
}
@@ -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()
+7 -6
View File
@@ -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"));
@@ -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;
@@ -11,7 +11,6 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QPushButton>
#include <QRadioButton>
#include <QScrollArea>
@@ -27,6 +26,7 @@
#include "Core/HW/Memmap.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/Debugger/MemoryViewWidget.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Settings.h"
MemoryWidget::MemoryWidget(QWidget* parent) : QDockWidget(parent)
@@ -399,13 +399,13 @@ void MemoryWidget::OnSetValue()
if (!good_address)
{
QMessageBox::critical(this, tr("Error"), tr("Bad address provided."));
ModalMessageBox::critical(this, tr("Error"), tr("Bad address provided."));
return;
}
if (m_data_edit->text().isEmpty())
{
QMessageBox::critical(this, tr("Error"), tr("No value provided."));
ModalMessageBox::critical(this, tr("Error"), tr("No value provided."));
return;
}
@@ -423,7 +423,7 @@ void MemoryWidget::OnSetValue()
if (!good_value)
{
QMessageBox::critical(this, tr("Error"), tr("Bad value provided."));
ModalMessageBox::critical(this, tr("Error"), tr("Bad value provided."));
return;
}
@@ -455,7 +455,7 @@ static void DumpArray(const std::string& filename, const u8* data, size_t length
if (!f)
{
QMessageBox::critical(
ModalMessageBox::critical(
nullptr, QObject::tr("Error"),
QObject::tr("Failed to dump %1: Can't open file").arg(QString::fromStdString(filename)));
return;
@@ -463,9 +463,9 @@ static void DumpArray(const std::string& filename, const u8* data, size_t length
if (!f.WriteBytes(data, length))
{
QMessageBox::critical(nullptr, QObject::tr("Error"),
QObject::tr("Failed to dump %1: Failed to write to file")
.arg(QString::fromStdString(filename)));
ModalMessageBox::critical(nullptr, QObject::tr("Error"),
QObject::tr("Failed to dump %1: Failed to write to file")
.arg(QString::fromStdString(filename)));
}
}
@@ -11,11 +11,11 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QRadioButton>
#include <QVBoxLayout>
#include "DolphinQt/Debugger/BreakpointWidget.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
NewBreakpointDialog::NewBreakpointDialog(BreakpointWidget* parent)
: QDialog(parent), m_parent(parent)
@@ -138,7 +138,8 @@ void NewBreakpointDialog::OnAddressTypeChanged()
void NewBreakpointDialog::accept()
{
auto invalid_input = [this](QString field) {
QMessageBox::critical(this, tr("Error"), tr("Invalid input for the field \"%1\"").arg(field));
ModalMessageBox::critical(this, tr("Error"),
tr("Invalid input for the field \"%1\"").arg(field));
};
bool instruction = m_instruction_bp->isChecked();
@@ -7,7 +7,7 @@
#include <cstring>
#include <utility>
#include <QMessageBox>
#include "DolphinQt/QtUtils/ModalMessageBox.h"
RegisterColumn::RegisterColumn(RegisterType type, std::function<u64()> get,
std::function<void(u64)> set)
@@ -84,7 +84,7 @@ void RegisterColumn::SetValue()
}
if (!valid)
QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Invalid input provided"));
ModalMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Invalid input provided"));
else
m_set_register(value);
@@ -4,6 +4,12 @@
#include "DolphinQt/Debugger/WatchWidget.h"
#include <QHeaderView>
#include <QMenu>
#include <QTableWidget>
#include <QToolBar>
#include <QVBoxLayout>
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "Core/ConfigManager.h"
@@ -11,16 +17,10 @@
#include "Core/PowerPC/MMU.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
#include <QHeaderView>
#include <QMenu>
#include <QMessageBox>
#include <QTableWidget>
#include <QToolBar>
#include <QVBoxLayout>
WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)
{
// i18n: This kind of "watch" is used for watching emulated memory.
@@ -306,7 +306,7 @@ void WatchWidget::OnItemChanged(QTableWidgetItem* item)
}
else
{
QMessageBox::critical(this, tr("Error"), tr("Invalid input provided"));
ModalMessageBox::critical(this, tr("Error"), tr("Invalid input provided"));
}
break;
}
+4 -1
View File
@@ -154,6 +154,7 @@
<QtMoc Include="QtUtils\DoubleClickEventFilter.h" />
<QtMoc Include="QtUtils\ElidedButton.h" />
<QtMoc Include="QtUtils\FlowLayout.h" />
<QtMoc Include="QtUtils\ModalMessageBox.h" />
<QtMoc Include="QtUtils\WindowActivationEventFilter.h" />
<QtMoc Include="QtUtils\WrapInScrollArea.h" />
<QtMoc Include="RenderWidget.h" />
@@ -245,6 +246,7 @@
<ClCompile Include="$(QtMocOutPrefix)MemoryViewWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MemoryWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)MenuBar.cpp" />
<ClCompile Include="$(QtMocOutPrefix)ModalMessageBox.cpp" />
<ClCompile Include="$(QtMocOutPrefix)NetPlayDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)NetPlaySetupDialog.cpp" />
<ClCompile Include="$(QtMocOutPrefix)NewBreakpointDialog.cpp" />
@@ -371,6 +373,7 @@
<ClCompile Include="QtUtils\ElidedButton.cpp" />
<ClCompile Include="QtUtils\FlowLayout.cpp" />
<ClCompile Include="QtUtils\ImageConverter.cpp" />
<ClCompile Include="QtUtils\ModalMessageBox.cpp" />
<ClCompile Include="QtUtils\WindowActivationEventFilter.cpp" />
<ClCompile Include="QtUtils\WrapInScrollArea.cpp" />
<ClCompile Include="RenderWidget.cpp" />
@@ -491,4 +494,4 @@
<Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" />
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" />
</Target>
</Project>
</Project>
@@ -10,7 +10,6 @@
#include <QLabel>
#include <QLineEdit>
#include <QListWidget>
#include <QMessageBox>
#include <QPushButton>
#include <QSplitter>
#include <QTextBrowser>
@@ -10,7 +10,6 @@
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QMessageBox>
#include <QPushButton>
#include <QSpinBox>
#include <QTabWidget>
@@ -25,6 +24,7 @@
#include "Core/FifoPlayer/FifoRecorder.h"
#include "DolphinQt/FIFO/FIFOAnalyzer.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/QueueOnObject.h"
#include "DolphinQt/Settings.h"
@@ -205,10 +205,7 @@ void FIFOPlayerWindow::SaveRecording()
if (!result)
{
QMessageBox msg(QMessageBox::Critical, tr("Error"), tr("Failed to save FIFO log."),
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::critical(this, tr("Error"), tr("Failed to save FIFO log."));
}
}
+9 -26
View File
@@ -15,7 +15,6 @@
#include <QImage>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QPixmap>
#include <QPushButton>
#include <QTableWidget>
@@ -27,6 +26,8 @@
#include "Core/HW/GCMemcard/GCMemcard.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
constexpr u32 BANNER_WIDTH = 96;
constexpr u32 ANIM_FRAME_WIDTH = 32;
constexpr u32 IMAGE_HEIGHT = 32;
@@ -306,10 +307,7 @@ void GCMemcardManager::ExportFiles(bool prompt)
QString text = count == 1 ? tr("Successfully exported the save file.") :
tr("Successfully exported the %1 save files.").arg(count);
QMessageBox msg(QMessageBox::Information, tr("Success"), text, QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::information(this, tr("Success"), text);
}
void GCMemcardManager::ExportAllFiles()
@@ -333,10 +331,7 @@ void GCMemcardManager::ImportFile()
if (result != SUCCESS)
{
QMessageBox msg(QMessageBox::Critical, tr("Import failed"),
tr("Failed to import \"%1\".").arg(path), QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::critical(this, tr("Import failed"), tr("Failed to import \"%1\".").arg(path));
return;
}
@@ -362,10 +357,7 @@ void GCMemcardManager::CopyFiles()
if (result != SUCCESS)
{
QMessageBox msg(QMessageBox::Warning, tr("Copy failed"), tr("Failed to copy file"),
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::warning(this, tr("Copy failed"), tr("Failed to copy file"));
}
}
@@ -391,11 +383,8 @@ void GCMemcardManager::DeleteFiles()
QString text = count == 1 ? tr("Do you want to delete the selected save file?") :
tr("Do you want to delete the %1 selected save files?").arg(count);
QMessageBox msg(QMessageBox::Warning, tr("Question"), text,
QMessageBox::Yes | QMessageBox::Abort, this);
msg.setWindowModality(Qt::WindowModal);
auto response = msg.exec();
auto response = ModalMessageBox::question(this, tr("Question"), text);
;
if (response == QMessageBox::Abort)
return;
@@ -412,10 +401,7 @@ void GCMemcardManager::DeleteFiles()
{
if (memcard->RemoveFile(file_index) != SUCCESS)
{
QMessageBox msg(QMessageBox::Warning, tr("Remove failed"), tr("Failed to remove file"),
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::warning(this, tr("Remove failed"), tr("Failed to remove file"));
}
}
@@ -425,10 +411,7 @@ void GCMemcardManager::DeleteFiles()
}
else
{
QMessageBox msg(QMessageBox::Information, tr("Success"), tr("Successfully deleted files."),
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::information(this, tr("Success"), tr("Successfully deleted files."));
}
UpdateSlotTable(m_active_slot);
+15 -33
View File
@@ -20,7 +20,6 @@
#include <QListView>
#include <QMap>
#include <QMenu>
#include <QMessageBox>
#include <QProgressDialog>
#include <QShortcut>
#include <QSortFilterProxyModel>
@@ -44,6 +43,7 @@
#include "DolphinQt/GameList/ListProxyModel.h"
#include "DolphinQt/MenuBar.h"
#include "DolphinQt/QtUtils/DoubleClickEventFilter.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
#include "DolphinQt/WiiUpdate.h"
@@ -442,19 +442,12 @@ void GameList::ExportWiiSave()
QString failed_str;
for (const std::string& str : failed)
failed_str.append(QStringLiteral("\n")).append(QString::fromStdString(str));
QMessageBox msg(QMessageBox::Critical, tr("Save Export"),
tr("Failed to export the following save files:") + failed_str, QMessageBox::Ok,
this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::critical(this, tr("Save Export"),
tr("Failed to export the following save files:") + failed_str);
}
else
{
QMessageBox msg(QMessageBox::Information, tr("Save Export"),
tr("Successfully exported save files"), QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::information(this, tr("Save Export"), tr("Successfully exported save files"));
}
}
@@ -493,9 +486,8 @@ void GameList::CompressISO(bool decompress)
if (!wii_warning_given && !decompress && file->GetPlatform() == DiscIO::Platform::WiiDisc)
{
QMessageBox wii_warning(this);
ModalMessageBox wii_warning(this);
wii_warning.setIcon(QMessageBox::Warning);
wii_warning.setWindowModality(Qt::WindowModal);
wii_warning.setWindowTitle(tr("Confirm"));
wii_warning.setText(tr("Are you sure?"));
wii_warning.setInformativeText(tr(
@@ -554,9 +546,8 @@ void GameList::CompressISO(bool decompress)
QFileInfo dst_info = QFileInfo(dst_path);
if (dst_info.exists())
{
QMessageBox confirm_replace(this);
ModalMessageBox confirm_replace(this);
confirm_replace.setIcon(QMessageBox::Warning);
confirm_replace.setWindowModality(Qt::WindowModal);
confirm_replace.setWindowTitle(tr("Confirm"));
confirm_replace.setText(tr("The file %1 already exists.\n"
"Do you wish to replace it?")
@@ -602,13 +593,10 @@ void GameList::CompressISO(bool decompress)
}
}
QMessageBox msg(QMessageBox::Information, tr("Success"),
decompress ? tr("Successfully decompressed %n image(s).", "", files.size()) :
tr("Successfully compressed %n image(s).", "", files.size()),
QMessageBox::Ok, this);
msg.setWindowModality(Qt::WindowModal);
msg.exec();
ModalMessageBox::information(this, tr("Success"),
decompress ?
tr("Successfully decompressed %n image(s).", "", files.size()) :
tr("Successfully compressed %n image(s).", "", files.size()));
}
void GameList::InstallWAD()
@@ -617,12 +605,11 @@ void GameList::InstallWAD()
if (!game)
return;
QMessageBox result_dialog(this);
ModalMessageBox result_dialog(this);
const bool success = WiiUtils::InstallWAD(game->GetFilePath());
result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
result_dialog.setWindowModality(Qt::WindowModal);
result_dialog.setWindowTitle(success ? tr("Success") : tr("Failure"));
result_dialog.setText(success ? tr("Successfully installed this title to the NAND.") :
tr("Failed to install this title to the NAND."));
@@ -635,10 +622,9 @@ void GameList::UninstallWAD()
if (!game)
return;
QMessageBox warning_dialog(this);
ModalMessageBox warning_dialog(this);
warning_dialog.setIcon(QMessageBox::Information);
warning_dialog.setWindowModality(Qt::WindowModal);
warning_dialog.setWindowTitle(tr("Confirm"));
warning_dialog.setText(tr("Uninstalling the WAD will remove the currently installed version of "
"this title from the NAND without deleting its save data. Continue?"));
@@ -647,12 +633,11 @@ void GameList::UninstallWAD()
if (warning_dialog.exec() == QMessageBox::No)
return;
QMessageBox result_dialog(this);
ModalMessageBox result_dialog(this);
const bool success = WiiUtils::UninstallTitle(game->GetTitleID());
result_dialog.setIcon(success ? QMessageBox::Information : QMessageBox::Critical);
result_dialog.setWindowModality(Qt::WindowModal);
result_dialog.setWindowTitle(success ? tr("Success") : tr("Failure"));
result_dialog.setText(success ? tr("Successfully removed this title from the NAND.") :
tr("Failed to remove this title from the NAND."));
@@ -692,12 +677,10 @@ void GameList::OpenSaveFolder()
void GameList::DeleteFile()
{
QMessageBox confirm_dialog(this);
ModalMessageBox confirm_dialog(this);
confirm_dialog.setIcon(QMessageBox::Warning);
confirm_dialog.setWindowModality(Qt::WindowModal);
confirm_dialog.setWindowTitle(tr("Confirm"));
confirm_dialog.setWindowModality(Qt::WindowModal);
confirm_dialog.setText(tr("Are you sure you want to delete this file?"));
confirm_dialog.setInformativeText(tr("This cannot be undone!"));
confirm_dialog.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
@@ -718,10 +701,9 @@ void GameList::DeleteFile()
}
else
{
QMessageBox error_dialog(this);
ModalMessageBox error_dialog(this);
error_dialog.setIcon(QMessageBox::Critical);
error_dialog.setWindowModality(Qt::WindowModal);
error_dialog.setWindowTitle(tr("Failure"));
error_dialog.setText(tr("Failed to delete the selected file."));
error_dialog.setInformativeText(tr("Check whether you have the permissions required to "
+7 -5
View File
@@ -12,30 +12,33 @@
#include <OptionParser.h>
#include <QAbstractEventDispatcher>
#include <QApplication>
#include <QMessageBox>
#include <QObject>
#include <QPushButton>
#include <QWidget>
#include "Common/MsgHandler.h"
#include "Core/Analytics.h"
#include "Core/Boot/Boot.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "DolphinQt/Host.h"
#include "DolphinQt/MainWindow.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
#include "DolphinQt/QtUtils/RunOnObject.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
#include "DolphinQt/Translation.h"
#include "DolphinQt/Updater.h"
#include "UICommon/CommandLineParse.h"
#include "UICommon/UICommon.h"
static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no, MsgType style)
{
std::optional<bool> r = RunOnObject(QApplication::instance(), [&] {
QMessageBox message_box(QApplication::activeWindow());
ModalMessageBox message_box(QApplication::activeWindow());
message_box.setWindowTitle(QString::fromUtf8(caption));
message_box.setText(QString::fromUtf8(text));
@@ -162,7 +165,7 @@ int main(int argc, char* argv[])
}
else
{
QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Invalid title ID."));
ModalMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Invalid title ID."));
}
}
else if (!args.empty())
@@ -183,10 +186,9 @@ int main(int argc, char* argv[])
#if defined(USE_ANALYTICS) && USE_ANALYTICS
if (!SConfig::GetInstance().m_analytics_permission_asked)
{
QMessageBox analytics_prompt(&win);
ModalMessageBox analytics_prompt(&win);
analytics_prompt.setIcon(QMessageBox::Question);
analytics_prompt.setWindowModality(Qt::WindowModal);
analytics_prompt.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
analytics_prompt.setWindowTitle(QObject::tr("Allow Usage Statistics Reporting"));
analytics_prompt.setText(

Some files were not shown because too many files have changed in this diff Show More