Commit c564f57e authored by Kevin Funk's avatar Kevin Funk
Browse files

clang-tidy: modernize-use-nullptr run

parent c51b3cc1
......@@ -27,7 +27,7 @@ File::fullPath(const Folder *root /*= 0*/) const
QString path;
if (root == this)
root = 0; //prevent returning empty string when there is something we could return
root = nullptr; //prevent returning empty string when there is something we could return
for (const Folder *d = (Folder*)this; d != root && d; d = d->parent())
path.prepend(d->name());
......
......@@ -41,7 +41,7 @@ public:
friend class Folder;
public:
File(const char *name, FileSize size) : m_parent(0), m_name(qstrdup(name)), m_size(size) {}
File(const char *name, FileSize size) : m_parent(nullptr), m_name(qstrdup(name)), m_size(size) {}
virtual ~File() {
delete [] m_name;
}
......@@ -63,7 +63,7 @@ public:
return false;
}
QString fullPath(const Folder* = 0) const;
QString fullPath(const Folder* = nullptr) const;
QString humanReadableSize() const {
return KFormat().formatByteSize(m_size);
}
......@@ -94,7 +94,7 @@ public:
}
///appends a Folder
void append(Folder *d, const char *name=0)
void append(Folder *d, const char *name=nullptr)
{
if (name) {
delete [] d->m_name;
......
......@@ -76,7 +76,7 @@ HistoryCollection::HistoryCollection(KActionCollection *ac, QObject *parent)
: QObject(parent)
, m_b(new HistoryAction(QIcon::fromTheme(QLatin1String( "go-previous" )), i18nc("Go to the last path viewed", "Back"), ac))
, m_f(new HistoryAction(QIcon::fromTheme(QLatin1String( "go-next" )), i18nc("Go to forward in the history of paths viewed", "Forward"), ac))
, m_receiver(0)
, m_receiver(nullptr)
{
ac->addAction(QLatin1String( "go_back" ), m_b);
ac->addAction(QLatin1String( "go_forward" ), m_f);
......@@ -96,7 +96,7 @@ void HistoryCollection::push(const QUrl& url) //slot
m_receiver->push(url);
}
m_receiver = 0;
m_receiver = nullptr;
}
void HistoryCollection::pop() //slot
......
......@@ -72,7 +72,7 @@ public:
public slots:
void push(const QUrl& url);
void stop() {
m_receiver = 0;
m_receiver = nullptr;
}
signals:
......
......@@ -92,7 +92,7 @@ LocalLister::run()
{
qDebug() << "Scan successfully aborted";
delete tree;
tree = 0;
tree = nullptr;
}
qDebug() << "Emitting signal to cache results ...";
emit branchCompleted(tree);
......@@ -198,7 +198,7 @@ LocalLister::scan(const QByteArray &path, const QByteArray &dirname)
else if (S_ISDIR(statbuf.st_mode)) //folder
{
Folder *d = 0;
Folder *d = nullptr;
QByteArray new_dirname = ent->d_name;
new_path += '/';
......
......@@ -60,7 +60,7 @@ namespace Filelight {
MainWindow::MainWindow()
: KXmlGuiWindow()
, m_histories(0)
, m_histories(nullptr)
, m_summary(nullptr)
, m_map(nullptr)
, m_started(false)
......@@ -179,7 +179,7 @@ void MainWindow::setupActions() //singleton function
action->setText(i18n("Scan Folder"));
action->setIcon(QIcon::fromTheme(QStringLiteral("folder")));
QWidgetAction *locationAction = ac->add<QWidgetAction>(QStringLiteral("location_bar"), 0, 0);
QWidgetAction *locationAction = ac->add<QWidgetAction>(QStringLiteral("location_bar"), nullptr, nullptr);
locationAction->setText(i18n("Location Bar"));
locationAction->setDefaultWidget(m_combo);
......@@ -390,7 +390,7 @@ bool MainWindow::openUrl(const QUrl &u)
else
{
//we don't want to be using the summary screen anymore
if (m_summary != 0)
if (m_summary != nullptr)
m_summary->hide();
m_stateWidget->show();
......@@ -487,7 +487,7 @@ void MainWindow::rescan()
{
if (m_summary && !m_summary->isHidden()) {
delete m_summary;
m_summary = 0;
m_summary = nullptr;
showSummary();
return;
}
......@@ -542,7 +542,7 @@ void MainWindow::mapChanged(const Folder *tree)
void MainWindow::showSummary()
{
if (m_summary == 0) {
if (m_summary == nullptr) {
m_summary = new SummaryWidget(widget());
m_summary->setObjectName(QStringLiteral("summaryWidget"));
connect(m_summary, &SummaryWidget::activated, this, &MainWindow::openUrl);
......
......@@ -38,7 +38,7 @@
#include "widget.h"
RadialMap::Map::Map(bool summary)
: m_signature(NULL)
: m_signature(nullptr)
, m_visibleDepth(DEFAULT_RING_DEPTH)
, m_ringBreadth(MIN_RING_BREADTH)
, m_innerRadius(0)
......@@ -59,7 +59,7 @@ RadialMap::Map::~Map()
void RadialMap::Map::invalidate()
{
delete [] m_signature;
m_signature = NULL;
m_signature = nullptr;
m_visibleDepth = Config::defaultRingDepth;
}
......@@ -232,7 +232,7 @@ bool RadialMap::Map::resize(const QRect &rect)
//resize the pixmap
size += MAP_2MARGIN;
if (m_signature != NULL)
if (m_signature != nullptr)
{
setRingBreadth();
paint();
......
......@@ -43,7 +43,7 @@ public:
bool resize(const QRect&);
bool isNull() const {
return (m_signature == 0);
return (m_signature == nullptr);
}
void invalidate();
......
......@@ -38,12 +38,12 @@
RadialMap::Widget::Widget(QWidget *parent, bool isSummary)
: QWidget(parent)
, m_tree(0)
, m_focus(0)
, m_tree(nullptr)
, m_focus(nullptr)
, m_map(isSummary)
, m_rootSegment(0) //TODO we don't delete it, *shrug*
, m_rootSegment(nullptr) //TODO we don't delete it, *shrug*
, m_isSummary(isSummary)
, m_toBeDeleted(0)
, m_toBeDeleted(nullptr)
{
setAcceptDrops(true);
setMinimumSize(350, 250);
......@@ -84,11 +84,11 @@ void RadialMap::Widget::invalidate()
QUrl invalidatedUrl(url());
//ensure this class won't think we have a map still
m_tree = 0;
m_focus = 0;
m_tree = nullptr;
m_focus = nullptr;
delete m_rootSegment;
m_rootSegment = 0;
m_rootSegment = nullptr;
//FIXME move this disablement thing no?
// it is confusing in other areas, like the whole createFromCache() thing
......@@ -110,7 +110,7 @@ RadialMap::Widget::create(const Folder *tree)
if (tree)
{
m_focus = 0;
m_focus = nullptr;
//generate the filemap image
m_map.make(tree);
......@@ -147,7 +147,7 @@ RadialMap::Widget::resizeTimeout() //slot
{
// the segments are about to erased!
// this was a horrid bug, and proves the OO programming should be obeyed always!
m_focus = 0;
m_focus = nullptr;
if (m_tree)
m_map.make(m_tree, true);
update();
......@@ -163,7 +163,7 @@ RadialMap::Widget::refresh(int filth)
switch (filth)
{
case 1:
m_focus=0;
m_focus=nullptr;
m_map.make(m_tree, true); //true means refresh only
break;
......@@ -190,7 +190,7 @@ RadialMap::Widget::zoomIn() //slot
if (m_map.m_visibleDepth > MIN_RING_DEPTH)
{
--m_map.m_visibleDepth;
m_focus = 0;
m_focus = nullptr;
m_map.make(m_tree);
Config::defaultRingDepth = m_map.m_visibleDepth;
update();
......@@ -200,7 +200,7 @@ RadialMap::Widget::zoomIn() //slot
void
RadialMap::Widget::zoomOut() //slot
{
m_focus = 0;
m_focus = nullptr;
++m_map.m_visibleDepth;
m_map.make(m_tree);
if (m_map.m_visibleDepth > Config::defaultRingDepth)
......
......@@ -51,13 +51,13 @@ class Widget : public QWidget
Q_OBJECT
public:
explicit Widget(QWidget* = 0, bool = false);
explicit Widget(QWidget* = nullptr, bool = false);
~Widget() override;
QString path() const;
QUrl url(File const * const = 0) const;
QUrl url(File const * const = nullptr) const;
bool isValid() const {
return m_tree != 0;
return m_tree != nullptr;
}
bool isSummary() const {
......
......@@ -95,7 +95,7 @@ const RadialMap::Segment* RadialMap::Widget::segmentAt(QPoint &e) const
e -= m_offset;
if (!m_map.m_signature)
return 0;
return nullptr;
if (e.x() <= m_map.width() && e.y() <= m_map.height())
{
......@@ -130,7 +130,7 @@ const RadialMap::Segment* RadialMap::Widget::segmentAt(QPoint &e) const
else return m_rootSegment; //hovering over inner circle
}
return 0;
return nullptr;
}
void RadialMap::Widget::mouseMoveEvent(QMouseEvent *e)
......@@ -251,12 +251,12 @@ void RadialMap::Widget::mousePressEvent(QMouseEvent *e)
}
// Actions in the right click menu
QAction* openFileManager = 0;
QAction* openTerminal = 0;
QAction* centerMap = 0;
QAction* openFile = 0;
QAction* copyClipboard = 0;
QAction* deleteItem = 0;
QAction* openFileManager = nullptr;
QAction* openTerminal = nullptr;
QAction* centerMap = nullptr;
QAction* openFile = nullptr;
QAction* copyClipboard = nullptr;
QAction* deleteItem = nullptr;
QMenu popup;
popup.setTitle(m_focus->file()->fullPath(m_tree));
......@@ -284,7 +284,7 @@ void RadialMap::Widget::mousePressEvent(QMouseEvent *e)
deleteItem = popup.addAction(QIcon::fromTheme(QLatin1String( "edit-delete" )), i18n("&Delete"));
}
QAction* clicked = popup.exec(e->globalPos(), 0);
QAction* clicked = popup.exec(e->globalPos(), nullptr);
if (openFileManager && clicked == openFileManager) {
KRun::runUrl(url, QLatin1String( "inode/directory" ), this);
......@@ -328,8 +328,8 @@ void RadialMap::Widget::deleteJobFinished(KJob *job)
if (!job->error() && m_toBeDeleted) {
m_toBeDeleted->file()->parent()->remove(m_toBeDeleted->file());
delete m_toBeDeleted->file();
m_toBeDeleted = 0;
m_focus = 0;
m_toBeDeleted = nullptr;
m_focus = nullptr;
m_map.make(m_tree, true);
repaint();
} else
......
......@@ -81,7 +81,7 @@ private:
RemoteLister::RemoteLister(const QUrl &url, QWidget *parent, ScanManager* manager)
: KDirLister(parent)
, m_root(new Store(url, url.url(), 0))
, m_root(new Store(url, url.url(), nullptr))
, m_store(m_root)
, m_manager(manager)
{
......
......@@ -38,7 +38,7 @@ ScanManager::ScanManager(QObject *parent)
, m_abort(false)
, m_files(0)
, m_mutex()
, m_thread(0)
, m_thread(nullptr)
{
Filelight::LocalLister::readMounts();
connect(this, &ScanManager::branchCacheHit, this, &ScanManager::foundCached, Qt::QueuedConnection);
......@@ -114,7 +114,7 @@ bool ScanManager::start(const QUrl &url)
QVector<QStringRef> split = path.midRef(cachePath.length()).split(QLatin1Char('/'));
Folder *d = folder;
while (!split.isEmpty() && d != NULL) { //if NULL we have got lost so abort!!
while (!split.isEmpty() && d != nullptr) { //if NULL we have got lost so abort!!
if (split.first().isEmpty()) { //found the dir
break;
}
......@@ -197,7 +197,7 @@ void ScanManager::cacheTree(Folder *tree)
m_thread->wait();
qDebug() << "Thread terminated!";
delete m_thread; //note the lister deletes itself
m_thread = 0;
m_thread = nullptr;
}
emit completed(tree);
......
......@@ -180,7 +180,7 @@ void SettingsDialog::addFolder()
{
Config::skipList.append(path);
m_listBox->addItem(path);
if (m_listBox->currentItem() == 0) m_listBox->setCurrentRow(0);
if (m_listBox->currentItem() == nullptr) m_listBox->setCurrentRow(0);
m_removeButton->setEnabled(true);
}
else QMessageBox::information(this, i18n("Folder already ignored"), i18n("That folder is already set to be excluded from scans."));
......
......@@ -35,7 +35,7 @@ class SettingsDialog : public QDialog, public Ui::Dialog
Q_OBJECT
public:
explicit SettingsDialog(QWidget* = 0);
explicit SettingsDialog(QWidget* = nullptr);
protected:
void closeEvent(QCloseEvent *) override;
......
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