Suggested code improvements

This commit is contained in:
CrisMystik 2022-04-25 21:34:43 +02:00 committed by John Preston
parent 3a021f4e49
commit fafbbb4996

View file

@ -448,7 +448,7 @@ bool ResolveSettings(
controller->window().activate(); controller->window().activate();
const auto section = match->captured(1).mid(1).toLower(); const auto section = match->captured(1).mid(1).toLower();
const auto getSectionType = [&]() -> std::optional<::Settings::Type> { const auto type = [&]() -> std::optional<::Settings::Type> {
if (section.isEmpty()) { if (section.isEmpty()) {
return ::Settings::Main::Id(); return ::Settings::Main::Id();
} else if (section == qstr("language")) { } else if (section == qstr("language")) {
@ -466,9 +466,9 @@ bool ResolveSettings(
return ::Settings::ChangePhone::Id(); return ::Settings::ChangePhone::Id();
} }
return {}; return {};
}; }();
if (const auto type = getSectionType()) { if (type.has_value()) {
controller->showSettings(*type); controller->showSettings(*type);
controller->window().activate(); controller->window().activate();
} }