[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kregexpeditor] src: Use nullptr
From: Montel Laurent <null () kde ! org>
Date: 2017-05-31 4:49:57
Message-ID: E1dFva1-0005BO-B6 () code ! kde ! org
[Download RAW message or body]
Git commit 7f28d3caad3b64ac79cd6f263f7e7d1ef77bc844 by Montel Laurent.
Committed on 31/05/2017 at 04:49.
Pushed by mlaurent into branch 'master'.
Use nullptr
M +1 -1 src/KMultiFormListBox/kmultiformlistbox-windowed.cpp
M +2 -2 src/emacsregexpconverter.cpp
M +1 -1 src/kregexpeditorprivate.cpp
M +1 -1 src/qregexpparser.y
M +2 -2 src/regexp.cpp
M +15 -14 src/regexpbuttons.cpp
M +1 -1 src/regexpbuttons.h
M +1 -1 src/regexpconverter.cpp
M +2 -2 src/repeatregexp.cpp
M +1 -1 src/textrangeregexp.cpp
M +1 -1 src/textregexp.cpp
M +4 -4 src/widgetfactory.cpp
https://commits.kde.org/kregexpeditor/7f28d3caad3b64ac79cd6f263f7e7d1ef77bc844
diff --git a/src/KMultiFormListBox/kmultiformlistbox-windowed.cpp \
b/src/KMultiFormListBox/kmultiformlistbox-windowed.cpp index 15a0b3b..47f3ca2 100644
--- a/src/KMultiFormListBox/kmultiformlistbox-windowed.cpp
+++ b/src/KMultiFormListBox/kmultiformlistbox-windowed.cpp
@@ -157,7 +157,7 @@ void KMultiFormListBoxWindowed::slotDeleteEntry()
WindowListboxItem *item = selected();
if (item) {
int answer
- = KMessageBox::warningContinueCancel(0, i18n("Delete item \"%1\"?", \
item->text()), i18n("Delete Item"), KStandardGuiItem::del()); + = \
KMessageBox::warningContinueCancel(nullptr, i18n("Delete item \"%1\"?", \
item->text()), i18n("Delete Item"), KStandardGuiItem::del()); if (answer == \
KMessageBox::Continue) { delete item;
slotUpdateButtonState();
diff --git a/src/emacsregexpconverter.cpp b/src/emacsregexpconverter.cpp
index 5c194bb..37cc2be 100644
--- a/src/emacsregexpconverter.cpp
+++ b/src/emacsregexpconverter.cpp
@@ -75,7 +75,7 @@ QString EmacsRegExpConverter::toString(LookAheadRegExp * \
/*regexp*/, bool /*mark {
static bool haveWarned = false;
if (!haveWarned) {
- KMessageBox::sorry(0, i18n("Look ahead regular expressions not supported in \
Emacs style")); + KMessageBox::sorry(nullptr, i18n("Look ahead regular \
expressions not supported in Emacs style")); haveWarned = true;
}
@@ -179,7 +179,7 @@ QString EmacsRegExpConverter::toString(PositionRegExp *regexp, \
bool /*markSelect case PositionRegExp::WORDBOUNDARY:
case PositionRegExp::NONWORDBOUNDARY:
if (!haveWarned) {
- KMessageBox::sorry(0, i18n("Word boundary and non word boundary is not \
supported in Emacs syntax")); + KMessageBox::sorry(nullptr, i18n("Word \
boundary and non word boundary is not supported in Emacs syntax")); haveWarned = \
true; return QString::fromLatin1("");
}
diff --git a/src/kregexpeditorprivate.cpp b/src/kregexpeditorprivate.cpp
index 8583d66..072c492 100644
--- a/src/kregexpeditorprivate.cpp
+++ b/src/kregexpeditorprivate.cpp
@@ -379,7 +379,7 @@ void KRegExpEditorPrivate::setVerifyText(const QString &fileName)
_autoVerify = false;
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {
- KMessageBox::sorry(0, i18n("Could not open file '%1' for reading", \
fileName)); + KMessageBox::sorry(nullptr, i18n("Could not open file '%1' for \
reading", fileName)); } else {
QTextStream s(&file);
QString txt = s.readAll();
diff --git a/src/qregexpparser.y b/src/qregexpparser.y
index dcd64f1..b950eda 100644
--- a/src/qregexpparser.y
+++ b/src/qregexpparser.y
@@ -202,7 +202,7 @@ RegExp* parseQtRegExp( const QString &qstr, bool* ok ) {
(void) yyparse( scanner, &context );
scannerDestroy( scanner );
foreach ( const QString &match, context.backrefs ) {
- KMessageBox::information(0,i18n("<p>Back reference regular expressions are not \
supported.</p>" + KMessageBox::information(nullptr,i18n("<p>Back reference regular \
expressions are not supported.</p>"
"<p><tt>\\1</tt>, <tt>\\2</tt>, ... are <i>back \
references</i>, meaning they " "refer to previous matches. "
"Unfortunately this is not supported in the \
current version of this editor.</p>"
diff --git a/src/regexp.cpp b/src/regexp.cpp
index b53043a..e678829 100644
--- a/src/regexp.cpp
+++ b/src/regexp.cpp
@@ -22,7 +22,7 @@
#include "kregexpeditorgui.h"
#include "errormap.h"
-RegExp::RegExp(bool selected) : _parent(0)
+RegExp::RegExp(bool selected) : _parent(nullptr)
, _destructing(false)
, _selected(selected)
{
@@ -36,7 +36,7 @@ RegExp::~RegExp()
if (_parent) {
_parent->removeChild(this);
}
- _parent = 0;
+ _parent = nullptr;
}
void RegExp::addChild(RegExp *child)
diff --git a/src/regexpbuttons.cpp b/src/regexpbuttons.cpp
index 3608acb..ed8bfbc 100644
--- a/src/regexpbuttons.cpp
+++ b/src/regexpbuttons.cpp
@@ -61,22 +61,22 @@ RegExpButtons::RegExpButtons(QWidget *parent, const QString \
&name) // Insert buttons.
DoubleClickButton *but;
- but = insert(TEXT, "text", i18n("Text"),
+ but = insert(TEXT, QStringLiteral("text"), i18n("Text"),
i18n("<qt>This will insert a text field, where you may write text. \
The text you write will "
"be matched literally. (i.e. you do not need to escape any \
characters)</qt>")); addWidget(but);
- but = insert(CHARSET, "characters", i18n("A single character specified in a \
range"), + but = insert(CHARSET, QStringLiteral("characters"), i18n("A single \
character specified in a range"),
i18n("<p>This will match a single character from a predefined \
range.</p>"
"<p>When you insert this widget a dialog box will appear, \
which lets you specify "
"which characters this <i>regexp item</i> will match.</p>"));
addWidget(but);
- but = insert(DOT, "anychar", i18n("Any character"),
+ but = insert(DOT, QStringLiteral("anychar"), i18n("Any character"),
i18n("<qt>This will match any single character</qt>"));
addWidget(but);
- but = insert(REPEAT, "repeat", i18n("Repeated content"),
+ but = insert(REPEAT, QStringLiteral("repeat"), i18n("Repeated content"),
i18n("<qt>This <i>regexp item</i> will repeat the <i>regexp \
items</i> it surrounds " "a specified number of times.<br />"
"The number of times to repeat may be specified using ranges; \
e.g. it could be specified " @@ -89,13 +89,13 @@ RegExpButtons::RegExpButtons(QWidget \
*parent, const QString &name) "etc.</qt>"));
addWidget(but);
- but = insert(ALTN, "altn", i18n("Alternatives"),
+ but = insert(ALTN, QStringLiteral("altn"), i18n("Alternatives"),
i18n("<p>This <i>regexp item</i> will match any of its \
alternatives.</p>"
"<p>Alternatives are specified by placing <i>regexp items</i> \
on top of " "each other inside this widget.</p>"));
addWidget(but);
- but = insert(COMPOUND, "compound", i18n("Compound regexp"),
+ but = insert(COMPOUND, QStringLiteral("compound"), i18n("Compound regexp"),
i18n("<qt>This <i>regexp item</i> serves two purposes:"
"<ul><li>It makes it possible for you to collapse a huge \
<i>regexp item</i> into "
"a small box. This makes it easier for you to get an overview \
of large " @@ -103,39 +103,40 @@ RegExpButtons::RegExpButtons(QWidget *parent, const \
QString &name)
"that you perhaps do not care about the inner workings \
of.</qt>")); addWidget(but);
- but = insert(BEGLINE, "begline", i18n("Beginning of line"),
+ but = insert(BEGLINE, QStringLiteral("begline"), i18n("Beginning of line"),
i18n("<qt>This will match the beginning of a line.</qt>"));
addWidget(but);
- but = insert(ENDLINE, "endline", i18n("End of line"),
+ but = insert(ENDLINE, QStringLiteral("endline"), i18n("End of line"),
i18n("<qt>This will match the end of a line.</qt>"));
addWidget(but);
- _wordBoundary = insert(WORDBOUNDARY, "wordboundary", i18n("Word boundary"),
+ _wordBoundary = insert(WORDBOUNDARY, QStringLiteral("wordboundary"), i18n("Word \
boundary"),
i18n("<qt>This asserts a word boundary (This part does \
not actually match any characters)</qt>")); addWidget(_wordBoundary);
- _nonWordBoundary = insert(NONWORDBOUNDARY, "nonwordboundary", i18n("Non Word \
boundary"), + _nonWordBoundary = insert(NONWORDBOUNDARY, \
QStringLiteral("nonwordboundary"), i18n("Non Word boundary"),
i18n("<qt>This asserts a non-word boundary "
"(This part does not actually match any \
characters)</qt>")); addWidget(_nonWordBoundary);
- _posLookAhead = insert(POSLOOKAHEAD, "poslookahead", i18n("Positive Look \
Ahead"), + _posLookAhead = insert(POSLOOKAHEAD, QStringLiteral("poslookahead"), \
i18n("Positive Look Ahead"),
i18n("<qt>This asserts a regular expression (This part \
does not actually match any characters). "
"You can only use this at the end of a regular \
expression.</qt>")); addWidget(_posLookAhead);
- _negLookAhead = insert(NEGLOOKAHEAD, "neglookahead", i18n("Negative Look \
Ahead"), + _negLookAhead = insert(NEGLOOKAHEAD, QStringLiteral("neglookahead"), \
i18n("Negative Look Ahead"),
i18n("<qt>This asserts a regular expression that must not \
match "
"(This part does not actually match any characters). \
"
"You can only use this at the end of a regular \
expression.</qt>")); addWidget(_negLookAhead);
}
-DoubleClickButton *RegExpButtons::insert(RegExpType tp, const char *name, const \
QString &tooltip, const QString &whatsthis) +DoubleClickButton \
*RegExpButtons::insert(RegExpType tp, const QString &name, const QString &tooltip, \
const QString &whatsthis) {
QPixmap pix
- = KIconLoader::global()->loadIcon(QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QString::fromLatin1("kregexpeditor/pics/") + QString::fromLatin1(name) + \
QString::fromLatin1( + = \
KIconLoader::global()->loadIcon(QStandardPaths::locate(QStandardPaths::GenericDataLocation,
+ \
QString::fromLatin1("kregexpeditor/pics/") + name + \
QString::fromLatin1(
".png")), \
KIconLoader::Toolbar);
DoubleClickButton *but = new DoubleClickButton(pix, this, \
QStringLiteral("RegExpButtons::but"));
diff --git a/src/regexpbuttons.h b/src/regexpbuttons.h
index 7b33a92..e76b1e4 100644
--- a/src/regexpbuttons.h
+++ b/src/regexpbuttons.h
@@ -36,7 +36,7 @@ public:
void setFeatures(int features);
protected:
- DoubleClickButton *insert(RegExpType tp, const char *file, const QString \
&tooltip, const QString &whatsthis); + DoubleClickButton *insert(RegExpType tp, \
const QString &file, const QString &tooltip, const QString &whatsthis);
public slots:
void slotSelectNewAction();
diff --git a/src/regexpconverter.cpp b/src/regexpconverter.cpp
index 06e56e9..fdb0eff 100644
--- a/src/regexpconverter.cpp
+++ b/src/regexpconverter.cpp
@@ -31,7 +31,7 @@
#include "textregexp.h"
#include "regexphighlighter.h"
-RegExpConverter *RegExpConverter::_current = 0;
+RegExpConverter *RegExpConverter::_current = nullptr;
RegExp *RegExpConverter::parse(const QString &, bool *ok)
{
*ok = false;
diff --git a/src/repeatregexp.cpp b/src/repeatregexp.cpp
index 3df98f5..194e1ec 100644
--- a/src/repeatregexp.cpp
+++ b/src/repeatregexp.cpp
@@ -54,7 +54,7 @@ bool RepeatRegExp::load(QDomElement top, const QString &version)
bool ok;
_lower = lower.toInt(&ok);
if (!ok) {
- KMessageBox::sorry(0, i18n("<p>Value for attribute <b>%1</b> was not an \
integer for element " + KMessageBox::sorry(nullptr, i18n("<p>Value for \
attribute <b>%1</b> was not an integer for element "
"<b>%2</b></p><p>It contained the value \
<b>%3</b></p>",
QString::fromLatin1("lower"), \
QString::fromLatin1("Repeat"), lower), i18n("Error While Loading From XML File"));
@@ -62,7 +62,7 @@ bool RepeatRegExp::load(QDomElement top, const QString &version)
}
_upper = upper.toInt(&ok);
if (!ok) {
- KMessageBox::sorry(0, i18n("<p>Value for attribute <b>%1</b> was not an \
integer for element " + KMessageBox::sorry(nullptr, i18n("<p>Value for \
attribute <b>%1</b> was not an integer for element "
"<b>%2</b></p><p>It contained the value \
<b>%3</b></p>",
QString::fromLatin1("upper"), \
QString::fromLatin1("Repeat"), upper), i18n("Error While Loading From XML File"));
diff --git a/src/textrangeregexp.cpp b/src/textrangeregexp.cpp
index e994018..fea738c 100644
--- a/src/textrangeregexp.cpp
+++ b/src/textrangeregexp.cpp
@@ -142,7 +142,7 @@ bool TextRangeRegExp::load(QDomElement top, const QString & \
/*version*/) QString to = child.attribute(QString::fromLocal8Bit("to"));
addRange(from, to);
} else {
- KMessageBox::sorry(0, i18n("<p>Invalid sub element to element \
<b>TextRange</b>. Tag was <b>%1</b></p>", child.tagName()), + \
KMessageBox::sorry(nullptr, i18n("<p>Invalid sub element to element <b>TextRange</b>. \
Tag was <b>%1</b></p>", child.tagName()),
i18n("Error While Loading From XML File"));
return false;
}
diff --git a/src/textregexp.cpp b/src/textregexp.cpp
index fb06231..582fbac 100644
--- a/src/textregexp.cpp
+++ b/src/textregexp.cpp
@@ -50,7 +50,7 @@ bool TextRegExp::load(QDomElement top, const QString & /*version*/)
if (top.hasChildNodes()) {
QDomNode child = top.firstChild();
if (!child.isText()) {
- KMessageBox::sorry(0, i18n("<p>Element <b>Text</b> did not contain any \
textual data.</p>"), + KMessageBox::sorry(nullptr, i18n("<p>Element \
<b>Text</b> did not contain any textual data.</p>"),
i18n("Error While Loading From XML File"));
return false;
}
diff --git a/src/widgetfactory.cpp b/src/widgetfactory.cpp
index 8c298f1..f8d5569 100644
--- a/src/widgetfactory.cpp
+++ b/src/widgetfactory.cpp
@@ -169,7 +169,7 @@ RegExp *WidgetFactory::createRegExp(QDomElement node, const \
QString &version) } else if (tag == QString::fromLocal8Bit("Repeat")) {
regexp = new RepeatRegExp(false);
} else {
- KMessageBox::sorry(0, i18n("<p>Unknown tag while reading XML. Tag was \
<b>%1</b></p>", tag), + KMessageBox::sorry(nullptr, i18n("<p>Unknown tag while \
reading XML. Tag was <b>%1</b></p>", tag), i18n("Error While Loading From XML \
File"));
return nullptr;
@@ -194,20 +194,20 @@ RegExp *WidgetFactory::createRegExp(const QString &str)
if (!ok) {
qDebug() << error << "at line" << errorLine << "xml was:";
qDebug() << str;
- KMessageBox::sorry(0, i18n("Error while loading regular expression from \
XML.") + QLatin1Char('\n') + error, + KMessageBox::sorry(nullptr, i18n("Error \
while loading regular expression from XML.") + QLatin1Char('\n') + \
error,
i18n("Error While Loading Regular Expression From XML"));
}
// Read the RegularExpression element, and extract the version.
QDomElement top = doc.documentElement();
if (!(top.tagName() == QString::fromLocal8Bit("RegularExpression"))) {
- KMessageBox::sorry(0, i18n("<p>XML file did not contain a <b>%1</b> \
tag.</p>", QString::fromLatin1("RegularExpression")), + \
KMessageBox::sorry(nullptr, i18n("<p>XML file did not contain a <b>%1</b> tag.</p>", \
QString::fromLatin1("RegularExpression")), i18n("Error While Loading From XML \
File")); }
QString version = top.attribute(QString::fromLocal8Bit("version"), \
KRegExpEditorGUI::version); QDomNode child = top.firstChild();
if (!child.isElement()) {
- KMessageBox::sorry(0, i18n("<p>Error while reading XML file. The element \
just below the tag " + KMessageBox::sorry(nullptr, i18n("<p>Error while \
reading XML file. The element just below the tag "
"<b>%1</b> was not an element.</p>", \
QString::fromLatin1("RegularExpression")), i18n("Error While Loading From XML \
File")); }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic