diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 12:36:16 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-01 15:56:34 (GMT) |
commit | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (patch) | |
tree | 8d396e5801d77a2f0ee4ab8e4c5093d8cf8118e6 /Swift | |
parent | a79db8d446e152b715f435550c2a6e10a36ee532 (diff) | |
download | swift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.zip swift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.tar.bz2 |
Modernize code to use C++11 nullptr using clang-tidy
Run 'clang-tidy -fix -checks=modernize-use-nullptr' on all
source code files on OS X. This does not modernize platform
specific code on Linux and Windows
Test-Information:
Code builds and unit tests pass on OS X 10.11.4.
Change-Id: Ic43ffeb1b76c1a933a55af03db3c54977f5f60dd
Diffstat (limited to 'Swift')
129 files changed, 412 insertions, 352 deletions
diff --git a/Swift/Controllers/BlockListController.cpp b/Swift/Controllers/BlockListController.cpp index 6fbf6b3..9ed98a8 100644 --- a/Swift/Controllers/BlockListController.cpp +++ b/Swift/Controllers/BlockListController.cpp @@ -27,7 +27,7 @@ namespace Swift { -BlockListController::BlockListController(ClientBlockListManager* blockListManager, UIEventStream* uiEventStream, BlockListEditorWidgetFactory* blockListEditorWidgetFactory, EventController* eventController) : blockListManager_(blockListManager), blockListEditorWidgetFactory_(blockListEditorWidgetFactory), blockListEditorWidget_(0), eventController_(eventController), remainingRequests_(0), uiEventStream_(uiEventStream) { +BlockListController::BlockListController(ClientBlockListManager* blockListManager, UIEventStream* uiEventStream, BlockListEditorWidgetFactory* blockListEditorWidgetFactory, EventController* eventController) : blockListManager_(blockListManager), blockListEditorWidgetFactory_(blockListEditorWidgetFactory), blockListEditorWidget_(nullptr), eventController_(eventController), remainingRequests_(0), uiEventStream_(uiEventStream) { uiEventStream->onUIEvent.connect(boost::bind(&BlockListController::handleUIEvent, this, _1)); blockListManager_->getBlockList()->onItemAdded.connect(boost::bind(&BlockListController::handleBlockListChanged, this)); blockListManager_->getBlockList()->onItemRemoved.connect(boost::bind(&BlockListController::handleBlockListChanged, this)); @@ -56,8 +56,8 @@ void BlockListController::blockListDifferences(const std::vector<JID> &newBlockL void BlockListController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { // handle UI dialog boost::shared_ptr<RequestBlockListDialogUIEvent> requestDialogEvent = boost::dynamic_pointer_cast<RequestBlockListDialogUIEvent>(rawEvent); - if (requestDialogEvent != NULL) { - if (blockListEditorWidget_ == NULL) { + if (requestDialogEvent != nullptr) { + if (blockListEditorWidget_ == nullptr) { blockListEditorWidget_ = blockListEditorWidgetFactory_->createBlockListEditorWidget(); blockListEditorWidget_->onSetNewBlockList.connect(boost::bind(&BlockListController::handleSetNewBlockList, this, _1)); } @@ -70,7 +70,7 @@ void BlockListController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { // handle block state change boost::shared_ptr<RequestChangeBlockStateUIEvent> changeStateEvent = boost::dynamic_pointer_cast<RequestChangeBlockStateUIEvent>(rawEvent); - if (changeStateEvent != NULL) { + if (changeStateEvent != nullptr) { if (changeStateEvent->getBlockState() == RequestChangeBlockStateUIEvent::Blocked) { GenericRequest<BlockPayload>::ref blockRequest = blockListManager_->createBlockJIDRequest(changeStateEvent->getContact()); blockRequest->onResponse.connect(boost::bind(&BlockListController::handleBlockResponse, this, blockRequest, _1, _2, std::vector<JID>(1, changeStateEvent->getContact()), false)); diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index d478e2a..7a3db1e 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -69,7 +69,7 @@ void ChatControllerBase::handleLogCleared() { ChatWindow* ChatControllerBase::detachChatWindow() { ChatWindow* chatWindow = chatWindow_; - chatWindow_ = NULL; + chatWindow_ = nullptr; return chatWindow; } diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 32da58a..7a52d9b 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -154,11 +154,11 @@ ChatsManager::ChatsManager( chatWindowFactory_ = chatWindowFactory; nickResolver_ = nickResolver; presenceOracle_ = presenceOracle; - avatarManager_ = NULL; + avatarManager_ = nullptr; serverDiscoInfo_ = boost::make_shared<DiscoInfo>(); presenceSender_ = presenceSender; uiEventStream_ = uiEventStream; - mucBookmarkManager_ = NULL; + mucBookmarkManager_ = nullptr; profileSettings_ = profileSettings; presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1)); uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&ChatsManager::handleUIEvent, this, _1)); @@ -168,7 +168,7 @@ ChatsManager::ChatsManager( chatListWindow_->onRecentActivated.connect(boost::bind(&ChatsManager::handleRecentActivated, this, _1)); chatListWindow_->onClearRecentsRequested.connect(boost::bind(&ChatsManager::handleClearRecentsRequested, this)); - joinMUCWindow_ = NULL; + joinMUCWindow_ = nullptr; mucSearchController_ = new MUCSearchController(jid_, mucSearchWindowFactory, iqRouter, profileSettings_); mucSearchController_->onMUCSelected.connect(boost::bind(&ChatsManager::handleMUCSelectedAfterSearch, this, _1)); ftOverview_->onNewFileTransferController.connect(boost::bind(&ChatsManager::handleNewFileTransferController, this, _1)); @@ -239,7 +239,7 @@ void ChatsManager::saveRecents() { void ChatsManager::handleClearRecentsRequested() { recentChats_.clear(); saveRecents(); - handleUnreadCountChanged(NULL); + handleUnreadCountChanged(nullptr); } void ChatsManager::handleJIDAddedToRoster(const JID &jid) { @@ -340,7 +340,7 @@ void ChatsManager::loadRecents() { prependRecent(chat); } } - handleUnreadCountChanged(NULL); + handleUnreadCountChanged(nullptr); } void ChatsManager::setupBookmarks() { @@ -419,7 +419,7 @@ void ChatsManager::handleChatActivity(const JID& jid, const std::string& activit ChatListWindow::Chat chat = createChatListChatItem(jid, activity, privateMessage); /* FIXME: handle nick changes */ appendRecent(chat); - handleUnreadCountChanged(NULL); + handleUnreadCountChanged(nullptr); saveRecents(); } @@ -744,7 +744,7 @@ ChatController* ChatsManager::getChatControllerOrCreate(const JID &contact) { ChatController* ChatsManager::getChatControllerIfExists(const JID &contact, bool rebindIfNeeded) { if (chatControllers_.find(contact) == chatControllers_.end()) { if (mucRegistry_->isMUC(contact.toBare())) { - return NULL; + return nullptr; } //Need to look for an unbound window to bind first JID bare(contact.toBare()); @@ -766,7 +766,7 @@ ChatController* ChatsManager::getChatControllerIfExists(const JID &contact, bool } } } - return NULL; + return nullptr; } } return chatControllers_[contact]; @@ -807,8 +807,8 @@ MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::opti muc->setCreateAsReservedIfNew(); } - MUCController* controller = NULL; - SingleChatWindowFactoryAdapter* chatWindowFactoryAdapter = NULL; + MUCController* controller = nullptr; + SingleChatWindowFactoryAdapter* chatWindowFactoryAdapter = nullptr; if (reuseChatwindow) { chatWindowFactoryAdapter = new SingleChatWindowFactoryAdapter(reuseChatwindow); } diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h index 7bba219..fa6ab3a 100644 --- a/Swift/Controllers/Chat/ChatsManager.h +++ b/Swift/Controllers/Chat/ChatsManager.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. */ @@ -89,7 +89,7 @@ namespace Swift { ChatListWindow::Chat createChatListChatItem(const JID& jid, const std::string& activity, bool privateMessage); void handleChatRequest(const std::string& contact); void finalizeImpromptuJoin(MUC::ref muc, const std::vector<JID>& jidsToInvite, const std::string& reason, const boost::optional<JID>& reuseChatJID = boost::optional<JID>()); - MUC::ref handleJoinMUCRequest(const JID& muc, const boost::optional<std::string>& password, const boost::optional<std::string>& nick, bool addAutoJoin, bool createAsReservedIfNew, bool isImpromptu, ChatWindow* reuseChatwindow = 0); + MUC::ref handleJoinMUCRequest(const JID& muc, const boost::optional<std::string>& password, const boost::optional<std::string>& nick, bool addAutoJoin, bool createAsReservedIfNew, bool isImpromptu, ChatWindow* reuseChatwindow = nullptr); void handleSearchMUCRequest(); void handleMUCSelectedAfterSearch(const JID&); void rebindControllerJID(const JID& from, const JID& to); diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 1e2b7ad..66a655c 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -154,7 +154,7 @@ MUCController::MUCController ( if (stanzaChannel->isAvailable()) { MUCController::setOnline(true); } - if (avatarManager_ != NULL) { + if (avatarManager_ != nullptr) { avatarChangedConnection_ = (avatarManager_->onAvatarChanged.connect(boost::bind(&MUCController::handleAvatarChanged, this, _1))); } MUCController::handleBareJIDCapsChanged(muc->getJID()); @@ -177,13 +177,13 @@ MUCController::MUCController ( MUCController::~MUCController() { eventStream_->onUIEvent.disconnect(boost::bind(&MUCController::handleUIEvent, this, _1)); - chatWindow_->setRosterModel(NULL); + chatWindow_->setRosterModel(nullptr); delete rosterVCardProvider_; delete roster_; if (loginCheckTimer_) { loginCheckTimer_->stop(); } - chatWindow_->setTabComplete(NULL); + chatWindow_->setTabComplete(nullptr); delete completer_; } @@ -465,7 +465,7 @@ void MUCController::handleOccupantJoined(const MUCOccupant& occupant) { onActivity(""); } } - if (avatarManager_ != NULL) { + if (avatarManager_ != nullptr) { handleAvatarChanged(jid); } } @@ -780,7 +780,7 @@ void MUCController::handleOccupantNicknameChanged(const std::string& oldNickname std::string groupName(roleToGroupName(role)); roster_->addContact(newJID, realJID, newNickname, groupName, avatarManager_->getAvatarPath(newJID)); roster_->applyOnItems(SetMUC(newJID, role, affiliation)); - if (avatarManager_ != NULL) { + if (avatarManager_ != nullptr) { handleAvatarChanged(newJID); } diff --git a/Swift/Controllers/Chat/MUCSearchController.cpp b/Swift/Controllers/Chat/MUCSearchController.cpp index 884978c..4f28058 100644 --- a/Swift/Controllers/Chat/MUCSearchController.cpp +++ b/Swift/Controllers/Chat/MUCSearchController.cpp @@ -25,7 +25,7 @@ namespace Swift { static const std::string SEARCHED_SERVICES = "searchedServices"; -MUCSearchController::MUCSearchController(const JID& jid, MUCSearchWindowFactory* factory, IQRouter* iqRouter, ProfileSettingsProvider* settings) : jid_(jid), factory_(factory), iqRouter_(iqRouter), settings_(settings), window_(NULL), walker_(NULL) { +MUCSearchController::MUCSearchController(const JID& jid, MUCSearchWindowFactory* factory, IQRouter* iqRouter, ProfileSettingsProvider* settings) : jid_(jid), factory_(factory), iqRouter_(iqRouter), settings_(settings), window_(nullptr), walker_(nullptr) { itemsInProgress_ = 0; loadSavedServices(); } diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index 7445c4b..92a8ca0 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp @@ -95,7 +95,7 @@ public: joinMUCWindowFactory_ = mocks_->InterfaceMock<JoinMUCWindowFactory>(); xmppRoster_ = new XMPPRosterImpl(); mucRegistry_ = new MUCRegistry(); - nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, NULL, mucRegistry_); + nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, nullptr, mucRegistry_); presenceOracle_ = new PresenceOracle(stanzaChannel_, xmppRoster_); serverDiscoInfo_ = boost::make_shared<DiscoInfo>(); presenceSender_ = new StanzaChannelPresenceSender(stanzaChannel_); @@ -124,7 +124,7 @@ public: vcardManager_ = new VCardManager(jid_, iqRouter_, vcardStorage_); mocks_->ExpectCall(chatListWindowFactory_, ChatListWindowFactory::createChatListWindow).With(uiEventStream_).Return(chatListWindow_); clientBlockListManager_ = new ClientBlockListManager(iqRouter_); - manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, NULL, mucRegistry_, entityCapsProvider_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, xmppRoster_, false, settings_, NULL, wbManager_, highlightManager_, clientBlockListManager_, emoticons_, vcardManager_); + manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, nullptr, mucRegistry_, entityCapsProvider_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, xmppRoster_, false, settings_, nullptr, wbManager_, highlightManager_, clientBlockListManager_, emoticons_, vcardManager_); manager_->setAvatarManager(avatarManager_); } @@ -386,7 +386,7 @@ public: manager_->handleIncomingMessage(message); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex<Stanza>(0); CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); - CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != 0); + CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != nullptr); xmppRoster_->removeContact(messageJID); @@ -416,7 +416,7 @@ public: CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex<Stanza>(0); - CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != 0); + CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != nullptr); } /** @@ -729,7 +729,7 @@ public: CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex<Stanza>(0); - CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != 0); + CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != nullptr); } void testChatControllerHighlightingNotificationTesting() { diff --git a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp index db9bcdc..80dbc32 100644 --- a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp @@ -84,7 +84,7 @@ public: directedPresenceSender_ = new DirectedPresenceSender(presenceSender_); uiEventStream_ = new UIEventStream(); avatarManager_ = new NullAvatarManager(); - TimerFactory* timerFactory = NULL; + TimerFactory* timerFactory = nullptr; window_ = new MockChatWindow(); mucRegistry_ = new MUCRegistry(); entityCapsProvider_ = new DummyEntityCapsProvider(); @@ -97,7 +97,7 @@ public: vcardManager_ = new VCardManager(self_, iqRouter_, vcardStorage_); clientBlockListManager_ = new ClientBlockListManager(iqRouter_); mucBookmarkManager_ = new MUCBookmarkManager(iqRouter_); - controller_ = new MUCController (self_, muc_, boost::optional<std::string>(), nick_, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory, eventController_, entityCapsProvider_, NULL, NULL, mucRegistry_, highlightManager_, clientBlockListManager_, chatMessageParser_, false, NULL, vcardManager_, mucBookmarkManager_); + controller_ = new MUCController (self_, muc_, boost::optional<std::string>(), nick_, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory, eventController_, entityCapsProvider_, nullptr, nullptr, mucRegistry_, highlightManager_, clientBlockListManager_, chatMessageParser_, false, nullptr, vcardManager_, mucBookmarkManager_); } void tearDown() { diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp index 216488a..c1040f0 100644 --- a/Swift/Controllers/Chat/UserSearchController.cpp +++ b/Swift/Controllers/Chat/UserSearchController.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. */ @@ -40,8 +40,8 @@ UserSearchController::UserSearchController(Type type, const JID& jid, UIEventStr vcardManager_->onVCardChanged.connect(boost::bind(&UserSearchController::handleVCardChanged, this, _1, _2)); avatarManager_->onAvatarChanged.connect(boost::bind(&UserSearchController::handleAvatarChanged, this, _1)); presenceOracle_->onPresenceChange.connect(boost::bind(&UserSearchController::handlePresenceChanged, this, _1)); - window_ = NULL; - discoWalker_ = NULL; + window_ = nullptr; + discoWalker_ = nullptr; loadSavedDirectories(); } diff --git a/Swift/Controllers/ContactEditController.cpp b/Swift/Controllers/ContactEditController.cpp index 734ef79..d3106ed 100644 --- a/Swift/Controllers/ContactEditController.cpp +++ b/Swift/Controllers/ContactEditController.cpp @@ -20,7 +20,7 @@ namespace Swift { -ContactEditController::ContactEditController(RosterController* rosterController, VCardManager* vcardManager, ContactEditWindowFactory* contactEditWindowFactory, UIEventStream* uiEventStream) : rosterController(rosterController), vcardManager(vcardManager), contactEditWindowFactory(contactEditWindowFactory), uiEventStream(uiEventStream), contactEditWindow(NULL) { +ContactEditController::ContactEditController(RosterController* rosterController, VCardManager* vcardManager, ContactEditWindowFactory* contactEditWindowFactory, UIEventStream* uiEventStream) : rosterController(rosterController), vcardManager(vcardManager), contactEditWindowFactory(contactEditWindowFactory), uiEventStream(uiEventStream), contactEditWindow(nullptr) { uiEventStream->onUIEvent.connect(boost::bind(&ContactEditController::handleUIEvent, this, _1)); vcardManager->onVCardChanged.connect(boost::bind(&ContactEditController::handleVCardChanged, this, _1, _2)); } diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp index fd13d99..c005705 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferController.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. */ @@ -28,12 +28,12 @@ namespace Swift { FileTransferController::FileTransferController(const JID& receipient, const std::string& filename, FileTransferManager* fileTransferManager) : - sending(true), otherParty(receipient), filename(filename), ftManager(fileTransferManager), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) { + sending(true), otherParty(receipient), filename(filename), ftManager(fileTransferManager), ftProgressInfo(nullptr), chatWindow(nullptr), currentState(FileTransfer::State::WaitingForStart) { } FileTransferController::FileTransferController(IncomingFileTransfer::ref transfer) : - sending(false), otherParty(transfer->getSender()), filename(transfer->getFileName()), transfer(transfer), ftManager(0), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) { + sending(false), otherParty(transfer->getSender()), filename(transfer->getFileName()), transfer(transfer), ftManager(nullptr), ftProgressInfo(nullptr), chatWindow(nullptr), currentState(FileTransfer::State::WaitingForStart) { transfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); } diff --git a/Swift/Controllers/FileTransferListController.cpp b/Swift/Controllers/FileTransferListController.cpp index a383ae5..8400e52 100644 --- a/Swift/Controllers/FileTransferListController.cpp +++ b/Swift/Controllers/FileTransferListController.cpp @@ -19,7 +19,7 @@ namespace Swift { -FileTransferListController::FileTransferListController(UIEventStream* uiEventStream, FileTransferListWidgetFactory* fileTransferListWidgetFactory) : fileTransferListWidgetFactory(fileTransferListWidgetFactory), fileTransferListWidget(NULL), fileTransferOverview(0) { +FileTransferListController::FileTransferListController(UIEventStream* uiEventStream, FileTransferListWidgetFactory* fileTransferListWidgetFactory) : fileTransferListWidgetFactory(fileTransferListWidgetFactory), fileTransferListWidget(nullptr), fileTransferOverview(nullptr) { uiEventStream->onUIEvent.connect(boost::bind(&FileTransferListController::handleUIEvent, this, _1)); } @@ -36,8 +36,8 @@ void FileTransferListController::setFileTransferOverview(FileTransferOverview *o void FileTransferListController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { boost::shared_ptr<RequestFileTransferListUIEvent> event = boost::dynamic_pointer_cast<RequestFileTransferListUIEvent>(rawEvent); - if (event != NULL) { - if (fileTransferListWidget == NULL) { + if (event != nullptr) { + if (fileTransferListWidget == nullptr) { fileTransferListWidget = fileTransferListWidgetFactory->createFileTransferListWidget(); if (fileTransferOverview) { fileTransferListWidget->setFileTransferOverview(fileTransferOverview); diff --git a/Swift/Controllers/HighlightEditorController.cpp b/Swift/Controllers/HighlightEditorController.cpp index bf5dbc4..2c71e1d 100644 --- a/Swift/Controllers/HighlightEditorController.cpp +++ b/Swift/Controllers/HighlightEditorController.cpp @@ -23,7 +23,7 @@ namespace Swift { HighlightEditorController::HighlightEditorController(UIEventStream* uiEventStream, HighlightEditorWindowFactory* highlightEditorWindowFactory, HighlightManager* highlightManager) -: highlightEditorWindowFactory_(highlightEditorWindowFactory), highlightEditorWindow_(NULL), highlightManager_(highlightManager), contactSuggester_(0) +: highlightEditorWindowFactory_(highlightEditorWindowFactory), highlightEditorWindow_(nullptr), highlightManager_(highlightManager), contactSuggester_(nullptr) { uiEventStream->onUIEvent.connect(boost::bind(&HighlightEditorController::handleUIEvent, this, _1)); } @@ -31,7 +31,7 @@ HighlightEditorController::HighlightEditorController(UIEventStream* uiEventStrea HighlightEditorController::~HighlightEditorController() { delete highlightEditorWindow_; - highlightEditorWindow_ = NULL; + highlightEditorWindow_ = nullptr; } void HighlightEditorController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) diff --git a/Swift/Controllers/HistoryViewController.cpp b/Swift/Controllers/HistoryViewController.cpp index d0ccc66..827d7d6 100644 --- a/Swift/Controllers/HistoryViewController.cpp +++ b/Swift/Controllers/HistoryViewController.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2016 Isode Limited. * Licensed under the GNU General Public License. * See the COPYING file for more information. */ @@ -42,8 +42,8 @@ HistoryViewController::HistoryViewController( avatarManager_(avatarManager), presenceOracle_(presenceOracle), historyWindowFactory_(historyWindowFactory), - historyWindow_(NULL), - selectedItem_(NULL), + historyWindow_(nullptr), + selectedItem_(nullptr), currentResultDate_(boost::gregorian::not_a_date_time) { uiEventStream_->onUIEvent.connect(boost::bind(&HistoryViewController::handleUIEvent, this, _1)); @@ -72,8 +72,8 @@ HistoryViewController::~HistoryViewController() { void HistoryViewController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { boost::shared_ptr<RequestHistoryUIEvent> event = boost::dynamic_pointer_cast<RequestHistoryUIEvent>(rawEvent); - if (event != NULL) { - if (historyWindow_ == NULL) { + if (event != nullptr) { + if (historyWindow_ == nullptr) { historyWindow_ = historyWindowFactory_->createHistoryWindow(uiEventStream_); historyWindow_->onSelectedContactChanged.connect(boost::bind(&HistoryViewController::handleSelectedContactChanged, this, _1)); historyWindow_->onReturnPressed.connect(boost::bind(&HistoryViewController::handleReturnPressed, this, _1)); @@ -266,7 +266,7 @@ void HistoryViewController::handlePreviousButtonClicked() { void HistoryViewController::reset() { roster_->removeAll(); contacts_.clear(); - selectedItem_ = NULL; + selectedItem_ = nullptr; historyWindow_->resetConversationView(); } diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index b48059c..e8cd012 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.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. */ @@ -121,33 +121,33 @@ MainController::MainController( settings_(settings), uriHandler_(uriHandler), idleDetector_(idleDetector), - loginWindow_(NULL) , + loginWindow_(nullptr) , useDelayForLatency_(useDelayForLatency), - ftOverview_(NULL), + ftOverview_(nullptr), emoticons_(emoticons) { - storages_ = NULL; - certificateStorage_ = NULL; - certificateTrustChecker_ = NULL; - statusTracker_ = NULL; - presenceNotifier_ = NULL; - eventNotifier_ = NULL; - rosterController_ = NULL; - chatsManager_ = NULL; - historyController_ = NULL; - historyViewController_ = NULL; - eventWindowController_ = NULL; - profileController_ = NULL; - blockListController_ = NULL; - showProfileController_ = NULL; - contactEditController_ = NULL; - userSearchControllerChat_ = NULL; - userSearchControllerAdd_ = NULL; - userSearchControllerInvite_ = NULL; - contactsFromRosterProvider_ = NULL; - contactSuggesterWithoutRoster_ = NULL; - contactSuggesterWithRoster_ = NULL; - whiteboardManager_ = NULL; - adHocManager_ = NULL; + storages_ = nullptr; + certificateStorage_ = nullptr; + certificateTrustChecker_ = nullptr; + statusTracker_ = nullptr; + presenceNotifier_ = nullptr; + eventNotifier_ = nullptr; + rosterController_ = nullptr; + chatsManager_ = nullptr; + historyController_ = nullptr; + historyViewController_ = nullptr; + eventWindowController_ = nullptr; + profileController_ = nullptr; + blockListController_ = nullptr; + showProfileController_ = nullptr; + contactEditController_ = nullptr; + userSearchControllerChat_ = nullptr; + userSearchControllerAdd_ = nullptr; + userSearchControllerInvite_ = nullptr; + contactsFromRosterProvider_ = nullptr; + contactSuggesterWithoutRoster_ = nullptr; + contactSuggesterWithRoster_ = nullptr; + whiteboardManager_ = nullptr; + adHocManager_ = nullptr; quitRequested_ = false; clientInitialized_ = false; offlineRequested_ = false; @@ -221,7 +221,7 @@ MainController::MainController( /* FIXME: deal with autologin with a cert*/ handleLoginRequest(selectedLoginJID, cachedPassword, cachedCertificate, CertificateWithKey::ref(), cachedOptions, true, true); } else { - profileSettings_ = NULL; + profileSettings_ = nullptr; } } @@ -255,58 +255,58 @@ void MainController::resetClient() { resetPendingReconnects(); vCardPhotoHash_.clear(); delete contactEditController_; - contactEditController_ = NULL; + contactEditController_ = nullptr; delete profileController_; - profileController_ = NULL; + profileController_ = nullptr; delete showProfileController_; - showProfileController_ = NULL; + showProfileController_ = nullptr; delete eventWindowController_; - eventWindowController_ = NULL; + eventWindowController_ = nullptr; delete chatsManager_; - chatsManager_ = NULL; + chatsManager_ = nullptr; #ifdef SWIFT_EXPERIMENTAL_HISTORY delete historyViewController_; - historyViewController_ = NULL; + historyViewController_ = nullptr; delete historyController_; - historyController_ = NULL; + historyController_ = nullptr; #endif - fileTransferListController_->setFileTransferOverview(NULL); + fileTransferListController_->setFileTransferOverview(nullptr); delete ftOverview_; - ftOverview_ = NULL; + ftOverview_ = nullptr; delete blockListController_; - blockListController_ = NULL; + blockListController_ = nullptr; delete rosterController_; - rosterController_ = NULL; + rosterController_ = nullptr; delete eventNotifier_; - eventNotifier_ = NULL; + eventNotifier_ = nullptr; delete presenceNotifier_; - presenceNotifier_ = NULL; + presenceNotifier_ = nullptr; delete certificateTrustChecker_; - certificateTrustChecker_ = NULL; + certificateTrustChecker_ = nullptr; delete certificateStorage_; - certificateStorage_ = NULL; + certificateStorage_ = nullptr; delete storages_; - storages_ = NULL; + storages_ = nullptr; delete statusTracker_; - statusTracker_ = NULL; + statusTracker_ = nullptr; delete profileSettings_; - profileSettings_ = NULL; + profileSettings_ = nullptr; delete userSearchControllerChat_; - userSearchControllerChat_ = NULL; + userSearchControllerChat_ = nullptr; delete userSearchControllerAdd_; - userSearchControllerAdd_ = NULL; + userSearchControllerAdd_ = nullptr; delete userSearchControllerInvite_; - userSearchControllerInvite_ = NULL; + userSearchControllerInvite_ = nullptr; delete contactSuggesterWithoutRoster_; - contactSuggesterWithoutRoster_ = NULL; + contactSuggesterWithoutRoster_ = nullptr; delete contactSuggesterWithRoster_; - contactSuggesterWithRoster_ = NULL; + contactSuggesterWithRoster_ = nullptr; delete contactsFromRosterProvider_; - contactsFromRosterProvider_ = NULL; + contactsFromRosterProvider_ = nullptr; delete adHocManager_; - adHocManager_ = NULL; + adHocManager_ = nullptr; delete whiteboardManager_; - whiteboardManager_ = NULL; + whiteboardManager_ = nullptr; clientInitialized_ = false; } @@ -341,7 +341,7 @@ void MainController::handleConnected() { purgeCachedCredentials(); } - bool freshLogin = rosterController_ == NULL; + bool freshLogin = rosterController_ == nullptr; myStatusLooksOnline_ = true; if (freshLogin) { profileController_ = new ProfileController(client_->getVCardManager(), uiFactory_, uiEventStream_); @@ -372,7 +372,7 @@ void MainController::handleConnected() { historyViewController_ = new HistoryViewController(jid_, uiEventStream_, historyController_, client_->getNickResolver(), client_->getAvatarManager(), client_->getPresenceOracle(), uiFactory_); chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, client_->getRoster(), !settings_->getSetting(SettingConstants::REMEMBER_RECENT_CHATS), settings_, historyController_, whiteboardManager_, highlightManager_, client_->getClientBlockListManager(), emoticons_, client_->getVCardManager()); #else - chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, client_->getRoster(), !settings_->getSetting(SettingConstants::REMEMBER_RECENT_CHATS), settings_, NULL, whiteboardManager_, highlightManager_, client_->getClientBlockListManager(), emoticons_, client_->getVCardManager()); + chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_, ftOverview_, client_->getRoster(), !settings_->getSetting(SettingConstants::REMEMBER_RECENT_CHATS), settings_, nullptr, whiteboardManager_, highlightManager_, client_->getClientBlockListManager(), emoticons_, client_->getVCardManager()); #endif contactsFromRosterProvider_ = new ContactsFromXMPPRoster(client_->getRoster(), client_->getAvatarManager(), client_->getPresenceOracle()); contactSuggesterWithoutRoster_->addContactProvider(chatsManager_); diff --git a/Swift/Controllers/ProfileController.cpp b/Swift/Controllers/ProfileController.cpp index 756aaff..48a4c93 100644 --- a/Swift/Controllers/ProfileController.cpp +++ b/Swift/Controllers/ProfileController.cpp @@ -17,7 +17,7 @@ namespace Swift { -ProfileController::ProfileController(VCardManager* vcardManager, ProfileWindowFactory* profileWindowFactory, UIEventStream* uiEventStream) : vcardManager(vcardManager), profileWindowFactory(profileWindowFactory), uiEventStream(uiEventStream), available(true), profileWindow(NULL), gettingVCard(false) { +ProfileController::ProfileController(VCardManager* vcardManager, ProfileWindowFactory* profileWindowFactory, UIEventStream* uiEventStream) : vcardManager(vcardManager), profileWindowFactory(profileWindowFactory), uiEventStream(uiEventStream), available(true), profileWindow(nullptr), gettingVCard(false) { uiEventStream->onUIEvent.connect(boost::bind(&ProfileController::handleUIEvent, this, _1)); } @@ -92,7 +92,7 @@ void ProfileController::handleOwnVCardChanged(VCard::ref vcard) { } void ProfileController::handleProfileWindowAboutToBeClosed(const JID&) { - profileWindow = NULL; + profileWindow = nullptr; } void ProfileController::setAvailable(bool b) { diff --git a/Swift/Controllers/Roster/GroupRosterItem.cpp b/Swift/Controllers/Roster/GroupRosterItem.cpp index 82e43df..5aa3a5e 100644 --- a/Swift/Controllers/Roster/GroupRosterItem.cpp +++ b/Swift/Controllers/Roster/GroupRosterItem.cpp @@ -99,7 +99,7 @@ void GroupRosterItem::removeAll() { */ ContactRosterItem* GroupRosterItem::removeChild(const JID& jid) { std::vector<RosterItem*>::iterator it = children_.begin(); - ContactRosterItem* removed = NULL; + ContactRosterItem* removed = nullptr; while (it != children_.end()) { ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(*it); if (contact && contact->getJID() == jid) { @@ -125,7 +125,7 @@ ContactRosterItem* GroupRosterItem::removeChild(const JID& jid) { GroupRosterItem* GroupRosterItem::removeGroupChild(const std::string& groupName) { std::vector<RosterItem*>::iterator it = children_.begin(); - GroupRosterItem* removed = NULL; + GroupRosterItem* removed = nullptr; while (it != children_.end()) { GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(*it); if (group && group->getDisplayName() == groupName) { diff --git a/Swift/Controllers/Roster/Roster.cpp b/Swift/Controllers/Roster/Roster.cpp index 2e68fd4..a5be13c 100644 --- a/Swift/Controllers/Roster/Roster.cpp +++ b/Swift/Controllers/Roster/Roster.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. */ @@ -25,7 +25,7 @@ namespace Swift { Roster::Roster(bool sortByStatus, bool fullJIDMapping) : blockingSupported_(false) { sortByStatus_ = sortByStatus; fullJIDMapping_ = fullJIDMapping; - root_ = new GroupRosterItem("Dummy-Root", NULL, sortByStatus_); + root_ = new GroupRosterItem("Dummy-Root", nullptr, sortByStatus_); root_->onChildrenChanged.connect(boost::bind(&Roster::handleChildrenChanged, this, root_)); } diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp index e391f41..f863ed7 100644 --- a/Swift/Controllers/Roster/RosterController.cpp +++ b/Swift/Controllers/Roster/RosterController.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. */ @@ -96,7 +96,7 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE)); - ownContact_ = boost::make_shared<ContactRosterItem>(myJID_.toBare(), myJID_.toBare(), nickManager_->getOwnNick(), static_cast<GroupRosterItem*>(0)); + ownContact_ = boost::make_shared<ContactRosterItem>(myJID_.toBare(), myJID_.toBare(), nickManager_->getOwnNick(), static_cast<GroupRosterItem*>(nullptr)); ownContact_->setVCard(vcardManager_->getVCard(myJID_.toBare())); ownContact_->setAvatarPath(pathToString(avatarManager_->getAvatarPath(myJID_.toBare()))); mainWindow_->setMyContactRosterItem(ownContact_); @@ -110,7 +110,7 @@ RosterController::~RosterController() { delete offlineFilter_; delete expandiness_; - mainWindow_->setRosterModel(NULL); + mainWindow_->setRosterModel(nullptr); if (mainWindow_->canDelete()) { delete mainWindow_; } diff --git a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp index 551bd6b..91cc764 100644 --- a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.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. */ @@ -70,7 +70,7 @@ class RosterControllerTest : public CppUnit::TestFixture { avatarManager_ = new NullAvatarManager(); mainWindowFactory_ = new MockMainWindowFactory(); mucRegistry_ = new MUCRegistry(); - nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, NULL, mucRegistry_); + nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, nullptr, mucRegistry_); channel_ = new DummyIQChannel(); router_ = new IQRouter(channel_); stanzaChannel_ = new DummyStanzaChannel(); diff --git a/Swift/Controllers/Storages/FileStorages.cpp b/Swift/Controllers/Storages/FileStorages.cpp index 7ba2b0f..49f9ecf 100644 --- a/Swift/Controllers/Storages/FileStorages.cpp +++ b/Swift/Controllers/Storages/FileStorages.cpp @@ -25,7 +25,7 @@ FileStorages::FileStorages(const boost::filesystem::path& baseDir, const JID& ji #ifdef SWIFT_EXPERIMENTAL_HISTORY historyStorage = new SQLiteHistoryStorage(baseDir / "history.db"); #else - historyStorage = NULL; + historyStorage = nullptr; #endif } @@ -57,7 +57,7 @@ HistoryStorage* FileStorages::getHistoryStorage() const { #ifdef SWIFT_EXPERIMENTAL_HISTORY return historyStorage; #else - return NULL; + return nullptr; #endif } diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index b4588e7..e535eca 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -43,7 +43,7 @@ namespace Swift { virtual void replaceSystemMessage(const ChatMessage& /*message*/, const std::string& /*id*/, const TimestampBehaviour /*timestampBehaviour*/) {} // File transfer related stuff - virtual std::string addFileTransfer(const std::string& /*senderName*/, bool /*senderIsSelf*/,const std::string& /*filename*/, const boost::uintmax_t /*sizeInBytes*/, const std::string& /*description*/) { return 0; } + virtual std::string addFileTransfer(const std::string& /*senderName*/, bool /*senderIsSelf*/,const std::string& /*filename*/, const boost::uintmax_t /*sizeInBytes*/, const std::string& /*description*/) { return nullptr; } virtual void setFileTransferProgress(std::string /*id*/, const int /*alreadyTransferedBytes*/) { } virtual void setFileTransferStatus(std::string /*id*/, const FileTransferState /*state*/, const std::string& /*msg*/) { } diff --git a/Swift/Controllers/UnitTest/MockMainWindow.h b/Swift/Controllers/UnitTest/MockMainWindow.h index 9177bdc..43522ce 100644 --- a/Swift/Controllers/UnitTest/MockMainWindow.h +++ b/Swift/Controllers/UnitTest/MockMainWindow.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 Roster; class MockMainWindow : public MainWindow { public: - MockMainWindow() : roster(NULL) {} + MockMainWindow() : roster(nullptr) {} virtual ~MockMainWindow() {} virtual void setRosterModel(Roster* roster) {this->roster = roster;} virtual void setMyNick(const std::string& /*name*/) {} diff --git a/Swift/Controllers/UnitTest/MockMainWindowFactory.h b/Swift/Controllers/UnitTest/MockMainWindowFactory.h index 4af0c79..adf4fdf 100644 --- a/Swift/Controllers/UnitTest/MockMainWindowFactory.h +++ b/Swift/Controllers/UnitTest/MockMainWindowFactory.h @@ -13,7 +13,7 @@ namespace Swift { class MockMainWindowFactory : public MainWindowFactory { public: - MockMainWindowFactory() : last(NULL) {} + MockMainWindowFactory() : last(nullptr) {} virtual ~MockMainWindowFactory() {} diff --git a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp index e1284fd..b3b364f 100644 --- a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp +++ b/Swift/Controllers/UnitTest/PresenceNotifierTest.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. */ @@ -57,7 +57,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { user2 = JID("user2@foo.com/baz"); avatarManager = new DummyAvatarManager(); roster = new XMPPRosterImpl(); - nickResolver = new NickResolver(JID("foo@bar.com"), roster, NULL, mucRegistry); + nickResolver = new NickResolver(JID("foo@bar.com"), roster, nullptr, mucRegistry); presenceOracle = new PresenceOracle(stanzaChannel, roster); timerFactory = new DummyTimerFactory(); } diff --git a/Swift/Controllers/WhiteboardManager.cpp b/Swift/Controllers/WhiteboardManager.cpp index 91f01c8..9594be4 100644 --- a/Swift/Controllers/WhiteboardManager.cpp +++ b/Swift/Controllers/WhiteboardManager.cpp @@ -50,7 +50,7 @@ namespace Swift { WhiteboardWindow* WhiteboardManager::findWhiteboardWindow(const JID& contact) { if (whiteboardWindows_.find(contact.toBare()) == whiteboardWindows_.end()) { - return NULL; + return nullptr; } return whiteboardWindows_[contact.toBare()]; } @@ -71,7 +71,7 @@ namespace Swift { boost::shared_ptr<ShowWhiteboardUIEvent> showWindowEvent = boost::dynamic_pointer_cast<ShowWhiteboardUIEvent>(event); if (showWindowEvent) { WhiteboardWindow* window = findWhiteboardWindow(showWindowEvent->getContact()); - if (window != NULL) { + if (window != nullptr) { window->activateWindow(); } } @@ -93,7 +93,7 @@ namespace Swift { session->onRequestRejected.connect(boost::bind(&WhiteboardManager::handleRequestReject, this, _1)); WhiteboardWindow* window = findWhiteboardWindow(contact); - if (window == NULL) { + if (window == nullptr) { createNewWhiteboardWindow(contact, session); } else { window->setSession(session); @@ -113,7 +113,7 @@ namespace Swift { session->onRequestAccepted.connect(boost::bind(&WhiteboardManager::handleSessionAccept, this, _1)); WhiteboardWindow* window = findWhiteboardWindow(session->getTo()); - if (window == NULL) { + if (window == nullptr) { createNewWhiteboardWindow(session->getTo(), session); } else { window->setSession(session); @@ -132,7 +132,7 @@ namespace Swift { void WhiteboardManager::handleSessionAccept(const JID& contact) { WhiteboardWindow* window = findWhiteboardWindow(contact); - if (window != NULL) { + if (window != nullptr) { window->show(); } onRequestAccepted(contact); diff --git a/Swift/Controllers/XMLConsoleController.cpp b/Swift/Controllers/XMLConsoleController.cpp index 175a4eb..2d4ca0a 100644 --- a/Swift/Controllers/XMLConsoleController.cpp +++ b/Swift/Controllers/XMLConsoleController.cpp @@ -11,7 +11,7 @@ namespace Swift { -XMLConsoleController::XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) : xmlConsoleWidgetFactory(xmlConsoleWidgetFactory), xmlConsoleWidget(NULL) { +XMLConsoleController::XMLConsoleController(UIEventStream* uiEventStream, XMLConsoleWidgetFactory* xmlConsoleWidgetFactory) : xmlConsoleWidgetFactory(xmlConsoleWidgetFactory), xmlConsoleWidget(nullptr) { uiEventStream->onUIEvent.connect(boost::bind(&XMLConsoleController::handleUIEvent, this, _1)); } @@ -21,8 +21,8 @@ XMLConsoleController::~XMLConsoleController() { void XMLConsoleController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { boost::shared_ptr<RequestXMLConsoleUIEvent> event = boost::dynamic_pointer_cast<RequestXMLConsoleUIEvent>(rawEvent); - if (event != NULL) { - if (xmlConsoleWidget == NULL) { + if (event != nullptr) { + if (xmlConsoleWidget == nullptr) { xmlConsoleWidget = xmlConsoleWidgetFactory->createXMLConsoleWidget(); } xmlConsoleWidget->show(); 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; } |