diff options
Diffstat (limited to 'Swift/QtUI')
102 files changed, 282 insertions, 222 deletions
diff --git a/Swift/QtUI/ChatList/ChatListModel.cpp b/Swift/QtUI/ChatList/ChatListModel.cpp index 307cdea..e5e8963 100644 --- a/Swift/QtUI/ChatList/ChatListModel.cpp +++ b/Swift/QtUI/ChatList/ChatListModel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,8 +16,8 @@ namespace Swift { -ChatListModel::ChatListModel() : whiteboards_(NULL) { - root_ = new ChatListGroupItem("", NULL, false); +ChatListModel::ChatListModel() : whiteboards_(nullptr) { + root_ = new ChatListGroupItem("", nullptr, false); mucBookmarks_ = new ChatListGroupItem(tr("Bookmarked Rooms"), root_); recents_ = new ChatListGroupItem(tr("Recent Chats"), root_, false); #ifdef SWIFT_EXPERIMENTAL_WB @@ -106,7 +106,7 @@ void ChatListModel::setRecents(const std::list<ChatListWindow::Chat>& recents) { QMimeData* ChatListModel::mimeData(const QModelIndexList& indexes) const { QMimeData* data = QAbstractItemModel::mimeData(indexes); ChatListRecentItem *item = dynamic_cast<ChatListRecentItem*>(getItemForIndex(indexes.first())); - if (item == NULL) { + if (item == nullptr) { return data; } @@ -132,7 +132,7 @@ QMimeData* ChatListModel::mimeData(const QModelIndexList& indexes) const { } const ChatListMUCItem* ChatListModel::getChatListMUCItem(const JID& roomJID) const { - const ChatListMUCItem* mucItem = NULL; + const ChatListMUCItem* mucItem = nullptr; for (int i = 0; i < mucBookmarks_->rowCount(); i++) { ChatListMUCItem* item = dynamic_cast<ChatListMUCItem*>(mucBookmarks_->item(i)); if (item->getBookmark().getRoom() == roomJID) { @@ -148,7 +148,7 @@ int ChatListModel::columnCount(const QModelIndex& /*parent*/) const { } ChatListItem* ChatListModel::getItemForIndex(const QModelIndex& index) const { - return index.isValid() ? static_cast<ChatListItem*>(index.internalPointer()) : NULL; + return index.isValid() ? static_cast<ChatListItem*>(index.internalPointer()) : nullptr; } QVariant ChatListModel::data(const QModelIndex& index, int role) const { @@ -175,7 +175,7 @@ QModelIndex ChatListModel::parent(const QModelIndex& index) const { } int ChatListModel::rowCount(const QModelIndex& parentIndex) const { - ChatListGroupItem* parent = NULL; + ChatListGroupItem* parent = nullptr; if (parentIndex.isValid()) { parent = dynamic_cast<ChatListGroupItem*>(static_cast<ChatListItem*>(parentIndex.internalPointer())); } else { diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index eddd0cd..1a121aa 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -177,7 +177,7 @@ void QtChatListWindow::dragEnterEvent(QDragEnterEvent *event) { void QtChatListWindow::contextMenuEvent(QContextMenuEvent* event) { QModelIndex index = indexAt(event->pos()); - ChatListItem* baseItem = index.isValid() ? static_cast<ChatListItem*>(index.internalPointer()) : NULL; + ChatListItem* baseItem = index.isValid() ? static_cast<ChatListItem*>(index.internalPointer()) : nullptr; contextMenuItem_ = baseItem; foreach(QAction* action, onlineOnlyActions_) { @@ -203,7 +203,7 @@ void QtChatListWindow::contextMenuEvent(QContextMenuEvent* event) { const ChatListWindow::Chat& chat = recentItem->getChat(); if (chat.isMUC) { QMenu mucRecentsMenu; - QAction* bookmarkAction = NULL; + QAction* bookmarkAction = nullptr; const ChatListMUCItem* mucItem = model_->getChatListMUCItem(chat.jid); if (mucItem) { contextMenuItem_ = mucItem; diff --git a/Swift/QtUI/ChatList/QtChatListWindow.h b/Swift/QtUI/ChatList/QtChatListWindow.h index 61f8391..834e318 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.h +++ b/Swift/QtUI/ChatList/QtChatListWindow.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -19,7 +19,7 @@ namespace Swift { class QtChatListWindow : public QTreeView, public ChatListWindow { Q_OBJECT public: - QtChatListWindow(UIEventStream *uiEventStream, SettingsProvider* settings, QWidget* parent = NULL); + QtChatListWindow(UIEventStream *uiEventStream, SettingsProvider* settings, QWidget* parent = nullptr); virtual ~QtChatListWindow(); void addMUCBookmark(const MUCBookmark& bookmark); void removeMUCBookmark(const MUCBookmark& bookmark); diff --git a/Swift/QtUI/CocoaUIHelpers.mm b/Swift/QtUI/CocoaUIHelpers.mm index 16fe2ce..06a74aa 100644 --- a/Swift/QtUI/CocoaUIHelpers.mm +++ b/Swift/QtUI/CocoaUIHelpers.mm @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include "CocoaUIHelpers.h" #include <boost/shared_ptr.hpp> @@ -26,8 +32,8 @@ void CocoaUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std:: foreach(Certificate::ref cert, chain) { // convert chain to SecCertificateRef ByteArray certAsDER = cert->toDER(); - boost::shared_ptr<boost::remove_pointer<CFDataRef>::type> certData(CFDataCreate(NULL, certAsDER.data(), certAsDER.size()), CFRelease); - boost::shared_ptr<OpaqueSecCertificateRef> macCert(SecCertificateCreateWithData(NULL, certData.get()), CFRelease); + boost::shared_ptr<boost::remove_pointer<CFDataRef>::type> certData(CFDataCreate(nullptr, certAsDER.data(), certAsDER.size()), CFRelease); + boost::shared_ptr<OpaqueSecCertificateRef> macCert(SecCertificateCreateWithData(nullptr, certData.get()), CFRelease); // add to NSMutable array [certificates addObject: (id)macCert.get()]; @@ -36,7 +42,7 @@ void CocoaUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std:: SFCertificatePanel* panel = [[SFCertificatePanel alloc] init]; //[panel setPolicies:(id)policies.get()]; - [panel beginSheetForWindow:parentWindow modalDelegate:nil didEndSelector:NULL contextInfo:NULL certificates:certificates showGroup:YES]; + [panel beginSheetForWindow:parentWindow modalDelegate:nil didEndSelector:nullptr contextInfo:nullptr certificates:certificates showGroup:YES]; [certificates release]; } diff --git a/Swift/QtUI/EventViewer/EventModel.cpp b/Swift/QtUI/EventViewer/EventModel.cpp index 1568ec7..d830db9 100644 --- a/Swift/QtUI/EventViewer/EventModel.cpp +++ b/Swift/QtUI/EventViewer/EventModel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -28,7 +28,7 @@ EventModel::~EventModel() { } QtEvent* EventModel::getItem(int row) const { - QtEvent* event = NULL; + QtEvent* event = nullptr; if (row < activeEvents_.size()) { event = activeEvents_[row]; } diff --git a/Swift/QtUI/MUCSearch/MUCSearchModel.cpp b/Swift/QtUI/MUCSearch/MUCSearchModel.cpp index af6f17f..2dbfc37 100644 --- a/Swift/QtUI/MUCSearch/MUCSearchModel.cpp +++ b/Swift/QtUI/MUCSearch/MUCSearchModel.cpp @@ -60,7 +60,7 @@ QModelIndex MUCSearchModel::parent(const QModelIndex& index) const { return QModelIndex(); } - MUCSearchServiceItem* parent = NULL; + MUCSearchServiceItem* parent = nullptr; if (MUCSearchRoomItem* roomItem = dynamic_cast<MUCSearchRoomItem*>(item)) { parent = roomItem->getParent(); } diff --git a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp index 03fa582..8bef7e4 100644 --- a/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp +++ b/Swift/QtUI/MUCSearch/QtMUCSearchWindow.cpp @@ -187,7 +187,7 @@ MUCSearchRoomItem* QtMUCSearchWindow::getSelectedRoom() const { } } if (lstIndex.isEmpty()) { - return NULL; + return nullptr; } else { return dynamic_cast<MUCSearchRoomItem*>(static_cast<MUCSearchItem*>(lstIndex.first().internalPointer())); diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp index 87b1585..e638523 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ const int FormLayoutIndex = 1; namespace Swift { QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) : command_(command) { - formWidget_ = NULL; + formWidget_ = nullptr; setAttribute(Qt::WA_DeleteOnClose); command->onNextStageReceived.connect(boost::bind(&QtAdHocCommandWindow::handleNextStageReceived, this, _1)); @@ -142,7 +142,7 @@ void QtAdHocCommandWindow::setForm(Form::ref form) { void QtAdHocCommandWindow::setNoForm(bool andHide) { form_.reset(); delete formWidget_; - formWidget_ = NULL; + formWidget_ = nullptr; resize(minimumSize()); setVisible(!andHide); } diff --git a/Swift/QtUI/QtAffiliationEditor.h b/Swift/QtUI/QtAffiliationEditor.h index 3b7e548..58e2497 100644 --- a/Swift/QtUI/QtAffiliationEditor.h +++ b/Swift/QtUI/QtAffiliationEditor.h @@ -20,7 +20,7 @@ namespace Swift { class QtAffiliationEditor : public QDialog { Q_OBJECT public: - QtAffiliationEditor(QWidget* parent = NULL); + QtAffiliationEditor(QWidget* parent = nullptr); ~QtAffiliationEditor(); void setAffiliations(MUCOccupant::Affiliation, const std::vector<JID>& jids); const std::vector<std::pair<MUCOccupant::Affiliation, JID> >& getChanges() const; diff --git a/Swift/QtUI/QtBlockListEditorWindow.cpp b/Swift/QtUI/QtBlockListEditorWindow.cpp index 5b04b49..9e13943 100644 --- a/Swift/QtUI/QtBlockListEditorWindow.cpp +++ b/Swift/QtUI/QtBlockListEditorWindow.cpp @@ -73,7 +73,7 @@ class QtJIDValidatedItemDelegate : public QItemDelegate { } }; -QtBlockListEditorWindow::QtBlockListEditorWindow() : QWidget(), ui(new Ui::QtBlockListEditorWindow), removeItemDelegate(0), editItemDelegate(0) { +QtBlockListEditorWindow::QtBlockListEditorWindow() : QWidget(), ui(new Ui::QtBlockListEditorWindow), removeItemDelegate(nullptr), editItemDelegate(nullptr) { ui->setupUi(this); freshBlockListTemplate = tr("Double-click to add contact"); @@ -163,7 +163,7 @@ void QtBlockListEditorWindow::setCurrentBlockList(const std::vector<JID> &blocke item->setFlags(item->flags() | Qt::ItemIsEditable); ui->blockListTreeWidget->addTopLevelItem(item); } - handleItemChanged(0,0); + handleItemChanged(nullptr,0); } void QtBlockListEditorWindow::setBusy(bool isBusy) { diff --git a/Swift/QtUI/QtBookmarkDetailWindow.h b/Swift/QtUI/QtBookmarkDetailWindow.h index 19c6462..82e757d 100644 --- a/Swift/QtUI/QtBookmarkDetailWindow.h +++ b/Swift/QtUI/QtBookmarkDetailWindow.h @@ -18,7 +18,7 @@ namespace Swift { class QtBookmarkDetailWindow : public QDialog, protected Ui::QtBookmarkDetailWindow { Q_OBJECT public: - QtBookmarkDetailWindow(QWidget* parent = NULL); + QtBookmarkDetailWindow(QWidget* parent = nullptr); virtual bool commit() = 0; boost::optional<MUCBookmark> createBookmarkFromForm(); diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 4a77ffd..3609cc9 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -33,7 +33,7 @@ #include <Swift/QtUI/Trellis/QtGridSelectionDialog.h> namespace Swift { -QtChatTabs::QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bool trellisMode) : QWidget(), singleWindow_(singleWindow), settingsProvider_(settingsProvider), trellisMode_(trellisMode), dynamicGrid_(NULL), gridSelectionDialog_(NULL) { +QtChatTabs::QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bool trellisMode) : QWidget(), singleWindow_(singleWindow), settingsProvider_(settingsProvider), trellisMode_(trellisMode), dynamicGrid_(nullptr), gridSelectionDialog_(nullptr) { #ifndef Q_OS_MAC setWindowIcon(QIcon(":/logo-chat-16.png")); #else diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 95d643c..6cb2292 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -65,11 +65,11 @@ QtChatWindow::QtChatWindow(const QString& contact, QtChatTheme* theme, UIEventSt settings_ = settings; unreadCount_ = 0; isOnline_ = true; - completer_ = NULL; - affiliationEditor_ = NULL; + completer_ = nullptr; + affiliationEditor_ = nullptr; theme_ = theme; isCorrection_ = false; - labelModel_ = NULL; + labelModel_ = nullptr; correctionEnabled_ = Maybe; fileTransferEnabled_ = Maybe; updateTitleWithUnreadCount(); @@ -559,7 +559,7 @@ void QtChatWindow::handleCursorPositionChanged() { } void QtChatWindow::show() { - if (parentWidget() == NULL) { + if (parentWidget() == nullptr) { QWidget::show(); } emit windowOpening(); @@ -685,14 +685,14 @@ void QtChatWindow::handleTextInputLostFocus() { void QtChatWindow::handleActionButtonClicked() { QMenu contextMenu; - QAction* changeSubject = NULL; - QAction* configure = NULL; - QAction* affiliations = NULL; - QAction* destroy = NULL; - QAction* invite = NULL; + QAction* changeSubject = nullptr; + QAction* configure = nullptr; + QAction* affiliations = nullptr; + QAction* destroy = nullptr; + QAction* invite = nullptr; - QAction* block = NULL; - QAction* unblock = NULL; + QAction* block = nullptr; + QAction* unblock = nullptr; if (availableRoomActions_.empty()) { if (blockingState_ == IsBlocked) { @@ -748,7 +748,7 @@ void QtChatWindow::handleActionButtonClicked() { } } - QAction* bookmark = NULL; + QAction* bookmark = nullptr; if (isMUC_) { if (roomBookmarkState_ == RoomNotBookmarked) { bookmark = contextMenu.addAction(tr("Bookmark this room...")); @@ -760,7 +760,7 @@ void QtChatWindow::handleActionButtonClicked() { } QAction* result = contextMenu.exec(QCursor::pos()); - if (result == NULL) { + if (result == nullptr) { /* Skip processing. Note that otherwise, because the actions could be null they could match */ } else if (result == changeSubject) { diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 2a23f5f..00693d2 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -45,7 +45,7 @@ namespace Swift { class LabelModel : public QAbstractListModel { Q_OBJECT public: - LabelModel(QObject* parent = NULL) : QAbstractListModel(parent) {} + LabelModel(QObject* parent = nullptr) : QAbstractListModel(parent) {} virtual int rowCount(const QModelIndex& /*index*/) const { return static_cast<int>(availableLabels_.size()); diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp index a97fd7c..9c59e9a 100644 --- a/Swift/QtUI/QtChatWindowFactory.cpp +++ b/Swift/QtUI/QtChatWindowFactory.cpp @@ -26,7 +26,7 @@ QtChatWindowFactory::QtChatWindowFactory(QtSingleWindow* splitter, SettingsProvi qtOnlySettings_ = qtSettings; settings_ = settings; tabs_ = tabs; - theme_ = NULL; + theme_ = nullptr; QtChatTabs* fullTabs = dynamic_cast<QtChatTabs*>(tabs_); if (splitter) { assert(fullTabs && "Netbook mode and no-tabs interface is not supported!"); diff --git a/Swift/QtUI/QtClosableLineEdit.h b/Swift/QtUI/QtClosableLineEdit.h index 206851b..0b195dd 100644 --- a/Swift/QtUI/QtClosableLineEdit.h +++ b/Swift/QtUI/QtClosableLineEdit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -26,7 +26,7 @@ class QtClosableLineEdit : public QLineEdit { Q_OBJECT public: - QtClosableLineEdit(QWidget *parent = 0); + QtClosableLineEdit(QWidget *parent = nullptr); protected: void resizeEvent(QResizeEvent *); diff --git a/Swift/QtUI/QtColorToolButton.h b/Swift/QtUI/QtColorToolButton.h index 5260048..babafc5 100644 --- a/Swift/QtUI/QtColorToolButton.h +++ b/Swift/QtUI/QtColorToolButton.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <QToolButton> @@ -14,7 +20,7 @@ namespace Swift { Q_OBJECT Q_PROPERTY(QColor color READ getColor WRITE setColor NOTIFY colorChanged) public: - explicit QtColorToolButton(QWidget* parent = NULL); + explicit QtColorToolButton(QWidget* parent = nullptr); void setColor(const QColor& color); const QColor& getColor() const { return color_; } diff --git a/Swift/QtUI/QtContactEditWidget.cpp b/Swift/QtUI/QtContactEditWidget.cpp index ced9157..4e9a7fe 100644 --- a/Swift/QtUI/QtContactEditWidget.cpp +++ b/Swift/QtUI/QtContactEditWidget.cpp @@ -20,7 +20,7 @@ namespace Swift { -QtContactEditWidget::QtContactEditWidget(const std::set<std::string>& allGroups, QWidget* parent) : QWidget(parent), nameRadioButton_(NULL), groups_(NULL) { +QtContactEditWidget::QtContactEditWidget(const std::set<std::string>& allGroups, QWidget* parent) : QWidget(parent), nameRadioButton_(nullptr), groups_(nullptr) { QBoxLayout* layout = new QVBoxLayout(this); setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0); @@ -116,7 +116,7 @@ void QtContactEditWidget::setNameSuggestions(const std::vector<std::string>& sug throbberLabel_->hide(); // remove old suggestions except for the user input text field - QLayoutItem* suggestionItem = NULL; + QLayoutItem* suggestionItem = nullptr; while ((suggestionItem = suggestionsLayout_->itemAt(0)) && suggestionItem->widget() != name_) { QWidget* suggestionWidget = suggestionItem->widget(); suggestionsLayout_->removeWidget(suggestionWidget); @@ -131,7 +131,7 @@ void QtContactEditWidget::setNameSuggestions(const std::vector<std::string>& sug nameRadioButton_ = new QRadioButton(tr("Name:"), this); suggestionsLayout_->insertWidget(nameLayout_->count(), nameRadioButton_); - QRadioButton* suggestedRadioButton = 0; + QRadioButton* suggestedRadioButton = nullptr; QList<QRadioButton*> radioButtons = findChildren<QRadioButton*>(); foreach (QRadioButton* candidate, radioButtons) { if (candidate->text() == name_->text()) { @@ -169,7 +169,7 @@ void QtContactEditWidget::clear() { delete layoutItem->widget(); delete layoutItem; } - nameRadioButton_ = NULL; + nameRadioButton_ = nullptr; } } diff --git a/Swift/QtUI/QtContactEditWindow.cpp b/Swift/QtUI/QtContactEditWindow.cpp index 214f256..138a356 100644 --- a/Swift/QtUI/QtContactEditWindow.cpp +++ b/Swift/QtUI/QtContactEditWindow.cpp @@ -23,7 +23,7 @@ namespace Swift { -QtContactEditWindow::QtContactEditWindow() : contactEditWidget_(NULL) { +QtContactEditWindow::QtContactEditWindow() : contactEditWidget_(nullptr) { resize(400,300); setWindowTitle(tr("Edit contact")); setContentsMargins(0,0,0,0); diff --git a/Swift/QtUI/QtElidingLabel.h b/Swift/QtUI/QtElidingLabel.h index 9f590a8..e10c39c 100644 --- a/Swift/QtUI/QtElidingLabel.h +++ b/Swift/QtUI/QtElidingLabel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -12,8 +12,8 @@ namespace Swift { class QtElidingLabel : public QLabel { Q_OBJECT public: - QtElidingLabel(QWidget* parent = NULL, Qt::WindowFlags f = 0); - QtElidingLabel(const QString &text, QWidget* parent = NULL, Qt::WindowFlags f = 0); + QtElidingLabel(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::Widget); + QtElidingLabel(const QString &text, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::Widget); void setText(const QString& text); virtual ~QtElidingLabel(); diff --git a/Swift/QtUI/QtEmoticonCell.h b/Swift/QtUI/QtEmoticonCell.h index e408a83..669d1ed 100644 --- a/Swift/QtUI/QtEmoticonCell.h +++ b/Swift/QtUI/QtEmoticonCell.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <map> @@ -21,7 +27,7 @@ namespace Swift { class QtEmoticonCell : public QLabel { Q_OBJECT public: - QtEmoticonCell(const QString emoticonAsText, QString filePath, QWidget* parent = 0); + QtEmoticonCell(const QString emoticonAsText, QString filePath, QWidget* parent = nullptr); ~QtEmoticonCell(); virtual void mousePressEvent(QMouseEvent* event); diff --git a/Swift/QtUI/QtEmoticonsGrid.h b/Swift/QtUI/QtEmoticonsGrid.h index 0cae9ab..b3b8ac3 100644 --- a/Swift/QtUI/QtEmoticonsGrid.h +++ b/Swift/QtUI/QtEmoticonsGrid.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <map> @@ -23,7 +29,7 @@ namespace Swift { class QtEmoticonsGrid : public QGridLayout { Q_OBJECT public: - explicit QtEmoticonsGrid(const std::map<std::string, std::string>& emoticons, QWidget* parent = 0); + explicit QtEmoticonsGrid(const std::map<std::string, std::string>& emoticons, QWidget* parent = nullptr); virtual ~QtEmoticonsGrid(); signals: diff --git a/Swift/QtUI/QtFileTransferListItemModel.cpp b/Swift/QtUI/QtFileTransferListItemModel.cpp index d26733b..d070391 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.cpp +++ b/Swift/QtUI/QtFileTransferListItemModel.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -25,7 +25,7 @@ namespace Swift { -QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(0) { +QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(nullptr) { } QtFileTransferListItemModel::~QtFileTransferListItemModel() { @@ -137,7 +137,7 @@ int QtFileTransferListItemModel::rowCount(const QModelIndex& /* parent */) const } QModelIndex QtFileTransferListItemModel::index(int row, int column, const QModelIndex& /* parent */) const { - return createIndex(row, column, static_cast<void*>(0)); + return createIndex(row, column, static_cast<void*>(nullptr)); } } diff --git a/Swift/QtUI/QtFileTransferListItemModel.h b/Swift/QtUI/QtFileTransferListItemModel.h index d0e0e42..4d1e48b 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.h +++ b/Swift/QtUI/QtFileTransferListItemModel.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ class FileTransferOverview; class QtFileTransferListItemModel : public QAbstractItemModel { Q_OBJECT public: - explicit QtFileTransferListItemModel(QObject *parent = 0); + explicit QtFileTransferListItemModel(QObject *parent = nullptr); virtual ~QtFileTransferListItemModel(); void setFileTransferOverview(FileTransferOverview*); diff --git a/Swift/QtUI/QtFileTransferListWidget.cpp b/Swift/QtUI/QtFileTransferListWidget.cpp index f67b510..8b855b0 100644 --- a/Swift/QtUI/QtFileTransferListWidget.cpp +++ b/Swift/QtUI/QtFileTransferListWidget.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -25,7 +25,7 @@ namespace Swift { -QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(0) { +QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(nullptr) { QVBoxLayout* layout = new QVBoxLayout(this); layout->setSpacing(0); layout->setContentsMargins(0,0,0,0); @@ -58,7 +58,7 @@ QtFileTransferListWidget::QtFileTransferListWidget() : fileTransferOverview(0) { QtFileTransferListWidget::~QtFileTransferListWidget() { if (fileTransferOverview) { fileTransferOverview->onFileTransferListChanged.disconnect(boost::bind(&QtFileTransferListWidget::handleFileTransferListChanged, this)); - fileTransferOverview = NULL; + fileTransferOverview = nullptr; } delete itemModel; } @@ -89,7 +89,7 @@ void QtFileTransferListWidget::activate() { void QtFileTransferListWidget::setFileTransferOverview(FileTransferOverview *overview) { if (fileTransferOverview) { fileTransferOverview->onFileTransferListChanged.disconnect(boost::bind(&QtFileTransferListWidget::handleFileTransferListChanged, this)); - fileTransferOverview = NULL; + fileTransferOverview = nullptr; } if (overview) { fileTransferOverview = overview; diff --git a/Swift/QtUI/QtFormWidget.cpp b/Swift/QtUI/QtFormWidget.cpp index 13049ca..31f9a10 100644 --- a/Swift/QtUI/QtFormWidget.cpp +++ b/Swift/QtUI/QtFormWidget.cpp @@ -103,7 +103,7 @@ QListWidget* QtFormWidget::createList(FormField::ref field) { } QWidget* QtFormWidget::createWidget(FormField::ref field, const FormField::Type type, const size_t index) { - QWidget* widget = NULL; + QWidget* widget = nullptr; if (type == FormField::BooleanType) { QCheckBox* checkWidget = new QCheckBox(this); checkWidget->setCheckState(field->getBoolValue() ? Qt::Checked : Qt::Unchecked); @@ -226,7 +226,7 @@ void QtFormWidget::setEditable(bool editable) { return; } foreach (boost::shared_ptr<FormField> field, form_->getFields()) { - QWidget* widget = NULL; + QWidget* widget = nullptr; if (field) { widget = fields_[field->getName()]; } diff --git a/Swift/QtUI/QtFormWidget.h b/Swift/QtUI/QtFormWidget.h index 1eec115..f228ccb 100644 --- a/Swift/QtUI/QtFormWidget.h +++ b/Swift/QtUI/QtFormWidget.h @@ -19,7 +19,7 @@ namespace Swift { class QtFormWidget : public QWidget { Q_OBJECT public: - QtFormWidget(Form::ref form, QWidget* parent = NULL); + QtFormWidget(Form::ref form, QWidget* parent = nullptr); virtual ~QtFormWidget(); Form::ref getCompletedForm(); void setEditable(bool editable); diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h index 2a9f06b..845b11b 100644 --- a/Swift/QtUI/QtHighlightEditor.h +++ b/Swift/QtUI/QtHighlightEditor.h @@ -27,7 +27,7 @@ namespace Swift { Q_OBJECT public: - QtHighlightEditor(QtSettingsProvider* settings, QWidget* parent = NULL); + QtHighlightEditor(QtSettingsProvider* settings, QWidget* parent = nullptr); virtual ~QtHighlightEditor(); virtual void show(); diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index 5ed8114..035e73f 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -50,7 +50,7 @@ QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* even idCounter_ = 0; delete ui_.conversation_; - conversation_ = new QtWebKitChatView(NULL, NULL, theme_, this, true); // Horrible unsafe. Do not do this. FIXME + conversation_ = new QtWebKitChatView(nullptr, nullptr, theme_, this, true); // Horrible unsafe. Do not do this. FIXME QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(80); sizePolicy.setVerticalStretch(0); diff --git a/Swift/QtUI/QtLineEdit.h b/Swift/QtUI/QtLineEdit.h index 557f025..851a2ff 100644 --- a/Swift/QtUI/QtLineEdit.h +++ b/Swift/QtUI/QtLineEdit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -12,7 +12,7 @@ namespace Swift { class QtLineEdit : public QLineEdit { Q_OBJECT public: - QtLineEdit(QWidget* parent = NULL); + QtLineEdit(QWidget* parent = nullptr); signals: void escapePressed(); protected: diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 5f15f4c..11458f0 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -176,7 +176,7 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* set connect(loginButton_, SIGNAL(clicked()), SLOT(loginClicked())); stack_->addWidget(loginWidgetWrapper_); #ifdef SWIFTEN_PLATFORM_MACOSX - menuBar_ = new QMenuBar(NULL); + menuBar_ = new QMenuBar(nullptr); #else menuBar_ = menuBar(); #endif diff --git a/Swift/QtUI/QtMUCConfigurationWindow.cpp b/Swift/QtUI/QtMUCConfigurationWindow.cpp index 629e94f..e07b8c6 100644 --- a/Swift/QtUI/QtMUCConfigurationWindow.cpp +++ b/Swift/QtUI/QtMUCConfigurationWindow.cpp @@ -25,7 +25,7 @@ QtMUCConfigurationWindow::QtMUCConfigurationWindow(Form::ref form) : closed_(fal //label->setText(tr("Room configuration")); //layout->addWidget(label); - formWidget_ = NULL; + formWidget_ = nullptr; formWidget_ = new QtFormWidget(form, this); layout->addWidget(formWidget_); diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index d61026a..e351bd3 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -97,7 +97,7 @@ QtMainWindow::QtMainWindow(SettingsProvider* settings, UIEventStream* uiEventStr connect(tabs_, SIGNAL(currentChanged(int)), this, SLOT(handleTabChanged(int))); - tabBarCombo_ = NULL; + tabBarCombo_ = nullptr; if (settings_->getSetting(QtUISettingConstants::USE_SCREENREADER)) { tabs_->tabBar()->hide(); tabBarCombo_ = new QComboBox(this); diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp index 9dc815a..fc53666 100644 --- a/Swift/QtUI/QtPlainChatView.cpp +++ b/Swift/QtUI/QtPlainChatView.cpp @@ -343,7 +343,7 @@ void QtPlainChatView::rejectMUCInvite() } QtPlainChatView::FileTransfer::FileTransfer(QtPlainChatView* parent, bool senderIsSelf, const std::string& ftId, const std::string& filename, const ChatWindow::FileTransferState state, const std::string &desc, const std::string& msg, bool initializing) -: PopupDialog(parent), bar_(0), senderIsSelf_(senderIsSelf), ftId_(ftId), filename_(filename), description_(desc), message_(msg), initializing_(initializing) +: PopupDialog(parent), bar_(nullptr), senderIsSelf_(senderIsSelf), ftId_(ftId), filename_(filename), description_(desc), message_(msg), initializing_(initializing) { QHBoxLayout* layout = new QHBoxLayout; QLabel* statusLabel = new QLabel; diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index f8a4cdb..56c3104 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -27,7 +27,7 @@ #include <Swift/QtUI/Roster/RosterTooltip.h> namespace Swift { -QtRosterHeader::QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent) : QWidget(parent), statusEdit_(NULL) { +QtRosterHeader::QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent) : QWidget(parent), statusEdit_(nullptr) { QHBoxLayout* topLayout = new QHBoxLayout(); topLayout->setSpacing(3); topLayout->setContentsMargins(4,4,4,4); diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index b556504..7447c88 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -33,7 +33,7 @@ namespace Swift { class QtRosterHeader : public QWidget { Q_OBJECT public: - QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent = NULL); + QtRosterHeader(SettingsProvider* settings, StatusCache* statusCache, QWidget* parent = nullptr); void setAvatar(const QString& path); void setJID(const QString& jid); diff --git a/Swift/QtUI/QtSpellCheckerWindow.h b/Swift/QtUI/QtSpellCheckerWindow.h index 95e0725..846dcbb 100644 --- a/Swift/QtUI/QtSpellCheckerWindow.h +++ b/Swift/QtUI/QtSpellCheckerWindow.h @@ -21,7 +21,7 @@ namespace Swift { class QtSpellCheckerWindow : public QDialog, protected Ui::QtSpellCheckerWindow { Q_OBJECT public: - QtSpellCheckerWindow(SettingsProvider* settings, QWidget* parent = NULL); + QtSpellCheckerWindow(SettingsProvider* settings, QWidget* parent = nullptr); public slots: void handleChecker(bool state); void handleCancel(); diff --git a/Swift/QtUI/QtSubscriptionRequestWindow.h b/Swift/QtUI/QtSubscriptionRequestWindow.h index 1a36e19..83c6333 100644 --- a/Swift/QtUI/QtSubscriptionRequestWindow.h +++ b/Swift/QtUI/QtSubscriptionRequestWindow.h @@ -16,7 +16,7 @@ namespace Swift { class QtSubscriptionRequestWindow : public QDialog { Q_OBJECT public: - static QtSubscriptionRequestWindow* getWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = 0); + static QtSubscriptionRequestWindow* getWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); ~QtSubscriptionRequestWindow(); boost::shared_ptr<SubscriptionRequestEvent> getEvent(); private slots: @@ -24,7 +24,7 @@ namespace Swift { void handleNo(); void handleDefer(); private: - QtSubscriptionRequestWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = 0); + QtSubscriptionRequestWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); static QList<QtSubscriptionRequestWindow*> windows_; boost::shared_ptr<SubscriptionRequestEvent> event_; /*QPushButton* yesButton_; diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 5e8d61c..2fa2407 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -136,7 +136,7 @@ void QtSwift::loadEmoticonsFile(const QString& fileName, std::map<std::string, s } } -QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMainThreadCaller_), autoUpdater_(NULL), idleDetector_(&idleQuerier_, networkFactories_.getTimerFactory(), 1000) { +QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMainThreadCaller_), autoUpdater_(nullptr), idleDetector_(&idleQuerier_, networkFactories_.getTimerFactory(), 1000) { QCoreApplication::setApplicationName(SWIFT_APPLICATION_NAME); QCoreApplication::setOrganizationName(SWIFT_ORGANIZATION_NAME); QCoreApplication::setOrganizationDomain(SWIFT_ORGANIZATION_DOMAIN); @@ -157,7 +157,7 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa if (options.count("netbook-mode")) { splitter_ = new QtSingleWindow(qtSettings_); } else { - splitter_ = NULL; + splitter_ = nullptr; } int numberOfAccounts = 1; @@ -173,12 +173,12 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa } bool enableAdHocCommandOnJID = options.count("enable-jid-adhocs") > 0; - tabs_ = NULL; + tabs_ = nullptr; if (options.count("no-tabs") && !splitter_) { tabs_ = new QtChatTabsShortcutOnlySubstitute(); } else { - tabs_ = new QtChatTabs(splitter_ != NULL, settingsHierachy_, options.count("trellis")); + tabs_ = new QtChatTabs(splitter_ != nullptr, settingsHierachy_, options.count("trellis")); } bool startMinimized = options.count("start-minimized") > 0; applicationPathProvider_ = new PlatformApplicationPathProvider(SWIFT_APPLICATION_NAME); diff --git a/Swift/QtUI/QtSystemTray.cpp b/Swift/QtUI/QtSystemTray.cpp index 55a7d43..d9bfbc3 100644 --- a/Swift/QtUI/QtSystemTray.cpp +++ b/Swift/QtUI/QtSystemTray.cpp @@ -19,7 +19,7 @@ #include <QAction> namespace Swift { -QtSystemTray::QtSystemTray() : QObject(), statusType_(StatusShow::None), trayMenu_(0), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png"), throbberMovie_(":/icons/connecting.mng"), unreadMessages_(false), connecting_(false) { +QtSystemTray::QtSystemTray() : QObject(), statusType_(StatusShow::None), trayMenu_(nullptr), onlineIcon_(":icons/online.png"), awayIcon_(":icons/away.png"), dndIcon_(":icons/dnd.png"), offlineIcon_(":icons/offline.png"), newMessageIcon_(":icons/new-chat.png"), throbberMovie_(":/icons/connecting.mng"), unreadMessages_(false), connecting_(false) { trayIcon_ = new QSystemTrayIcon(offlineIcon_); trayIcon_->setToolTip("Swift"); connect(trayIcon_, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(handleIconActivated(QSystemTrayIcon::ActivationReason))); diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp index d3ba914..e0ca619 100644 --- a/Swift/QtUI/QtTextEdit.cpp +++ b/Swift/QtUI/QtTextEdit.cpp @@ -29,7 +29,7 @@ namespace Swift { -QtTextEdit::QtTextEdit(SettingsProvider* settings, QWidget* parent) : QTextEdit(parent), checker_(NULL), highlighter_(NULL) { +QtTextEdit::QtTextEdit(SettingsProvider* settings, QWidget* parent) : QTextEdit(parent), checker_(nullptr), highlighter_(nullptr) { connect(this, SIGNAL(textChanged()), this, SLOT(handleTextChanged())); settings_ = settings; #ifdef HAVE_SPELLCHECKER @@ -182,9 +182,9 @@ void QtTextEdit::addSuggestions(QMenu* menu, QContextMenuEvent* event) void QtTextEdit::setUpSpellChecker() { delete highlighter_; - highlighter_ = NULL; + highlighter_ = nullptr; delete checker_; - checker_ = NULL; + checker_ = nullptr; if (settings_->getSetting(SettingConstants::SPELL_CHECKER)) { std::string dictPath = settings_->getSetting(SettingConstants::DICT_PATH); std::string dictFile = settings_->getSetting(SettingConstants::DICT_FILE); diff --git a/Swift/QtUI/QtTextEdit.h b/Swift/QtUI/QtTextEdit.h index f03699b..0c2b740 100644 --- a/Swift/QtUI/QtTextEdit.h +++ b/Swift/QtUI/QtTextEdit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -23,7 +23,7 @@ namespace Swift { class QtTextEdit : public QTextEdit { Q_OBJECT public: - QtTextEdit(SettingsProvider* settings, QWidget* parent = 0); + QtTextEdit(SettingsProvider* settings, QWidget* parent = nullptr); virtual ~QtTextEdit(); virtual QSize sizeHint() const; diff --git a/Swift/QtUI/QtTranslator.h b/Swift/QtUI/QtTranslator.h index 4254324..cdb259f 100644 --- a/Swift/QtUI/QtTranslator.h +++ b/Swift/QtUI/QtTranslator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,7 +17,7 @@ class QtTranslator : public Swift::Translator { virtual std::string translate(const std::string& text, const std::string& context) { #if QT_VERSION >= 0x050000 - return std::string(QCoreApplication::translate(context.c_str(), text.c_str(), 0).toUtf8()); + return std::string(QCoreApplication::translate(context.c_str(), text.c_str(), nullptr).toUtf8()); #else return std::string(QCoreApplication::translate(context.c_str(), text.c_str(), 0, QCoreApplication::UnicodeUTF8).toUtf8()); #endif diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index a1321bd..3318c21 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -38,7 +38,7 @@ namespace Swift { -QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabsBase* tabs, QtSingleWindow* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, StatusCache* statusCache, bool startMinimized, bool emoticonsExist, bool enableAdHocCommandOnJID) : settings(settings), qtOnlySettings(qtOnlySettings), tabsBase(tabs), netbookSplitter(netbookSplitter), systemTray(systemTray), chatWindowFactory(chatWindowFactory), timerFactory_(timerFactory), lastMainWindow(NULL), loginWindow(NULL), statusCache(statusCache), startMinimized(startMinimized), emoticonsExist_(emoticonsExist), enableAdHocCommandOnJID_(enableAdHocCommandOnJID) { +QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabsBase* tabs, QtSingleWindow* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, StatusCache* statusCache, bool startMinimized, bool emoticonsExist, bool enableAdHocCommandOnJID) : settings(settings), qtOnlySettings(qtOnlySettings), tabsBase(tabs), netbookSplitter(netbookSplitter), systemTray(systemTray), chatWindowFactory(chatWindowFactory), timerFactory_(timerFactory), lastMainWindow(nullptr), loginWindow(nullptr), statusCache(statusCache), startMinimized(startMinimized), emoticonsExist_(emoticonsExist), enableAdHocCommandOnJID_(enableAdHocCommandOnJID) { chatFontSize = settings->getSetting(QtUISettingConstants::CHATWINDOW_FONT_SIZE); historyFontSize_ = settings->getSetting(QtUISettingConstants::HISTORYWINDOW_FONT_SIZE); this->tabs = dynamic_cast<QtChatTabs*>(tabsBase); diff --git a/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp b/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp index ec7941c..da4f22f 100644 --- a/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp +++ b/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp @@ -24,7 +24,7 @@ QtCloseButton::QtCloseButton(QWidget *parent) : QAbstractButton(parent) { } QSize QtCloseButton::sizeHint() const { - return QSize(style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, 0), style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, 0)); + return QSize(style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, nullptr), style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, nullptr)); } bool QtCloseButton::event(QEvent *e) { diff --git a/Swift/QtUI/QtVCardWidget/QtCloseButton.h b/Swift/QtUI/QtVCardWidget/QtCloseButton.h index 1ba31a0..0c6e192 100644 --- a/Swift/QtUI/QtVCardWidget/QtCloseButton.h +++ b/Swift/QtUI/QtVCardWidget/QtCloseButton.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <QAbstractButton> @@ -13,7 +19,7 @@ namespace Swift { class QtCloseButton : public QAbstractButton { Q_OBJECT public: - explicit QtCloseButton(QWidget *parent = 0); + explicit QtCloseButton(QWidget *parent = nullptr); virtual QSize sizeHint() const; protected: diff --git a/Swift/QtUI/QtVCardWidget/QtRemovableItemDelegate.cpp b/Swift/QtUI/QtVCardWidget/QtRemovableItemDelegate.cpp index 67c79a9..079f77d 100644 --- a/Swift/QtUI/QtVCardWidget/QtRemovableItemDelegate.cpp +++ b/Swift/QtUI/QtVCardWidget/QtRemovableItemDelegate.cpp @@ -36,7 +36,7 @@ void QtRemovableItemDelegate::paint(QPainter* painter, const QStyleOptionViewIte if (index.data().toString().isEmpty()) { #ifdef SWIFTEN_PLATFORM_MACOSX // workaround for Qt not painting relative to the cell we're in, on OS X - int height = style->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, 0); + int height = style->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, nullptr); painter->translate(option.rect.x(), option.rect.y() + (option.rect.height() - height)/2); #endif style->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, painter); @@ -45,7 +45,7 @@ void QtRemovableItemDelegate::paint(QPainter* painter, const QStyleOptionViewIte } QWidget* QtRemovableItemDelegate::createEditor(QWidget*, const QStyleOptionViewItem&, const QModelIndex&) const { - return NULL; + return nullptr; } bool QtRemovableItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) { @@ -58,7 +58,7 @@ bool QtRemovableItemDelegate::editorEvent(QEvent* event, QAbstractItemModel* mod } QSize QtRemovableItemDelegate::sizeHint(const QStyleOptionViewItem&, const QModelIndex&) const { - QSize size(style->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, 0) + 2, style->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, 0) + 2); + QSize size(style->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, nullptr) + 2, style->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, nullptr) + 2); return size; } diff --git a/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.h b/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.h index 47c6f3e..eab5b2b 100644 --- a/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.h +++ b/Swift/QtUI/QtVCardWidget/QtResizableLineEdit.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <QLineEdit> @@ -15,7 +21,7 @@ namespace Swift { Q_PROPERTY(bool editable READ isEditable WRITE setEditable) public: - explicit QtResizableLineEdit(QWidget* parent = 0); + explicit QtResizableLineEdit(QWidget* parent = nullptr); ~QtResizableLineEdit(); bool isEditable() const; diff --git a/Swift/QtUI/QtVCardWidget/QtTagComboBox.h b/Swift/QtUI/QtVCardWidget/QtTagComboBox.h index f08f136..e9dbbdd 100644 --- a/Swift/QtUI/QtVCardWidget/QtTagComboBox.h +++ b/Swift/QtUI/QtVCardWidget/QtTagComboBox.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <QComboBox> @@ -18,7 +24,7 @@ class QtTagComboBox : public QComboBox { Q_PROPERTY(bool editable READ isEditable WRITE setEditable) public: - explicit QtTagComboBox(QWidget* parent = 0); + explicit QtTagComboBox(QWidget* parent = nullptr); ~QtTagComboBox(); bool isEditable() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp index 57bb2cd..4043dbc 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ namespace Swift { QtVCardAddressField::QtVCardAddressField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Address")), streetLineEdit(NULL), poboxLineEdit(NULL), addressextLineEdit(NULL), cityLineEdit(NULL), pocodeLineEdit(NULL), regionLineEdit(NULL), countryLineEdit(NULL), textFieldGridLayout(NULL), textFieldGridLayoutItem(NULL), deliveryTypeLabel(NULL), domesticRadioButton(NULL), internationalRadioButton(NULL), buttonGroup(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Address")), streetLineEdit(nullptr), poboxLineEdit(nullptr), addressextLineEdit(nullptr), cityLineEdit(nullptr), pocodeLineEdit(nullptr), regionLineEdit(nullptr), countryLineEdit(nullptr), textFieldGridLayout(nullptr), textFieldGridLayoutItem(nullptr), deliveryTypeLabel(nullptr), domesticRadioButton(nullptr), internationalRadioButton(nullptr), buttonGroup(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } @@ -164,7 +164,7 @@ void QtVCardAddressField::handleEditibleChanged(bool isEditable) { regionLineEdit->setEditable(isEditable); countryLineEdit->setEditable(isEditable); - deliveryTypeLabel->setText(buttonGroup->checkedButton() == 0 ? "" : buttonGroup->checkedButton()->text()); + deliveryTypeLabel->setText(buttonGroup->checkedButton() == nullptr ? "" : buttonGroup->checkedButton()->text()); deliveryTypeLabel->setVisible(!isEditable); domesticRadioButton->setVisible(isEditable); diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h index c90628a..aeebbff 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.h @@ -32,7 +32,7 @@ class QtVCardAddressField : public QtVCardGeneralField, public QtVCardHomeWork { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Address"), UNLIMITED_INSTANCES, QtVCardAddressField) - QtVCardAddressField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardAddressField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardAddressField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp index 7f270c5..e4a75cd 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ namespace Swift { QtVCardAddressLabelField::QtVCardAddressLabelField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Address Label")), addressLabelPlainTextEdit(NULL), deliveryTypeLabel(NULL), domesticRadioButton(NULL), internationalRadioButton(NULL), buttonGroup(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Address Label")), addressLabelPlainTextEdit(nullptr), deliveryTypeLabel(nullptr), domesticRadioButton(nullptr), internationalRadioButton(nullptr), buttonGroup(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } @@ -97,7 +97,7 @@ void QtVCardAddressLabelField::handleEditibleChanged(bool isEditable) { addressLabelPlainTextEdit->setReadOnly(!isEditable); addressLabelPlainTextEdit->setStyleSheet(isEditable ? "" : "QPlainTextEdit { background: transparent; }"); - deliveryTypeLabel->setText(buttonGroup->checkedButton() == 0 ? "" : buttonGroup->checkedButton()->text()); + deliveryTypeLabel->setText(buttonGroup->checkedButton() == nullptr ? "" : buttonGroup->checkedButton()->text()); deliveryTypeLabel->setVisible(!isEditable); domesticRadioButton->setVisible(isEditable); diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h index 16910b3..ceca88a 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressLabelField.h @@ -32,7 +32,7 @@ class QtVCardAddressLabelField : public QtVCardGeneralField, public QtVCardHomeW public: GENERIC_QT_VCARD_FIELD_INFO(tr("Address Label"), UNLIMITED_INSTANCES, QtVCardAddressLabelField) - QtVCardAddressLabelField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardAddressLabelField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardAddressLabelField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.cpp index 53dfc7f..1111295 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.cpp @@ -22,7 +22,7 @@ namespace Swift { QtVCardBirthdayField::QtVCardBirthdayField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Birthday"), false, false), birthdayLabel(NULL), birthdayDateEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Birthday"), false, false), birthdayLabel(nullptr), birthdayDateEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h index 431751e..0383b6c 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardBirthdayField.h @@ -28,7 +28,7 @@ class QtVCardBirthdayField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Birthday"), 1, QtVCardBirthdayField) - QtVCardBirthdayField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardBirthdayField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardBirthdayField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.cpp index 9926262..2a8e1c9 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.cpp @@ -22,7 +22,7 @@ namespace Swift { QtVCardDescriptionField::QtVCardDescriptionField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Description"), false, false), descriptionPlainTextEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Description"), false, false), descriptionPlainTextEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h index 489797a..c06dd97 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardDescriptionField.h @@ -27,7 +27,7 @@ class QtVCardDescriptionField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Description"), 1, QtVCardDescriptionField) - QtVCardDescriptionField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardDescriptionField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardDescriptionField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp index 44d94d7..ab69cba 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp @@ -22,8 +22,8 @@ namespace Swift { QtVCardGeneralField::QtVCardGeneralField(QWidget* parent, QGridLayout* layout, bool editable, int row, QString label, bool preferrable, bool taggable) : - QWidget(parent), editable(editable), preferrable(preferrable), starVisible(false), taggable(taggable), layout(layout), row(row), preferredCheckBox(0), label(0), labelText(label), - tagComboBox(0), tagLabel(NULL), closeButton(0) { + QWidget(parent), editable(editable), preferrable(preferrable), starVisible(false), taggable(taggable), layout(layout), row(row), preferredCheckBox(nullptr), label(nullptr), labelText(label), + tagComboBox(nullptr), tagLabel(nullptr), closeButton(nullptr) { } QtVCardGeneralField::~QtVCardGeneralField() { diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h index d907196..48ecf9f 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -37,7 +37,7 @@ class QtVCardGeneralField : public QWidget { Q_PROPERTY(bool empty READ isEmpty) public: - explicit QtVCardGeneralField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false, int row = 0, QString label = QString(), + explicit QtVCardGeneralField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false, int row = 0, QString label = QString(), bool preferrable = true, bool taggable = true); virtual ~QtVCardGeneralField(); diff --git a/Swift/QtUI/QtVCardWidget/QtVCardHomeWork.cpp b/Swift/QtUI/QtVCardWidget/QtVCardHomeWork.cpp index c147c68..7f204ca 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardHomeWork.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardHomeWork.cpp @@ -14,7 +14,7 @@ namespace Swift { -QtVCardHomeWork::QtVCardHomeWork() : tagComboBox(0) { +QtVCardHomeWork::QtVCardHomeWork() : tagComboBox(nullptr) { } QtVCardHomeWork::~QtVCardHomeWork() { diff --git a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp index e563ca2..9deb7ba 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.cpp @@ -24,7 +24,7 @@ namespace Swift { QtVCardInternetEMailField::QtVCardInternetEMailField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("E-Mail")), emailLineEdit(NULL), emailLabel(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("E-Mail")), emailLineEdit(nullptr), emailLabel(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.h b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.h index 63a83e2..07f4f8d 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardInternetEMailField.h @@ -27,7 +27,7 @@ class QtVCardInternetEMailField : public QtVCardGeneralField, public QtVCardHome public: GENERIC_QT_VCARD_FIELD_INFO(tr("E-Mail"), UNLIMITED_INSTANCES, QtVCardInternetEMailField) - QtVCardInternetEMailField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardInternetEMailField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardInternetEMailField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp index 705ad6b..f93ea06 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.cpp @@ -23,7 +23,7 @@ namespace Swift { QtVCardJIDField::QtVCardJIDField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("JID"), false, false), jidLabel(NULL), jidLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("JID"), false, false), jidLabel(nullptr), jidLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h index 2e9b4ef..f2df9f9 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardJIDField.h @@ -26,7 +26,7 @@ class QtVCardJIDField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("JID"), UNLIMITED_INSTANCES, QtVCardJIDField) - QtVCardJIDField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardJIDField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardJIDField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp index 8b94c42..9e303b7 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.h> #include <boost/algorithm/string.hpp> @@ -17,7 +23,7 @@ namespace Swift { QtVCardOrganizationField::QtVCardOrganizationField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Organization"), false, false), organizationLabel(NULL), organizationLineEdit(NULL), unitsTreeWidget(NULL), itemDelegate(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Organization"), false, false), organizationLabel(nullptr), organizationLineEdit(nullptr), unitsTreeWidget(nullptr), itemDelegate(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.h b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.h index 6de3167..23e89c0 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.h @@ -29,7 +29,7 @@ class QtVCardOrganizationField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Organization"), UNLIMITED_INSTANCES, QtVCardOrganizationField) - QtVCardOrganizationField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardOrganizationField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardOrganizationField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h index a0bbb24..ca6a1f3 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <QMenu> @@ -23,7 +29,7 @@ namespace Swift { Q_PROPERTY(bool editable READ isEditable WRITE setEditable) public: - explicit QtVCardPhotoAndNameFields(QWidget* parent = 0); + explicit QtVCardPhotoAndNameFields(QWidget* parent = nullptr); ~QtVCardPhotoAndNameFields(); bool isEditable() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.cpp index 2881932..e9e29ad 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.cpp @@ -21,7 +21,7 @@ namespace Swift { QtVCardRoleField::QtVCardRoleField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Role"), false, false), roleLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Role"), false, false), roleLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h index 40b5d0b..a507fef 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardRoleField.h @@ -26,7 +26,7 @@ class QtVCardRoleField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Role"), UNLIMITED_INSTANCES, QtVCardRoleField) - QtVCardRoleField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardRoleField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardRoleField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.cpp index 4af2fa3..9421016 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.cpp @@ -19,7 +19,7 @@ namespace Swift { QtVCardTelephoneField::QtVCardTelephoneField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Telephone")), telephoneLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Telephone")), telephoneLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h index 1a08a5a..13bb232 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardTelephoneField.h @@ -27,7 +27,7 @@ class QtVCardTelephoneField : public QtVCardGeneralField, public QtVCardHomeWork public: GENERIC_QT_VCARD_FIELD_INFO(tr("Telephone"), UNLIMITED_INSTANCES, QtVCardTelephoneField) - QtVCardTelephoneField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardTelephoneField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardTelephoneField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.cpp index 5da5763..14c3813 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.cpp @@ -21,7 +21,7 @@ namespace Swift { QtVCardTitleField::QtVCardTitleField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Title"), false, false), titleLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("Title"), false, false), titleLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h index ff2a04e..0ea3772 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardTitleField.h @@ -26,7 +26,7 @@ class QtVCardTitleField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("Title"), UNLIMITED_INSTANCES, QtVCardTitleField) - QtVCardTitleField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardTitleField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardTitleField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp index 8abc46e..153b897 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardURLField.cpp @@ -24,7 +24,7 @@ namespace Swift { QtVCardURLField::QtVCardURLField(QWidget* parent, QGridLayout *layout, bool editable) : - QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("URL"), false, false), urlLabel(NULL), urlLineEdit(NULL) { + QtVCardGeneralField(parent, layout, editable, layout->rowCount(), tr("URL"), false, false), urlLabel(nullptr), urlLineEdit(nullptr) { connect(this, SIGNAL(editableChanged(bool)), SLOT(handleEditibleChanged(bool))); } diff --git a/Swift/QtUI/QtVCardWidget/QtVCardURLField.h b/Swift/QtUI/QtVCardWidget/QtVCardURLField.h index a1ffacd..3830a7b 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardURLField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardURLField.h @@ -26,7 +26,7 @@ class QtVCardURLField : public QtVCardGeneralField { public: GENERIC_QT_VCARD_FIELD_INFO(tr("URL"), UNLIMITED_INSTANCES, QtVCardURLField) - QtVCardURLField(QWidget* parent = 0, QGridLayout* layout = 0, bool editable = false); + QtVCardURLField(QWidget* parent = nullptr, QGridLayout* layout = nullptr, bool editable = false); virtual ~QtVCardURLField(); virtual bool isEmpty() const; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp index 712cedf..fffd4b3 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp @@ -227,8 +227,8 @@ VCard::ref QtVCardWidget::getVCard() { vcard->clearAddressLabels(); - QtVCardBirthdayField* bdayField = NULL; - QtVCardDescriptionField* descriptionField = NULL; + QtVCardBirthdayField* bdayField = nullptr; + QtVCardDescriptionField* descriptionField = nullptr; foreach(QtVCardGeneralField* field, fields) { QtVCardInternetEMailField* emailField; @@ -310,7 +310,7 @@ VCard::ref QtVCardWidget::getVCard() { } void QtVCardWidget::addField() { - QAction* action = NULL; + QAction* action = nullptr; if ((action = dynamic_cast<QAction*>(sender()))) { boost::shared_ptr<QtVCardFieldInfo> fieldInfo = actionFieldInfo[action]; QWidget* newField = fieldInfo->createFieldInstance(this, ui->cardFields, true); @@ -325,7 +325,7 @@ void QtVCardWidget::addField() { void QtVCardWidget::removeField(QtVCardGeneralField *field) { int sameFields = 0; - QtVCardGeneralField* fieldToChange = NULL; + QtVCardGeneralField* fieldToChange = nullptr; foreach (QtVCardGeneralField* vcardField, fields) { if ((vcardField != field) && (typeid(*vcardField) == typeid(*field))) { sameFields++; @@ -361,7 +361,7 @@ int QtVCardWidget::fieldTypeInstances(boost::shared_ptr<QtVCardFieldInfo> fieldT void layoutDeleteChildren(QLayout *layout) { while(layout->count() > 0) { QLayoutItem* child; - if ((child = layout->takeAt(0)) != 0) { + if ((child = layout->takeAt(0)) != nullptr) { if (child->layout()) { layoutDeleteChildren(child->layout()); } @@ -403,7 +403,7 @@ void QtVCardWidget::clearEmptyFields() { void QtVCardWidget::appendField(QtVCardGeneralField *field) { connect(field, SIGNAL(deleteField(QtVCardGeneralField*)), SLOT(removeField(QtVCardGeneralField*))); - QtVCardGeneralField* fieldToChange = NULL; + QtVCardGeneralField* fieldToChange = nullptr; foreach (QtVCardGeneralField* vcardField, fields) { if (typeid(*vcardField) == typeid(*field)) { fieldToChange = vcardField; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h index 95283c5..76fc46c 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -34,7 +34,7 @@ namespace Swift { Q_PROPERTY(bool editable READ isEditable WRITE setEditable) public : - explicit QtVCardWidget(QWidget* parent = 0); + explicit QtVCardWidget(QWidget* parent = nullptr); ~QtVCardWidget(); bool isEditable() const; 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; } diff --git a/Swift/QtUI/Trellis/QtDNDTabBar.cpp b/Swift/QtUI/Trellis/QtDNDTabBar.cpp index fac2233..9a6c436 100644 --- a/Swift/QtUI/Trellis/QtDNDTabBar.cpp +++ b/Swift/QtUI/Trellis/QtDNDTabBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -118,7 +118,7 @@ bool QtDNDTabBar::event(QEvent* event) { QMouseEvent* finishMoveEvent = new QMouseEvent (QEvent::MouseMove, mouseEvent->pos (), Qt::NoButton, Qt::NoButton, Qt::NoModifier); QTabBar::event(finishMoveEvent); delete finishMoveEvent; - finishMoveEvent = NULL; + finishMoveEvent = nullptr; // start drag QDrag* drag = new QDrag(this); diff --git a/Swift/QtUI/Trellis/QtDNDTabBar.h b/Swift/QtUI/Trellis/QtDNDTabBar.h index 3677b73..40eb66d 100644 --- a/Swift/QtUI/Trellis/QtDNDTabBar.h +++ b/Swift/QtUI/Trellis/QtDNDTabBar.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,7 +13,7 @@ namespace Swift { class QtDNDTabBar : public QTabBar { Q_OBJECT public: - explicit QtDNDTabBar(QWidget* parent = 0); + explicit QtDNDTabBar(QWidget* parent = nullptr); virtual ~QtDNDTabBar(); int getDragIndex() const; diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp index 7de2791..cafecf9 100644 --- a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp +++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -23,7 +23,7 @@ namespace Swift { -QtDynamicGridLayout::QtDynamicGridLayout(QWidget* parent, bool enableDND) : QWidget(parent), dndEnabled_(enableDND), movingTab_(NULL) { +QtDynamicGridLayout::QtDynamicGridLayout(QWidget* parent, bool enableDND) : QWidget(parent), dndEnabled_(enableDND), movingTab_(nullptr) { gridLayout_ = new QGridLayout(this); setContentsMargins(0,0,0,0); setDimensions(QSize(1,1)); @@ -44,7 +44,7 @@ int QtDynamicGridLayout::addTab(QtTabbable* tab, const QString& title) { lastPos = QPoint(qMin(lastPos.x(), gridLayout_->columnCount() - 1), qMin(lastPos.y(), gridLayout_->rowCount() - 1)); QLayoutItem* item = gridLayout_->itemAtPosition(lastPos.y(), lastPos.x()); - QtTabWidget* tabWidget = dynamic_cast<QtTabWidget*>(item ? item->widget() : 0); + QtTabWidget* tabWidget = dynamic_cast<QtTabWidget*>(item ? item->widget() : nullptr); if (tabWidget) { tabWidget->addTab(tab, title); } @@ -66,7 +66,7 @@ int QtDynamicGridLayout::count() const { } QWidget* QtDynamicGridLayout::widget(int index) const { - QWidget* widgetAtIndex = NULL; + QWidget* widgetAtIndex = nullptr; for (int y = 0; y < gridLayout_->rowCount(); y++) { for (int x = 0; x < gridLayout_->columnCount(); x++) { QLayoutItem* layoutItem = gridLayout_->itemAtPosition(y, x); @@ -171,13 +171,13 @@ bool QtDynamicGridLayout::eventFilter(QObject* object, QEvent* event) { } QWidget* QtDynamicGridLayout::currentWidget() const { - QWidget* current = NULL; + QWidget* current = nullptr; current = focusWidget(); while (current && !dynamic_cast<QtTabbable*>(current)) { if (current->parentWidget()) { current = current->parentWidget(); } else { - current = NULL; + current = nullptr; break; } } @@ -218,14 +218,14 @@ QtTabWidget* QtDynamicGridLayout::indexToTabWidget(int index, int& tabIndex) { if (index < 0) { qWarning() << "Called QtDynamicGridLayout::setCurrentIndex with index out of bounds: index = " << index; tabIndex = -1; - return NULL; + return nullptr; } } } } } tabIndex = -1; - return NULL; + return nullptr; } bool QtDynamicGridLayout::isDNDEnabled() const { @@ -458,9 +458,9 @@ void QtDynamicGridLayout::updateTabPositions() { void QtDynamicGridLayout::moveTab(QtTabWidget* tabWidget, int oldIndex, int newIndex) { #if QT_VERSION >= 0x040500 - SWIFT_LOG_ASSERT(movingTab_ == NULL, error) << std::endl; + SWIFT_LOG_ASSERT(movingTab_ == nullptr, error) << std::endl; movingTab_ = qobject_cast<QtTabbable*>(tabWidget->widget(oldIndex)); - SWIFT_LOG_ASSERT(movingTab_ != NULL, error) << std::endl; + SWIFT_LOG_ASSERT(movingTab_ != nullptr, error) << std::endl; if (movingTab_) { // Install event filter that filters out events issued during the internal movement of the @@ -472,7 +472,7 @@ void QtDynamicGridLayout::moveTab(QtTabWidget* tabWidget, int oldIndex, int newI qApp->removeEventFilter(this); SWIFT_LOG_ASSERT(movingTab_ == tabWidget->widget(newIndex), error) << std::endl; } - movingTab_ = NULL; + movingTab_ = nullptr; tabWidget->widget(newIndex)->setFocus(); #else #warning Qt 4.5 or later is needed. Trying anyway, some things will be disabled. diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.h b/Swift/QtUI/Trellis/QtDynamicGridLayout.h index 2a6029c..dad0f7e 100644 --- a/Swift/QtUI/Trellis/QtDynamicGridLayout.h +++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ namespace Swift { class QtDynamicGridLayout : public QWidget { Q_OBJECT public: - explicit QtDynamicGridLayout(QWidget* parent = 0, bool enableDND = false); + explicit QtDynamicGridLayout(QWidget* parent = nullptr, bool enableDND = false); virtual ~QtDynamicGridLayout(); QSize getDimension() const; diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp index c7b7edb..8a69a3d 100644 --- a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp +++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -103,7 +103,7 @@ void QtGridSelectionDialog::paintEvent(QPaintEvent*) { int yPos = verticalMargin + (y * (frameSize.height() + padding)); option.menuRect.moveTo(QPoint(xPos, yPos)); option.rect = option.menuRect; - style()->drawControl(QStyle::CE_MenuItem, &option, &painter, 0); + style()->drawControl(QStyle::CE_MenuItem, &option, &painter, nullptr); } } diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.h b/Swift/QtUI/Trellis/QtGridSelectionDialog.h index c763e68..56a575f 100644 --- a/Swift/QtUI/Trellis/QtGridSelectionDialog.h +++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,7 +18,7 @@ namespace Swift { Q_PROPERTY(QSize minGridSize READ getMinGridSize WRITE setMinGridSize NOTIFY minGridSizeChanged) Q_PROPERTY(QSize maxGridSize READ getMaxGridSize WRITE setMaxGridSize NOTIFY maxGridSizeChanged) public: - explicit QtGridSelectionDialog(QWidget* parent = 0); + explicit QtGridSelectionDialog(QWidget* parent = nullptr); virtual QSize sizeHint() const; diff --git a/Swift/QtUI/UserSearch/QtUserSearchFieldsPage.cpp b/Swift/QtUI/UserSearch/QtUserSearchFieldsPage.cpp index 3a82a62..3a6028d 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchFieldsPage.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchFieldsPage.cpp @@ -8,7 +8,7 @@ namespace Swift { -QtUserSearchFieldsPage::QtUserSearchFieldsPage() : formWidget_(0) { +QtUserSearchFieldsPage::QtUserSearchFieldsPage() : formWidget_(nullptr) { setupUi(this); } @@ -27,7 +27,7 @@ QtFormWidget* QtUserSearchFieldsPage::getFormWidget() { void QtUserSearchFieldsPage::setFormWidget(QtFormWidget *widget) { if (formWidget_) { delete formWidget_; - formWidget_ = NULL; + formWidget_ = nullptr; } if (widget) { formContainer_->layout()->addWidget(widget); diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index 1140b6e..09943c5 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -36,7 +36,7 @@ namespace Swift { -QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWindow::Type type, const std::set<std::string>& groups, SettingsProvider* settingsProvider) : eventStream_(eventStream), type_(type), model_(NULL), firstMultiJIDPage_(NULL), settings_(settingsProvider), searchNext_(false), supportsImpromptu_(false) { +QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWindow::Type type, const std::set<std::string>& groups, SettingsProvider* settingsProvider) : eventStream_(eventStream), type_(type), model_(nullptr), firstMultiJIDPage_(nullptr), settings_(settingsProvider), searchNext_(false), supportsImpromptu_(false) { setupUi(this); #ifndef Q_OS_MAC #ifdef Q_OS_WIN32 @@ -339,7 +339,7 @@ void QtUserSearchWindow::setSearchFields(boost::shared_ptr<SearchPayload> fields if (fields->getForm()) { fieldsPage_->setFormWidget(new QtFormWidget(fields->getForm(), fieldsPage_)); } else { - fieldsPage_->setFormWidget(NULL); + fieldsPage_->setFormWidget(nullptr); bool enabled[8] = {!!fields->getNick(), !!fields->getNick(), !!fields->getFirst(), !!fields->getFirst(), !!fields->getLast(), !!fields->getLast(), !!fields->getEMail(), !!fields->getEMail()}; QWidget* legacySearchWidgets[8] = {fieldsPage_->nickInputLabel_, fieldsPage_->nickInput_, fieldsPage_->firstInputLabel_, fieldsPage_->firstInput_, fieldsPage_->lastInputLabel_, fieldsPage_->lastInput_, fieldsPage_->emailInputLabel_, fieldsPage_->emailInput_}; for (int i = 0; i < 8; i++) { @@ -494,7 +494,7 @@ void QtUserSearchWindow::handleJIDEditingDone() { } void QtUserSearchWindow::setFirstPage(QString title) { - if (page(1) != 0) { + if (page(1) != nullptr) { removePage(1); } if (type_ == AddContact) { @@ -524,7 +524,7 @@ void QtUserSearchWindow::setFirstPage(QString title) { } void QtUserSearchWindow::setSecondPage() { - if (page(2) != 0) { + if (page(2) != nullptr) { removePage(2); } fieldsPage_ = new QtUserSearchFieldsPage(); @@ -534,7 +534,7 @@ void QtUserSearchWindow::setSecondPage() { } void QtUserSearchWindow::setThirdPage() { - if (page(3) != 0) { + if (page(3) != nullptr) { removePage(3); } resultsPage_ = new QtUserSearchResultsPage(); @@ -585,9 +585,9 @@ void QtUserSearchWindow::clear() { firstMultiJIDPage_->howLabel_->setText(howText); } clearForm(); - resultsPage_->results_->setModel(NULL); + resultsPage_->results_->setModel(nullptr); delete model_; - model_ = NULL; + model_ = nullptr; restart(); lastPage_ = 1; } diff --git a/Swift/QtUI/UserSearch/UserSearchDelegate.h b/Swift/QtUI/UserSearch/UserSearchDelegate.h index 8234689..a5639ec 100644 --- a/Swift/QtUI/UserSearch/UserSearchDelegate.h +++ b/Swift/QtUI/UserSearch/UserSearchDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,7 +17,7 @@ namespace Swift { Q_OBJECT public: - UserSearchDelegate(QObject* parent = 0); + UserSearchDelegate(QObject* parent = nullptr); virtual ~UserSearchDelegate(); void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; diff --git a/Swift/QtUI/Whiteboard/ColorWidget.h b/Swift/QtUI/Whiteboard/ColorWidget.h index 18dc73f..56ada0c 100644 --- a/Swift/QtUI/Whiteboard/ColorWidget.h +++ b/Swift/QtUI/Whiteboard/ColorWidget.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once #include <QWidget> @@ -12,7 +18,7 @@ namespace Swift { class ColorWidget : public QWidget { Q_OBJECT public: - ColorWidget(QWidget* parent = 0); + ColorWidget(QWidget* parent = nullptr); QSize sizeHint() const; public slots: diff --git a/Swift/QtUI/Whiteboard/FreehandLineItem.h b/Swift/QtUI/Whiteboard/FreehandLineItem.h index a2dab34..5b83d95 100644 --- a/Swift/QtUI/Whiteboard/FreehandLineItem.h +++ b/Swift/QtUI/Whiteboard/FreehandLineItem.h @@ -21,9 +21,9 @@ namespace Swift { class FreehandLineItem : public QGraphicsItem { public: enum {Type = UserType + 1}; - FreehandLineItem(QGraphicsItem* parent = 0); + FreehandLineItem(QGraphicsItem* parent = nullptr); QRectF boundingRect() const; - void paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /*widget*/ = 0); + void paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /*widget*/ = nullptr); void setStartPoint(QPointF point); void lineTo(QPointF point); bool collidesWithPath(const QPainterPath& path, Qt::ItemSelectionMode /*mode*/ = Qt::IntersectsItemShape) const; diff --git a/Swift/QtUI/Whiteboard/GView.cpp b/Swift/QtUI/Whiteboard/GView.cpp index 4deaaf6..80061fd 100644 --- a/Swift/QtUI/Whiteboard/GView.cpp +++ b/Swift/QtUI/Whiteboard/GView.cpp @@ -15,7 +15,7 @@ #include <Swift/QtUI/QtSwiftUtil.h> namespace Swift { - GView::GView(QGraphicsScene* scene, QWidget* parent) : QGraphicsView(scene, parent), zValue(0), mousePressed(false), brush(QColor(Qt::white)), defaultBrush(QColor(Qt::white)), mode(GView::Select), lastItem(NULL), selectionRect(NULL), textDialog(NULL) { + GView::GView(QGraphicsScene* scene, QWidget* parent) : QGraphicsView(scene, parent), zValue(0), mousePressed(false), brush(QColor(Qt::white)), defaultBrush(QColor(Qt::white)), mode(GView::Select), lastItem(nullptr), selectionRect(nullptr), textDialog(nullptr) { } void GView::setLineWidth(int i) { @@ -63,7 +63,7 @@ namespace Swift { void GView::setMode(Mode mode) { this->mode = mode; - lastItem = 0; + lastItem = nullptr; deselect(); } @@ -86,8 +86,8 @@ namespace Swift { scene()->clear(); items_.clear(); itemsMap_.clear(); - lastItem = 0; - selectionRect = 0; + lastItem = nullptr; + selectionRect = nullptr; brush = QBrush(QColor(Qt::white)); defaultBrush = QBrush(QColor(Qt::white)); pen = QPen(); @@ -123,7 +123,7 @@ namespace Swift { if (mode == Line) { QGraphicsLineItem* item = qgraphicsitem_cast<QGraphicsLineItem*>(lastItem); - if(item != 0) { + if(item != nullptr) { QLineF line = item->line(); line.setP1(this->mapToScene(event->pos())); item->setLine(line); @@ -132,7 +132,7 @@ namespace Swift { } else if (mode == Rect) { QGraphicsRectItem* item = qgraphicsitem_cast<QGraphicsRectItem*>(lastItem); - if (item != 0) { + if (item != nullptr) { QPointF beginPoint = item->data(0).toPointF(); QPointF newPoint = this->mapToScene(event->pos()); QRectF rect = item->rect(); @@ -182,7 +182,7 @@ namespace Swift { } else if (mode == HandLine) { FreehandLineItem* item = qgraphicsitem_cast<FreehandLineItem*>(lastItem); - if (item != 0) { + if (item != nullptr) { QPointF newPoint = this->mapToScene(event->pos()); item->lineTo(newPoint); } @@ -197,7 +197,7 @@ namespace Swift { } else if (mode == Select) { QGraphicsItem* item = selectionRect->data(1).value<QGraphicsItem*>(); - if (item != 0) { + if (item != nullptr) { QPainterPath path; QPointF beginPoint = selectionRect->data(0).toPointF(); QPointF newPoint = this->mapToScene(event->pos()); @@ -283,7 +283,7 @@ namespace Swift { else if (mode == Polygon) { QPointF point = this->mapToScene(event->pos()); QGraphicsPolygonItem* item = dynamic_cast<QGraphicsPolygonItem*>(lastItem); - if (item == 0) { + if (item == nullptr) { QPolygonF polygon; polygon.append(point); polygon.append(point); @@ -376,7 +376,7 @@ namespace Swift { void GView::move(QGraphicsItem* item, int npos) { int pos = items_.indexOf(item); - QGraphicsItem* itemAfter = NULL; + QGraphicsItem* itemAfter = nullptr; if (npos-1 > pos) { if (npos == items_.size()) { item->setZValue(zValue++); @@ -473,12 +473,12 @@ namespace Swift { } void GView::deselect() { - if (selectionRect != 0) { + if (selectionRect != nullptr) { pen = defaultPen; brush = defaultBrush; scene()->removeItem(selectionRect); delete selectionRect; - selectionRect = 0; + selectionRect = nullptr; lineWidthChanged(pen.width()); lineColorChanged(pen.color()); brushColorChanged(brush.color()); @@ -486,14 +486,14 @@ namespace Swift { } void GView::deselect(QString id) { - if (selectionRect != 0) { + if (selectionRect != nullptr) { QGraphicsItem* item = getItem(id); if (item && selectionRect->data(1).value<QGraphicsItem*>() == item) { pen = defaultPen; brush = defaultBrush; scene()->removeItem(selectionRect); delete selectionRect; - selectionRect = 0; + selectionRect = nullptr; lineWidthChanged(pen.width()); lineColorChanged(pen.color()); brushColorChanged(brush.color()); diff --git a/Swift/QtUI/Whiteboard/GView.h b/Swift/QtUI/Whiteboard/GView.h index 396e381..4af5a53 100644 --- a/Swift/QtUI/Whiteboard/GView.h +++ b/Swift/QtUI/Whiteboard/GView.h @@ -30,7 +30,7 @@ namespace Swift { public: enum Mode { Rubber, Line, Rect, Circle, HandLine, Text, Polygon, Select }; enum Type { New, Update, MoveUp, MoveDown }; - GView(QGraphicsScene* scene, QWidget* parent = 0); + GView(QGraphicsScene* scene, QWidget* parent = nullptr); void setLineWidth(int i); void setLineColor(QColor color); QColor getLineColor(); diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp index 26887e0..2eae84d 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp @@ -182,14 +182,14 @@ namespace Swift { void QtWhiteboardWindow::showColorDialog() { - QColor color = QColorDialog::getColor(graphicsView->getLineColor(), 0, "Select pen color", QColorDialog::ShowAlphaChannel); + QColor color = QColorDialog::getColor(graphicsView->getLineColor(), nullptr, "Select pen color", QColorDialog::ShowAlphaChannel); if(color.isValid()) graphicsView->setLineColor(color); } void QtWhiteboardWindow::showBrushColorDialog() { - QColor color = QColorDialog::getColor(graphicsView->getBrushColor(), 0, "Select brush color", QColorDialog::ShowAlphaChannel); + QColor color = QColorDialog::getColor(graphicsView->getBrushColor(), nullptr, "Select brush color", QColorDialog::ShowAlphaChannel); if(color.isValid()) graphicsView->setBrushColor(color); } @@ -258,7 +258,7 @@ namespace Swift { void QtWhiteboardWindow::handleLastItemChanged(QGraphicsItem* item, int pos, GView::Type type) { WhiteboardElement::ref el; QGraphicsLineItem* lineItem = qgraphicsitem_cast<QGraphicsLineItem*>(item); - if (lineItem != 0) { + if (lineItem != nullptr) { QLine line = lineItem->line().toLine(); QColor color = lineItem->pen().color(); WhiteboardLineElement::ref element = boost::make_shared<WhiteboardLineElement>(line.x1()+lineItem->pos().x(), line.y1()+lineItem->pos().y(), line.x2()+lineItem->pos().x(), line.y2()+lineItem->pos().y()); @@ -270,7 +270,7 @@ namespace Swift { } FreehandLineItem* freehandLineItem = qgraphicsitem_cast<FreehandLineItem*>(item); - if (freehandLineItem != 0) { + if (freehandLineItem != nullptr) { WhiteboardFreehandPathElement::ref element = boost::make_shared<WhiteboardFreehandPathElement>(); QColor color = freehandLineItem->pen().color(); std::vector<std::pair<int, int> > points; @@ -290,7 +290,7 @@ namespace Swift { } QGraphicsRectItem* rectItem = qgraphicsitem_cast<QGraphicsRectItem*>(item); - if (rectItem != 0) { + if (rectItem != nullptr) { QRectF rect = rectItem->rect(); WhiteboardRectElement::ref element = boost::make_shared<WhiteboardRectElement>(rect.x()+item->pos().x(), rect.y()+item->pos().y(), rect.width(), rect.height()); QColor penColor = rectItem->pen().color(); @@ -305,7 +305,7 @@ namespace Swift { } QGraphicsTextItem* textItem = qgraphicsitem_cast<QGraphicsTextItem*>(item); - if (textItem != 0) { + if (textItem != nullptr) { QPointF point = textItem->pos(); WhiteboardTextElement::ref element = boost::make_shared<WhiteboardTextElement>(point.x(), point.y()); element->setText(textItem->toPlainText().toStdString()); diff --git a/Swift/QtUI/Whiteboard/TextDialog.h b/Swift/QtUI/Whiteboard/TextDialog.h index 31bd096..513d381 100644 --- a/Swift/QtUI/Whiteboard/TextDialog.h +++ b/Swift/QtUI/Whiteboard/TextDialog.h @@ -27,7 +27,7 @@ namespace Swift { { Q_OBJECT public: - TextDialog(QGraphicsTextItem* item, QWidget* parent = 0); + TextDialog(QGraphicsTextItem* item, QWidget* parent = nullptr); private: QGraphicsTextItem* item; diff --git a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h index 719725c..8182bcb 100644 --- a/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h +++ b/Swift/QtUI/Whiteboard/WhiteboardElementDrawingVisitor.h @@ -111,7 +111,7 @@ namespace Swift { void visit(WhiteboardPolygonElement& element) { QGraphicsPolygonItem* item = qgraphicsitem_cast<QGraphicsPolygonItem*>(graphicsView_->getItem(P2QSTRING(element.getID()))); - if (item == 0 && type_ == GView::New) { + if (item == nullptr && type_ == GView::New) { item = new QGraphicsPolygonItem(); QString id = P2QSTRING(element.getID()); item->setData(100, id); diff --git a/Swift/QtUI/main.cpp b/Swift/QtUI/main.cpp index 86ba931..dde1487 100644 --- a/Swift/QtUI/main.cpp +++ b/Swift/QtUI/main.cpp @@ -98,7 +98,7 @@ int main(int argc, char* argv[]) { Swift::QtSwift swift(vm); int result = app.exec(); - Swift::Translator::setInstance(NULL); + Swift::Translator::setInstance(nullptr); return result; } |