From 4d9d83a9c1e2f13bee0be1305c4b10749bea24ed Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 29 Sep 2022 15:26:52 +0200 Subject: Fix a few compile warnings --- src/dialog.cpp | 6 +++--- src/session.h | 4 ++-- src/vsession.cpp | 8 ++++---- src/xsession.cpp | 5 +++-- 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/dialog.cpp b/src/dialog.cpp index 8acaa9d..aea2d6e 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -193,8 +193,8 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index) ::kill(pid_t(scriptPid), SIGTERM); } QMessageBox::critical( - this, trUtf8("vmchooser"), - trUtf8("Vmchooser failed to run the selected session!")); + this, tr("vmchooser"), + tr("Vmchooser failed to run the selected session!")); QApplication::instance()->quit(); } @@ -446,7 +446,7 @@ void Dialog::onCenterTimer() { if (autoQuit_ == 0) { QCoreApplication::instance()->exit(0); } else if (autoQuit_ < 60) { - ui->lblAutoQuit->setText(trUtf8("Auto logout in %1").arg(autoQuit_)); + ui->lblAutoQuit->setText(tr("Auto logout in %1").arg(autoQuit_)); ui->lblAutoQuit->show(); } else if (!ui->lblAutoQuit->isHidden()) { ui->lblAutoQuit->hide(); diff --git a/src/session.h b/src/session.h index c3f758c..675aada 100644 --- a/src/session.h +++ b/src/session.h @@ -28,8 +28,8 @@ class Session { if (!error.isEmpty()) { if (showError) { QMessageBox::critical( - nullptr, QObject::trUtf8("vmchooser"), - QObject::trUtf8("Cannot start selected session:") + QStringLiteral("\n") + error); + nullptr, QObject::tr("vmchooser"), + QObject::tr("Cannot start selected session:") + QStringLiteral("\n") + error); } return false; } diff --git a/src/vsession.cpp b/src/vsession.cpp index a7d86e0..a3334c8 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -225,10 +225,10 @@ bool VSession::isLocked() const { QString VSession::checkCanRunInternal() const { if (getAttribute(QStringLiteral("image_name")).isEmpty()) - return QObject::trUtf8("XML error: image_name is empty"); + return QObject::tr("XML error: image_name is empty"); const Virtualizer* virt = Virtualizer::get(virtualizer()); if (!virt->isAvailable) - return QObject::trUtf8("Virtualizer '%1' is not enabled.").arg(virt->id); + return QObject::tr("Virtualizer '%1' is not enabled.").arg(virt->id); // Seems OK return QString(); } @@ -253,8 +253,8 @@ bool VSession::prepareRun() const { tmpfile.write(this->toXml().toUtf8()) == -1) { qDebug() << "Error writing xml to file" << tmpfile.fileName(); QMessageBox::critical( - nullptr, QObject::trUtf8("vmchooser"), - QObject::trUtf8("Error writing temporary XML file for run-virt")); + nullptr, QObject::tr("vmchooser"), + QObject::tr("Error writing temporary XML file for run-virt")); return false; } if (!tmpFileName.isEmpty()) { diff --git a/src/xsession.cpp b/src/xsession.cpp index 5db3b11..dcc9d22 100644 --- a/src/xsession.cpp +++ b/src/xsession.cpp @@ -128,7 +128,7 @@ QString XSession::checkCanRunInternal() const { if (fi.isFile() && fi.isExecutable()) return QString(); // Not found - return QObject::trUtf8("Binary %1 not found.").arg(exe); + return QObject::tr("Binary %1 not found.").arg(exe); } bool XSession::isLocked() const { @@ -175,8 +175,9 @@ void XSession::run() const { command += exec_; qDebug() << "Running via /bin/sh:" << command; QByteArray cmdbin = command.toUtf8(); - char *argv[4] = { "/bin/sh", "-c", cmdbin.data(), nullptr }; + char * const argv[4] = { strdup("/bin/sh"), strdup("-c"), cmdbin.data(), nullptr }; execv("/bin/sh", argv); + // Caller will show error on failure to exec } int XSession::type() const { -- cgit v1.2.3-55-g7522