From 99de80e7224f2491fb7518e32f195ad6a912b624 Mon Sep 17 00:00:00 2001 From: Tannin Date: Fri, 28 Nov 2014 11:19:20 +0100 Subject: replaced all uses of NULL with nullptr fixed a few placed where NULL was used as a number or boolean --- src/modlist.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/modlist.cpp') diff --git a/src/modlist.cpp b/src/modlist.cpp index fb8df15e..1bd7b0f0 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -50,8 +50,8 @@ using namespace MOBase; ModList::ModList(QObject *parent) : QAbstractItemModel(parent) - , m_Profile(NULL) - , m_NexusInterface(NULL) + , m_Profile(nullptr) + , m_NexusInterface(nullptr) , m_Modified(false) , m_FontMetrics(QFont()) , m_DropOnItems(false) @@ -177,7 +177,7 @@ QString ModList::contentsToToolTip(const std::vector &content QVariant ModList::data(const QModelIndex &modelIndex, int role) const { - if (m_Profile == NULL) return QVariant(); + if (m_Profile == nullptr) return QVariant(); if (!modelIndex.isValid()) return QVariant(); unsigned int modIndex = modelIndex.row(); int column = modelIndex.column(); @@ -410,7 +410,7 @@ bool ModList::renameMod(int index, const QString &newName) { QString nameFixed = newName; if (!fixDirectoryName(nameFixed) || nameFixed.isEmpty()) { - MessageDialog::showMessage(tr("Invalid name"), NULL); + MessageDialog::showMessage(tr("Invalid name"), nullptr); return false; } @@ -433,7 +433,7 @@ bool ModList::renameMod(int index, const QString &newName) bool ModList::setData(const QModelIndex &index, const QVariant &value, int role) { - if (m_Profile == NULL) return false; + if (m_Profile == nullptr) return false; if (static_cast(index.row()) >= ModInfo::getNumMods()) { return false; @@ -591,7 +591,7 @@ QStringList ModList::mimeTypes() const void ModList::changeModPriority(std::vector sourceIndices, int newPriority) { - if (m_Profile == NULL) return; + if (m_Profile == nullptr) return; emit layoutAboutToBeChanged(); Profile *profile = m_Profile; @@ -625,7 +625,7 @@ void ModList::changeModPriority(std::vector sourceIndices, int newPriority) void ModList::changeModPriority(int sourceIndex, int newPriority) { - if (m_Profile == NULL) return; + if (m_Profile == nullptr) return; emit layoutAboutToBeChanged(); m_Profile->setModPriority(sourceIndex, newPriority); @@ -839,7 +839,7 @@ bool ModList::dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int return true; } - if (m_Profile == NULL) return false; + if (m_Profile == nullptr) return false; if (mimeData->hasUrls()) { return dropURLs(mimeData, row, parent); } else { @@ -854,7 +854,7 @@ void ModList::removeRowForce(int row) if (static_cast(row) >= ModInfo::getNumMods()) { return; } - if (m_Profile == NULL) return; + if (m_Profile == nullptr) return; m_Profile->setModEnabled(row, false); @@ -882,7 +882,7 @@ void ModList::removeRow(int row, const QModelIndex&) if (static_cast(row) >= ModInfo::getNumMods()) { return; } - if (m_Profile == NULL) return; + if (m_Profile == nullptr) return; m_Profile->setModEnabled(row, false); @@ -992,28 +992,28 @@ bool ModList::eventFilter(QObject *obj, QEvent *event) if (event->type() == QEvent::ContextMenu) { QContextMenuEvent *contextEvent = static_cast(event); QWidget *object = qobject_cast(obj); - if ((object != NULL) && (contextEvent->reason() == QContextMenuEvent::Mouse)) { + if ((object != nullptr) && (contextEvent->reason() == QContextMenuEvent::Mouse)) { emit requestColumnSelect(object->mapToGlobal(contextEvent->pos())); return true; } - } else if ((event->type() == QEvent::KeyPress) && (m_Profile != NULL)) { + } else if ((event->type() == QEvent::KeyPress) && (m_Profile != nullptr)) { QAbstractItemView *itemView = qobject_cast(obj); QKeyEvent *keyEvent = static_cast(event); - if ((itemView != NULL) + if ((itemView != nullptr) && (keyEvent->modifiers() == Qt::ControlModifier) && ((keyEvent->key() == Qt::Key_Up) || (keyEvent->key() == Qt::Key_Down))) { QItemSelectionModel *selectionModel = itemView->selectionModel(); const QAbstractProxyModel *proxyModel = qobject_cast(selectionModel->model()); - const QSortFilterProxyModel *filterModel = NULL; - while ((filterModel == NULL) && (proxyModel != NULL)) { + const QSortFilterProxyModel *filterModel = nullptr; + while ((filterModel == nullptr) && (proxyModel != nullptr)) { filterModel = qobject_cast(proxyModel); - if (filterModel == NULL) { + if (filterModel == nullptr) { proxyModel = qobject_cast(proxyModel->sourceModel()); } } - if (filterModel == NULL) { + if (filterModel == nullptr) { return true; } int diff = -1; @@ -1028,7 +1028,7 @@ bool ModList::eventFilter(QObject *obj, QEvent *event) } } foreach (QModelIndex idx, rows) { - if (filterModel != NULL) { + if (filterModel != nullptr) { idx = filterModel->mapToSource(idx); } int newPriority = m_Profile->getModPriority(idx.row()) + diff; @@ -1054,7 +1054,7 @@ bool ModList::eventFilter(QObject *obj, QEvent *event) QModelIndex minRow, maxRow; foreach (QModelIndex idx, selectionModel->selectedRows()) { - if (proxyModel != NULL) { + if (proxyModel != nullptr) { idx = proxyModel->mapToSource(idx); } if (!minRow.isValid() || (idx.row() < minRow.row())) { -- cgit v1.3.1