diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 17:23:49 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-04 08:28:23 (GMT) |
commit | 741c45b74d5f634622eb5f757c49323274fb8937 (patch) | |
tree | b9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Swift/QtUI/UserSearch | |
parent | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff) | |
download | swift-741c45b74d5f634622eb5f757c49323274fb8937.zip swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2 |
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed'
replacement calls to all source files:
's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g'
's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g'
's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g'
's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g'
's/boost::make_shared/std::make_shared/g'
's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g'
's/boost::shared_ptr/std::shared_ptr/g'
's/boost::weak_ptr/std::weak_ptr/g'
's/boost::enable_shared_from_this/std::enable_shared_from_this/g'
The remaining issues have been fixed manually.
Test-Information:
Code builds on OS X 10.11.4 and unit tests pass.
Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Swift/QtUI/UserSearch')
-rw-r--r-- | Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/UserSearch/QtUserSearchWindow.cpp | 19 | ||||
-rw-r--r-- | Swift/QtUI/UserSearch/QtUserSearchWindow.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/UserSearch/UserSearchModel.h | 2 |
4 files changed, 14 insertions, 13 deletions
diff --git a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp index 4e8f4e1..e9a26ea 100644 --- a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp +++ b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp @@ -74,13 +74,13 @@ Contact::ref QtSuggestingJIDInput::getContact() { if (!text().isEmpty()) { JID jid(Q2PSTRING(text())); if (jid.isValid()) { - Contact::ref manualContact = boost::make_shared<Contact>(); + Contact::ref manualContact = std::make_shared<Contact>(); manualContact->name = jid.toString(); manualContact->jid = jid; return manualContact; } } - return boost::shared_ptr<Contact>(); + return std::shared_ptr<Contact>(); } void QtSuggestingJIDInput::setSuggestions(const std::vector<Contact::ref>& suggestions) { diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index 09943c5..83b8df6 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -6,8 +6,9 @@ #include <Swift/QtUI/UserSearch/QtUserSearchWindow.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QItemDelegate> #include <QModelIndex> @@ -132,11 +133,11 @@ void QtUserSearchWindow::handleAccepted() { switch(type_) { case AddContact: jid = getContactJID(); - eventStream_->send(boost::make_shared<AddContactUIEvent>(jid, detailsPage_->getName(), detailsPage_->getSelectedGroups())); + eventStream_->send(std::make_shared<AddContactUIEvent>(jid, detailsPage_->getName(), detailsPage_->getSelectedGroups())); break; case ChatToContact: if (contactVector_.size() == 1) { - boost::shared_ptr<UIEvent> event(new RequestChatUIEvent(contactVector_[0]->jid)); + std::shared_ptr<UIEvent> event(new RequestChatUIEvent(contactVector_[0]->jid)); eventStream_->send(event); break; } @@ -145,13 +146,13 @@ void QtUserSearchWindow::handleAccepted() { jids.push_back(contact->jid); } - eventStream_->send(boost::make_shared<CreateImpromptuMUCUIEvent>(jids, JID(), Q2PSTRING(firstMultiJIDPage_->reason_->text()))); + eventStream_->send(std::make_shared<CreateImpromptuMUCUIEvent>(jids, JID(), Q2PSTRING(firstMultiJIDPage_->reason_->text()))); break; case InviteToChat: foreach(Contact::ref contact, contactVector_) { jids.push_back(contact->jid); } - eventStream_->send(boost::make_shared<InviteToMUCUIEvent>(roomJID_, jids, Q2PSTRING(firstMultiJIDPage_->reason_->text()))); + eventStream_->send(std::make_shared<InviteToMUCUIEvent>(roomJID_, jids, Q2PSTRING(firstMultiJIDPage_->reason_->text()))); break; } } @@ -229,7 +230,7 @@ void QtUserSearchWindow::handleFirstPageRadioChange() { } void QtUserSearchWindow::handleSearch() { - boost::shared_ptr<SearchPayload> search(new SearchPayload()); + std::shared_ptr<SearchPayload> search(new SearchPayload()); if (fieldsPage_->getFormWidget()) { search->setForm(fieldsPage_->getFormWidget()->getCompletedForm()); search->getForm()->clearEmptyTextFields(); @@ -292,7 +293,7 @@ JID QtUserSearchWindow::getContactJID() const { } Contact::ref QtUserSearchWindow::getContact() const { - return boost::make_shared<Contact>("", getContactJID(), StatusShow::None, ""); + return std::make_shared<Contact>("", getContactJID(), StatusShow::None, ""); } void QtUserSearchWindow::addSearchedJIDToList(const Contact::ref& contact) { @@ -330,7 +331,7 @@ void QtUserSearchWindow::addSavedServices(const std::vector<JID>& services) { } } -void QtUserSearchWindow::setSearchFields(boost::shared_ptr<SearchPayload> fields) { +void QtUserSearchWindow::setSearchFields(std::shared_ptr<SearchPayload> fields) { fieldsPage_->fetchingThrobber_->hide(); fieldsPage_->fetchingThrobber_->movie()->stop(); fieldsPage_->fetchingLabel_->hide(); @@ -375,7 +376,7 @@ void QtUserSearchWindow::setContactSuggestions(const std::vector<Contact::ref>& void QtUserSearchWindow::setJIDs(const std::vector<JID> &jids) { foreach(JID jid, jids) { - addSearchedJIDToList(boost::make_shared<Contact>("", jid, StatusShow::None, "")); + addSearchedJIDToList(std::make_shared<Contact>("", jid, StatusShow::None, "")); } onJIDUpdateRequested(jids); } diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.h b/Swift/QtUI/UserSearch/QtUserSearchWindow.h index bcef0b9..5d8b755 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.h +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.h @@ -42,7 +42,7 @@ namespace Swift { virtual void setSelectedService(const JID& jid); virtual void setServerSupportsSearch(bool error); virtual void setSearchError(bool error); - virtual void setSearchFields(boost::shared_ptr<SearchPayload> fields); + virtual void setSearchFields(std::shared_ptr<SearchPayload> fields); virtual void setNameSuggestions(const std::vector<std::string>& suggestions); virtual void prepopulateJIDAndName(const JID& jid, const std::string& name); virtual void setContactSuggestions(const std::vector<Contact::ref>& suggestions); diff --git a/Swift/QtUI/UserSearch/UserSearchModel.h b/Swift/QtUI/UserSearch/UserSearchModel.h index 0a57b28..a3940da 100644 --- a/Swift/QtUI/UserSearch/UserSearchModel.h +++ b/Swift/QtUI/UserSearch/UserSearchModel.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QAbstractItemModel> #include <QList> |