[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kbibtex] src/program/docklets: Add 'QStringLiteral' around raw char strings
From: Thomas Fischer <null () kde ! org>
Date: 2017-03-31 21:56:22
Message-ID: E1cu4Ws-0004Se-P5 () code ! kde ! org
[Download RAW message or body]
Git commit 499f026249f3f6b5364055d3ec45d346eb8daf2b by Thomas Fischer.
Committed on 31/03/2017 at 21:43.
Pushed by thomasfischer into branch 'master'.
Add 'QStringLiteral' around raw char strings
M +9 -9 src/program/docklets/referencepreview.cpp
https://commits.kde.org/kbibtex/499f026249f3f6b5364055d3ec45d346eb8daf2b
diff --git a/src/program/docklets/referencepreview.cpp \
b/src/program/docklets/referencepreview.cpp index f306798d..a9e6ed77 100644
--- a/src/program/docklets/referencepreview.cpp
+++ b/src/program/docklets/referencepreview.cpp
@@ -108,8 +108,8 @@ public:
configKeyName(QStringLiteral("Style")), file(nullptr), fileView(nullptr),
textColor(QApplication::palette().text().color()),
defaultFontSize(QFontDatabase::systemFont(QFontDatabase::GeneralFont).pointSize()),
- htmlStart("<html>\n<head>\n<meta http-equiv=\"content-type\" \
content=\"text/html; charset=utf-8\" />\n<style type=\"text/css\">\npre {\n \
white-space: pre-wrap;\n white-space: -moz-pre-wrap;\n white-space: -pre-wrap;\n \
white-space: -o-pre-wrap;\n word-wrap: break-word;\n}\n</style>\n</head>\n<body \
style=\"color: " + textColor.name() + "; font-size: " + \
QString::number(defaultFontSize) + "pt; font-family: '" + \
QFontDatabase::systemFont(QFontDatabase::GeneralFont).family() + "'; \
background-color: '" + QApplication::palette().base().color().name(QColor::HexRgb) + \
"'\">"),
- notAvailableMessage(htmlStart + "<p style=\"font-style: italic;\">" + \
i18n("No preview available") + "</p><p style=\"font-size: 90%;\">" + i18n("Reason:") \
+ " %1</p></body></html>") { + \
htmlStart(QStringLiteral("<html>\n<head>\n<meta http-equiv=\"content-type\" \
content=\"text/html; charset=utf-8\" />\n<style type=\"text/css\">\npre {\n \
white-space: pre-wrap;\n white-space: -moz-pre-wrap;\n white-space: -pre-wrap;\n \
white-space: -o-pre-wrap;\n word-wrap: break-word;\n}\n</style>\n</head>\n<body \
style=\"color: ") + textColor.name() + QStringLiteral("; font-size: ") + \
QString::number(defaultFontSize) + QStringLiteral("pt; font-family: '") + \
QFontDatabase::systemFont(QFontDatabase::GeneralFont).family() + QStringLiteral("'; \
background-color: '") + QApplication::palette().base().color().name(QColor::HexRgb) + \
QStringLiteral("'\">")), + notAvailableMessage(htmlStart + \
QStringLiteral("<p style=\"font-style: italic;\">") + i18n("No preview available") + \
QStringLiteral("</p><p style=\"font-size: 90%;\">") + i18n("Reason:") + \
QStringLiteral(" %1</p></body></html>")) { QGridLayout *gridLayout = new \
QGridLayout(p); gridLayout->setMargin(0);
gridLayout->setColumnStretch(0, 1);
@@ -160,7 +160,7 @@ public:
if (tempFile.open()) {
QTextStream ts(&tempFile);
ts.setCodec("utf-8");
- ts << QString(htmlText).replace(QRegExp("<a[^>]+href=\"kbibtex:[^>]+>([^<]+)</a>"), \
QStringLiteral("\\1")); + ts << \
QString(htmlText).replace(QRegExp(QStringLiteral("<a[^>]+href=\"kbibtex:[^>]+>([^<]+)</a>")), \
QStringLiteral("\\1")); tempFile.close();
return true;
}
@@ -269,7 +269,7 @@ void ReferencePreview::renderHTML()
exporter = exporterHTML;
} else if (previewStyle.type == QStringLiteral("xml") || \
previewStyle.type.endsWith(QStringLiteral("_xml"))) { crossRefHandling = merge;
- const QString filename = previewStyle.style + ".xsl";
+ const QString filename = previewStyle.style + QStringLiteral(".xsl");
exporter = new \
FileExporterXSLT(QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("kbibtex/") + filename), this); } else
qCWarning(LOG_KBIBTEX_PROGRAM) << "Don't know how to handle output type " << \
previewStyle.type; @@ -338,13 +338,13 @@ void ReferencePreview::renderHTML()
/// bibtex2html
/// remove "generated by" line from HTML code if BibTeX2HTML was \
used
- text.remove(QRegExp("<hr><p><em>.*</p>"));
- text.remove(QRegExp("<[/]?(font)[^>]*>"));
- QRegExp reTable("^.*<td.*</td.*<td>");
+ text.remove(QRegExp(QStringLiteral("<hr><p><em>.*</p>")));
+ text.remove(QRegExp(QStringLiteral("<[/]?(font)[^>]*>")));
+ QRegExp reTable(QStringLiteral("^.*<td.*</td.*<td>"));
reTable.setMinimal(true);
text.remove(reTable);
- text.remove(QRegExp("</td>.*$"));
- QRegExp reAnchor("\\[ <a.*</a> \\]");
+ text.remove(QRegExp(QStringLiteral("</td>.*$")));
+ QRegExp reAnchor(QStringLiteral("\\[ <a.*</a> \\]"));
reAnchor.setMinimal(true);
text.remove(reAnchor);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic