Skip to content

Commit

Permalink
Multilang: remove redundant QString() around tr() (#25003)
Browse files Browse the repository at this point in the history
remove qstring
  • Loading branch information
deanlee authored Jun 30, 2022
1 parent e643f8e commit 8d53e2c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion selfdrive/ui/qt/offroad/onboarding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void DeclinePage::showEvent(QShowEvent *event) {

QObject::connect(back_btn, &QPushButton::clicked, this, &DeclinePage::getBack);

QPushButton *uninstall_btn = new QPushButton(QString(tr("Decline, uninstall %1")).arg(getBrand()));
QPushButton *uninstall_btn = new QPushButton(tr("Decline, uninstall %1").arg(getBrand()));
uninstall_btn->setStyleSheet("background-color: #B73D3D");
buttons->addWidget(uninstall_btn);
QObject::connect(uninstall_btn, &QPushButton::clicked, [=]() {
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/ui/qt/offroad/settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void DevicePanel::updateCalibDescription() {
if (calib.getCalStatus() != 0) {
double pitch = calib.getRpyCalib()[1] * (180 / M_PI);
double yaw = calib.getRpyCalib()[2] * (180 / M_PI);
desc += QString(tr(" Your device is pointed %1° %2 and %3° %4."))
desc += tr(" Your device is pointed %1° %2 and %3° %4.")
.arg(QString::number(std::abs(pitch), 'g', 1), pitch > 0 ? tr("down") : tr("up"),
QString::number(std::abs(yaw), 'g', 1), yaw > 0 ? tr("left") : tr("right"));
}
Expand Down
6 changes: 3 additions & 3 deletions selfdrive/ui/qt/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ QString timeAgo(const QDateTime &date) {
s = "now";
} else if (diff < 60 * 60) {
int minutes = diff / 60;
s = QString(QObject::tr("%1 minute%2 ago")).arg(minutes).arg(minutes > 1 ? "s" : "");
s = QObject::tr("%1 minute%2 ago").arg(minutes).arg(minutes > 1 ? "s" : "");
} else if (diff < 60 * 60 * 24) {
int hours = diff / (60 * 60);
s = QString(QObject::tr("%1 hour%2 ago")).arg(hours).arg(hours > 1 ? "s" : "");
s = QObject::tr("%1 hour%2 ago").arg(hours).arg(hours > 1 ? "s" : "");
} else if (diff < 3600 * 24 * 7) {
int days = diff / (60 * 60 * 24);
s = QString(QObject::tr("%1 day%2 ago")).arg(days).arg(days > 1 ? "s" : "");
s = QObject::tr("%1 day%2 ago").arg(days).arg(days > 1 ? "s" : "");
} else {
s = date.date().toString();
}
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/ui/qt/widgets/ssh_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ void SshControl::getUserKeys(const QString &username) {
params.put("GithubUsername", username.toStdString());
params.put("GithubSshKeys", resp.toStdString());
} else {
ConfirmationDialog::alert(QString(tr("Username '%1' has no keys on GitHub")).arg(username), this);
ConfirmationDialog::alert(tr("Username '%1' has no keys on GitHub").arg(username), this);
}
} else {
if (request->timeout()) {
ConfirmationDialog::alert(tr("Request timed out"), this);
} else {
ConfirmationDialog::alert(QString(tr("Username '%1' doesn't exist on GitHub")).arg(username), this);
ConfirmationDialog::alert(tr("Username '%1' doesn't exist on GitHub").arg(username), this);
}
}

Expand Down

0 comments on commit 8d53e2c

Please sign in to comment.