summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-01 12:36:16 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-01 15:56:34 (GMT)
commiteddd92ed76ae68cb1e202602fd3ebd11b69191a2 (patch)
tree8d396e5801d77a2f0ee4ab8e4c5093d8cf8118e6 /Swift/QtUI/Roster
parenta79db8d446e152b715f435550c2a6e10a36ee532 (diff)
downloadswift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.zip
swift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.tar.bz2
Modernize code to use C++11 nullptr using clang-tidy
Run 'clang-tidy -fix -checks=modernize-use-nullptr' on all source code files on OS X. This does not modernize platform specific code on Linux and Windows Test-Information: Code builds and unit tests pass on OS X 10.11.4. Change-Id: Ic43ffeb1b76c1a933a55af03db3c54977f5f60dd
Diffstat (limited to 'Swift/QtUI/Roster')
-rw-r--r--Swift/QtUI/Roster/QtFilterWidget.cpp6
-rw-r--r--Swift/QtUI/Roster/QtFilterWidget.h2
-rw-r--r--Swift/QtUI/Roster/QtOccupantListWidget.h2
-rw-r--r--Swift/QtUI/Roster/QtRosterWidget.cpp10
-rw-r--r--Swift/QtUI/Roster/QtRosterWidget.h2
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.cpp4
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.h2
-rw-r--r--Swift/QtUI/Roster/RosterModel.cpp10
8 files changed, 19 insertions, 19 deletions
diff --git a/Swift/QtUI/Roster/QtFilterWidget.cpp b/Swift/QtUI/Roster/QtFilterWidget.cpp
index 60b87df..3ed23b6 100644
--- a/Swift/QtUI/Roster/QtFilterWidget.cpp
+++ b/Swift/QtUI/Roster/QtFilterWidget.cpp
@@ -26,7 +26,7 @@
namespace Swift {
-QtFilterWidget::QtFilterWidget(QWidget* parent, QtTreeWidget* treeView, UIEventStream* eventStream, QBoxLayout* layout) : QWidget(parent), treeView_(treeView), eventStream_(eventStream), fuzzyRosterFilter_(0), isModifierSinglePressed_(false) {
+QtFilterWidget::QtFilterWidget(QWidget* parent, QtTreeWidget* treeView, UIEventStream* eventStream, QBoxLayout* layout) : QWidget(parent), treeView_(treeView), eventStream_(eventStream), fuzzyRosterFilter_(nullptr), isModifierSinglePressed_(false) {
int targetIndex = layout->indexOf(treeView);
QVBoxLayout* vboxLayout = new QVBoxLayout(this);
@@ -123,7 +123,7 @@ void QtFilterWidget::updateRosterFilters() {
// remove currently installed search filter and put old filters back
treeView_->getRoster()->removeFilter(fuzzyRosterFilter_);
delete fuzzyRosterFilter_;
- fuzzyRosterFilter_ = NULL;
+ fuzzyRosterFilter_ = nullptr;
pushAllFilters();
} else {
// remove currently intsalled search filter and put new search filter in place
@@ -143,7 +143,7 @@ void QtFilterWidget::updateSearchFilter() {
if (fuzzyRosterFilter_) {
treeView_->getRoster()->removeFilter(fuzzyRosterFilter_);
delete fuzzyRosterFilter_;
- fuzzyRosterFilter_ = NULL;
+ fuzzyRosterFilter_ = nullptr;
}
fuzzyRosterFilter_ = new FuzzyRosterFilter(Q2PSTRING(filterLineEdit_->text()));
treeView_->getRoster()->addFilter(fuzzyRosterFilter_);
diff --git a/Swift/QtUI/Roster/QtFilterWidget.h b/Swift/QtUI/Roster/QtFilterWidget.h
index 5edcc5b..ea3c325 100644
--- a/Swift/QtUI/Roster/QtFilterWidget.h
+++ b/Swift/QtUI/Roster/QtFilterWidget.h
@@ -28,7 +28,7 @@ class QtClosableLineEdit;
class QtFilterWidget : public QWidget {
Q_OBJECT
public:
- QtFilterWidget(QWidget* parent, QtTreeWidget* treeView, UIEventStream* eventStream, QBoxLayout* layout = 0);
+ QtFilterWidget(QWidget* parent, QtTreeWidget* treeView, UIEventStream* eventStream, QBoxLayout* layout = nullptr);
virtual ~QtFilterWidget();
protected:
diff --git a/Swift/QtUI/Roster/QtOccupantListWidget.h b/Swift/QtUI/Roster/QtOccupantListWidget.h
index 4cff50f..78be276 100644
--- a/Swift/QtUI/Roster/QtOccupantListWidget.h
+++ b/Swift/QtUI/Roster/QtOccupantListWidget.h
@@ -18,7 +18,7 @@ class SettingsProvider;
class QtOccupantListWidget : public QtTreeWidget {
Q_OBJECT
public:
- QtOccupantListWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget privateMessageTarget, QWidget* parent = NULL);
+ QtOccupantListWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget privateMessageTarget, QWidget* parent = nullptr);
virtual ~QtOccupantListWidget();
void setAvailableOccupantActions(const std::vector<ChatWindow::OccupantAction>& actions);
boost::signal<void (ChatWindow::OccupantAction, ContactRosterItem*)> onOccupantActionSelected;
diff --git a/Swift/QtUI/Roster/QtRosterWidget.cpp b/Swift/QtUI/Roster/QtRosterWidget.cpp
index 027ff00..92fed86 100644
--- a/Swift/QtUI/Roster/QtRosterWidget.cpp
+++ b/Swift/QtUI/Roster/QtRosterWidget.cpp
@@ -66,28 +66,28 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) {
removeContact->setEnabled(isOnline());
QAction* showProfileForContact = contextMenu.addAction(tr("Show Profile"));
- QAction* unblockContact = NULL;
+ QAction* unblockContact = nullptr;
if (contact->blockState() == ContactRosterItem::IsBlocked ||
contact->blockState() == ContactRosterItem::IsDomainBlocked) {
unblockContact = contextMenu.addAction(tr("Unblock"));
unblockContact->setEnabled(isOnline());
}
- QAction* blockContact = NULL;
+ QAction* blockContact = nullptr;
if (contact->blockState() == ContactRosterItem::IsUnblocked) {
blockContact = contextMenu.addAction(tr("Block"));
blockContact->setEnabled(isOnline());
}
#ifdef SWIFT_EXPERIMENTAL_FT
- QAction* sendFile = NULL;
+ QAction* sendFile = nullptr;
if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) {
sendFile = contextMenu.addAction(tr("Send File"));
sendFile->setEnabled(isOnline());
}
#endif
#ifdef SWIFT_EXPERIMENTAL_WB
- QAction* startWhiteboardChat = NULL;
+ QAction* startWhiteboardChat = nullptr;
if (contact->supportsFeature(ContactRosterItem::WhiteboardFeature)) {
startWhiteboardChat = contextMenu.addAction(tr("Start Whiteboard Chat"));
startWhiteboardChat->setEnabled(isOnline());
@@ -153,7 +153,7 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) {
void QtRosterWidget::renameGroup(GroupRosterItem* group) {
bool ok;
- QString newName = QInputDialog::getText(NULL, tr("Rename group"), tr("Enter a new name for group '%1':").arg(P2QSTRING(group->getDisplayName())), QLineEdit::Normal, P2QSTRING(group->getDisplayName()), &ok);
+ QString newName = QInputDialog::getText(nullptr, tr("Rename group"), tr("Enter a new name for group '%1':").arg(P2QSTRING(group->getDisplayName())), QLineEdit::Normal, P2QSTRING(group->getDisplayName()), &ok);
if (ok) {
eventStream_->send(boost::make_shared<RenameGroupUIEvent>(group->getDisplayName(), Q2PSTRING(newName)));
}
diff --git a/Swift/QtUI/Roster/QtRosterWidget.h b/Swift/QtUI/Roster/QtRosterWidget.h
index 25f7f9d..2cf8315 100644
--- a/Swift/QtUI/Roster/QtRosterWidget.h
+++ b/Swift/QtUI/Roster/QtRosterWidget.h
@@ -14,7 +14,7 @@ class QtUIPreferences;
class QtRosterWidget : public QtTreeWidget {
Q_OBJECT
public:
- QtRosterWidget(UIEventStream* eventStream, SettingsProvider* settings, QWidget* parent = 0);
+ QtRosterWidget(UIEventStream* eventStream, SettingsProvider* settings, QWidget* parent = nullptr);
virtual ~QtRosterWidget();
public slots:
void handleEditUserActionTriggered(bool checked);
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp
index a0b6e92..16a186e 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidget.cpp
@@ -124,7 +124,7 @@ QModelIndexList QtTreeWidget::getSelectedIndexes() const {
}
void QtTreeWidget::currentChanged(const QModelIndex& current, const QModelIndex& previous) {
- RosterItem* item = NULL;
+ RosterItem* item = nullptr;
QModelIndexList selectedIndexList = getSelectedIndexes();
if (selectedIndexList.empty() || !selectedIndexList[0].isValid()) {
/* I didn't quite understand why using current didn't seem to work here.*/
@@ -180,7 +180,7 @@ void QtTreeWidget::dragMoveEvent(QDragMoveEvent* event) {
}
bool QtTreeWidget::event(QEvent* event) {
- QChildEvent* childEvent = NULL;
+ QChildEvent* childEvent = nullptr;
if ((childEvent = dynamic_cast<QChildEvent*>(event))) {
if (childEvent->polished()) {
if (dynamic_cast<QLabel*>(childEvent->child())) {
diff --git a/Swift/QtUI/Roster/QtTreeWidget.h b/Swift/QtUI/Roster/QtTreeWidget.h
index 9a94e8f..c3ed5a2 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.h
+++ b/Swift/QtUI/Roster/QtTreeWidget.h
@@ -26,7 +26,7 @@ class QtTreeWidget : public QTreeView {
public:
enum MessageTarget {MessageDefaultJID, MessageDisplayJID};
- QtTreeWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget messageTarget, QWidget* parent = 0);
+ QtTreeWidget(UIEventStream* eventStream, SettingsProvider* settings, MessageTarget messageTarget, QWidget* parent = nullptr);
~QtTreeWidget();
void show();
QtTreeWidgetItem* getRoot();
diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp
index 2b3759d..22af6ec 100644
--- a/Swift/QtUI/Roster/RosterModel.cpp
+++ b/Swift/QtUI/Roster/RosterModel.cpp
@@ -28,7 +28,7 @@
namespace Swift {
-RosterModel::RosterModel(QtTreeWidget* view, bool screenReaderMode) : roster_(NULL), view_(view), screenReader_(screenReaderMode) {
+RosterModel::RosterModel(QtTreeWidget* view, bool screenReaderMode) : roster_(nullptr), view_(view), screenReader_(screenReaderMode) {
const int tooltipAvatarSize = 96; // maximal suggested size according to XEP-0153
cachedImageScaler_ = new QtScaledAvatarCache(tooltipAvatarSize);
}
@@ -75,7 +75,7 @@ void RosterModel::handleDataChanged(RosterItem* item) {
Qt::ItemFlags RosterModel::flags(const QModelIndex& index) const {
Qt::ItemFlags flags = QAbstractItemModel::flags(index);
- if (dynamic_cast<GroupRosterItem*>(getItem(index)) == NULL) {
+ if (dynamic_cast<GroupRosterItem*>(getItem(index)) == nullptr) {
flags |= Qt::ItemIsDragEnabled;
}
return flags;
@@ -86,7 +86,7 @@ int RosterModel::columnCount(const QModelIndex& /*parent*/) const {
}
RosterItem* RosterModel::getItem(const QModelIndex& index) const {
- return index.isValid() ? static_cast<RosterItem*>(index.internalPointer()) : NULL;
+ return index.isValid() ? static_cast<RosterItem*>(index.internalPointer()) : nullptr;
}
QVariant RosterModel::data(const QModelIndex& index, int role) const {
@@ -230,7 +230,7 @@ QModelIndex RosterModel::index(RosterItem* item) const {
/* Recursive check that it's ok to create such an item
Assuming there are more contacts in a group than groups in a
group, this could save a decent chunk of search time at startup.*/
- if (parent == NULL || roster_ == NULL || (parent != roster_->getRoot() && !index(parent).isValid())) {
+ if (parent == nullptr || roster_ == nullptr || (parent != roster_->getRoot() && !index(parent).isValid())) {
return QModelIndex();
}
for (size_t i = 0; i < parent->getDisplayedChildren().size(); i++) {
@@ -264,7 +264,7 @@ QMimeData* RosterModel::mimeData(const QModelIndexList& indexes) const {
QMimeData* data = QAbstractItemModel::mimeData(indexes);
ContactRosterItem *item = dynamic_cast<ContactRosterItem*>(getItem(indexes.first()));
- if (item == NULL) {
+ if (item == nullptr) {
return data;
}