Gui: Use QStringLiteral

This commit is contained in:
Benjamin Bræstrup Sayoc
2025-02-09 18:33:01 +01:00
parent bad9499d50
commit f647d4a1eb
83 changed files with 519 additions and 520 deletions

View File

@@ -1298,7 +1298,7 @@ static bool checkCanonicalPath(const std::map<App::Document*, bool> &docs)
auto docName = [](App::Document *doc) -> QString {
if (doc->Label.getStrValue() == doc->getName())
return QString::fromLatin1(doc->getName());
return QString::fromLatin1("%1 (%2)").arg(QString::fromUtf8(doc->Label.getValue()),
return QStringLiteral("%1 (%2)").arg(QString::fromUtf8(doc->Label.getValue()),
QString::fromLatin1(doc->getName()));
};
int count = 0;
@@ -1458,7 +1458,7 @@ bool Document::saveAs()
}
QString fn = FileDialog::getSaveFileName(getMainWindow(), QObject::tr("Save %1 Document").arg(exe),
name,
QString::fromLatin1("%1 %2 (*.FCStd)").arg(exe, QObject::tr("Document")));
QStringLiteral("%1 %2 (*.FCStd)").arg(exe, QObject::tr("Document")));
if (!fn.isEmpty()) {
QFileInfo fi;
@@ -1544,7 +1544,7 @@ void Document::saveAll()
catch (const Base::Exception& e) {
QMessageBox::critical(getMainWindow(),
QObject::tr("Failed to save document") +
QString::fromLatin1(": %1").arg(QString::fromUtf8(doc->getName())),
QStringLiteral(": %1").arg(QString::fromUtf8(doc->getName())),
QString::fromLatin1(e.what()));
break;
}
@@ -2029,7 +2029,7 @@ MDIView *Document::createView(const Base::Type& typeId)
view3D->getViewer()->removeViewProvider(getViewProvider(obj));
const char* name = getDocument()->Label.getValue();
QString title = QString::fromLatin1("%1 : %2[*]")
QString title = QStringLiteral("%1 : %2[*]")
.arg(QString::fromUtf8(name)).arg(d->_iWinCount++);
view3D->setWindowTitle(title);
@@ -2260,7 +2260,7 @@ bool Document::canClose (bool checkModify, bool checkLink)
getActiveView(),
QObject::tr("Document not saved"),
QObject::tr("The document%1 could not be saved. Do you want to cancel closing it?")
.arg(docName?(QString::fromUtf8(" ")+QString::fromUtf8(docName)):QString()),
.arg(docName?(QStringLiteral(" ")+QString::fromUtf8(docName)):QString()),
QMessageBox::Discard | QMessageBox::Cancel,
QMessageBox::Discard);
if (ret == QMessageBox::Discard)
@@ -2593,7 +2593,7 @@ bool Document::checkTransactionID(bool undo, int iSteps) {
str << " " << doc->getName() << "\n";
}
int ret = QMessageBox::warning(getMainWindow(), undo ? QObject::tr("Undo") : QObject::tr("Redo"),
QString::fromLatin1("%1,\n%2%3").arg(
QStringLiteral("%1,\n%2%3").arg(
QObject::tr("There are grouped transactions in the following documents with "
"other preceding transactions"),
QString::fromStdString(str.str()),