use WindowModal on all crash handler messageboxes

Improves appearance on macOS.
This commit is contained in:
itsmattkc
2021-04-09 08:47:09 +10:00
parent 8f21d05baa
commit 0cb8da3de1
+44 -18
View File
@@ -148,9 +148,14 @@ void CrashHandlerDialog::ReplyFinished(QNetworkReply* reply)
// Close dialog
QDialog::accept();
} else {
QMessageBox::critical(this, tr("Upload Failed"),
tr("Failed to send error report. Please try again later."),
QMessageBox::Ok);
QMessageBox b(this);
b.setIcon(QMessageBox::Critical);
b.setWindowModality(Qt::WindowModal);
b.setWindowTitle(tr("Upload Failed"));
b.setText(tr("Failed to send error report. Please try again later."));
b.addButton(QMessageBox::Ok);
b.exec();
SetGUIObjectsEnabled(true);
}
}
@@ -181,10 +186,15 @@ void CrashHandlerDialog::ReadProcessFinished()
void CrashHandlerDialog::SendErrorReport()
{
if (summary_edit_->document()->isEmpty()) {
if (QMessageBox::question(this,
tr("No Crash Summary"),
tr("Are you sure you want to send an error report with no crash summary?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
QMessageBox b(this);
b.setIcon(QMessageBox::Question);
b.setWindowModality(Qt::WindowModal);
b.setWindowTitle(tr("No Crash Summary"));
b.setText(tr("Are you sure you want to send an error report with no crash summary?"));
b.addButton(QMessageBox::Yes);
b.addButton(QMessageBox::No);
if (b.exec() == QMessageBox::No) {
return;
}
}
@@ -249,9 +259,15 @@ void CrashHandlerDialog::SendErrorReport()
if (folders_in_symbol_path.size() > 0) {
symbol_dir = QDir(symbol_dir.filePath(folders_in_symbol_path.first()));
} else {
QMessageBox::critical(this, tr("Failed to send report"), tr("Failed to find symbols necessary to send report. "
"This is a packaging issue. Please notify "
"the maintainers of this package."));
QMessageBox b(this);
b.setIcon(QMessageBox::Critical);
b.setWindowModality(Qt::WindowModal);
b.setWindowTitle(tr("Failed to send report"));
b.setText(tr("Failed to find symbols necessary to send report. "
"This is a packaging issue. Please notify "
"the maintainers of this package."));
b.addButton(QMessageBox::Ok);
b.exec();
return;
}
@@ -270,8 +286,14 @@ void CrashHandlerDialog::SendErrorReport()
QFile sym_file(symbol_full_path);
if (!sym_file.open(QFile::ReadOnly)) {
QMessageBox::critical(this, tr("Failed to send report"), tr("Failed to open symbol file. You may not have "
"permission to access it."));
QMessageBox b(this);
b.setIcon(QMessageBox::Critical);
b.setWindowModality(Qt::WindowModal);
b.setWindowTitle(tr("Failed to send report"));
b.setText(tr("Failed to open symbol file. You may not have "
"permission to access it."));
b.addButton(QMessageBox::Ok);
b.exec();
return;
}
@@ -289,12 +311,16 @@ void CrashHandlerDialog::SendErrorReport()
void CrashHandlerDialog::closeEvent(QCloseEvent* e)
{
if (waiting_for_upload_
&& QMessageBox::warning(this,
tr("Confirm Close"),
tr("Crash report is still uploading. Closing now may result in no "
"report being sent. Are you sure you wish to close?"),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) {
QMessageBox b(this);
b.setIcon(QMessageBox::Warning);
b.setWindowModality(Qt::WindowModal);
b.setWindowTitle(tr("Confirm Close"));
b.setText(tr("Crash report is still uploading. Closing now may result in no "
"report being sent. Are you sure you wish to close?"));
b.addButton(QMessageBox::Ok);
b.addButton(QMessageBox::Cancel);
if (waiting_for_upload_ && b.exec() == QMessageBox::Cancel) {
e->ignore();
} else {
e->accept();