Commit dd945865 authored by Joseph Wenninger's avatar Joseph Wenninger

more QStringLiterals

parent e22fc431
......@@ -26,8 +26,8 @@ static QString eolDelimiter(const QString &str)
{
// find the split character
QString separator(QLatin1Char('\n'));
if (str.indexOf(QLatin1String("\r\n")) != -1) {
separator = QLatin1String("\r\n");
if (str.indexOf(QStringLiteral("\r\n")) != -1) {
separator = QStringLiteral("\r\n");
} else if (str.indexOf(QLatin1Char('\r')) != -1) {
separator = QLatin1Char('\r');
}
......@@ -36,7 +36,7 @@ static QString eolDelimiter(const QString &str)
static bool lineNoLessThan(const QString &lhs, const QString &rhs)
{
QRegExp rx(QLatin1String("^#(\\d+)"));
QRegExp rx(QStringLiteral("^#(\\d+)"));
int ilhs = rx.indexIn(lhs);
int lhsLn = rx.cap(1).toInt();
int irhs = rx.indexIn(rhs);
......@@ -86,7 +86,7 @@ static BtInfo parseBtLine(const QString &line)
// try a) cap #number(1), address(2), function(3), filename(4), linenumber(5)
static QRegExp rxa(QLatin1String("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+at\\s+(.+):(\\d+)$"));
static QRegExp rxa(QStringLiteral("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+at\\s+(.+):(\\d+)$"));
index = rxa.indexIn(line);
if (index == 0) {
BtInfo info;
......@@ -101,7 +101,7 @@ static BtInfo parseBtLine(const QString &line)
}
// try b) cap #number(1), address(2), function(3), lib(4)
static QRegExp rxb(QLatin1String("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+from\\s+(.+)$"));
static QRegExp rxb(QStringLiteral("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+from\\s+(.+)$"));
index = rxb.indexIn(line);
if (index == 0) {
BtInfo info;
......@@ -116,7 +116,7 @@ static BtInfo parseBtLine(const QString &line)
}
// try c) #41 0x0805e690 in ?? ()
static QRegExp rxc(QLatin1String("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+\\?\\?\\s+\\(\\)$"));
static QRegExp rxc(QStringLiteral("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+\\?\\?\\s+\\(\\)$"));
index = rxc.indexIn(line);
if (index == 0) {
BtInfo info;
......@@ -131,7 +131,7 @@ static BtInfo parseBtLine(const QString &line)
}
// try d) #5 0xffffe410 in __kernel_vsyscall ()
static QRegExp rxd(QLatin1String("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)$"));
static QRegExp rxd(QStringLiteral("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)$"));
index = rxd.indexIn(line);
if (index == 0) {
BtInfo info;
......
......@@ -47,9 +47,9 @@ K_PLUGIN_FACTORY_WITH_JSON(KateBtBrowserFactory, "katebacktracebrowserplugin.jso
KateBtBrowserPlugin *KateBtBrowserPlugin::s_self = 0L;
static QStringList fileExtensions =
QStringList() << QLatin1String("*.cpp") << QLatin1String("*.cxx") <<
QLatin1String("*.c") << QLatin1String("*.cc") << QLatin1String("*.h") <<
QLatin1String("*.hpp") << QLatin1String("*.hxx") << QLatin1String("*.moc");
QStringList() << QStringLiteral("*.cpp") << QStringLiteral("*.cxx") <<
QStringLiteral("*.c") << QStringLiteral("*.cc") << QStringLiteral("*.h") <<
QStringLiteral("*.hpp") << QStringLiteral("*.hxx") << QStringLiteral("*.moc");
KateBtBrowserPlugin::KateBtBrowserPlugin(QObject *parent, const QList<QVariant> &)
: KTextEditor::Plugin(parent)
......@@ -58,7 +58,7 @@ KateBtBrowserPlugin::KateBtBrowserPlugin(QObject *parent, const QList<QVariant>
{
s_self = this;
db.loadFromFile(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QLatin1String("/katebtbrowser/backtracedatabase.db"));
+ QStringLiteral("/katebtbrowser/backtracedatabase.db"));
}
KateBtBrowserPlugin::~KateBtBrowserPlugin()
......@@ -69,9 +69,9 @@ KateBtBrowserPlugin::~KateBtBrowserPlugin()
}
const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QLatin1String("/katebtbrowser");
+ QStringLiteral("/katebtbrowser");
QDir().mkpath(path);
db.saveToFile(path + QLatin1String("/backtracedatabase.db"));
db.saveToFile(path + QStringLiteral("/backtracedatabase.db"));
s_self = 0;
}
......@@ -142,7 +142,7 @@ QString KateBtBrowserPlugin::configPageFullName(int number) const
QIcon KateBtBrowserPlugin::configPageIcon(int) const
{
return QIcon::fromTheme(QLatin1String("kbugbuster"));
return QIcon::fromTheme(QStringLiteral("kbugbuster"));
}
......@@ -154,9 +154,9 @@ KateBtBrowserPluginView::KateBtBrowserPluginView(KateBtBrowserPlugin *plugin, KT
{
// init console
QWidget *toolview = mainWindow->createToolView(plugin,
QLatin1String("kate_private_plugin_katebacktracebrowserplugin"),
QStringLiteral("kate_private_plugin_katebacktracebrowserplugin"),
KTextEditor::MainWindow::Bottom,
QIcon::fromTheme(QLatin1String("kbugbuster")),
QIcon::fromTheme(QStringLiteral("kbugbuster")),
i18n("Backtrace Browser"));
m_widget = new KateBtBrowserWidget(mainWindow, toolview);
......@@ -267,12 +267,12 @@ void KateBtBrowserWidget::itemActivated(QTreeWidgetItem *item, int column)
// if not absolute path + exists, try to find with index
if (!QFile::exists(path)) {
// try to match the backtrace forms ".*/foo/bar.txt" and "foo/bar.txt"
static QRegExp rx1(QLatin1String("/([^/]+)/([^/]+)$"));
static QRegExp rx1(QStringLiteral("/([^/]+)/([^/]+)$"));
int idx = rx1.indexIn(file);
if (idx != -1) {
file = rx1.cap(1) + QLatin1Char('/') + rx1.cap(2);
} else {
static QRegExp rx2(QLatin1String("([^/]+)/([^/]+)$"));
static QRegExp rx2(QStringLiteral("([^/]+)/([^/]+)$"));
idx = rx2.indexIn(file);
if (idx != -1) {
// file is of correct form
......@@ -354,13 +354,13 @@ void KateBtConfigWidget::reset()
KConfigGroup cg(KSharedConfig::openConfig(), "backtracebrowser");
lstFolders->clear();
lstFolders->addItems(cg.readEntry("search-folders", QStringList()));
edtExtensions->setText(cg.readEntry("file-extensions", fileExtensions).join(QLatin1String(" ")));
edtExtensions->setText(cg.readEntry("file-extensions", fileExtensions).join(QStringLiteral(" ")));
}
void KateBtConfigWidget::defaults()
{
lstFolders->clear();
edtExtensions->setText(fileExtensions.join(QLatin1String(" ")));
edtExtensions->setText(fileExtensions.join(QStringLiteral(" ")));
m_changed = true;
}
......
......@@ -60,7 +60,7 @@ void FolderFilesList::generateList(const QString &folder,
m_types = types.split(QLatin1Char(','), QString::SkipEmptyParts);
if (m_types.isEmpty()) {
m_types << QLatin1String("*");
m_types << QStringLiteral("*");
}
QStringList tmpExcludes = excludes.split(QLatin1Char(','));
......
......@@ -61,7 +61,7 @@ void SearchDiskFiles::run()
emit searching(fileName);
}
if (m_regExp.pattern().contains(QLatin1String("\\n"))) {
if (m_regExp.pattern().contains(QStringLiteral("\\n"))) {
searchMultiLineRegExp(fileName);
}
else {
......@@ -136,10 +136,10 @@ void SearchDiskFiles::searchMultiLineRegExp(const QString &fileName)
lineStart << i+1;
}
}
if (tmpRegExp.pattern().endsWith(QLatin1String("$"))) {
if (tmpRegExp.pattern().endsWith(QStringLiteral("$"))) {
fullDoc += QLatin1Char('\n');
QString newPatern = tmpRegExp.pattern();
newPatern.replace(QLatin1String("$"), QLatin1String("(?=\\n)"));
newPatern.replace(QStringLiteral("$"), QStringLiteral("(?=\\n)"));
tmpRegExp.setPattern(newPatern);
}
......
This diff is collapsed.
......@@ -151,18 +151,18 @@ void ReplaceMatches::doReplaceNextMatch()
}
QString replaceText = m_replaceText;
replaceText.replace(QLatin1String("\\\\"), QLatin1String("¤Search&Replace¤"));
replaceText.replace(QStringLiteral("\\\\"), QStringLiteral("¤Search&Replace¤"));
for (int j=1; j<=m_regExp.captureCount(); j++) {
replaceText.replace(QString::fromLatin1("\\%1").arg(j), m_regExp.cap(j));
}
replaceText.replace(QLatin1String("\\n"), QLatin1String("\n"));
replaceText.replace(QLatin1String("¤Search&Replace¤"), QLatin1String("\\\\"));
replaceText.replace(QStringLiteral("\\n"), QStringLiteral("\n"));
replaceText.replace(QStringLiteral("¤Search&Replace¤"), QStringLiteral("\\\\"));
rTexts << replaceText;
replaceText.replace(QLatin1Char('\n'), QLatin1String("\\n"));
replaceText.replace(QLatin1Char('\n'), QStringLiteral("\\n"));
QString html = item->data(0, PreMatchRole).toString();
html += QLatin1String("<i><s>") + item->data(0, MatchRole).toString() + QLatin1String("</s></i> ");
html += QLatin1String("<b>") + replaceText + QLatin1String("</b>");
html += QStringLiteral("<i><s>") + item->data(0, MatchRole).toString() + QStringLiteral("</s></i> ");
html += QStringLiteral("<b>") + replaceText + QStringLiteral("</b>");
html += item->data(0, PostMatchRole).toString();
item->setData(0, Qt::DisplayRole, i18n("Line: <b>%1</b>: %2",line+1, html));
......
......@@ -82,7 +82,7 @@ int SearchOpenFiles::searchOpenFile(KTextEditor::Document *doc, const QRegExp &r
emit searching(doc->url().toString());
}
if (regExp.pattern().contains(QLatin1String("\\n"))) {
if (regExp.pattern().contains(QStringLiteral("\\n"))) {
return searchMultiLineRegExp(doc, regExp, startLine);
}
......@@ -128,7 +128,7 @@ int SearchOpenFiles::searchMultiLineRegExp(KTextEditor::Document *doc, const QRe
m_fullDoc += doc->line(i) + QLatin1Char('\n');
m_lineStart << m_fullDoc.size();
}
if (!regExp.pattern().endsWith(QLatin1String("$"))) {
if (!regExp.pattern().endsWith(QStringLiteral("$"))) {
// if regExp ends with '$' leave the extra newline at the end as
// '$' will be replaced with (?=\\n), which needs the extra newline
m_fullDoc.remove(m_fullDoc.size()-1, 1);
......@@ -144,9 +144,9 @@ int SearchOpenFiles::searchMultiLineRegExp(KTextEditor::Document *doc, const QRe
}
}
if (regExp.pattern().endsWith(QLatin1String("$"))) {
if (regExp.pattern().endsWith(QStringLiteral("$"))) {
QString newPatern = tmpRegExp.pattern();
newPatern.replace(QLatin1String("$"), QLatin1String("(?=\\n)"));
newPatern.replace(QStringLiteral("$"), QStringLiteral("(?=\\n)"));
tmpRegExp.setPattern(newPatern);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment