summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2024-02-17 14:24:25 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2024-02-22 20:25:57 +0100
commit82440a59b3c0e465ab3114a1dd8a46fd2e6a74cb (patch)
tree96474b6bd0ea1f4ecd352453829b0c3ac7518207
parent2488f8360aa6ac4fd758a339d4b2457c4ee5718c (diff)
QtHelp: More _L1
Task-number: QTBUG-122025 Change-Id: Icbdb003e9bd1b05bfb9d92002aab2aa5cc1aa0f7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--src/assistant/help/qcompressedhelpinfo.h2
-rw-r--r--src/assistant/help/qhelp_global.cpp12
-rw-r--r--src/assistant/help/qhelpcollectionhandler.cpp26
-rw-r--r--src/assistant/help/qhelpcollectionhandler_p.h2
-rw-r--r--src/assistant/help/qhelpcontentwidget.cpp4
-rw-r--r--src/assistant/help/qhelpcontentwidget.h3
-rw-r--r--src/assistant/help/qhelpdbreader.cpp251
-rw-r--r--src/assistant/help/qhelpdbreader_p.h2
-rw-r--r--src/assistant/help/qhelpengine.h2
-rw-r--r--src/assistant/help/qhelpenginecore.cpp20
-rw-r--r--src/assistant/help/qhelpfilterengine.cpp6
-rw-r--r--src/assistant/help/qhelpfiltersettingswidget.cpp14
-rw-r--r--src/assistant/help/qhelpindexwidget.h2
-rw-r--r--src/assistant/help/qhelpsearchengine.h2
-rw-r--r--src/assistant/help/qhelpsearchenginecore.cpp7
-rw-r--r--src/assistant/help/qhelpsearchenginecore.h2
-rw-r--r--src/assistant/help/qhelpsearchindexreader.cpp52
-rw-r--r--src/assistant/help/qhelpsearchindexreader_p.h4
-rw-r--r--src/assistant/help/qhelpsearchindexwriter.cpp154
-rw-r--r--src/assistant/help/qhelpsearchindexwriter_p.h4
-rw-r--r--src/assistant/help/qhelpsearchquerywidget.h2
-rw-r--r--src/assistant/help/qhelpsearchresultwidget.h2
-rw-r--r--src/assistant/help/qoptionswidget.cpp8
-rw-r--r--src/assistant/help/qoptionswidget_p.h2
-rw-r--r--src/designer/src/lib/shared/widgetfactory_p.h3
25 files changed, 292 insertions, 296 deletions
diff --git a/src/assistant/help/qcompressedhelpinfo.h b/src/assistant/help/qcompressedhelpinfo.h
index bae87aa83..a68c03c11 100644
--- a/src/assistant/help/qcompressedhelpinfo.h
+++ b/src/assistant/help/qcompressedhelpinfo.h
@@ -40,4 +40,4 @@ private:
QT_END_NAMESPACE
-#endif // QHELPCOLLECTIONDETAILS_H
+#endif // QCOMPRESSEDHELPINFO_H
diff --git a/src/assistant/help/qhelp_global.cpp b/src/assistant/help/qhelp_global.cpp
index 3eb964766..bd4c85ff4 100644
--- a/src/assistant/help/qhelp_global.cpp
+++ b/src/assistant/help/qhelp_global.cpp
@@ -8,6 +8,10 @@
#include <QtCore/qmutex.h>
#include <QtGui/qtextdocument.h>
+QT_BEGIN_NAMESPACE
+
+using namespace Qt::StringLiterals;
+
QString QHelpGlobal::uniquifyConnectionName(const QString &name, void *pointer)
{
static QMutex mutex;
@@ -20,11 +24,11 @@ QString QHelpGlobal::documentTitle(const QString &content)
{
QString title = QCoreApplication::translate("QHelp", "Untitled");
if (!content.isEmpty()) {
- const int start = content.indexOf(QLatin1String("<title>"), 0, Qt::CaseInsensitive) + 7;
- const int end = content.indexOf(QLatin1String("</title>"), 0, Qt::CaseInsensitive);
+ const int start = content.indexOf("<title>"_L1, 0, Qt::CaseInsensitive) + 7;
+ const int end = content.indexOf("</title>"_L1, 0, Qt::CaseInsensitive);
if ((end - start) > 0) {
title = content.mid(start, end - start);
- if (Qt::mightBeRichText(title) || title.contains(QLatin1Char('&'))) {
+ if (Qt::mightBeRichText(title) || title.contains(u'&')) {
QTextDocument doc;
doc.setHtml(title);
title = doc.toPlainText();
@@ -33,3 +37,5 @@ QString QHelpGlobal::documentTitle(const QString &content)
}
return title;
}
+
+QT_END_NAMESPACE
diff --git a/src/assistant/help/qhelpcollectionhandler.cpp b/src/assistant/help/qhelpcollectionhandler.cpp
index cc270f1b8..a9f17131f 100644
--- a/src/assistant/help/qhelpcollectionhandler.cpp
+++ b/src/assistant/help/qhelpcollectionhandler.cpp
@@ -225,7 +225,7 @@ QString QHelpCollectionHandler::absoluteDocPath(const QString &fileName) const
const QFileInfo fi(collectionFile());
return QDir::isAbsolutePath(fileName)
? fileName
- : QFileInfo(fi.absolutePath() + QLatin1Char('/') + fileName).absoluteFilePath();
+ : QFileInfo(fi.absolutePath() + u'/' + fileName).absoluteFilePath();
}
bool QHelpCollectionHandler::isTimeStampCorrect(const TimeStamp &timeStamp) const
@@ -336,7 +336,7 @@ bool QHelpCollectionHandler::copyCollectionFile(const QString &fileName)
copyQuery.bindValue(0, m_query->value(0).toString());
QString oldFilePath = m_query->value(1).toString();
if (!QDir::isAbsolutePath(oldFilePath))
- oldFilePath = oldBaseDir + QLatin1Char('/') + oldFilePath;
+ oldFilePath = oldBaseDir + u'/' + oldFilePath;
copyQuery.bindValue(1, newColFi.absoluteDir().relativeFilePath(oldFilePath));
copyQuery.exec();
}
@@ -923,16 +923,16 @@ static QHelpCollectionHandler::FileInfo extractFileInfo(const QUrl &url)
{
QHelpCollectionHandler::FileInfo fileInfo;
- if (!url.isValid() || url.toString().count(QLatin1Char('/')) < 4
+ if (!url.isValid() || url.toString().count(u'/') < 4
|| url.scheme() != "qthelp"_L1) {
return fileInfo;
}
fileInfo.namespaceName = url.authority();
fileInfo.fileName = url.path();
- if (fileInfo.fileName.startsWith(QLatin1Char('/')))
+ if (fileInfo.fileName.startsWith(u'/'))
fileInfo.fileName = fileInfo.fileName.mid(1);
- fileInfo.folderName = fileInfo.fileName.mid(0, fileInfo.fileName.indexOf(QLatin1Char('/'), 1));
+ fileInfo.folderName = fileInfo.fileName.mid(0, fileInfo.fileName.indexOf(u'/', 1));
fileInfo.fileName.remove(0, fileInfo.folderName.size() + 1);
return fileInfo;
@@ -1232,11 +1232,8 @@ QStringList QHelpCollectionHandler::files(const QString &namespaceName,
return {};
QStringList fileNames;
- while (m_query->next()) {
- fileNames.append(m_query->value(0).toString()
- + QLatin1Char('/')
- + m_query->value(1).toString());
- }
+ while (m_query->next())
+ fileNames.append(m_query->value(0).toString() + u'/' + m_query->value(1).toString());
return fileNames;
}
@@ -1278,11 +1275,8 @@ QStringList QHelpCollectionHandler::files(const QString &namespaceName,
return{};
QStringList fileNames;
- while (m_query->next()) {
- fileNames.append(m_query->value(0).toString()
- + QLatin1Char('/')
- + m_query->value(1).toString());
- }
+ while (m_query->next())
+ fileNames.append(m_query->value(0).toString() + u'/' + m_query->value(1).toString());
return fileNames;
}
@@ -2218,7 +2212,7 @@ QUrl QHelpCollectionHandler::buildQUrl(const QString &ns, const QString &folder,
QUrl url;
url.setScheme("qthelp"_L1);
url.setAuthority(ns);
- url.setPath(QLatin1Char('/') + folder + QLatin1Char('/') + relFileName);
+ url.setPath(u'/' + folder + u'/' + relFileName);
url.setFragment(anchor);
return url;
}
diff --git a/src/assistant/help/qhelpcollectionhandler_p.h b/src/assistant/help/qhelpcollectionhandler_p.h
index 625835daf..4fe9e7a2c 100644
--- a/src/assistant/help/qhelpcollectionhandler_p.h
+++ b/src/assistant/help/qhelpcollectionhandler_p.h
@@ -197,4 +197,4 @@ private:
QT_END_NAMESPACE
-#endif //QHELPCOLLECTIONHANDLER_H
+#endif // QHELPCOLLECTIONHANDLER_H
diff --git a/src/assistant/help/qhelpcontentwidget.cpp b/src/assistant/help/qhelpcontentwidget.cpp
index d692776b6..482414cc1 100644
--- a/src/assistant/help/qhelpcontentwidget.cpp
+++ b/src/assistant/help/qhelpcontentwidget.cpp
@@ -13,6 +13,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QHelpContentModelPrivate
{
#if QT_CONFIG(future)
@@ -259,7 +261,7 @@ QHelpContentWidget::QHelpContentWidget()
QModelIndex QHelpContentWidget::indexOf(const QUrl &link)
{
QHelpContentModel *contentModel = qobject_cast<QHelpContentModel*>(model());
- if (!contentModel || link.scheme() != QLatin1String("qthelp"))
+ if (!contentModel || link.scheme() != "qthelp"_L1)
return {};
m_syncIndex = {};
diff --git a/src/assistant/help/qhelpcontentwidget.h b/src/assistant/help/qhelpcontentwidget.h
index 9a7e7db41..cf9668835 100644
--- a/src/assistant/help/qhelpcontentwidget.h
+++ b/src/assistant/help/qhelpcontentwidget.h
@@ -72,5 +72,4 @@ private:
QT_END_NAMESPACE
-#endif
-
+#endif // QHELPCONTENTWIDGET_H
diff --git a/src/assistant/help/qhelpdbreader.cpp b/src/assistant/help/qhelpdbreader.cpp
index 5a8a3a704..cfe1b6839 100644
--- a/src/assistant/help/qhelpdbreader.cpp
+++ b/src/assistant/help/qhelpdbreader.cpp
@@ -13,9 +13,11 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
QHelpDBReader::QHelpDBReader(const QString &dbName)
: m_dbName(dbName)
- , m_uniqueId(QHelpGlobal::uniquifyConnectionName(QLatin1String("QHelpDBReader"), this))
+ , m_uniqueId(QHelpGlobal::uniquifyConnectionName("QHelpDBReader"_L1, this))
{}
QHelpDBReader::QHelpDBReader(const QString &dbName, const QString &uniqueId, QObject *parent)
@@ -50,8 +52,8 @@ bool QHelpDBReader::init()
bool QHelpDBReader::initDB()
{
- QSqlDatabase db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), m_uniqueId);
- db.setConnectOptions(QLatin1String("QSQLITE_OPEN_READONLY"));
+ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"_L1, m_uniqueId);
+ db.setConnectOptions("QSQLITE_OPEN_READONLY"_L1);
db.setDatabaseName(m_dbName);
if (!db.open()) {
/*: The placeholders are: %1 - The name of the database which cannot be opened
@@ -68,7 +70,7 @@ QString QHelpDBReader::namespaceName() const
if (!m_namespace.isEmpty())
return m_namespace;
if (m_query) {
- m_query->exec(QLatin1String("SELECT Name FROM NamespaceTable"));
+ m_query->exec("SELECT Name FROM NamespaceTable"_L1);
if (m_query->next())
m_namespace = m_query->value(0).toString();
}
@@ -78,7 +80,7 @@ QString QHelpDBReader::namespaceName() const
QString QHelpDBReader::virtualFolder() const
{
if (m_query) {
- m_query->exec(QLatin1String("SELECT Name FROM FolderTable WHERE Id=1"));
+ m_query->exec("SELECT Name FROM FolderTable WHERE Id=1"_L1);
if (m_query->next())
return m_query->value(0).toString();
}
@@ -87,7 +89,7 @@ QString QHelpDBReader::virtualFolder() const
QString QHelpDBReader::version() const
{
- const QString versionString = metaData(QLatin1String("version")).toString();
+ const QString versionString = metaData("version"_L1).toString();
if (versionString.isEmpty())
return qtVersionHeuristic();
return versionString;
@@ -96,12 +98,12 @@ QString QHelpDBReader::version() const
QString QHelpDBReader::qtVersionHeuristic() const
{
const QString nameSpace = namespaceName();
- if (!nameSpace.startsWith(QLatin1String("org.qt-project.")))
+ if (!nameSpace.startsWith("org.qt-project."_L1))
return {};
// We take the namespace tail, starting from the last letter in namespace name.
// We drop any non digit characters.
- const QChar dot(QLatin1Char('.'));
+ const QChar dot(u'.');
QString tail;
for (int i = nameSpace.size(); i > 0; --i) {
const QChar c = nameSpace.at(i - 1);
@@ -172,7 +174,7 @@ QHelpDBReader::IndexTable QHelpDBReader::indexTable() const
return table;
QMap<int, QString> attributeIds;
- m_query->exec(QLatin1String("SELECT DISTINCT Id, Name FROM FilterAttributeTable ORDER BY Id"));
+ m_query->exec("SELECT DISTINCT Id, Name FROM FilterAttributeTable ORDER BY Id"_L1);
while (m_query->next())
attributeIds.insert(m_query->value(0).toInt(), m_query->value(1).toString());
@@ -181,27 +183,22 @@ QHelpDBReader::IndexTable QHelpDBReader::indexTable() const
QList<int> usedAttributeIds;
for (auto it = attributeIds.cbegin(), end = attributeIds.cend(); it != end; ++it) {
const int attributeId = it.key();
- if (isAttributeUsed(m_query.get(), QLatin1String("IndexFilterTable"), attributeId)
- || isAttributeUsed(m_query.get(), QLatin1String("ContentsFilterTable"), attributeId)
- || isAttributeUsed(m_query.get(), QLatin1String("FileFilterTable"), attributeId)) {
+ if (isAttributeUsed(m_query.get(), "IndexFilterTable"_L1, attributeId)
+ || isAttributeUsed(m_query.get(), "ContentsFilterTable"_L1, attributeId)
+ || isAttributeUsed(m_query.get(), "FileFilterTable"_L1, attributeId)) {
usedAttributeIds.append(attributeId);
}
}
bool legacy = false;
- m_query->exec(QLatin1String("SELECT * FROM pragma_table_info('IndexTable') "
- "WHERE name='ContextName'"));
+ m_query->exec("SELECT * FROM pragma_table_info('IndexTable') WHERE name='ContextName'"_L1);
if (m_query->next())
legacy = true;
- const QString identifierColumnName = legacy
- ? QLatin1String("ContextName")
- : QLatin1String("Identifier");
-
+ const QString identifierColumnName = legacy ? "ContextName"_L1 : "Identifier"_L1;
const int usedAttributeCount = usedAttributeIds.size();
QMap<int, IndexItem> idToIndexItem;
-
m_query->exec(QString::fromLatin1("SELECT Name, %1, FileId, Anchor, Id "
"FROM IndexTable "
"ORDER BY Id").arg(identifierColumnName));
@@ -220,13 +217,14 @@ QHelpDBReader::IndexTable QHelpDBReader::indexTable() const
QMap<int, int> originalFileIdToNewFileId;
int filesCount = 0;
- m_query->exec(QLatin1String("SELECT "
- "FileNameTable.FileId, "
- "FileNameTable.Name, "
- "FileNameTable.Title "
- "FROM FileNameTable, FolderTable "
- "WHERE FileNameTable.FolderId = FolderTable.Id "
- "ORDER BY FileId"));
+ m_query->exec(
+ "SELECT "
+ "FileNameTable.FileId, "
+ "FileNameTable.Name, "
+ "FileNameTable.Title "
+ "FROM FileNameTable, FolderTable "
+ "WHERE FileNameTable.FolderId = FolderTable.Id "
+ "ORDER BY FileId"_L1);
while (m_query->next()) {
const int fileId = m_query->value(0).toInt();
FileItem fileItem;
@@ -240,9 +238,7 @@ QHelpDBReader::IndexTable QHelpDBReader::indexTable() const
QMap<int, ContentsItem> idToContentsItem;
- m_query->exec(QLatin1String("SELECT Data, Id "
- "FROM ContentsTable "
- "ORDER BY Id"));
+ m_query->exec("SELECT Data, Id FROM ContentsTable ORDER BY Id"_L1);
while (m_query->next()) {
ContentsItem contentsItem;
contentsItem.data = m_query->value(0).toByteArray();
@@ -262,27 +258,25 @@ QHelpDBReader::IndexTable QHelpDBReader::indexTable() const
// which we want to optimize). The same with FileNameTable and
// FileFilterTable.
- const bool mayOptimizeIndexTable
- = filterDataCount(m_query.get(), QLatin1String("IndexFilterTable"))
+ const bool mayOptimizeIndexTable = filterDataCount(m_query.get(), "IndexFilterTable"_L1)
== idToIndexItem.size() * usedAttributeCount;
- const bool mayOptimizeFileTable
- = filterDataCount(m_query.get(), QLatin1String("FileFilterTable"))
+ const bool mayOptimizeFileTable = filterDataCount(m_query.get(), "FileFilterTable"_L1)
== idToFileItem.size() * usedAttributeCount;
- const bool mayOptimizeContentsTable
- = filterDataCount(m_query.get(), QLatin1String("ContentsFilterTable"))
+ const bool mayOptimizeContentsTable =
+ filterDataCount(m_query.get(), "ContentsFilterTable"_L1)
== idToContentsItem.size() * usedAttributeCount;
optimized = mayOptimizeIndexTable && mayOptimizeFileTable && mayOptimizeContentsTable;
if (!optimized) {
- m_query->exec(QLatin1String(
- "SELECT "
- "IndexFilterTable.IndexId, "
- "FilterAttributeTable.Name "
- "FROM "
- "IndexFilterTable, "
- "FilterAttributeTable "
- "WHERE "
- "IndexFilterTable.FilterAttributeId = FilterAttributeTable.Id"));
+ m_query->exec(
+ "SELECT "
+ "IndexFilterTable.IndexId, "
+ "FilterAttributeTable.Name "
+ "FROM "
+ "IndexFilterTable, "
+ "FilterAttributeTable "
+ "WHERE "
+ "IndexFilterTable.FilterAttributeId = FilterAttributeTable.Id"_L1);
while (m_query->next()) {
const int indexId = m_query->value(0).toInt();
auto it = idToIndexItem.find(indexId);
@@ -290,15 +284,15 @@ QHelpDBReader::IndexTable QHelpDBReader::indexTable() const
it.value().filterAttributes.append(m_query->value(1).toString());
}
- m_query->exec(QLatin1String(
- "SELECT "
- "FileFilterTable.FileId, "
- "FilterAttributeTable.Name "
- "FROM "
- "FileFilterTable, "
- "FilterAttributeTable "
- "WHERE "
- "FileFilterTable.FilterAttributeId = FilterAttributeTable.Id"));
+ m_query->exec(
+ "SELECT "
+ "FileFilterTable.FileId, "
+ "FilterAttributeTable.Name "
+ "FROM "
+ "FileFilterTable, "
+ "FilterAttributeTable "
+ "WHERE "
+ "FileFilterTable.FilterAttributeId = FilterAttributeTable.Id"_L1);
while (m_query->next()) {
const int fileId = m_query->value(0).toInt();
auto it = idToFileItem.find(fileId);
@@ -306,15 +300,15 @@ QHelpDBReader::IndexTable QHelpDBReader::indexTable() const
it.value().filterAttributes.append(m_query->value(1).toString());
}
- m_query->exec(QLatin1String(
- "SELECT "
- "ContentsFilterTable.ContentsId, "
- "FilterAttributeTable.Name "
- "FROM "
- "ContentsFilterTable, "
- "FilterAttributeTable "
- "WHERE "
- "ContentsFilterTable.FilterAttributeId = FilterAttributeTable.Id"));
+ m_query->exec(
+ "SELECT "
+ "ContentsFilterTable.ContentsId, "
+ "FilterAttributeTable.Name "
+ "FROM "
+ "ContentsFilterTable, "
+ "FilterAttributeTable "
+ "WHERE "
+ "ContentsFilterTable.FilterAttributeId = FilterAttributeTable.Id"_L1);
while (m_query->next()) {
const int contentsId = m_query->value(0).toInt();
auto it = idToContentsItem.find(contentsId);
@@ -345,15 +339,15 @@ QList<QStringList> QHelpDBReader::filterAttributeSets() const
{
QList<QStringList> result;
if (m_query) {
- m_query->exec(QLatin1String(
- "SELECT "
- "FileAttributeSetTable.Id, "
- "FilterAttributeTable.Name "
- "FROM "
- "FileAttributeSetTable, "
- "FilterAttributeTable "
- "WHERE FileAttributeSetTable.FilterAttributeId = FilterAttributeTable.Id "
- "ORDER BY FileAttributeSetTable.Id"));
+ m_query->exec(
+ "SELECT "
+ "FileAttributeSetTable.Id, "
+ "FilterAttributeTable.Name "
+ "FROM "
+ "FileAttributeSetTable, "
+ "FilterAttributeTable "
+ "WHERE FileAttributeSetTable.FilterAttributeId = FilterAttributeTable.Id "
+ "ORDER BY FileAttributeSetTable.Id"_L1);
int oldId = -1;
while (m_query->next()) {
const int id = m_query->value(0).toInt();
@@ -375,22 +369,22 @@ QByteArray QHelpDBReader::fileData(const QString &virtualFolder,
return ba;
namespaceName();
- m_query->prepare(QLatin1String(
- "SELECT "
- "FileDataTable.Data "
- "FROM "
- "FileDataTable, "
- "FileNameTable, "
- "FolderTable, "
- "NamespaceTable "
- "WHERE FileDataTable.Id = FileNameTable.FileId "
- "AND (FileNameTable.Name = ? OR FileNameTable.Name = ?) "
- "AND FileNameTable.FolderId = FolderTable.Id "
- "AND FolderTable.Name = ? "
- "AND FolderTable.NamespaceId = NamespaceTable.Id "
- "AND NamespaceTable.Name = ?"));
+ m_query->prepare(
+ "SELECT "
+ "FileDataTable.Data "
+ "FROM "
+ "FileDataTable, "
+ "FileNameTable, "
+ "FolderTable, "
+ "NamespaceTable "
+ "WHERE FileDataTable.Id = FileNameTable.FileId "
+ "AND (FileNameTable.Name = ? OR FileNameTable.Name = ?) "
+ "AND FileNameTable.FolderId = FolderTable.Id "
+ "AND FolderTable.Name = ? "
+ "AND FolderTable.NamespaceId = NamespaceTable.Id "
+ "AND NamespaceTable.Name = ?"_L1);
m_query->bindValue(0, filePath);
- m_query->bindValue(1, QString(QLatin1String("./") + filePath));
+ m_query->bindValue(1, QString("./"_L1 + filePath));
m_query->bindValue(2, virtualFolder);
m_query->bindValue(3, m_namespace);
m_query->exec();
@@ -403,7 +397,7 @@ QStringList QHelpDBReader::customFilters() const
{
QStringList lst;
if (m_query) {
- m_query->exec(QLatin1String("SELECT Name FROM FilterNameTable"));
+ m_query->exec("SELECT Name FROM FilterNameTable"_L1);
while (m_query->next())
lst.append(m_query->value(0).toString());
}
@@ -415,18 +409,18 @@ QStringList QHelpDBReader::filterAttributes(const QString &filterName) const
QStringList lst;
if (m_query) {
if (filterName.isEmpty()) {
- m_query->prepare(QLatin1String("SELECT Name FROM FilterAttributeTable"));
+ m_query->prepare("SELECT Name FROM FilterAttributeTable"_L1);
} else {
- m_query->prepare(QLatin1String(
- "SELECT "
- "FilterAttributeTable.Name "
- "FROM "
- "FilterAttributeTable, "
- "FilterTable, "
- "FilterNameTable "
- "WHERE FilterNameTable.Name = ? "
- "AND FilterNameTable.Id = FilterTable.NameId "
- "AND FilterTable.FilterAttributeId = FilterAttributeTable.Id"));
+ m_query->prepare(
+ "SELECT "
+ "FilterAttributeTable.Name "
+ "FROM "
+ "FilterAttributeTable, "
+ "FilterTable, "
+ "FilterNameTable "
+ "WHERE FilterNameTable.Name = ? "
+ "AND FilterNameTable.Id = FilterTable.NameId "
+ "AND FilterTable.FilterAttributeId = FilterAttributeTable.Id"_L1);
m_query->bindValue(0, filterName);
}
m_query->exec();
@@ -445,40 +439,39 @@ QMultiMap<QString, QByteArray> QHelpDBReader::filesData(const QStringList &filte
QString query;
QString extension;
if (!extensionFilter.isEmpty())
- extension = QString(QLatin1String("AND FileNameTable.Name "
- "LIKE \'%.%1\'")).arg(extensionFilter);
+ extension = "AND FileNameTable.Name LIKE \'%.%1\'"_L1.arg(extensionFilter);
if (filterAttributes.isEmpty()) {
- query = QString(QLatin1String("SELECT "
- "FileNameTable.Name, "
- "FileDataTable.Data "
- "FROM "
- "FolderTable, "
- "FileNameTable, "
- "FileDataTable "
- "WHERE FileDataTable.Id = FileNameTable.FileId "
- "AND FileNameTable.FolderId = FolderTable.Id %1"))
- .arg(extension);
+ query =
+ "SELECT "
+ "FileNameTable.Name, "
+ "FileDataTable.Data "
+ "FROM "
+ "FolderTable, "
+ "FileNameTable, "
+ "FileDataTable "
+ "WHERE FileDataTable.Id = FileNameTable.FileId "
+ "AND FileNameTable.FolderId = FolderTable.Id %1"_L1.arg(extension);
} else {
for (int i = 0; i < filterAttributes.size(); ++i) {
if (i > 0)
- query.append(QLatin1String(" INTERSECT "));
- query.append(QString(QLatin1String(
- "SELECT "
- "FileNameTable.Name, "
- "FileDataTable.Data "
- "FROM "
- "FolderTable, "
- "FileNameTable, "
- "FileDataTable, "
- "FileFilterTable, "
- "FilterAttributeTable "
- "WHERE FileDataTable.Id = FileNameTable.FileId "
- "AND FileNameTable.FolderId = FolderTable.Id "
- "AND FileNameTable.FileId = FileFilterTable.FileId "
- "AND FileFilterTable.FilterAttributeId = FilterAttributeTable.Id "
- "AND FilterAttributeTable.Name = \'%1\' %2"))
- .arg(quote(filterAttributes.at(i)), extension));
+ query.append(" INTERSECT "_L1);
+ query.append(
+ "SELECT "
+ "FileNameTable.Name, "
+ "FileDataTable.Data "
+ "FROM "
+ "FolderTable, "
+ "FileNameTable, "
+ "FileDataTable, "
+ "FileFilterTable, "
+ "FilterAttributeTable "
+ "WHERE FileDataTable.Id = FileNameTable.FileId "
+ "AND FileNameTable.FolderId = FolderTable.Id "
+ "AND FileNameTable.FileId = FileFilterTable.FileId "
+ "AND FileFilterTable.FilterAttributeId = FilterAttributeTable.Id "
+ "AND FilterAttributeTable.Name = \'%1\' %2"_L1
+ .arg(quote(filterAttributes.at(i)), extension));
}
}
m_query->exec(query);
@@ -493,7 +486,7 @@ QVariant QHelpDBReader::metaData(const QString &name) const
if (!m_query)
return {};
- m_query->prepare(QLatin1String("SELECT COUNT(Value), Value FROM MetaDataTable WHERE Name=?"));
+ m_query->prepare("SELECT COUNT(Value), Value FROM MetaDataTable WHERE Name=?"_L1);
m_query->bindValue(0, name);
if (m_query->exec() && m_query->next() && m_query->value(0).toInt() == 1)
return m_query->value(1);
@@ -503,7 +496,7 @@ QVariant QHelpDBReader::metaData(const QString &name) const
QString QHelpDBReader::quote(const QString &string) const
{
QString s = string;
- s.replace(QLatin1Char('\''), QLatin1String("\'\'"));
+ s.replace(u'\'', "\'\'"_L1);
return s;
}
diff --git a/src/assistant/help/qhelpdbreader_p.h b/src/assistant/help/qhelpdbreader_p.h
index 2c464250a..1bc4fc7c9 100644
--- a/src/assistant/help/qhelpdbreader_p.h
+++ b/src/assistant/help/qhelpdbreader_p.h
@@ -97,4 +97,4 @@ private:
QT_END_NAMESPACE
-#endif
+#endif // QHELPDBREADER_H
diff --git a/src/assistant/help/qhelpengine.h b/src/assistant/help/qhelpengine.h
index 219ff3818..31b8fb3ef 100644
--- a/src/assistant/help/qhelpengine.h
+++ b/src/assistant/help/qhelpengine.h
@@ -39,4 +39,4 @@ private:
QT_END_NAMESPACE
-#endif
+#endif // QHELPENGINE_H
diff --git a/src/assistant/help/qhelpenginecore.cpp b/src/assistant/help/qhelpenginecore.cpp
index 130aaf9cc..e5dc4aa63 100644
--- a/src/assistant/help/qhelpenginecore.cpp
+++ b/src/assistant/help/qhelpenginecore.cpp
@@ -349,7 +349,7 @@ QString QHelpEngineCore::documentationFileName(const QString &namespaceName)
return fileInfo.fileName;
return QFileInfo(QFileInfo(d->collectionHandler->collectionFile()).absolutePath()
- + QLatin1Char('/') + fileInfo.fileName).absoluteFilePath();
+ + u'/' + fileInfo.fileName).absoluteFilePath();
}
/*!
@@ -469,8 +469,8 @@ QString QHelpEngineCore::currentFilter() const
return {};
if (d->currentFilter.isEmpty()) {
- const QString &filter = d->collectionHandler->customValue(
- QLatin1String("CurrentFilter"), QString()).toString();
+ const QString &filter =
+ d->collectionHandler->customValue("CurrentFilter"_L1, QString()).toString();
if (!filter.isEmpty() && d->collectionHandler->customFilters().contains(filter))
d->currentFilter = filter;
}
@@ -483,7 +483,7 @@ void QHelpEngineCore::setCurrentFilter(const QString &filterName)
return;
d->currentFilter = filterName;
if (d->autoSaveFilter)
- d->collectionHandler->setCustomValue(QLatin1String("CurrentFilter"), d->currentFilter);
+ d->collectionHandler->setCustomValue("CurrentFilter"_L1, d->currentFilter);
emit currentFilterChanged(d->currentFilter);
}
@@ -521,13 +521,13 @@ QList<QUrl> QHelpEngineCore::files(const QString namespaceName,
return res;
QUrl url;
- url.setScheme(QLatin1String("qthelp"));
+ url.setScheme("qthelp"_L1);
url.setAuthority(namespaceName);
const QStringList &files = d->collectionHandler->files(
namespaceName, filterAttributes, extensionFilter);
for (const QString &file : files) {
- url.setPath(QLatin1String("/") + file);
+ url.setPath("/"_L1 + file);
res.append(url);
}
return res;
@@ -547,13 +547,13 @@ QList<QUrl> QHelpEngineCore::files(const QString namespaceName,
return res;
QUrl url;
- url.setScheme(QLatin1String("qthelp"));
+ url.setScheme("qthelp"_L1);
url.setAuthority(namespaceName);
const QStringList &files = d->collectionHandler->files(
namespaceName, filterName, extensionFilter);
for (const QString &file : files) {
- url.setPath(QLatin1String("/") + file);
+ url.setPath("/"_L1 + file);
res.append(url);
}
return res;
@@ -715,7 +715,7 @@ bool QHelpEngineCore::setCustomValue(const QString &key, const QVariant &value)
QVariant QHelpEngineCore::metaData(const QString &documentationFileName,
const QString &name)
{
- QHelpDBReader reader(documentationFileName, QLatin1String("GetMetaData"), nullptr);
+ QHelpDBReader reader(documentationFileName, "GetMetaData"_L1, nullptr);
if (reader.init())
return reader.metaData(name);
@@ -780,7 +780,7 @@ bool QHelpEngineCore::usesFilterEngine() const
static QUrl constructUrl(const QString &namespaceName, const QString &folderName,
const QString &relativePath)
{
- const int idx = relativePath.indexOf(QLatin1Char('#'));
+ const int idx = relativePath.indexOf(u'#');
const QString &rp = idx < 0 ? relativePath : relativePath.left(idx);
const QString anchor = idx < 0 ? QString() : relativePath.mid(idx + 1);
return QHelpCollectionHandler::buildQUrl(namespaceName, folderName, rp, anchor);
diff --git a/src/assistant/help/qhelpfilterengine.cpp b/src/assistant/help/qhelpfilterengine.cpp
index 0253e7af0..dc139bffd 100644
--- a/src/assistant/help/qhelpfilterengine.cpp
+++ b/src/assistant/help/qhelpfilterengine.cpp
@@ -44,7 +44,7 @@ bool QHelpFilterEnginePrivate::setup()
}
const QString filter = m_collectionHandler->customValue(
- QLatin1String(ActiveFilter), QString()).toString();
+ QLatin1StringView(ActiveFilter), QString()).toString();
if (!filter.isEmpty() && m_collectionHandler->filters().contains(filter))
m_currentFilter = filter;
@@ -248,9 +248,7 @@ bool QHelpFilterEngine::setActiveFilter(const QString &filterName)
return false;
d->m_currentFilter = filterName;
- d->m_collectionHandler->setCustomValue(QLatin1String(ActiveFilter),
- d->m_currentFilter);
-
+ d->m_collectionHandler->setCustomValue(QLatin1StringView(ActiveFilter), d->m_currentFilter);
emit filterActivated(d->m_currentFilter);
return true;
}
diff --git a/src/assistant/help/qhelpfiltersettingswidget.cpp b/src/assistant/help/qhelpfiltersettingswidget.cpp
index 04d2aea4e..319111f6c 100644
--- a/src/assistant/help/qhelpfiltersettingswidget.cpp
+++ b/src/assistant/help/qhelpfiltersettingswidget.cpp
@@ -13,6 +13,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class QHelpFilterSettings final
{
public:
@@ -307,7 +309,7 @@ QString QHelpFilterSettingsWidgetPrivate::suggestedNewFilterName(const QString &
QString newFilterName = initialFilterName;
int counter = 1;
while (m_filterToItem.contains(newFilterName))
- newFilterName = initialFilterName + QLatin1Char(' ') + QString::number(++counter);
+ newFilterName = initialFilterName + u' ' + QString::number(++counter);
return newFilterName;
}
@@ -343,14 +345,14 @@ QHelpFilterSettingsWidget::QHelpFilterSettingsWidget(QWidget *parent)
d->m_ui.setupUi(this);
// TODO: make resources configurable
- QString resourcePath = QLatin1String(":/qt-project.org/assistant/images/");
+ QString resourcePath = ":/qt-project.org/assistant/images/"_L1;
#ifdef Q_OS_MACOS
- resourcePath.append(QLatin1String("mac"));
+ resourcePath.append("mac"_L1);
#else
- resourcePath.append(QLatin1String("win"));
+ resourcePath.append("win"_L1);
#endif
- d->m_ui.addButton->setIcon(QIcon(resourcePath + QLatin1String("/plus.png")));
- d->m_ui.removeButton->setIcon(QIcon(resourcePath + QLatin1String("/minus.png")));
+ d->m_ui.addButton->setIcon(QIcon(resourcePath + "/plus.png"_L1));
+ d->m_ui.removeButton->setIcon(QIcon(resourcePath + "/minus.png"_L1));
connect(d->m_ui.componentWidget, &QOptionsWidget::optionSelectionChanged,
this, [this](const QStringList &options) {
diff --git a/src/assistant/help/qhelpindexwidget.h b/src/assistant/help/qhelpindexwidget.h
index 15bb43954..c3518367b 100644
--- a/src/assistant/help/qhelpindexwidget.h
+++ b/src/assistant/help/qhelpindexwidget.h
@@ -74,4 +74,4 @@ private:
QT_END_NAMESPACE
-#endif
+#endif // QHELPINDEXWIDGET_H
diff --git a/src/assistant/help/qhelpsearchengine.h b/src/assistant/help/qhelpsearchengine.h
index e09f9ac07..f782e6174 100644
--- a/src/assistant/help/qhelpsearchengine.h
+++ b/src/assistant/help/qhelpsearchengine.h
@@ -89,4 +89,4 @@ private:
QT_END_NAMESPACE
-#endif // QHELPSEARCHENGINE_H
+#endif // QHELPSEARCHENGINE_H
diff --git a/src/assistant/help/qhelpsearchenginecore.cpp b/src/assistant/help/qhelpsearchenginecore.cpp
index a8b032b3d..5f8c3c7c8 100644
--- a/src/assistant/help/qhelpsearchenginecore.cpp
+++ b/src/assistant/help/qhelpsearchenginecore.cpp
@@ -16,17 +16,18 @@
QT_BEGIN_NAMESPACE
using namespace fulltextsearch;
+using namespace Qt::StringLiterals;
class QHelpSearchEngineCorePrivate
{
public:
QString indexFilesFolder() const
{
- QString indexFilesFolder = QLatin1String(".fulltextsearch");
+ QString indexFilesFolder = ".fulltextsearch"_L1;
if (m_helpEngine && !m_helpEngine->collectionFile().isEmpty()) {
const QFileInfo fi(m_helpEngine->collectionFile());
- indexFilesFolder = fi.absolutePath() + QDir::separator() + QLatin1Char('.')
- + fi.fileName().left(fi.fileName().lastIndexOf(QLatin1String(".qhc")));
+ indexFilesFolder = fi.absolutePath() + QDir::separator() + u'.'
+ + fi.fileName().left(fi.fileName().lastIndexOf(".qhc"_L1));
}
return indexFilesFolder;
}
diff --git a/src/assistant/help/qhelpsearchenginecore.h b/src/assistant/help/qhelpsearchenginecore.h
index c3da3d1d4..d820a8f3d 100644
--- a/src/assistant/help/qhelpsearchenginecore.h
+++ b/src/assistant/help/qhelpsearchenginecore.h
@@ -48,4 +48,4 @@ private:
QT_END_NAMESPACE
-#endif // QHELPSEARCHENGINECORE_H
+#endif // QHELPSEARCHENGINECORE_H
diff --git a/src/assistant/help/qhelpsearchindexreader.cpp b/src/assistant/help/qhelpsearchindexreader.cpp
index 8d7c16d7f..5fd583335 100644
--- a/src/assistant/help/qhelpsearchindexreader.cpp
+++ b/src/assistant/help/qhelpsearchindexreader.cpp
@@ -12,6 +12,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace fulltextsearch {
class Reader
@@ -57,8 +59,8 @@ static QString namespacePlaceholders(const QMultiMap<QString, QStringList> &name
if (firstNS)
firstNS = false;
else
- placeholders += QLatin1String(" OR ");
- placeholders += QLatin1String("(namespace = ?");
+ placeholders += " OR "_L1;
+ placeholders += "(namespace = ?"_L1;
const QList<QStringList> &attributeSets = namespaces.values(ns);
bool firstAS = true;
@@ -66,16 +68,16 @@ static QString namespacePlaceholders(const QMultiMap<QString, QStringList> &name
if (!attributeSet.isEmpty()) {
if (firstAS) {
firstAS = false;
- placeholders += QLatin1String(" AND (");
+ placeholders += " AND ("_L1;
} else {
- placeholders += QLatin1String(" OR ");
+ placeholders += " OR "_L1;
}
- placeholders += QLatin1String("attributes = ?");
+ placeholders += "attributes = ?"_L1;
}
}
if (!firstAS)
- placeholders += QLatin1Char(')'); // close "AND ("
- placeholders += QLatin1Char(')');
+ placeholders += u')'; // close "AND ("
+ placeholders += u')';
}
return placeholders;
}
@@ -90,7 +92,7 @@ static void bindNamespacesAndAttributes(QSqlQuery *query,
const QList<QStringList> &attributeSets = namespaces.values(ns);
for (const QStringList &attributeSet : attributeSets) {
if (!attributeSet.isEmpty())
- query->addBindValue(attributeSet.join(QLatin1Char('|')));
+ query->addBindValue(attributeSet.join(u'|'));
}
}
}
@@ -103,8 +105,8 @@ static QString namespacePlaceholders(const QStringList &namespaceList)
if (firstNS)
firstNS = false;
else
- placeholders += QLatin1String(" OR ");
- placeholders += QLatin1String("namespace = ?");
+ placeholders += " OR "_L1;
+ placeholders += "namespace = ?"_L1;
}
return placeholders;
}
@@ -122,11 +124,11 @@ QList<QHelpSearchResult> Reader::queryTable(const QSqlDatabase &db, const QStrin
? namespacePlaceholders(m_filterEngineNamespaceList)
: namespacePlaceholders(m_namespaceAttributes);
QSqlQuery query(db);
- query.prepare(QLatin1String("SELECT url, title, snippet(") + tableName +
- QLatin1String(", -1, '<b>', '</b>', '...', '10') FROM ") + tableName +
- QLatin1String(" WHERE (") + nsPlaceholders +
- QLatin1String(") AND ") + tableName +
- QLatin1String(" MATCH ? ORDER BY rank"));
+ query.prepare("SELECT url, title, snippet("_L1 + tableName +
+ ", -1, '<b>', '</b>', '...', '10') FROM "_L1 + tableName +
+ " WHERE ("_L1 + nsPlaceholders +
+ ") AND "_L1 + tableName +
+ " MATCH ? ORDER BY rank"_L1);
m_useFilterEngine
? bindNamespacesAndAttributes(&query, m_filterEngineNamespaceList)
: bindNamespacesAndAttributes(&query, m_namespaceAttributes);
@@ -136,8 +138,8 @@ QList<QHelpSearchResult> Reader::queryTable(const QSqlDatabase &db, const QStrin
QList<QHelpSearchResult> results;
while (query.next()) {
- const QString &url = query.value(QLatin1String("url")).toString();
- const QString &title = query.value(QLatin1String("title")).toString();
+ const QString &url = query.value("url"_L1).toString();
+ const QString &title = query.value("title"_L1).toString();
const QString &snippet = query.value(2).toString();
results.append(QHelpSearchResult(url, title, snippet));
}
@@ -146,18 +148,16 @@ QList<QHelpSearchResult> Reader::queryTable(const QSqlDatabase &db, const QStrin
void Reader::searchInDB(const QString &searchInput)
{
- const QString &uniqueId =
- QHelpGlobal::uniquifyConnectionName(QLatin1String("QHelpReader"), this);
+ const QString &uniqueId = QHelpGlobal::uniquifyConnectionName("QHelpReader"_L1, this);
{
- QSqlDatabase db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), uniqueId);
- db.setConnectOptions(QLatin1String("QSQLITE_OPEN_READONLY"));
- db.setDatabaseName(m_indexPath + QLatin1String("/fts"));
+ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"_L1, uniqueId);
+ db.setConnectOptions("QSQLITE_OPEN_READONLY"_L1);
+ db.setDatabaseName(m_indexPath + "/fts"_L1);
if (db.open()) {
- const QList<QHelpSearchResult> titleResults =
- queryTable(db, QLatin1String("titles"), searchInput);
+ const QList<QHelpSearchResult> titleResults = queryTable(db, "titles"_L1, searchInput);
const QList<QHelpSearchResult> contentResults =
- queryTable(db, QLatin1String("contents"), searchInput);
+ queryTable(db, "contents"_L1, searchInput);
// merge results form title and contents searches
m_searchResults.clear();
@@ -286,6 +286,6 @@ void QHelpSearchIndexReader::run()
emit searchingFinished(m_searchResults.size());
}
-} // namespace fulltextsearch
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/src/assistant/help/qhelpsearchindexreader_p.h b/src/assistant/help/qhelpsearchindexreader_p.h
index a54df4ded..835c44f97 100644
--- a/src/assistant/help/qhelpsearchindexreader_p.h
+++ b/src/assistant/help/qhelpsearchindexreader_p.h
@@ -55,8 +55,8 @@ private:
bool m_usesFilterEngine = false;
};
-} // namespace fulltextsearch
+} // namespace fulltextsearch
QT_END_NAMESPACE
-#endif // QHELPSEARCHINDEXREADER_H
+#endif // QHELPSEARCHINDEXREADER_H
diff --git a/src/assistant/help/qhelpsearchindexwriter.cpp b/src/assistant/help/qhelpsearchindexwriter.cpp
index 36ab3f805..2cccbade3 100644
--- a/src/assistant/help/qhelpsearchindexwriter.cpp
+++ b/src/assistant/help/qhelpsearchindexwriter.cpp
@@ -21,6 +21,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
namespace fulltextsearch {
const char FTS_DB_NAME[] = "fts";
@@ -66,9 +68,9 @@ Writer::Writer(const QString &path)
{
clearLegacyIndex();
QDir().mkpath(m_dbDir);
- m_uniqueId = QHelpGlobal::uniquifyConnectionName(QLatin1String("QHelpWriter"), this);
- m_db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), m_uniqueId);
- const QString dbPath = m_dbDir + QLatin1Char('/') + QLatin1String(FTS_DB_NAME);
+ m_uniqueId = QHelpGlobal::uniquifyConnectionName("QHelpWriter"_L1, this);
+ m_db = QSqlDatabase::addDatabase("QSQLITE"_L1, m_uniqueId);
+ const QString dbPath = m_dbDir + u'/' + QLatin1StringView(FTS_DB_NAME);
m_db.setDatabaseName(dbPath);
if (!m_db.open()) {
const QString &error = QHelpSearchIndexWriter::tr(
@@ -91,12 +93,11 @@ bool Writer::tryInit(bool reindex)
QSqlQuery query(m_db);
// HACK: we try to perform any modifying command just to check if
// we don't get SQLITE_BUSY code (SQLITE_BUSY is defined to 5 in sqlite driver)
- if (!query.exec(QLatin1String("CREATE TABLE foo ();"))) {
- if (query.lastError().nativeErrorCode() == QLatin1String("5")) // db is locked
- return false;
- }
+ if (!query.exec("CREATE TABLE foo ();"_L1) && query.lastError().nativeErrorCode() == "5"_L1) // db is locked
+ return false;
+
// HACK: clear what we have created
- query.exec(QLatin1String("DROP TABLE foo;"));
+ query.exec("DROP TABLE foo;"_L1);
init(reindex);
return true;
@@ -108,7 +109,7 @@ bool Writer::hasDB()
return false;
QSqlQuery query(m_db);
- query.prepare(QLatin1String("SELECT id FROM info LIMIT 1"));
+ query.prepare("SELECT id FROM info LIMIT 1"_L1);
query.exec();
return query.next();
}
@@ -123,7 +124,7 @@ void Writer::clearLegacyIndex()
return;
const QStringList &list = dir.entryList(QDir::Files | QDir::Hidden);
- if (!list.contains(QLatin1String(FTS_DB_NAME))) {
+ if (!list.contains(QLatin1StringView(FTS_DB_NAME))) {
for (const QString &item : list)
dir.remove(item);
}
@@ -139,50 +140,50 @@ void Writer::init(bool reindex)
if (reindex && hasDB()) {
m_needOptimize = true;
- query.exec(QLatin1String("DROP TABLE titles;"));
- query.exec(QLatin1String("DROP TABLE contents;"));
- query.exec(QLatin1String("DROP TABLE info;"));
+ query.exec("DROP TABLE titles;"_L1);
+ query.exec("DROP TABLE contents;"_L1);
+ query.exec("DROP TABLE info;"_L1);
}
- query.exec(QLatin1String("CREATE TABLE info (id INTEGER PRIMARY KEY, namespace, attributes, url, title, data);"));
-
- query.exec(QLatin1String("CREATE VIRTUAL TABLE titles USING fts5("
- "namespace UNINDEXED, attributes UNINDEXED, "
- "url UNINDEXED, title, "
- "tokenize = 'porter unicode61', content = 'info', content_rowid='id');"));
- query.exec(QLatin1String("CREATE TRIGGER titles_insert AFTER INSERT ON info BEGIN "
- "INSERT INTO titles(rowid, namespace, attributes, url, title) "
- "VALUES(new.id, new.namespace, new.attributes, new.url, new.title); "
- "END;"));
- query.exec(QLatin1String("CREATE TRIGGER titles_delete AFTER DELETE ON info BEGIN "
- "INSERT INTO titles(titles, rowid, namespace, attributes, url, title) "
- "VALUES('delete', old.id, old.namespace, old.attributes, old.url, old.title); "
- "END;"));
- query.exec(QLatin1String("CREATE TRIGGER titles_update AFTER UPDATE ON info BEGIN "
- "INSERT INTO titles(titles, rowid, namespace, attributes, url, title) "
- "VALUES('delete', old.id, old.namespace, old.attributes, old.url, old.title); "
- "INSERT INTO titles(rowid, namespace, attributes, url, title) "
- "VALUES(new.id, new.namespace, new.attributes, new.url, new.title); "
- "END;"));
-
- query.exec(QLatin1String("CREATE VIRTUAL TABLE contents USING fts5("
- "namespace UNINDEXED, attributes UNINDEXED, "
- "url UNINDEXED, title, data, "
- "tokenize = 'porter unicode61', content = 'info', content_rowid='id');"));
- query.exec(QLatin1String("CREATE TRIGGER contents_insert AFTER INSERT ON info BEGIN "
- "INSERT INTO contents(rowid, namespace, attributes, url, title, data) "
- "VALUES(new.id, new.namespace, new.attributes, new.url, new.title, new.data); "
- "END;"));
- query.exec(QLatin1String("CREATE TRIGGER contents_delete AFTER DELETE ON info BEGIN "
- "INSERT INTO contents(contents, rowid, namespace, attributes, url, title, data) "
- "VALUES('delete', old.id, old.namespace, old.attributes, old.url, old.title, old.data); "
- "END;"));
- query.exec(QLatin1String("CREATE TRIGGER contents_update AFTER UPDATE ON info BEGIN "
- "INSERT INTO contents(contents, rowid, namespace, attributes, url, title, data) "
- "VALUES('delete', old.id, old.namespace, old.attributes, old.url, old.title, old.data); "
- "INSERT INTO contents(rowid, namespace, attributes, url, title, data) "
- "VALUES(new.id, new.namespace, new.attributes, new.url, new.title, new.data); "
- "END;"));
+ query.exec("CREATE TABLE info (id INTEGER PRIMARY KEY, namespace, attributes, url, title, data);"_L1);
+
+ query.exec("CREATE VIRTUAL TABLE titles USING fts5("
+ "namespace UNINDEXED, attributes UNINDEXED, "
+ "url UNINDEXED, title, "
+ "tokenize = 'porter unicode61', content = 'info', content_rowid='id');"_L1);
+ query.exec("CREATE TRIGGER titles_insert AFTER INSERT ON info BEGIN "
+ "INSERT INTO titles(rowid, namespace, attributes, url, title) "
+ "VALUES(new.id, new.namespace, new.attributes, new.url, new.title); "
+ "END;"_L1);
+ query.exec("CREATE TRIGGER titles_delete AFTER DELETE ON info BEGIN "
+ "INSERT INTO titles(titles, rowid, namespace, attributes, url, title) "
+ "VALUES('delete', old.id, old.namespace, old.attributes, old.url, old.title); "
+ "END;"_L1);
+ query.exec("CREATE TRIGGER titles_update AFTER UPDATE ON info BEGIN "
+ "INSERT INTO titles(titles, rowid, namespace, attributes, url, title) "
+ "VALUES('delete', old.id, old.namespace, old.attributes, old.url, old.title); "
+ "INSERT INTO titles(rowid, namespace, attributes, url, title) "
+ "VALUES(new.id, new.namespace, new.attributes, new.url, new.title); "
+ "END;"_L1);
+
+ query.exec("CREATE VIRTUAL TABLE contents USING fts5("
+ "namespace UNINDEXED, attributes UNINDEXED, "
+ "url UNINDEXED, title, data, "
+ "tokenize = 'porter unicode61', content = 'info', content_rowid='id');"_L1);
+ query.exec("CREATE TRIGGER contents_insert AFTER INSERT ON info BEGIN "
+ "INSERT INTO contents(rowid, namespace, attributes, url, title, data) "
+ "VALUES(new.id, new.namespace, new.attributes, new.url, new.title, new.data); "
+ "END;"_L1);
+ query.exec("CREATE TRIGGER contents_delete AFTER DELETE ON info BEGIN "
+ "INSERT INTO contents(contents, rowid, namespace, attributes, url, title, data) "
+ "VALUES('delete', old.id, old.namespace, old.attributes, old.url, old.title, old.data); "
+ "END;"_L1);
+ query.exec("CREATE TRIGGER contents_update AFTER UPDATE ON info BEGIN "
+ "INSERT INTO contents(contents, rowid, namespace, attributes, url, title, data) "
+ "VALUES('delete', old.id, old.namespace, old.attributes, old.url, old.title, old.data); "
+ "INSERT INTO contents(rowid, namespace, attributes, url, title, data) "
+ "VALUES(new.id, new.namespace, new.attributes, new.url, new.title, new.data); "
+ "END;"_L1);
}
Writer::~Writer()
@@ -200,7 +201,7 @@ void Writer::flush()
return;
QSqlQuery query(m_db);
- query.prepare(QLatin1String("INSERT INTO info (namespace, attributes, url, title, data) VALUES (?, ?, ?, ?, ?)"));
+ query.prepare("INSERT INTO info (namespace, attributes, url, title, data) VALUES (?, ?, ?, ?, ?)"_L1);
query.addBindValue(m_namespaces);
query.addBindValue(m_attributes);
query.addBindValue(m_urls);
@@ -222,7 +223,7 @@ void Writer::removeNamespace(const QString &namespaceName)
m_needOptimize = true;
QSqlQuery query(m_db);
- query.prepare(QLatin1String("DELETE FROM info WHERE namespace = ?"));
+ query.prepare("DELETE FROM info WHERE namespace = ?"_L1);
query.addBindValue(namespaceName);
query.exec();
}
@@ -233,7 +234,7 @@ bool Writer::hasNamespace(const QString &namespaceName)
return false;
QSqlQuery query(m_db);
- query.prepare(QLatin1String("SELECT id FROM info WHERE namespace = ? LIMIT 1"));
+ query.prepare("SELECT id FROM info WHERE namespace = ? LIMIT 1"_L1);
query.addBindValue(namespaceName);
query.exec();
return query.next();
@@ -270,15 +271,15 @@ void Writer::endTransaction()
QSqlQuery query(m_db);
if (m_needOptimize) {
- query.exec(QLatin1String("INSERT INTO titles(titles) VALUES('rebuild')"));
- query.exec(QLatin1String("INSERT INTO contents(contents) VALUES('rebuild')"));
+ query.exec("INSERT INTO titles(titles) VALUES('rebuild')"_L1);
+ query.exec("INSERT INTO contents(contents) VALUES('rebuild')"_L1);
}
if (m_db.driver()->hasFeature(QSqlDriver::Transactions))
m_db.commit();
if (m_needOptimize)
- query.exec(QLatin1String("VACUUM"));
+ query.exec("VACUUM"_L1);
}
QHelpSearchIndexWriter::~QHelpSearchIndexWriter()
@@ -316,7 +317,8 @@ static const char IndexedNamespacesKey[] = "FTS5IndexedNamespaces";
static QMap<QString, QDateTime> readIndexMap(const QHelpEngineCore &engine)
{
QMap<QString, QDateTime> indexMap;
- QDataStream dataStream(engine.customValue(QLatin1String(IndexedNamespacesKey)).toByteArray());
+ QDataStream dataStream(
+ engine.customValue(QLatin1StringView(IndexedNamespacesKey)).toByteArray());
dataStream >> indexMap;
return indexMap;
}
@@ -324,16 +326,14 @@ static QMap<QString, QDateTime> readIndexMap(const QHelpEngineCore &engine)
static bool writeIndexMap(QHelpEngineCore *engine, const QMap<QString, QDateTime> &indexMap)
{
QByteArray data;
-
QDataStream dataStream(&data, QIODevice::ReadWrite);
dataStream << indexMap;
-
- return engine->setCustomValue(QLatin1String(IndexedNamespacesKey), data);
+ return engine->setCustomValue(QLatin1StringView(IndexedNamespacesKey), data);
}
static bool clearIndexMap(QHelpEngineCore *engine)
{
- return engine->removeCustomValue(QLatin1String(IndexedNamespacesKey));
+ return engine->removeCustomValue(QLatin1StringView(IndexedNamespacesKey));
}
void QHelpSearchIndexWriter::run()
@@ -433,16 +433,13 @@ void QHelpSearchIndexWriter::run()
engine.filterAttributeSets(namespaceName);
for (const QStringList &attributes : attributeSets) {
- const QString &attributesString = attributes.join(QLatin1Char('|'));
+ const QString &attributesString = attributes.join(u'|');
- const QMultiMap<QString, QByteArray> htmlFiles =
- reader.filesData(attributes, QLatin1String("html"));
- const QMultiMap<QString, QByteArray> htmFiles =
- reader.filesData(attributes, QLatin1String("htm"));
- const QMultiMap<QString, QByteArray> txtFiles =
- reader.filesData(attributes, QLatin1String("txt"));
+ const auto htmlFiles = reader.filesData(attributes, "html"_L1);
+ const auto htmFiles = reader.filesData(attributes, "htm"_L1);
+ const auto txtFiles = reader.filesData(attributes, "txt"_L1);
- QMultiMap<QString, QByteArray> files = htmlFiles;
+ auto files = htmlFiles;
files.unite(htmFiles);
files.unite(txtFiles);
@@ -464,17 +461,16 @@ void QHelpSearchIndexWriter::run()
continue;
QUrl url;
- url.setScheme(QLatin1String("qthelp"));
+ url.setScheme("qthelp"_L1);
url.setAuthority(namespaceName);
- url.setPath(QLatin1Char('/') + virtualFolder + QLatin1Char('/') + file);
+ url.setPath(u'/' + virtualFolder + u'/' + file);
if (url.hasFragment())
url.setFragment({});
const QString &fullFileName = url.toString();
- if (!fullFileName.endsWith(QLatin1String(".html"))
- && !fullFileName.endsWith(QLatin1String(".htm"))
- && !fullFileName.endsWith(QLatin1String(".txt"))) {
+ if (!fullFileName.endsWith(".html"_L1) && !fullFileName.endsWith(".htm"_L1)
+ && !fullFileName.endsWith(".txt"_L1)) {
continue;
}
@@ -489,8 +485,8 @@ void QHelpSearchIndexWriter::run()
QString title;
QString contents;
- if (fullFileName.endsWith(QLatin1String(".txt"))) {
- title = fullFileName.mid(fullFileName.lastIndexOf(QLatin1Char('/')) + 1);
+ if (fullFileName.endsWith(".txt"_L1)) {
+ title = fullFileName.mid(fullFileName.lastIndexOf(u'/') + 1);
contents = text.toHtmlEscaped();
} else {
QTextDocument doc;
@@ -514,6 +510,6 @@ void QHelpSearchIndexWriter::run()
emit indexingFinished();
}
-} // namespace fulltextsearch
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/src/assistant/help/qhelpsearchindexwriter_p.h b/src/assistant/help/qhelpsearchindexwriter_p.h
index 0e3b17451..61e004794 100644
--- a/src/assistant/help/qhelpsearchindexwriter_p.h
+++ b/src/assistant/help/qhelpsearchindexwriter_p.h
@@ -51,8 +51,8 @@ private:
QString m_indexFilesFolder;
};
-} // namespace fulltextsearch
+} // namespace fulltextsearch
QT_END_NAMESPACE
-#endif // QHELPSEARCHINDEXWRITER_H
+#endif // QHELPSEARCHINDEXWRITER_H
diff --git a/src/assistant/help/qhelpsearchquerywidget.h b/src/assistant/help/qhelpsearchquerywidget.h
index 7f633e0bd..148ae0f11 100644
--- a/src/assistant/help/qhelpsearchquerywidget.h
+++ b/src/assistant/help/qhelpsearchquerywidget.h
@@ -51,4 +51,4 @@ private:
QT_END_NAMESPACE
-#endif // QHELPSEARCHQUERYWIDGET_H
+#endif // QHELPSEARCHQUERYWIDGET_H
diff --git a/src/assistant/help/qhelpsearchresultwidget.h b/src/assistant/help/qhelpsearchresultwidget.h
index 9f5773576..859477eae 100644
--- a/src/assistant/help/qhelpsearchresultwidget.h
+++ b/src/assistant/help/qhelpsearchresultwidget.h
@@ -36,4 +36,4 @@ private:
QT_END_NAMESPACE
-#endif // QHELPSEARCHRESULTWIDGET_H
+#endif // QHELPSEARCHRESULTWIDGET_H
diff --git a/src/assistant/help/qoptionswidget.cpp b/src/assistant/help/qoptionswidget.cpp
index 688b4ed72..65713e722 100644
--- a/src/assistant/help/qoptionswidget.cpp
+++ b/src/assistant/help/qoptionswidget.cpp
@@ -9,13 +9,15 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
class ListWidgetDelegate : public QItemDelegate
{
public:
ListWidgetDelegate(QWidget *w) : QItemDelegate(w), m_widget(w) {}
static bool isSeparator(const QModelIndex &index) {
- return index.data(Qt::AccessibleDescriptionRole).toString() == QLatin1String("separator");
+ return index.data(Qt::AccessibleDescriptionRole).toString() == "separator"_L1;
}
static void setSeparator(QListWidgetItem *item) {
item->setData(Qt::AccessibleDescriptionRole, QString::fromLatin1("separator"));
@@ -139,9 +141,9 @@ QString QOptionsWidget::optionText(const QString &optionName, bool valid) const
{
QString text = optionName;
if (optionName.isEmpty())
- text = QLatin1Char('[') + m_noOptionText + QLatin1Char(']');
+ text = u'[' + m_noOptionText + u']';
if (!valid)
- text += QLatin1String("\t[") + m_invalidOptionText + QLatin1Char(']');
+ text += "\t["_L1 + m_invalidOptionText + u']';
return text;
}
diff --git a/src/assistant/help/qoptionswidget_p.h b/src/assistant/help/qoptionswidget_p.h
index d22ab0878..5d48b1ca0 100644
--- a/src/assistant/help/qoptionswidget_p.h
+++ b/src/assistant/help/qoptionswidget_p.h
@@ -58,4 +58,4 @@ private:
QT_END_NAMESPACE
-#endif // OPTIONSWIDGET_H
+#endif // QOPTIONSWIDGET_H
diff --git a/src/designer/src/lib/shared/widgetfactory_p.h b/src/designer/src/lib/shared/widgetfactory_p.h
index 8d0165eaf..6844ed578 100644
--- a/src/designer/src/lib/shared/widgetfactory_p.h
+++ b/src/designer/src/lib/shared/widgetfactory_p.h
@@ -1,3 +1,6 @@
+
+
+
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0