Qt: Use ModalMessageBox everywhere

This commit is contained in:
spycrab 2019-03-04 20:49:00 +01:00
commit 70da86f1c3
31 changed files with 244 additions and 298 deletions

View file

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

View file

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