Remove RestartDialog in favor of static function

The pattern was always to create the dialog and exec it, which can be
done as well with just a function call.

Change-Id: I3934cf5d869211713902abd333aa64d87ec59f32
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2024-01-26 12:23:01 +01:00
parent fca5c4fe96
commit cdef799321
13 changed files with 35 additions and 91 deletions

View File

@@ -907,6 +907,24 @@ Utils::InfoBar *ICore::infoBar()
return d->m_modeStack->infoBar();
}
/*!
Shows a modal dialog that asks the user if they want to restart \QC.
Uses \a text as the main text in the dialog, and triggers a restart
of \QC if the user chooses that option.
*/
void ICore::askForRestart(const QString &text)
{
QMessageBox mb(dialogParent());
mb.setWindowTitle(Tr::tr("Restart Required"));
mb.setText(text);
mb.setIcon(QMessageBox::Information);
mb.addButton(Tr::tr("Later"), QMessageBox::NoRole);
mb.addButton(Tr::tr("Restart Now"), QMessageBox::YesRole);
mb.connect(&mb, &QDialog::accepted, ICore::instance(), &ICore::restart, Qt::QueuedConnection);
mb.exec();
}
/*!
Raises and activates the window for \a widget. This contains workarounds
for X11.