Utils: Unify CheckableMessageBox and make it look more native

Change-Id: I5690c16f38cfd2058e01441283bec28d44cadf75
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marcus Tillmanns
2023-04-28 08:39:20 +02:00
parent 29371dc2f3
commit 1fc2459b62
23 changed files with 462 additions and 610 deletions

View File

@@ -232,30 +232,22 @@ void CMakeManager::enableBuildFileMenus(Node *node)
void CMakeManager::reloadCMakePresets()
{
auto settings = CMakeSpecificSettings::instance();
bool doNotAsk = !settings->askBeforePresetsReload.value();
if (!doNotAsk) {
CheckableMessageBox question(Core::ICore::dialogParent());
question.setIcon(QMessageBox::Question);
question.setWindowTitle(Tr::tr("Reload CMake Presets"));
question.setText(Tr::tr("Re-generates the CMake presets kits. The manual CMake project modifications will be lost."));
question.setCheckBoxText(Tr::tr("Do not ask again"));
question.setCheckBoxVisible(true);
question.setChecked(doNotAsk);
question.setStandardButtons(QDialogButtonBox::Cancel);
QMessageBox::StandardButton clickedButton
= CheckableMessageBox::question(Core::ICore::dialogParent(),
Tr::tr("Reload CMake Presets"),
Tr::tr("Re-generates the CMake presets kits. The manual "
"CMake project modifications will be lost."),
settings->askBeforePresetsReload,
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Yes,
QMessageBox::Yes,
{
{QMessageBox::Yes, Tr::tr("Reload")},
});
question.addButton(Tr::tr("Reload"), QDialogButtonBox::YesRole);
question.setDefaultButton(QDialogButtonBox::Yes);
question.exec();
doNotAsk = question.isChecked();
settings->askBeforePresetsReload.setValue(!doNotAsk);
settings->writeSettings(Core::ICore::settings());
if (question.clickedStandardButton() == QDialogButtonBox::Cancel)
return;
}
if (clickedButton == QMessageBox::Cancel)
return;
CMakeProject *project = static_cast<CMakeProject *>(ProjectTree::currentProject());
if (!project)