From 6d65b2cc8c5d86d2351e27c158e3b18519e1fcb5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 18 May 2012 20:00:23 +0200 Subject: Use QStringList::join(QChar) overload where applicable [examples] This is an automated change performing the following replacements: join\("(.)"\) -> join('\1') join\(QLatin1String\("(.)"\)\) -> join(QLatin1Char('\1')) join\(QStringLiteral\("(.)"\)\) -> join(QLatin1Char('\1')) Change-Id: I1d0c9782cc1522d937b930531720e32d4c8f7ce8 Reviewed-by: Marc Mutz --- examples/network/dnslookup/dnslookup.cpp | 2 +- .../network/securesocketclient/certificateinfo.cpp | 28 +++++++++++----------- examples/threads/queuedcustomtype/window.cpp | 2 +- examples/tools/settingseditor/variantdelegate.cpp | 2 +- examples/widgets/itemviews/chart/mainwindow.cpp | 2 +- .../widgets/itemviews/simpledommodel/dommodel.cpp | 4 ++-- .../tutorials/addressbook-fr/part7/addressbook.cpp | 2 +- .../tutorials/addressbook/part7/addressbook.cpp | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/network/dnslookup/dnslookup.cpp b/examples/network/dnslookup/dnslookup.cpp index 79f901ed99..77e8abc927 100644 --- a/examples/network/dnslookup/dnslookup.cpp +++ b/examples/network/dnslookup/dnslookup.cpp @@ -138,7 +138,7 @@ void DnsManager::showResults() QStringList values; foreach (const QByteArray &ba, record.values()) values << "\"" + QString::fromLatin1(ba) + "\""; - printf("%s\t%i\tIN\tTXT\t%s\n", qPrintable(record.name()), record.timeToLive(), qPrintable(values.join(" "))); + printf("%s\t%i\tIN\tTXT\t%s\n", qPrintable(record.name()), record.timeToLive(), qPrintable(values.join(' '))); } QCoreApplication::instance()->quit(); diff --git a/examples/network/securesocketclient/certificateinfo.cpp b/examples/network/securesocketclient/certificateinfo.cpp index e05d87710b..23f8d9d217 100644 --- a/examples/network/securesocketclient/certificateinfo.cpp +++ b/examples/network/securesocketclient/certificateinfo.cpp @@ -65,8 +65,8 @@ void CertificateInfo::setCertificateChain(const QList &chain) for (int i = 0; i < chain.size(); ++i) { const QSslCertificate &cert = chain.at(i); form->certificationPathView->addItem(tr("%1%2 (%3)").arg(!i ? QString() : tr("Issued by: ")) - .arg(cert.subjectInfo(QSslCertificate::Organization).join(QLatin1String(" "))) - .arg(cert.subjectInfo(QSslCertificate::CommonName).join(QLatin1String(" ")))); + .arg(cert.subjectInfo(QSslCertificate::Organization).join(QLatin1Char(' '))) + .arg(cert.subjectInfo(QSslCertificate::CommonName).join(QLatin1Char(' ')))); } form->certificationPathView->setCurrentIndex(0); @@ -78,19 +78,19 @@ void CertificateInfo::updateCertificateInfo(int index) if (index >= 0 && index < chain.size()) { const QSslCertificate &cert = chain.at(index); QStringList lines; - lines << tr("Organization: %1").arg(cert.subjectInfo(QSslCertificate::Organization).join(QLatin1String(" "))) - << tr("Subunit: %1").arg(cert.subjectInfo(QSslCertificate::OrganizationalUnitName).join(QLatin1String(" "))) - << tr("Country: %1").arg(cert.subjectInfo(QSslCertificate::CountryName).join(QLatin1String(" "))) - << tr("Locality: %1").arg(cert.subjectInfo(QSslCertificate::LocalityName).join(QLatin1String(" "))) - << tr("State/Province: %1").arg(cert.subjectInfo(QSslCertificate::StateOrProvinceName).join(QLatin1String(" "))) - << tr("Common Name: %1").arg(cert.subjectInfo(QSslCertificate::CommonName).join(QLatin1String(" "))) + lines << tr("Organization: %1").arg(cert.subjectInfo(QSslCertificate::Organization).join(QLatin1Char(' '))) + << tr("Subunit: %1").arg(cert.subjectInfo(QSslCertificate::OrganizationalUnitName).join(QLatin1Char(' '))) + << tr("Country: %1").arg(cert.subjectInfo(QSslCertificate::CountryName).join(QLatin1Char(' '))) + << tr("Locality: %1").arg(cert.subjectInfo(QSslCertificate::LocalityName).join(QLatin1Char(' '))) + << tr("State/Province: %1").arg(cert.subjectInfo(QSslCertificate::StateOrProvinceName).join(QLatin1Char(' '))) + << tr("Common Name: %1").arg(cert.subjectInfo(QSslCertificate::CommonName).join(QLatin1Char(' '))) << QString() - << tr("Issuer Organization: %1").arg(cert.issuerInfo(QSslCertificate::Organization).join(QLatin1String(" "))) - << tr("Issuer Unit Name: %1").arg(cert.issuerInfo(QSslCertificate::OrganizationalUnitName).join(QLatin1String(" "))) - << tr("Issuer Country: %1").arg(cert.issuerInfo(QSslCertificate::CountryName).join(QLatin1String(" "))) - << tr("Issuer Locality: %1").arg(cert.issuerInfo(QSslCertificate::LocalityName).join(QLatin1String(" "))) - << tr("Issuer State/Province: %1").arg(cert.issuerInfo(QSslCertificate::StateOrProvinceName).join(QLatin1String(" "))) - << tr("Issuer Common Name: %1").arg(cert.issuerInfo(QSslCertificate::CommonName).join(QLatin1String(" "))); + << tr("Issuer Organization: %1").arg(cert.issuerInfo(QSslCertificate::Organization).join(QLatin1Char(' '))) + << tr("Issuer Unit Name: %1").arg(cert.issuerInfo(QSslCertificate::OrganizationalUnitName).join(QLatin1Char(' '))) + << tr("Issuer Country: %1").arg(cert.issuerInfo(QSslCertificate::CountryName).join(QLatin1Char(' '))) + << tr("Issuer Locality: %1").arg(cert.issuerInfo(QSslCertificate::LocalityName).join(QLatin1Char(' '))) + << tr("Issuer State/Province: %1").arg(cert.issuerInfo(QSslCertificate::StateOrProvinceName).join(QLatin1Char(' '))) + << tr("Issuer Common Name: %1").arg(cert.issuerInfo(QSslCertificate::CommonName).join(QLatin1Char(' '))); foreach (QString line, lines) form->certificateInfoView->addItem(line); } else { diff --git a/examples/threads/queuedcustomtype/window.cpp b/examples/threads/queuedcustomtype/window.cpp index 8e7bc64640..9dc07eca53 100644 --- a/examples/threads/queuedcustomtype/window.cpp +++ b/examples/threads/queuedcustomtype/window.cpp @@ -84,7 +84,7 @@ void Window::loadImage() formats.append("*." + format); QString newPath = QFileDialog::getOpenFileName(this, tr("Open Image"), - path, tr("Image files (%1)").arg(formats.join(" "))); + path, tr("Image files (%1)").arg(formats.join(' '))); if (newPath.isEmpty()) return; diff --git a/examples/tools/settingseditor/variantdelegate.cpp b/examples/tools/settingseditor/variantdelegate.cpp index 245826237a..7b1da5a863 100644 --- a/examples/tools/settingseditor/variantdelegate.cpp +++ b/examples/tools/settingseditor/variantdelegate.cpp @@ -306,7 +306,7 @@ QString VariantDelegate::displayText(const QVariant &value) return QString("(%1,%2)").arg(size.width()).arg(size.height()); } case QVariant::StringList: - return value.toStringList().join(","); + return value.toStringList().join(','); case QVariant::Time: return value.toTime().toString(Qt::ISODate); default: diff --git a/examples/widgets/itemviews/chart/mainwindow.cpp b/examples/widgets/itemviews/chart/mainwindow.cpp index edaf302bf1..b94ca35100 100644 --- a/examples/widgets/itemviews/chart/mainwindow.cpp +++ b/examples/widgets/itemviews/chart/mainwindow.cpp @@ -162,7 +162,7 @@ void MainWindow::saveFile() pieces.append(model->data(model->index(row, 0, QModelIndex()), Qt::DecorationRole).toString()); - stream << pieces.join(",") << "\n"; + stream << pieces.join(',') << "\n"; } } diff --git a/examples/widgets/itemviews/simpledommodel/dommodel.cpp b/examples/widgets/itemviews/simpledommodel/dommodel.cpp index 2d1b9c9475..c47e733f78 100644 --- a/examples/widgets/itemviews/simpledommodel/dommodel.cpp +++ b/examples/widgets/itemviews/simpledommodel/dommodel.cpp @@ -91,9 +91,9 @@ QVariant DomModel::data(const QModelIndex &index, int role) const attributes << attribute.nodeName() + "=\"" +attribute.nodeValue() + "\""; } - return attributes.join(" "); + return attributes.join(' '); case 2: - return node.nodeValue().split("\n").join(" "); + return node.nodeValue().split("\n").join(' '); default: return QVariant(); } diff --git a/examples/widgets/tutorials/addressbook-fr/part7/addressbook.cpp b/examples/widgets/tutorials/addressbook-fr/part7/addressbook.cpp index 86350a7e7f..9005d7bb05 100644 --- a/examples/widgets/tutorials/addressbook-fr/part7/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook-fr/part7/addressbook.cpp @@ -427,7 +427,7 @@ void AddressBook::exportAsVCard() out << "N:" << lastName << ";" << firstName << "\n"; if (!nameList.isEmpty()) - out << "FN:" << nameList.join(" ") << "\n"; + out << "FN:" << nameList.join(' ') << "\n"; else out << "FN:" << firstName << "\n"; //! [export function part3] diff --git a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp index 81ae1909eb..ad268ad9e9 100644 --- a/examples/widgets/tutorials/addressbook/part7/addressbook.cpp +++ b/examples/widgets/tutorials/addressbook/part7/addressbook.cpp @@ -427,7 +427,7 @@ void AddressBook::exportAsVCard() out << "N:" << lastName << ";" << firstName << "\n"; if (!nameList.isEmpty()) - out << "FN:" << nameList.join(" ") << "\n"; + out << "FN:" << nameList.join(' ') << "\n"; else out << "FN:" << firstName << "\n"; //! [export function part3] -- cgit v1.2.3