Gui: apply std::ranges

This commit is contained in:
bofdahof
2025-03-12 17:47:04 +10:00
committed by Chris Hennes
parent 8ba49db74e
commit cb5caf6765
15 changed files with 42 additions and 41 deletions

View File

@@ -166,9 +166,9 @@ void DlgCreateNewPreferencePackImp::onBrowseButtonClicked()
void Gui::Dialog::DlgCreateNewPreferencePackImp::accept()
{
// Ensure that the chosen name is either unique, or that the user actually wants to overwrite the old one
if (auto chosenName = ui->lineEdit->text().toStdString();
std::find(_existingPackNames.begin(), _existingPackNames.end(), chosenName) != _existingPackNames.end()) {
auto result = QMessageBox::warning(this, tr("Pack already exists"),
if (const auto chosenName = ui->lineEdit->text().toStdString();
std::ranges::find(_existingPackNames, chosenName) != _existingPackNames.end()) {
const auto result = QMessageBox::warning(this, tr("Pack already exists"),
tr("A preference pack with that name already exists. Do you want to overwrite it?"),
QMessageBox::Yes | QMessageBox::Cancel);
if (result == QMessageBox::Cancel)