Skip to content

Commit ce34aed

Browse files
committed
Use multi-arg QString::arg()
1 parent 8efeb88 commit ce34aed

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

src/mainWindow.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -974,15 +974,17 @@ void RunnerDatabaseTab::removeClicked()
974974
if (results->findInColumn(i, qVariantFromValue<void*>(runner)) >= 0)
975975
{
976976
// TODO: Could offer to do the suggested things
977-
QMessageBox::warning(this, APP_NAME, tr("The runner %1 %2 you want to delete is in the result list of the current event. Either close the event or delete the runner from the event first!").arg(runner->getFirstName()).arg(runner->getLastName()));
977+
QMessageBox::warning(this, APP_NAME, tr("The runner %1 %2 you want to delete is in the result list of the current event. Either close the event or delete the runner from the event first!")
978+
.arg(runner->getFirstName(), runner->getLastName()));
978979
return;
979980
}
980981
}
981982
}
982983
if (seriesScoringDB.openScoringReferencesRunner(runner))
983984
{
984985
// TODO: Could offer to do the suggested things
985-
QMessageBox::warning(this, APP_NAME, tr("The runner %1 %2 you want to delete is still referenced by at least one open series scoring. Please remove all references first!").arg(runner->getFirstName()).arg(runner->getLastName()));
986+
QMessageBox::warning(this, APP_NAME, tr("The runner %1 %2 you want to delete is still referenced by at least one open series scoring. Please remove all references first!")
987+
.arg(runner->getFirstName(), runner->getLastName()));
986988
return;
987989
}
988990
}
@@ -1270,7 +1272,7 @@ SimilarClubProblem::SimilarClubProblem(Club* club, std::vector< Club* >& similar
12701272
similarClubsStr += " " + tr("or") + " ";
12711273
similarClubsStr += similarClubs[size - 1]->getName();
12721274

1273-
description = tr("Is the new club %1 the same as %2?").arg(club->getName()).arg(similarClubsStr);
1275+
description = tr("Is the new club %1 the same as %2?").arg(club->getName(), similarClubsStr);
12741276
}
12751277
int SimilarClubProblem::getNumSolutions()
12761278
{
@@ -1287,8 +1289,8 @@ QString SimilarClubProblem::getSolutionDescription(int i)
12871289
}
12881290
else
12891291
{
1290-
if (i % 2 == 1) return tr("Same as %1, change to %2").arg(similarClubs[i/2]->getName()).arg(club->getName());
1291-
else return tr("Same as %1, keep %2").arg(similarClubs[(i-1)/2]->getName()).arg(similarClubs[(i-1)/2]->getName());
1292+
if (i % 2 == 1) return tr("Same as %1, change to %2").arg(similarClubs[i/2]->getName(), club->getName());
1293+
else return tr("Same as %1, keep %2").arg(similarClubs[(i-1)/2]->getName(), similarClubs[(i-1)/2]->getName());
12921294
}
12931295
}
12941296
void SimilarClubProblem::applySolution(int i)
@@ -1334,7 +1336,7 @@ SimilarRunnerProblem::SimilarRunnerProblem(Runner* runner, std::vector< Runner*
13341336
similarRunnersStr += " " + tr("or") + " ";
13351337
similarRunnersStr += similarRunners[size - 1]->getFullDesc();
13361338

1337-
description = tr("Is the new runner %1 the same as %2?").arg(runner->getFullDesc()).arg(similarRunnersStr);
1339+
description = tr("Is the new runner %1 the same as %2?").arg(runner->getFullDesc(), similarRunnersStr);
13381340
}
13391341
int SimilarRunnerProblem::getNumSolutions()
13401342
{
@@ -1351,8 +1353,8 @@ QString SimilarRunnerProblem::getSolutionDescription(int i)
13511353
}
13521354
else
13531355
{
1354-
if (i % 2 == 1) return tr("Same as %1, change to %2").arg(similarRunners[i/2]->getFullDesc()).arg(runner->getFullDesc());
1355-
else return tr("Same as %1, keep %2").arg(similarRunners[(i-1)/2]->getFullDesc()).arg(similarRunners[(i-1)/2]->getFullDesc());
1356+
if (i % 2 == 1) return tr("Same as %1, change to %2").arg(similarRunners[i/2]->getFullDesc(), runner->getFullDesc());
1357+
else return tr("Same as %1, keep %2").arg(similarRunners[(i-1)/2]->getFullDesc(), similarRunners[(i-1)/2]->getFullDesc());
13561358
}
13571359
}
13581360
void SimilarRunnerProblem::applySolution(int i)

src/resultList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ ResultList::ResultList(QXmlStreamReader* stream, bool use_ids, SeriesScoring* sc
158158
Runner* runner = runnerDB.findRunner(first_name, last_name, year, isMale);
159159
if (!runner)
160160
{
161-
QMessageBox::warning(nullptr, tr("Error"), tr("Error while loading series scoring: cannot find runner %1 %2 in runner database!").arg(first_name).arg(last_name));
161+
QMessageBox::warning(nullptr, tr("Error"), tr("Error while loading series scoring: cannot find runner %1 %2 in runner database!").arg(first_name, last_name));
162162
return;
163163
}
164164
columns[cur_column][cur_row] = qVariantFromValue<void*>(runner);

src/runner.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ bool RunnerDB::loadFromFile()
235235
if (club)
236236
current_runner->addClub(club);
237237
else
238-
QMessageBox::warning(nullptr, tr("Warning"), tr("Could not find club %1 of runner %2 %3 in the club database!").arg(ref.toString()).arg(current_runner->getFirstName()).arg(current_runner->getLastName()));
238+
QMessageBox::warning(nullptr, tr("Warning"), tr("Could not find club %1 of runner %2 %3 in the club database!")
239+
.arg(ref.toString(), current_runner->getFirstName(), current_runner->getLastName()));
239240
}
240241
}
241242
else if (stream.name() == "Club")
@@ -244,7 +245,8 @@ bool RunnerDB::loadFromFile()
244245
if (club)
245246
current_runner->addClub(club);
246247
else
247-
QMessageBox::warning(nullptr, tr("Warning"), tr("Could not find club %1 of runner %2 %3 in the club database!").arg(stream.attributes().value("name").toString()).arg(current_runner->getFirstName()).arg(current_runner->getLastName()));
248+
QMessageBox::warning(nullptr, tr("Warning"), tr("Could not find club %1 of runner %2 %3 in the club database!")
249+
.arg(stream.attributes().value("name").toString(), current_runner->getFirstName(), current_runner->getLastName()));
248250

249251
}
250252
else if (stream.name() == "Merge")

src/scoring.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,12 +1369,12 @@ QString ScoringDB::getUnusedName(const QString& desiredName)
13691369

13701370
ClubDifferentProblem::ClubDifferentProblem(Club* club, const QString& country_text, Location* country, const QString& province_text, Location* province) : club(club), country(country), province(province)
13711371
{
1372-
database_location = QString("%1, %2").arg(club->getCountry() ? club->getCountry()->getName() : tr("not specified"))
1373-
.arg(club->getProvince() ? club->getProvince()->getName() : tr("not specified"));
1374-
scoring_location = QString("%1, %2").arg(country ? country->getName() : (country_text.isEmpty() ? tr("not specified") : tr("not found")))
1375-
.arg(province ? province->getName() : (province_text.isEmpty() ? tr("not specified") : tr("not found")));
1372+
database_location = QString("%1, %2").arg(club->getCountry() ? club->getCountry()->getName() : tr("not specified"),
1373+
club->getProvince() ? club->getProvince()->getName() : tr("not specified"));
1374+
scoring_location = QString("%1, %2").arg(country ? country->getName() : (country_text.isEmpty() ? tr("not specified") : tr("not found")),
1375+
province ? province->getName() : (province_text.isEmpty() ? tr("not specified") : tr("not found")));
13761376
description = tr("Club %1 is located at %2 according to the database, but at %3 according to the scoring")
1377-
.arg(club->getName()).arg(database_location).arg(scoring_location);
1377+
.arg(club->getName(), database_location, scoring_location);
13781378
}
13791379
int ClubDifferentProblem::getNumSolutions()
13801380
{

src/seriesScoring.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ QString SeriesScoringDB::getUnusedName(const QString& desiredName)
845845
OrganizerMissingProblem::OrganizerMissingProblem(SeriesRaceResult* result, const QString& first_name, const QString& last_name, int year, bool isMale)
846846
: result(result), first_name(first_name), last_name(last_name), year(year), isMale(isMale)
847847
{
848-
description = tr("Cannot find organizer %1 %2 in runner database").arg(first_name).arg(last_name);
848+
description = tr("Cannot find organizer %1 %2 in runner database").arg(first_name, last_name);
849849
// TODO: check for similar names in runner DB and offer to change reference to them
850850
}
851851
int OrganizerMissingProblem::getNumSolutions()

0 commit comments

Comments
 (0)