Commit abb6999b authored by Kevin Funk's avatar Kevin Funk

Modernize: Use nullptr where possible

Reviewers: sitter, broulik

Reviewed By: sitter, broulik

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8309
parent ca0690b1
......@@ -29,7 +29,7 @@ class AboutBugReportingDialog: public QDialog
Q_OBJECT
public:
explicit AboutBugReportingDialog(QWidget * parent = 0);
explicit AboutBugReportingDialog(QWidget * parent = nullptr);
~AboutBugReportingDialog() override;
void showSection(const QString&);
......
......@@ -36,8 +36,8 @@
BacktraceGenerator::BacktraceGenerator(const Debugger & debugger, QObject *parent)
: QObject(parent),
m_debugger(debugger), m_proc(NULL),
m_temp(NULL), m_state(NotLoaded)
m_debugger(debugger), m_proc(nullptr),
m_temp(nullptr), m_state(NotLoaded)
{
m_parser = BacktraceParser::newParser(m_debugger.codeName(), this);
m_parser->connectToGenerator(this);
......@@ -66,7 +66,7 @@ BacktraceGenerator::~BacktraceGenerator()
bool BacktraceGenerator::start()
{
//they should always be null before entering this function.
Q_ASSERT(m_proc == NULL && m_temp == NULL);
Q_ASSERT(m_proc && m_temp);
m_parsedBacktrace.clear();
m_state = Loading;
......@@ -103,8 +103,8 @@ bool BacktraceGenerator::start()
//we mustn't keep these around...
m_proc->deleteLater();
m_temp->deleteLater();
m_proc = NULL;
m_temp = NULL;
m_proc = nullptr;
m_temp = nullptr;
m_state = FailedToStart;
emit failedToStart();
......@@ -133,8 +133,8 @@ void BacktraceGenerator::slotProcessExited(int exitCode, QProcess::ExitStatus ex
//these are useless now
m_proc->deleteLater();
m_temp->deleteLater();
m_proc = NULL;
m_temp = NULL;
m_proc = nullptr;
m_temp = nullptr;
//mark the end of the backtrace for the parser
emit newLine(QString());
......
......@@ -42,7 +42,7 @@ BacktraceWidget::BacktraceWidget(BacktraceGenerator *generator, QWidget *parent,
bool showToggleBacktrace) :
QWidget(parent),
m_btGenerator(generator),
m_highlighter(0)
m_highlighter(nullptr)
{
ui.setupUi(this);
......@@ -123,7 +123,7 @@ void BacktraceWidget::setAsLoading()
{
//remove the syntax highlighter
delete m_highlighter;
m_highlighter = 0;
m_highlighter = nullptr;
//Set the widget as loading and disable all the action buttons
ui.m_backtraceEdit->setText(i18nc("@info:status", "Loading..."));
......
......@@ -34,7 +34,7 @@ class BacktraceWidget: public QWidget
Q_OBJECT
public:
explicit BacktraceWidget(BacktraceGenerator *generator, QWidget *parent = 0,
explicit BacktraceWidget(BacktraceGenerator *generator, QWidget *parent = nullptr,
bool showToggleBacktrace = false);
bool canInstallDebugPackages() const;
......
......@@ -60,7 +60,7 @@ BugzillaManager::BugzillaManager(const QString &bugTrackerUrl, QObject *parent)
: QObject(parent)
, m_bugTrackerUrl(bugTrackerUrl)
, m_logged(false)
, m_searchJob(0)
, m_searchJob(nullptr)
{
m_xmlRpcClient = new KXmlRpc::Client(QUrl(m_bugTrackerUrl + "xmlrpc.cgi"), this);
m_xmlRpcClient->setUserAgent(QLatin1String("DrKonqi"));
......@@ -296,7 +296,7 @@ void BugzillaManager::stopCurrentSearch()
if (m_searchJob) { //Stop previous searchJob
m_searchJob->disconnect();
m_searchJob->kill();
m_searchJob = 0;
m_searchJob = nullptr;
}
}
//END Misc methods
......@@ -344,7 +344,7 @@ void BugzillaManager::searchBugsJobFinished(KJob * job)
emit searchError(job->errorString());
}
m_searchJob = 0;
m_searchJob = nullptr;
}
static inline Component buildComponent(const QVariantMap& map)
......
......@@ -359,7 +359,7 @@ class BugzillaManager : public QObject
public:
// Note: it expect the bugTrackerUrl parameter to contain the trailing slash.
// so it should be "https://bugs.kde.org/", not "https://bugs.kde.org"
explicit BugzillaManager(const QString &bugTrackerUrl, QObject *parent = 0);
explicit BugzillaManager(const QString &bugTrackerUrl, QObject *parent = nullptr);
/* Login methods */
void tryLogin(const QString&, const QString&);
......@@ -368,7 +368,7 @@ public:
QString getUsername() const;
/* Bugzilla Action methods */
void fetchBugReport(int, QObject * jobOwner = 0);
void fetchBugReport(int, QObject * jobOwner = nullptr);
void searchBugs(const QStringList & products, const QString & severity,
const QString & date_start, const QString & date_end , QString comment);
......
......@@ -68,7 +68,7 @@ class DuplicateFinderJob : public KJob
BugReport::Resolution resolution;
};
DuplicateFinderJob(const QList<int> &bugIds, BugzillaManager *manager, QObject *parent = 0);
DuplicateFinderJob(const QList<int> &bugIds, BugzillaManager *manager, QObject *parent = nullptr);
~DuplicateFinderJob() override;
void start() override;
......
......@@ -34,7 +34,7 @@ class ParseBugBacktraces : QObject
{
Q_OBJECT
public:
explicit ParseBugBacktraces(const BugReport &bug, QObject *parent = 0);
explicit ParseBugBacktraces(const BugReport &bug, QObject *parent = nullptr);
void parse();
......
......@@ -32,7 +32,7 @@ class ProductMapping: public QObject
{
Q_OBJECT
public:
explicit ProductMapping(const CrashedApplication *, BugzillaManager *, QObject * parent = 0);
explicit ProductMapping(const CrashedApplication *, BugzillaManager *, QObject * parent = nullptr);
QString bugzillaProduct() const;
QString bugzillaComponent() const;
......
......@@ -42,7 +42,7 @@ static const char KDE_BUGZILLA_DESCRIPTION[] = I18N_NOOP("the KDE Bug Tracking S
ReportAssistantDialog::ReportAssistantDialog(QWidget * parent) :
KAssistantDialog(parent),
m_aboutBugReportingDialog(0),
m_aboutBugReportingDialog(nullptr),
m_reportInterface(new ReportInterface(this)),
m_canClose(false)
{
......
......@@ -34,7 +34,7 @@ class ReportAssistantDialog: public KAssistantDialog
Q_OBJECT
public:
explicit ReportAssistantDialog(QWidget * parent = 0);
explicit ReportAssistantDialog(QWidget * parent = nullptr);
~ReportAssistantDialog() override;
ReportInterface *reportInterface() const {
......
......@@ -67,7 +67,7 @@ static const char konquerorKWalletEntryPassword[] = "Bugzilla_password";
BugzillaLoginPage::BugzillaLoginPage(ReportAssistantDialog * parent) :
ReportAssistantPage(parent),
m_wallet(0), m_walletWasOpenedBefore(false),
m_wallet(nullptr), m_walletWasOpenedBefore(false),
m_bugzillaVersionFound(false)
{
connect(bugzillaManager(), &BugzillaManager::bugzillaVersionFound, this, &BugzillaLoginPage::bugzillaVersionFound);
......@@ -683,7 +683,7 @@ void BugzillaPreviewPage::aboutToShow()
BugzillaSendPage::BugzillaSendPage(ReportAssistantDialog * parent)
: ReportAssistantPage(parent),
m_contentsDialog(0)
m_contentsDialog(nullptr)
{
connect(reportInterface(), &ReportInterface::reportSent, this, &BugzillaSendPage::sent);
connect(reportInterface(), &ReportInterface::sendReportError, this, &BugzillaSendPage::sendError);
......
......@@ -114,7 +114,7 @@ class BugzillaReportInformationDialog : public QDialog
Q_OBJECT
public:
explicit BugzillaReportInformationDialog(BugzillaDuplicatesPage*parent=0);
explicit BugzillaReportInformationDialog(BugzillaDuplicatesPage*parent=nullptr);
~BugzillaReportInformationDialog() override;
void showBugReport(int bugNumber, bool relatedButtonEnabled = true);
......
......@@ -37,7 +37,7 @@ public:
enum Reproducible { ReproducibleUnsure, ReproducibleNever,
ReproducibleSometimes, ReproducibleEverytime };
explicit ReportInterface(QObject *parent = 0);
explicit ReportInterface(QObject *parent = nullptr);
void setBugAwarenessPageData(bool, Reproducible, bool, bool, bool);
bool isBugAwarenessPageDataUseful() const;
......
......@@ -84,18 +84,18 @@ int CrashedApplication::signalNumber() const
QString CrashedApplication::signalName() const
{
#if defined(HAVE_STRSIGNAL) && defined(Q_OS_UNIX)
const char * oldLocale = std::setlocale(LC_MESSAGES, NULL);
const char * oldLocale = std::setlocale(LC_MESSAGES, nullptr);
char * savedLocale;
if (oldLocale) {
savedLocale = strdup(oldLocale);
} else {
savedLocale = NULL;
savedLocale = nullptr;
}
std::setlocale(LC_MESSAGES, "C");
const char *name = strsignal(m_signalNumber);
std::setlocale(LC_MESSAGES, savedLocale);
std::free(savedLocale);
return QString::fromLocal8Bit(name != NULL ? name : "Unknown");
return QString::fromLocal8Bit(name ? name : "Unknown");
#else
switch (m_signalNumber) {
# if defined(Q_OS_UNIX)
......
......@@ -74,7 +74,7 @@ Q_SIGNALS:
protected:
friend class KCrashBackend;
CrashedApplication(QObject *parent = 0);
CrashedApplication(QObject *parent = nullptr);
int m_pid;
int m_signalNumber;
......
......@@ -29,7 +29,7 @@ class AbstractDebuggerLauncher : public QObject
Q_OBJECT
Q_PROPERTY(QString name READ name)
public:
explicit AbstractDebuggerLauncher(DebuggerManager *parent = 0) : QObject(parent) {}
explicit AbstractDebuggerLauncher(DebuggerManager *parent = nullptr) : QObject(parent) {}
virtual QString name() const = 0;
public Q_SLOTS:
......@@ -45,7 +45,7 @@ class DefaultDebuggerLauncher : public AbstractDebuggerLauncher
{
Q_OBJECT
public:
explicit DefaultDebuggerLauncher(const Debugger & debugger, DebuggerManager *parent = 0);
explicit DefaultDebuggerLauncher(const Debugger & debugger, DebuggerManager *parent = nullptr);
QString name() const override;
public Q_SLOTS:
......@@ -79,7 +79,7 @@ class DBusOldInterfaceLauncher : public AbstractDebuggerLauncher
Q_OBJECT
friend class DBusOldInterfaceAdaptor;
public:
explicit DBusOldInterfaceLauncher(DebuggerManager *parent = 0);
explicit DBusOldInterfaceLauncher(DebuggerManager *parent = nullptr);
QString name() const override;
public Q_SLOTS:
......
......@@ -29,7 +29,7 @@ class DebuggerManager : public QObject
public:
DebuggerManager(const Debugger & internalDebugger,
const QList<Debugger> & externalDebuggers,
QObject *parent = 0);
QObject *parent = nullptr);
~DebuggerManager() override;
bool debuggerIsRunning() const;
......
......@@ -30,7 +30,7 @@
#include "crashedapplication.h"
DebugPackageInstaller::DebugPackageInstaller(QObject *parent)
: QObject(parent), m_installerProcess(0), m_progressDialog(0)
: QObject(parent), m_installerProcess(nullptr), m_progressDialog(nullptr)
{
m_executablePath = QStandardPaths::findExecutable(DEBUG_PACKAGE_INSTALLER_NAME); //defined from CMakeLists.txt
}
......@@ -71,7 +71,7 @@ void DebugPackageInstaller::installDebugPackages()
void DebugPackageInstaller::progressDialogCanceled()
{
m_progressDialog->deleteLater();
m_progressDialog = 0;
m_progressDialog = nullptr;
if (m_installerProcess) {
if (m_installerProcess->state() == QProcess::Running) {
......@@ -81,7 +81,7 @@ void DebugPackageInstaller::progressDialogCanceled()
disconnect(m_installerProcess, QOverload<int, QProcess::ExitStatus>::of(&KProcess::finished),
m_installerProcess, &KProcess::deleteLater);
}
m_installerProcess = 0;
m_installerProcess = nullptr;
}
emit canceled();
......@@ -117,8 +117,8 @@ void DebugPackageInstaller::processFinished(int exitCode, QProcess::ExitStatus)
m_progressDialog->reject();
delete m_progressDialog;
m_progressDialog = 0;
m_progressDialog = nullptr;
delete m_installerProcess;
m_installerProcess = 0;
m_installerProcess = nullptr;
}
......@@ -33,7 +33,7 @@ class DebugPackageInstaller: public QObject
ResultSymbolsNotFound = 2, ResultCanceled = 3 };
public:
explicit DebugPackageInstaller(QObject *parent = 0);
explicit DebugPackageInstaller(QObject *parent = nullptr);
bool canInstallDebugPackages() const;
void setMissingLibraries(const QStringList &);
void installDebugPackages();
......
......@@ -23,7 +23,7 @@ class DetachedProcessMonitor : public QObject
{
Q_OBJECT
public:
explicit DetachedProcessMonitor(QObject *parent = 0);
explicit DetachedProcessMonitor(QObject *parent = nullptr);
void startMonitoring(int pid);
Q_SIGNALS:
......
......@@ -80,7 +80,7 @@ DrKonqi::~DrKonqi()
//static
DrKonqi *DrKonqi::instance()
{
static DrKonqi *drKonqiInstance = NULL;
static DrKonqi *drKonqiInstance = nullptr;
if (!drKonqiInstance) {
drKonqiInstance = new DrKonqi();
}
......
......@@ -36,7 +36,7 @@ public:
static DebuggerManager *debuggerManager();
static CrashedApplication *crashedApplication();
static void saveReport(const QString & reportText, QWidget *parent = 0);
static void saveReport(const QString & reportText, QWidget *parent = nullptr);
static void setSignal(int signal);
static void setAppName(const QString &appName);
......
......@@ -46,8 +46,8 @@ static QString DRKONQI_REPORT_BUG_URL = KDE_BUGZILLA_URL + QStringLiteral("enter
DrKonqiDialog::DrKonqiDialog(QWidget * parent) :
QDialog(parent),
m_aboutBugReportingDialog(0),
m_backtraceWidget(0)
m_aboutBugReportingDialog(nullptr),
m_backtraceWidget(nullptr)
{
setAttribute(Qt::WA_DeleteOnClose, true);
......
......@@ -38,7 +38,7 @@ class DrKonqiDialog: public QDialog
Q_OBJECT
public:
explicit DrKonqiDialog(QWidget * parent = 0);
explicit DrKonqiDialog(QWidget * parent = nullptr);
~DrKonqiDialog() override;
private Q_SLOTS:
......
......@@ -35,7 +35,7 @@ BacktraceParser *BacktraceParser::newParser(const QString & debuggerName, QObjec
}
}
BacktraceParser::BacktraceParser(QObject *parent) : QObject(parent), d_ptr(NULL) {}
BacktraceParser::BacktraceParser(QObject *parent) : QObject(parent), d_ptr(nullptr) {}
BacktraceParser::~BacktraceParser() { delete d_ptr; }
void BacktraceParser::connectToGenerator(QObject *generator)
......
......@@ -33,7 +33,7 @@ public:
enum Usefulness { InvalidUsefulness, Useless, ProbablyUseless, MayBeUseful, ReallyUseful };
Q_ENUM(Usefulness)
static BacktraceParser *newParser(const QString & debuggerName, QObject *parent = 0);
static BacktraceParser *newParser(const QString & debuggerName, QObject *parent = nullptr);
~BacktraceParser() override;
/*! Connects the parser to the backtrace generator.
......@@ -79,7 +79,7 @@ protected Q_SLOTS:
virtual void newLine(const QString & lineStr) = 0;
protected:
explicit BacktraceParser(QObject *parent = 0);
explicit BacktraceParser(QObject *parent = nullptr);
/*! Subclasses should override to provide their own BacktraceParserPrivate instance */
virtual BacktraceParserPrivate *constructPrivate() const;
......
......@@ -26,7 +26,7 @@ class BacktraceParserGdb : public BacktraceParser
Q_OBJECT
Q_DECLARE_PRIVATE(BacktraceParserGdb)
public:
explicit BacktraceParserGdb(QObject *parent = 0);
explicit BacktraceParserGdb(QObject *parent = nullptr);
QString parsedBacktrace() const override;
QList<BacktraceLine> parsedBacktraceLines() const override;
......
......@@ -25,7 +25,7 @@ class BacktraceParserKdbgwin : public BacktraceParser
Q_OBJECT
Q_DECLARE_PRIVATE(BacktraceParser)
public:
explicit BacktraceParserKdbgwin(QObject *parent = 0);
explicit BacktraceParserKdbgwin(QObject *parent = nullptr);
protected Q_SLOTS:
void newLine(const QString & lineStr) override;
......
......@@ -24,7 +24,7 @@ class BacktraceParserNull : public BacktraceParser
{
Q_OBJECT
public:
explicit BacktraceParserNull(QObject *parent = 0);
explicit BacktraceParserNull(QObject *parent = nullptr);
protected Q_SLOTS:
void newLine(const QString & lineStr) override;
......
......@@ -32,7 +32,7 @@ class StatusWidget: public QStackedWidget
{
Q_OBJECT
public:
explicit StatusWidget(QWidget * parent = 0);
explicit StatusWidget(QWidget * parent = nullptr);
void setBusy(const QString&);
void setIdle(const QString&);
......@@ -63,7 +63,7 @@ class WrapLabel: public QLabel
{
Q_OBJECT
public:
explicit WrapLabel(QWidget * parent = 0) : QLabel(parent){
explicit WrapLabel(QWidget * parent = nullptr) : QLabel(parent){
setWordWrap(true);
}
......
......@@ -26,7 +26,7 @@ class SystemInformation: public QObject
{
Q_OBJECT
public:
explicit SystemInformation(QObject * parent = 0);
explicit SystemInformation(QObject * parent = nullptr);
~SystemInformation() override;
QString bugzillaPlatform() const;
......
......@@ -25,7 +25,7 @@ class BacktraceParserTest : public QObject
{
Q_OBJECT
public:
BacktraceParserTest(QObject *parent = 0);
BacktraceParserTest(QObject *parent = nullptr);
private Q_SLOTS:
void btParserUsefulnessTest_data();
......
......@@ -25,7 +25,7 @@ class FakeBacktraceGenerator : public QObject
{
Q_OBJECT
public:
FakeBacktraceGenerator(QObject *parent = 0) : QObject(parent) {}
FakeBacktraceGenerator(QObject *parent = nullptr) : QObject(parent) {}
void sendData(const QString & filename);
Q_SIGNALS:
......
......@@ -46,7 +46,7 @@ struct SomeStruct
void do_crash()
{
SomeStruct *obj = 0;
SomeStruct *obj = nullptr;
int ret = obj->foo();
printf("result = %d\n", ret);
}
......
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