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

@@ -1,7 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "dialogs/restartdialog.h"
#include "dialogs/ioptionspage.h"
#include "generalsettings.h"
#include "coreconstants.h"
@@ -296,11 +295,8 @@ QString GeneralSettingsWidget::language()
void GeneralSettingsWidget::setLanguage(const QString &locale)
{
QtcSettings *settings = ICore::settings();
if (settings->value("General/OverrideLanguage").toString() != locale) {
RestartDialog dialog(ICore::dialogParent(),
Tr::tr("The language change will take effect after restart."));
dialog.exec();
}
if (settings->value("General/OverrideLanguage").toString() != locale)
ICore::askForRestart(Tr::tr("The language change will take effect after restart."));
settings->setValueWithDefault("General/OverrideLanguage", locale, {});
}
@@ -359,10 +355,8 @@ void GeneralSettingsWidget::setDpiPolicy(Qt::HighDpiScaleFactorRoundingPolicy po
settingsKeyDpiPolicy,
int(StyleHelper::defaultHighDpiScaleFactorRoundingPolicy())).value<Policy>();
if (policy != previousPolicy) {
RestartDialog dialog(ICore::dialogParent(),
Tr::tr("The DPI rounding policy change will take effect after "
"restart."));
dialog.exec();
ICore::askForRestart(
Tr::tr("The DPI rounding policy change will take effect after restart."));
}
settings->setValueWithDefault(settingsKeyDpiPolicy, int(policy),
int(StyleHelper::defaultHighDpiScaleFactorRoundingPolicy()));