diff options
Diffstat (limited to 'Swift/QtUI')
55 files changed, 244 insertions, 242 deletions
diff --git a/Swift/QtUI/ChatList/ChatListMUCItem.h b/Swift/QtUI/ChatList/ChatListMUCItem.h index 4e93600..c77c284 100644 --- a/Swift/QtUI/ChatList/ChatListMUCItem.h +++ b/Swift/QtUI/ChatList/ChatListMUCItem.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QList> diff --git a/Swift/QtUI/ChatList/ChatListRecentItem.h b/Swift/QtUI/ChatList/ChatListRecentItem.h index 4f0a363..3c9635b 100644 --- a/Swift/QtUI/ChatList/ChatListRecentItem.h +++ b/Swift/QtUI/ChatList/ChatListRecentItem.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QIcon> #include <QList> diff --git a/Swift/QtUI/ChatList/ChatListWhiteboardItem.h b/Swift/QtUI/ChatList/ChatListWhiteboardItem.h index 92acb1c..6dbc5f6 100644 --- a/Swift/QtUI/ChatList/ChatListWhiteboardItem.h +++ b/Swift/QtUI/ChatList/ChatListWhiteboardItem.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QIcon> #include <QList> diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index 1a121aa..3fe462a 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp @@ -103,7 +103,7 @@ void QtChatListWindow::handleItemActivated(const QModelIndex& index) { } else if (ChatListWhiteboardItem* whiteboardItem = dynamic_cast<ChatListWhiteboardItem*>(item)) { if (!whiteboardItem->getChat().isMUC || bookmarksEnabled_) { - eventStream_->send(boost::make_shared<ShowWhiteboardUIEvent>(whiteboardItem->getChat().jid)); + eventStream_->send(std::make_shared<ShowWhiteboardUIEvent>(whiteboardItem->getChat().jid)); } } } @@ -143,7 +143,7 @@ void QtChatListWindow::setOnline(bool isOnline) { void QtChatListWindow::handleRemoveBookmark() { const ChatListMUCItem* mucItem = dynamic_cast<const ChatListMUCItem*>(contextMenuItem_); if (!mucItem) return; - eventStream_->send(boost::shared_ptr<UIEvent>(new RemoveMUCBookmarkUIEvent(mucItem->getBookmark()))); + eventStream_->send(std::make_shared<RemoveMUCBookmarkUIEvent>(mucItem->getBookmark())); } void QtChatListWindow::handleAddBookmarkFromRecents() { @@ -153,7 +153,7 @@ void QtChatListWindow::handleAddBookmarkFromRecents() { MUCBookmark bookmark(chat.jid, chat.jid.toBare().toString()); bookmark.setNick(chat.nick); bookmark.setPassword(chat.password); - eventStream_->send(boost::shared_ptr<UIEvent>(new AddMUCBookmarkUIEvent(bookmark))); + eventStream_->send(std::make_shared<AddMUCBookmarkUIEvent>(bookmark)); } } diff --git a/Swift/QtUI/ChatSnippet.cpp b/Swift/QtUI/ChatSnippet.cpp index 14e4674..0369d0a 100644 --- a/Swift/QtUI/ChatSnippet.cpp +++ b/Swift/QtUI/ChatSnippet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -46,10 +46,10 @@ QString ChatSnippet::directionToCSS(Direction direction) { } ChatSnippet::Direction ChatSnippet::getDirection(const ChatWindow::ChatMessage& message) { - boost::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; + std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; std::string text = ""; - foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { - if ((textPart = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { + foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { + if ((textPart = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { text = textPart->text; break; } diff --git a/Swift/QtUI/ChatSnippet.h b/Swift/QtUI/ChatSnippet.h index bf2d6d2..f715cbf 100644 --- a/Swift/QtUI/ChatSnippet.h +++ b/Swift/QtUI/ChatSnippet.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QDateTime> #include <QString> @@ -31,7 +31,7 @@ namespace Swift { virtual const QString& getContent() const = 0; virtual QString getContinuationElementID() const { return ""; } - boost::shared_ptr<ChatSnippet> getContinuationFallbackSnippet() const {return continuationFallback_;} + std::shared_ptr<ChatSnippet> getContinuationFallbackSnippet() const {return continuationFallback_;} bool getAppendToPrevious() const { return appendToPrevious_; @@ -61,12 +61,12 @@ namespace Swift { static QString directionToCSS(Direction direction); QString wrapResizable(const QString& text); - void setContinuationFallbackSnippet(boost::shared_ptr<ChatSnippet> continuationFallback) { + void setContinuationFallbackSnippet(std::shared_ptr<ChatSnippet> continuationFallback) { continuationFallback_ = continuationFallback; } private: bool appendToPrevious_; - boost::shared_ptr<ChatSnippet> continuationFallback_; + std::shared_ptr<ChatSnippet> continuationFallback_; }; } diff --git a/Swift/QtUI/CocoaUIHelpers.mm b/Swift/QtUI/CocoaUIHelpers.mm index 06a74aa..c876312 100644 --- a/Swift/QtUI/CocoaUIHelpers.mm +++ b/Swift/QtUI/CocoaUIHelpers.mm @@ -12,7 +12,7 @@ #include "CocoaUIHelpers.h" -#include <boost/shared_ptr.hpp> +#include <memory> #include <boost/type_traits.hpp> #include <Cocoa/Cocoa.h> @@ -32,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(nullptr, certAsDER.data(), certAsDER.size()), CFRelease); - boost::shared_ptr<OpaqueSecCertificateRef> macCert(SecCertificateCreateWithData(nullptr, certData.get()), CFRelease); + std::shared_ptr<boost::remove_pointer<CFDataRef>::type> certData(CFDataCreate(nullptr, certAsDER.data(), certAsDER.size()), CFRelease); + std::shared_ptr<OpaqueSecCertificateRef> macCert(SecCertificateCreateWithData(nullptr, certData.get()), CFRelease); // add to NSMutable array [certificates addObject: (id)macCert.get()]; diff --git a/Swift/QtUI/EventViewer/EventDelegate.cpp b/Swift/QtUI/EventViewer/EventDelegate.cpp index eff9a7b..1c3ed7f 100644 --- a/Swift/QtUI/EventViewer/EventDelegate.cpp +++ b/Swift/QtUI/EventViewer/EventDelegate.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. */ @@ -56,24 +56,24 @@ void EventDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, } } -EventType EventDelegate::getEventType(boost::shared_ptr<StanzaEvent> event) const { - boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event); +EventType EventDelegate::getEventType(std::shared_ptr<StanzaEvent> event) const { + std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(event); if (messageEvent) { return MessageEventType; } - boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event); + std::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(event); if (subscriptionEvent) { return SubscriptionEventType; } - boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event); + std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(event); if (errorEvent) { return ErrorEventType; } - boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event); + std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(event); if (mucInviteEvent) { return MUCInviteEventType; } - boost::shared_ptr<IncomingFileTransferEvent> incomingFileTransferEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event); + std::shared_ptr<IncomingFileTransferEvent> incomingFileTransferEvent = std::dynamic_pointer_cast<IncomingFileTransferEvent>(event); if (incomingFileTransferEvent) { return IncomingFileTransferEventType; } diff --git a/Swift/QtUI/EventViewer/EventDelegate.h b/Swift/QtUI/EventViewer/EventDelegate.h index 0804589..79ee8ed 100644 --- a/Swift/QtUI/EventViewer/EventDelegate.h +++ b/Swift/QtUI/EventViewer/EventDelegate.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. */ @@ -20,7 +20,7 @@ namespace Swift { QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; private: - EventType getEventType(boost::shared_ptr<StanzaEvent> event) const; + EventType getEventType(std::shared_ptr<StanzaEvent> event) const; DelegateCommons common_; TwoLineDelegate messageDelegate_; TwoLineDelegate subscriptionDelegate_; diff --git a/Swift/QtUI/EventViewer/EventModel.cpp b/Swift/QtUI/EventViewer/EventModel.cpp index d830db9..e242003 100644 --- a/Swift/QtUI/EventViewer/EventModel.cpp +++ b/Swift/QtUI/EventViewer/EventModel.cpp @@ -74,7 +74,7 @@ int EventModel::rowCount(const QModelIndex& parent) const { return count; } -void EventModel::addEvent(boost::shared_ptr<StanzaEvent> event, bool active) { +void EventModel::addEvent(std::shared_ptr<StanzaEvent> event, bool active) { beginResetModel(); if (active) { activeEvents_.push_front(new QtEvent(event, active)); @@ -87,7 +87,7 @@ void EventModel::addEvent(boost::shared_ptr<StanzaEvent> event, bool active) { endResetModel(); } -void EventModel::removeEvent(boost::shared_ptr<StanzaEvent> event) { +void EventModel::removeEvent(std::shared_ptr<StanzaEvent> event) { beginResetModel(); for (int i = inactiveEvents_.size() - 1; i >= 0; i--) { if (event == inactiveEvents_[i]->getEvent()) { diff --git a/Swift/QtUI/EventViewer/EventModel.h b/Swift/QtUI/EventViewer/EventModel.h index 5cd5028..de72c1b 100644 --- a/Swift/QtUI/EventViewer/EventModel.h +++ b/Swift/QtUI/EventViewer/EventModel.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QAbstractListModel> #include <QList> @@ -21,8 +21,8 @@ class EventModel : public QAbstractListModel { public: EventModel(); virtual ~EventModel(); - void addEvent(boost::shared_ptr<StanzaEvent> event, bool active); - void removeEvent(boost::shared_ptr<StanzaEvent> event); + void addEvent(std::shared_ptr<StanzaEvent> event, bool active); + void removeEvent(std::shared_ptr<StanzaEvent> event); QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; int rowCount(const QModelIndex& parent = QModelIndex()) const; QtEvent* getItem(int row) const; diff --git a/Swift/QtUI/EventViewer/QtEvent.cpp b/Swift/QtUI/EventViewer/QtEvent.cpp index c287c66..5bd0fad 100644 --- a/Swift/QtUI/EventViewer/QtEvent.cpp +++ b/Swift/QtUI/EventViewer/QtEvent.cpp @@ -19,7 +19,7 @@ namespace Swift { -QtEvent::QtEvent(boost::shared_ptr<StanzaEvent> event, bool active) : event_(event) { +QtEvent::QtEvent(std::shared_ptr<StanzaEvent> event, bool active) : event_(event) { active_ = active; } @@ -38,23 +38,23 @@ QVariant QtEvent::data(int role) { } QString QtEvent::sender() { - boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event_); + std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(event_); if (messageEvent) { return P2QSTRING(messageEvent->getStanza()->getFrom().toString()); } - boost::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); + std::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); if (subscriptionRequestEvent) { return P2QSTRING(subscriptionRequestEvent->getJID().toBare().toString()); } - boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event_); + std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(event_); if (errorEvent) { return P2QSTRING(errorEvent->getJID().toBare().toString()); } - boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event_); + std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(event_); if (mucInviteEvent) { return P2QSTRING(mucInviteEvent->getInviter().toString()); } - boost::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event_); + std::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = std::dynamic_pointer_cast<IncomingFileTransferEvent>(event_); if (incomingFTEvent) { return P2QSTRING(incomingFTEvent->getSender().toString()); } @@ -62,11 +62,11 @@ QString QtEvent::sender() { } QString QtEvent::text() { - boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event_); + std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(event_); if (messageEvent) { return P2QSTRING(messageEvent->getStanza()->getBody().get_value_or("")); } - boost::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); + std::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); if (subscriptionRequestEvent) { std::string reason = subscriptionRequestEvent->getReason(); QString message; @@ -78,16 +78,16 @@ QString QtEvent::text() { } return message; } - boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event_); + std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(event_); if (errorEvent) { return P2QSTRING(errorEvent->getText()); } - boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event_); + std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(event_); if (mucInviteEvent) { QString message = QString(QObject::tr("%1 has invited you to enter the %2 room.")).arg(P2QSTRING(mucInviteEvent->getInviter().toBare().toString())).arg(P2QSTRING(mucInviteEvent->getRoomJID().toString())); return message; } - boost::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event_); + std::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = std::dynamic_pointer_cast<IncomingFileTransferEvent>(event_); if (incomingFTEvent) { QString message = QString(QObject::tr("%1 would like to send a file to you.")).arg(P2QSTRING(incomingFTEvent->getSender().toBare().toString())); return message; diff --git a/Swift/QtUI/EventViewer/QtEvent.h b/Swift/QtUI/EventViewer/QtEvent.h index d369255..cb78b00 100644 --- a/Swift/QtUI/EventViewer/QtEvent.h +++ b/Swift/QtUI/EventViewer/QtEvent.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QVariant> @@ -15,9 +15,9 @@ namespace Swift { class QtEvent { public: - QtEvent(boost::shared_ptr<StanzaEvent> event, bool active); + QtEvent(std::shared_ptr<StanzaEvent> event, bool active); QVariant data(int role); - boost::shared_ptr<StanzaEvent> getEvent() { return event_; } + std::shared_ptr<StanzaEvent> getEvent() { return event_; } enum EventRoles { SenderRole = Qt::UserRole @@ -26,7 +26,7 @@ namespace Swift { private: QString text(); QString sender(); - boost::shared_ptr<StanzaEvent> event_; + std::shared_ptr<StanzaEvent> event_; bool active_; }; } diff --git a/Swift/QtUI/EventViewer/QtEventWindow.cpp b/Swift/QtUI/EventViewer/QtEventWindow.cpp index 8395a6c..e77699b 100644 --- a/Swift/QtUI/EventViewer/QtEventWindow.cpp +++ b/Swift/QtUI/EventViewer/QtEventWindow.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. */ @@ -73,26 +73,26 @@ void QtEventWindow::handleReadClicked() { void QtEventWindow::handleItemActivated(const QModelIndex& item) { QtEvent* event = model_->getItem(item.row()); - boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event->getEvent()); - boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event->getEvent()); - boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event->getEvent()); - boost::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event->getEvent()); - boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event->getEvent()); + std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(event->getEvent()); + std::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(event->getEvent()); + std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(event->getEvent()); + std::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = std::dynamic_pointer_cast<IncomingFileTransferEvent>(event->getEvent()); + std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(event->getEvent()); if (messageEvent) { if (messageEvent->getStanza()->getType() == Message::Groupchat) { - eventStream_->send(boost::shared_ptr<UIEvent>(new JoinMUCUIEvent(messageEvent->getStanza()->getFrom().toBare(), messageEvent->getStanza()->getTo().getResource()))); + eventStream_->send(std::make_shared<JoinMUCUIEvent>(messageEvent->getStanza()->getFrom().toBare(), messageEvent->getStanza()->getTo().getResource())); } else { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(messageEvent->getStanza()->getFrom()))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(messageEvent->getStanza()->getFrom())); } } else if (subscriptionEvent) { QtSubscriptionRequestWindow* window = QtSubscriptionRequestWindow::getWindow(subscriptionEvent, this); window->show(); } else if (mucInviteEvent) { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(mucInviteEvent->getInviter()))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(mucInviteEvent->getInviter())); mucInviteEvent->conclude(); } else if (incomingFTEvent) { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(incomingFTEvent->getSender()))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(incomingFTEvent->getSender())); incomingFTEvent->conclude(); } else { if (errorEvent) { @@ -105,14 +105,14 @@ void QtEventWindow::handleItemActivated(const QModelIndex& item) { } -void QtEventWindow::addEvent(boost::shared_ptr<StanzaEvent> event, bool active) { +void QtEventWindow::addEvent(std::shared_ptr<StanzaEvent> event, bool active) { view_->clearSelection(); model_->addEvent(event, active); emit onNewEventCountUpdated(model_->getNewEventCount()); readButton_->setEnabled(model_->rowCount() > 0); } -void QtEventWindow::removeEvent(boost::shared_ptr<StanzaEvent> event) { +void QtEventWindow::removeEvent(std::shared_ptr<StanzaEvent> event) { view_->clearSelection(); model_->removeEvent(event); emit onNewEventCountUpdated(model_->getNewEventCount()); diff --git a/Swift/QtUI/EventViewer/QtEventWindow.h b/Swift/QtUI/EventViewer/QtEventWindow.h index 92f8de0..bad20e4 100644 --- a/Swift/QtUI/EventViewer/QtEventWindow.h +++ b/Swift/QtUI/EventViewer/QtEventWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QTreeView> @@ -25,8 +25,8 @@ namespace Swift { public: QtEventWindow(UIEventStream* eventStream); ~QtEventWindow(); - void addEvent(boost::shared_ptr<StanzaEvent> event, bool active); - void removeEvent(boost::shared_ptr<StanzaEvent> event); + void addEvent(std::shared_ptr<StanzaEvent> event, bool active); + void removeEvent(std::shared_ptr<StanzaEvent> event); signals: void onNewEventCountUpdated(int count); private slots: diff --git a/Swift/QtUI/EventViewer/main.cpp b/Swift/QtUI/EventViewer/main.cpp index 5eddd90..492599e 100644 --- a/Swift/QtUI/EventViewer/main.cpp +++ b/Swift/QtUI/EventViewer/main.cpp @@ -21,13 +21,13 @@ int main(int argc, char *argv[]) Swift::UIEventStream eventStream; Swift::QtEventWindow* viewer = new Swift::QtEventWindow(&eventStream); viewer->show(); - boost::shared_ptr<Swift::Message> message1(new Swift::Message()); + std::shared_ptr<Swift::Message> message1(new Swift::Message()); message1->setBody("Oooh, shiny"); - boost::shared_ptr<Swift::MessageEvent> event1(new Swift::MessageEvent(message1)); - viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(event1), true); + std::shared_ptr<Swift::MessageEvent> event1(new Swift::MessageEvent(message1)); + viewer->addEvent(std::dynamic_pointer_cast<Swift::StanzaEvent>(event1), true); for (int i = 0; i < 100; i++) { - viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(event1), false); + viewer->addEvent(std::dynamic_pointer_cast<Swift::StanzaEvent>(event1), false); } - viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(boost::make_shared<Swift::ErrorEvent>(Swift::JID("me@example.com"), "Something bad did happen to you.")), true); + viewer->addEvent(std::dynamic_pointer_cast<Swift::StanzaEvent>(std::make_shared<Swift::ErrorEvent>(Swift::JID("me@example.com"), "Something bad did happen to you.")), true); return app.exec(); } diff --git a/Swift/QtUI/MUCSearch/MUCSearchModel.h b/Swift/QtUI/MUCSearch/MUCSearchModel.h index d6a24f3..2922ca6 100644 --- a/Swift/QtUI/MUCSearch/MUCSearchModel.h +++ b/Swift/QtUI/MUCSearch/MUCSearchModel.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QAbstractItemModel> #include <QList> diff --git a/Swift/QtUI/MessageSnippet.cpp b/Swift/QtUI/MessageSnippet.cpp index 85cbdb9..4682365 100644 --- a/Swift/QtUI/MessageSnippet.cpp +++ b/Swift/QtUI/MessageSnippet.cpp @@ -12,7 +12,7 @@ namespace Swift { MessageSnippet::MessageSnippet(const QString& message, const QString& sender, const QDateTime& time, const QString& iconURI, bool isIncoming, bool appendToPrevious, QtChatTheme* theme, const QString& id, Direction direction) : ChatSnippet(appendToPrevious) { if (appendToPrevious) { - setContinuationFallbackSnippet(boost::shared_ptr<ChatSnippet>(new MessageSnippet(message, sender, time, iconURI, isIncoming, false, theme, id, direction))); + setContinuationFallbackSnippet(std::make_shared<MessageSnippet>(message, sender, time, iconURI, isIncoming, false, theme, id, direction)); } if (isIncoming) { if (appendToPrevious) { diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp index e638523..6b982b1 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWindow.cpp @@ -19,7 +19,7 @@ const int FormLayoutIndex = 1; namespace Swift { -QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) : command_(command) { +QtAdHocCommandWindow::QtAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command) : command_(command) { formWidget_ = nullptr; setAttribute(Qt::WA_DeleteOnClose); diff --git a/Swift/QtUI/QtAdHocCommandWindow.h b/Swift/QtUI/QtAdHocCommandWindow.h index 61cd5be..1135ef9 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.h +++ b/Swift/QtUI/QtAdHocCommandWindow.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. */ @@ -22,7 +22,7 @@ namespace Swift { class QtAdHocCommandWindow : public QWidget, public AdHocCommandWindow { Q_OBJECT public: - QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command); + QtAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command); virtual ~QtAdHocCommandWindow(); virtual void setOnline(bool online); @@ -41,7 +41,7 @@ namespace Swift { void handleCompleteClicked(); private: - boost::shared_ptr<OutgoingAdHocCommandSession> command_; + std::shared_ptr<OutgoingAdHocCommandSession> command_; QtFormWidget* formWidget_; Form::ref form_; QLabel* label_; diff --git a/Swift/QtUI/QtAdHocCommandWithJIDWindow.cpp b/Swift/QtUI/QtAdHocCommandWithJIDWindow.cpp index 69e1d68..1b114d9 100644 --- a/Swift/QtUI/QtAdHocCommandWithJIDWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWithJIDWindow.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. */ @@ -52,7 +52,7 @@ QtAdHocCommandWithJIDWindow::~QtAdHocCommandWithJIDWindow() { void QtAdHocCommandWithJIDWindow::handleAcceptClick() { const JID jid = JID(Q2PSTRING(jid_->text())); const std::string node = Q2PSTRING(node_->text()); - boost::shared_ptr<UIEvent> event(new RequestAdHocWithJIDUIEvent(jid, node)); + std::shared_ptr<UIEvent> event(new RequestAdHocWithJIDUIEvent(jid, node)); uiEventStream_->send(event); accept(); } diff --git a/Swift/QtUI/QtAddBookmarkWindow.cpp b/Swift/QtUI/QtAddBookmarkWindow.cpp index 500b298..8c5d662 100644 --- a/Swift/QtUI/QtAddBookmarkWindow.cpp +++ b/Swift/QtUI/QtAddBookmarkWindow.cpp @@ -19,7 +19,7 @@ QtAddBookmarkWindow::QtAddBookmarkWindow(UIEventStream* eventStream, const MUCBo bool QtAddBookmarkWindow::commit() { boost::optional<MUCBookmark> bookmark = createBookmarkFromForm(); if (bookmark) { - eventStream_->send(boost::shared_ptr<UIEvent>(new AddMUCBookmarkUIEvent(*bookmark))); + eventStream_->send(std::make_shared<AddMUCBookmarkUIEvent>(*bookmark)); return true; } else { diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h index cca3bdf..fd13cc2 100644 --- a/Swift/QtUI/QtChatView.h +++ b/Swift/QtUI/QtChatView.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/shared_ptr.hpp> #include <QWidget> @@ -28,11 +28,11 @@ namespace Swift { /** Add message to window. * @return id of added message (for acks). */ - virtual std::string addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual std::string addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; /** Adds action to window. * @return id of added message (for acks); */ - virtual std::string addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual std::string addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; virtual std::string addSystemMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) = 0; virtual void addPresenceMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) = 0; diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 6cb2292..a828210 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -6,9 +6,10 @@ #include <Swift/QtUI/QtChatWindow.h> +#include <memory> + #include <boost/cstdint.hpp> #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QApplication> #include <QBoxLayout> @@ -630,7 +631,7 @@ void QtChatWindow::dropEvent(QDropEvent *event) { else { std::string messageText(Q2PSTRING(tr("Sending of multiple files at once isn't supported at this time."))); ChatMessage message; - message.append(boost::make_shared<ChatTextMessagePart>(messageText)); + message.append(std::make_shared<ChatTextMessagePart>(messageText)); addSystemMessage(message, DefaultDirection); } } @@ -866,12 +867,12 @@ void QtChatWindow::addMUCInvitation(const std::string& senderName, const JID& ji messageLog_->addMUCInvitation(senderName, jid, reason, password, direct, isImpromptu, isContinuation); } -std::string QtChatWindow::addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { handleAppendedToLog(); return messageLog_->addMessage(message, senderName, senderIsSelf, label, avatarPath, time); } -std::string QtChatWindow::addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { handleAppendedToLog(); return messageLog_->addAction(message, senderName, senderIsSelf, label, avatarPath, time); } diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 00693d2..25a1948 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -55,7 +55,7 @@ namespace Swift { if (!index.isValid()) { return QVariant(); } - boost::shared_ptr<SecurityLabel> label = availableLabels_[index.row()].getLabel(); + std::shared_ptr<SecurityLabel> label = availableLabels_[index.row()].getLabel(); if (label && role == Qt::TextColorRole) { return P2QSTRING(label->getForegroundColor()); } @@ -80,8 +80,8 @@ namespace Swift { public: QtChatWindow(const QString& contact, QtChatTheme* theme, UIEventStream* eventStream, SettingsProvider* settings, const std::map<std::string, std::string>& emoticons); virtual ~QtChatWindow(); - std::string addMessage(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time); - std::string addAction(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time); + std::string addMessage(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time); + std::string addAction(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time); std::string addSystemMessage(const ChatMessage& message, Direction direction); void addPresenceMessage(const ChatMessage& message, Direction direction); diff --git a/Swift/QtUI/QtContactEditWidget.h b/Swift/QtUI/QtContactEditWidget.h index 5c081e9..d4ea609 100644 --- a/Swift/QtUI/QtContactEditWidget.h +++ b/Swift/QtUI/QtContactEditWidget.h @@ -7,12 +7,11 @@ #pragma once #include <map> +#include <memory> #include <set> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <QWidget> class QLabel; diff --git a/Swift/QtUI/QtEditBookmarkWindow.cpp b/Swift/QtUI/QtEditBookmarkWindow.cpp index a17b1aa..1d6b467 100644 --- a/Swift/QtUI/QtEditBookmarkWindow.cpp +++ b/Swift/QtUI/QtEditBookmarkWindow.cpp @@ -22,7 +22,7 @@ bool QtEditBookmarkWindow::commit() { if (!bookmark) { return false; } - eventStream_->send(boost::shared_ptr<UIEvent>(new EditMUCBookmarkUIEvent(bookmark_, *bookmark))); + eventStream_->send(std::make_shared<EditMUCBookmarkUIEvent>(bookmark_, *bookmark)); return true; } diff --git a/Swift/QtUI/QtFormWidget.cpp b/Swift/QtUI/QtFormWidget.cpp index 31f9a10..1d26815 100644 --- a/Swift/QtUI/QtFormWidget.cpp +++ b/Swift/QtUI/QtFormWidget.cpp @@ -6,8 +6,9 @@ #include <Swift/QtUI/QtFormWidget.h> +#include <memory> + #include <boost/algorithm/string/join.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QCheckBox> #include <QGridLayout> @@ -156,8 +157,8 @@ QWidget* QtFormWidget::createWidget(FormField::ref field, const FormField::Type Form::ref QtFormWidget::getCompletedForm() { Form::ref result(new Form(Form::SubmitType)); - foreach (boost::shared_ptr<FormField> field, form_->getFields()) { - boost::shared_ptr<FormField> resultField = boost::make_shared<FormField>(field->getType()); + foreach (std::shared_ptr<FormField> field, form_->getFields()) { + std::shared_ptr<FormField> resultField = std::make_shared<FormField>(field->getType()); if (field->getType() == FormField::BooleanType) { resultField->setBoolValue(qobject_cast<QCheckBox*>(fields_[field->getName()])->checkState() == Qt::Checked); } @@ -225,7 +226,7 @@ void QtFormWidget::setEditable(bool editable) { if (!form_) { return; } - foreach (boost::shared_ptr<FormField> field, form_->getFields()) { + foreach (std::shared_ptr<FormField> field, form_->getFields()) { QWidget* widget = nullptr; if (field) { widget = fields_[field->getName()]; diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index 035e73f..53e7ffe 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -12,12 +12,11 @@ #include <Swift/QtUI/QtHistoryWindow.h> +#include <memory> #include <string> #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/numeric/conversion/cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QDateTime> #include <QLineEdit> @@ -138,14 +137,14 @@ void QtHistoryWindow::addMessage(const std::string &message, const std::string & if (addAtTheTop) { bool appendToPrevious = ((senderIsSelf && previousTopMessageWasSelf_) || (!senderIsSelf && !previousTopMessageWasSelf_&& previousTopSenderName_ == P2QSTRING(senderName))); - conversation_->addMessageTop(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(message)))); + conversation_->addMessageTop(std::make_shared<MessageSnippet>(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(message))); previousTopMessageWasSelf_ = senderIsSelf; previousTopSenderName_ = P2QSTRING(senderName); } else { bool appendToPrevious = ((senderIsSelf && previousBottomMessageWasSelf_) || (!senderIsSelf && !previousBottomMessageWasSelf_&& previousBottomSenderName_ == P2QSTRING(senderName))); - conversation_->addMessageBottom(boost::make_shared<MessageSnippet>(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(message))); + conversation_->addMessageBottom(std::make_shared<MessageSnippet>(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(message))); previousBottomMessageWasSelf_ = senderIsSelf; previousBottomSenderName_ = P2QSTRING(senderName); } diff --git a/Swift/QtUI/QtJoinMUCWindow.cpp b/Swift/QtUI/QtJoinMUCWindow.cpp index 7225b06..ec2028c 100644 --- a/Swift/QtUI/QtJoinMUCWindow.cpp +++ b/Swift/QtUI/QtJoinMUCWindow.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swift/QtUI/QtJoinMUCWindow.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <QToolTip> @@ -49,7 +49,7 @@ void QtJoinMUCWindow::handleJoin() { lastSetNick = Q2PSTRING(ui.nickName->text()); std::string password = Q2PSTRING(ui.password->text()); JID room(Q2PSTRING(ui.room->text())); - uiEventStream->send(boost::make_shared<JoinMUCUIEvent>(room, password, lastSetNick, ui.joinAutomatically->isChecked(), !ui.instantRoom->isChecked())); + uiEventStream->send(std::make_shared<JoinMUCUIEvent>(room, password, lastSetNick, ui.joinAutomatically->isChecked(), !ui.instantRoom->isChecked())); hide(); } diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 11458f0..b2778a1 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -10,7 +10,7 @@ #include <cassert> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <QApplication> #include <QBoxLayout> @@ -399,12 +399,12 @@ void QtLoginWindow::loginClicked() { if (!certificateString.empty()) { #if defined(HAVE_SCHANNEL) if (isCAPIURI(certificateString)) { - certificate = boost::make_shared<CAPICertificate>(certificateString, timerFactory_); + certificate = std::make_shared<CAPICertificate>(certificateString, timerFactory_); } else { - certificate = boost::make_shared<PKCS12Certificate>(certificateString, createSafeByteArray(Q2PSTRING(password_->text()))); + certificate = std::make_shared<PKCS12Certificate>(certificateString, createSafeByteArray(Q2PSTRING(password_->text()))); } #else - certificate = boost::make_shared<PKCS12Certificate>(certificateString, createSafeByteArray(Q2PSTRING(password_->text()))); + certificate = std::make_shared<PKCS12Certificate>(certificateString, createSafeByteArray(Q2PSTRING(password_->text()))); #endif } @@ -454,15 +454,15 @@ void QtLoginWindow::handleAbout() { } void QtLoginWindow::handleShowXMLConsole() { - uiEventStream_->send(boost::make_shared<RequestXMLConsoleUIEvent>()); + uiEventStream_->send(std::make_shared<RequestXMLConsoleUIEvent>()); } void QtLoginWindow::handleShowFileTransferOverview() { - uiEventStream_->send(boost::make_shared<RequestFileTransferListUIEvent>()); + uiEventStream_->send(std::make_shared<RequestFileTransferListUIEvent>()); } void QtLoginWindow::handleShowHighlightEditor() { - uiEventStream_->send(boost::make_shared<RequestHighlightEditorUIEvent>()); + uiEventStream_->send(std::make_shared<RequestHighlightEditorUIEvent>()); } void QtLoginWindow::handleToggleSounds(bool enabled) { diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index e351bd3..611fc80 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -8,7 +8,7 @@ #include <boost/bind.hpp> #include <boost/optional.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <QAction> #include <QBoxLayout> @@ -225,7 +225,7 @@ void QtMainWindow::handleShowCertificateInfo() { } void QtMainWindow::handleEditBlockingList() { - uiEventStream_->send(boost::make_shared<RequestBlockListDialogUIEvent>()); + uiEventStream_->send(std::make_shared<RequestBlockListDialogUIEvent>()); } void QtMainWindow::handleSomethingSelectedChanged(bool itemSelected) { @@ -246,7 +246,7 @@ void QtMainWindow::setRosterModel(Roster* roster) { } void QtMainWindow::handleEditProfileRequest() { - uiEventStream_->send(boost::make_shared<RequestProfileEditorUIEvent>()); + uiEventStream_->send(std::make_shared<RequestProfileEditorUIEvent>()); } void QtMainWindow::handleEventCountUpdated(int count) { @@ -272,12 +272,12 @@ void QtMainWindow::handleChatCountUpdated(int count) { } void QtMainWindow::handleAddUserActionTriggered(bool /*checked*/) { - boost::shared_ptr<UIEvent> event(new RequestAddUserDialogUIEvent()); + std::shared_ptr<UIEvent> event(new RequestAddUserDialogUIEvent()); uiEventStream_->send(event); } void QtMainWindow::handleChatUserActionTriggered(bool /*checked*/) { - boost::shared_ptr<UIEvent> event(new RequestChatWithUserDialogUIEvent()); + std::shared_ptr<UIEvent> event(new RequestChatWithUserDialogUIEvent()); uiEventStream_->send(event); } @@ -291,15 +291,15 @@ void QtMainWindow::handleSignOutAction() { } void QtMainWindow::handleEditProfileAction() { - uiEventStream_->send(boost::make_shared<RequestProfileEditorUIEvent>()); + uiEventStream_->send(std::make_shared<RequestProfileEditorUIEvent>()); } void QtMainWindow::handleJoinMUCAction() { - uiEventStream_->send(boost::make_shared<RequestJoinMUCUIEvent>()); + uiEventStream_->send(std::make_shared<RequestJoinMUCUIEvent>()); } void QtMainWindow::handleViewLogsAction() { - uiEventStream_->send(boost::make_shared<RequestHistoryUIEvent>()); + uiEventStream_->send(std::make_shared<RequestHistoryUIEvent>()); } void QtMainWindow::handleStatusChanged(StatusShow::Type showType, const QString &statusMessage) { @@ -363,7 +363,7 @@ void QtMainWindow::setMyStatusType(StatusShow::Type type) { serverAdHocMenu_->setEnabled(online); } -void QtMainWindow::setMyContactRosterItem(boost::shared_ptr<ContactRosterItem> contact) { +void QtMainWindow::setMyContactRosterItem(std::shared_ptr<ContactRosterItem> contact) { meView_->setContactRosterItem(contact); } @@ -393,7 +393,7 @@ void QtMainWindow::handleAdHocActionTriggered(bool /*checked*/) { QAction* action = qobject_cast<QAction*>(sender()); assert(action); DiscoItems::Item command = serverAdHocCommands_[serverAdHocCommandActions_.indexOf(action)]; - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestAdHocUIEvent(command))); + uiEventStream_->send(std::make_shared<RequestAdHocUIEvent>(command)); } void QtMainWindow::setAvailableAdHocCommands(const std::vector<DiscoItems::Item>& commands) { diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index d90dade..c46fdfc 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -47,7 +47,7 @@ namespace Swift { void setMyAvatarPath(const std::string& path); void setMyStatusText(const std::string& status); void setMyStatusType(StatusShow::Type type); - void setMyContactRosterItem(boost::shared_ptr<ContactRosterItem> contact); + void setMyContactRosterItem(std::shared_ptr<ContactRosterItem> contact); void setConnecting(); void setStreamEncryptionStatus(bool tlsInPlaceAndValid); void openCertificateDialog(const std::vector<Certificate::ref>& chain); diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp index fc53666..d682cfa 100644 --- a/Swift/QtUI/QtPlainChatView.cpp +++ b/Swift/QtUI/QtPlainChatView.cpp @@ -45,28 +45,28 @@ QtPlainChatView::~QtPlainChatView() { QString chatMessageToString(const ChatWindow::ChatMessage& message) { QString result; - foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { - boost::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; - boost::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart; - boost::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart; - boost::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart; + foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { + std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; + std::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart; + std::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart; + std::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart; - if ((textPart = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { + if ((textPart = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { QString text = QtUtilities::htmlEscape(P2QSTRING(textPart->text)); text.replace("\n","<br/>"); result += text; continue; } - if ((uriPart = boost::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(part))) { + if ((uriPart = std::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(part))) { QString uri = QtUtilities::htmlEscape(P2QSTRING(uriPart->target)); result += "<a href='" + uri + "' >" + uri + "</a>"; continue; } - if ((emoticonPart = boost::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(part))) { + if ((emoticonPart = std::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(part))) { result += P2QSTRING(emoticonPart->alternativeText); continue; } - if ((highlightPart = boost::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part))) { + if ((highlightPart = std::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part))) { //FIXME: Maybe do something here. Anything, really. continue; } @@ -74,7 +74,7 @@ QString chatMessageToString(const ChatWindow::ChatMessage& message) { return result; } -std::string QtPlainChatView::addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& /*avatarPath*/, const boost::posix_time::ptime& time) { +std::string QtPlainChatView::addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& /*avatarPath*/, const boost::posix_time::ptime& time) { QString text = "<p>"; if (label) { text += P2QSTRING(label->getLabel()) + "<br/>"; @@ -89,7 +89,7 @@ std::string QtPlainChatView::addMessage(const ChatWindow::ChatMessage& message, return idx; } -std::string QtPlainChatView::addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& /*avatarPath*/, const boost::posix_time::ptime& time) { +std::string QtPlainChatView::addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& /*avatarPath*/, const boost::posix_time::ptime& time) { QString text = "<p>"; if (label) { text += P2QSTRING(label->getLabel()) + "<br/>"; @@ -328,7 +328,7 @@ void QtPlainChatView::acceptMUCInvite() { AcceptMUCInviteAction *action = dynamic_cast<AcceptMUCInviteAction*>(sender()); if (action) { - eventStream_->send(boost::make_shared<JoinMUCUIEvent>(action->jid_.toString(), action->password_, boost::optional<std::string>(), false, false, action->isImpromptu_, action->isContinuation_)); + eventStream_->send(std::make_shared<JoinMUCUIEvent>(action->jid_.toString(), action->password_, boost::optional<std::string>(), false, false, action->isImpromptu_, action->isContinuation_)); delete action->parent_; } } diff --git a/Swift/QtUI/QtPlainChatView.h b/Swift/QtUI/QtPlainChatView.h index cd6ab7e..2a9b3e1 100644 --- a/Swift/QtUI/QtPlainChatView.h +++ b/Swift/QtUI/QtPlainChatView.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/shared_ptr.hpp> #include <QTextEdit> #include <QWidget> @@ -35,11 +35,11 @@ namespace Swift { /** Add message to window. * @return id of added message (for acks). */ - virtual std::string addMessage(const ChatWindow::ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, boost::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/); + virtual std::string addMessage(const ChatWindow::ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/); /** Adds action to window. * @return id of added message (for acks); */ - virtual std::string addAction(const ChatWindow::ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, boost::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/); + virtual std::string addAction(const ChatWindow::ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/); virtual std::string addSystemMessage(const ChatWindow::ChatMessage& /*message*/, ChatWindow::Direction /*direction*/); virtual void addPresenceMessage(const ChatWindow::ChatMessage& /*message*/, ChatWindow::Direction /*direction*/); @@ -127,7 +127,7 @@ namespace Swift { UIEventStream* eventStream_; LogTextEdit* log_; FileTransferMap fileTransfers_; - std::map<std::string, boost::shared_ptr<SecurityLabel> > lastMessageLabel_; + std::map<std::string, std::shared_ptr<SecurityLabel> > lastMessageLabel_; int idGenerator_; }; diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index 56c3104..11dacb0 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -128,7 +128,7 @@ void QtRosterHeader::setNick(const QString& nick) { nameWidget_->setNick(nick); } -void QtRosterHeader::setContactRosterItem(boost::shared_ptr<ContactRosterItem> contact) { +void QtRosterHeader::setContactRosterItem(std::shared_ptr<ContactRosterItem> contact) { contact_ = contact; } diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index 7447c88..8370eb5 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -38,7 +38,7 @@ namespace Swift { void setJID(const QString& jid); void setNick(const QString& nick); - void setContactRosterItem(boost::shared_ptr<ContactRosterItem> contact); + void setContactRosterItem(std::shared_ptr<ContactRosterItem> contact); void setStatusText(const QString& statusMessage); void setStatusType(StatusShow::Type type); @@ -61,6 +61,6 @@ namespace Swift { QtStatusWidget* statusWidget_; QToolButton* securityInfoButton_; static const int avatarSize_; - boost::shared_ptr<ContactRosterItem> contact_; + std::shared_ptr<ContactRosterItem> contact_; }; } diff --git a/Swift/QtUI/QtSubscriptionRequestWindow.cpp b/Swift/QtUI/QtSubscriptionRequestWindow.cpp index 9e1fc37..eea13f2 100644 --- a/Swift/QtUI/QtSubscriptionRequestWindow.cpp +++ b/Swift/QtUI/QtSubscriptionRequestWindow.cpp @@ -14,7 +14,7 @@ #include <Swift/QtUI/QtSwiftUtil.h> namespace Swift { -QtSubscriptionRequestWindow::QtSubscriptionRequestWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) : QDialog(parent), event_(event) { +QtSubscriptionRequestWindow::QtSubscriptionRequestWindow(std::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) : QDialog(parent), event_(event) { QString text = QString(tr("%1 would like to add you to their contact list.")).arg(P2QSTRING(event->getJID().toString())); QVBoxLayout* layout = new QVBoxLayout(); QLabel* label = new QLabel(text, this); @@ -72,7 +72,7 @@ QtSubscriptionRequestWindow::~QtSubscriptionRequestWindow() { windows_.removeOne(this); } -QtSubscriptionRequestWindow* QtSubscriptionRequestWindow::getWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) { +QtSubscriptionRequestWindow* QtSubscriptionRequestWindow::getWindow(std::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) { foreach (QtSubscriptionRequestWindow* window, windows_) { if (window->getEvent() == event) { return window; @@ -83,7 +83,7 @@ QtSubscriptionRequestWindow* QtSubscriptionRequestWindow::getWindow(boost::share return window; } -boost::shared_ptr<SubscriptionRequestEvent> QtSubscriptionRequestWindow::getEvent() { +std::shared_ptr<SubscriptionRequestEvent> QtSubscriptionRequestWindow::getEvent() { return event_; } diff --git a/Swift/QtUI/QtSubscriptionRequestWindow.h b/Swift/QtUI/QtSubscriptionRequestWindow.h index 83c6333..3f1e816 100644 --- a/Swift/QtUI/QtSubscriptionRequestWindow.h +++ b/Swift/QtUI/QtSubscriptionRequestWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QDialog> @@ -16,17 +16,17 @@ namespace Swift { class QtSubscriptionRequestWindow : public QDialog { Q_OBJECT public: - static QtSubscriptionRequestWindow* getWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); + static QtSubscriptionRequestWindow* getWindow(std::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); ~QtSubscriptionRequestWindow(); - boost::shared_ptr<SubscriptionRequestEvent> getEvent(); + std::shared_ptr<SubscriptionRequestEvent> getEvent(); private slots: void handleYes(); void handleNo(); void handleDefer(); private: - QtSubscriptionRequestWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); + QtSubscriptionRequestWindow(std::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); static QList<QtSubscriptionRequestWindow*> windows_; - boost::shared_ptr<SubscriptionRequestEvent> event_; + std::shared_ptr<SubscriptionRequestEvent> event_; /*QPushButton* yesButton_; QPushButton* noButton_; QPushButton* deferButton_;*/ diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index 3318c21..a9e0e8f 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -159,7 +159,7 @@ ContactEditWindow* QtUIFactory::createContactEditWindow() { return new QtContactEditWindow(); } -WhiteboardWindow* QtUIFactory::createWhiteboardWindow(boost::shared_ptr<WhiteboardSession> whiteboardSession) { +WhiteboardWindow* QtUIFactory::createWhiteboardWindow(std::shared_ptr<WhiteboardSession> whiteboardSession) { return new QtWhiteboardWindow(whiteboardSession); } @@ -171,7 +171,7 @@ BlockListEditorWidget *QtUIFactory::createBlockListEditorWidget() { return new QtBlockListEditorWindow(); } -AdHocCommandWindow* QtUIFactory::createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) { +AdHocCommandWindow* QtUIFactory::createAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command) { return new QtAdHocCommandWindow(command); } diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h index c72bf63..a57d509 100644 --- a/Swift/QtUI/QtUIFactory.h +++ b/Swift/QtUI/QtUIFactory.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. */ @@ -48,10 +48,10 @@ namespace Swift { virtual ProfileWindow* createProfileWindow(); virtual ContactEditWindow* createContactEditWindow(); virtual FileTransferListWidget* createFileTransferListWidget(); - virtual WhiteboardWindow* createWhiteboardWindow(boost::shared_ptr<WhiteboardSession> whiteboardSession); + virtual WhiteboardWindow* createWhiteboardWindow(std::shared_ptr<WhiteboardSession> whiteboardSession); virtual HighlightEditorWindow* createHighlightEditorWindow(); virtual BlockListEditorWidget* createBlockListEditorWidget(); - virtual AdHocCommandWindow* createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command); + virtual AdHocCommandWindow* createAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command); private slots: void handleLoginWindowGeometryChanged(); diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp index fffd4b3..c5f99f0 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp @@ -52,17 +52,17 @@ QtVCardWidget::QtVCardWidget(QWidget* parent) : toolButton->hide(); toolButton->setMenu(menu); - addFieldType(menu, boost::make_shared<QtVCardInternetEMailField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardTelephoneField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardAddressField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardAddressLabelField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardBirthdayField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardJIDField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardDescriptionField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardRoleField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardTitleField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardOrganizationField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardURLField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardInternetEMailField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardTelephoneField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardAddressField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardAddressLabelField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardBirthdayField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardJIDField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardDescriptionField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardRoleField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardTitleField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardOrganizationField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardURLField::FieldInfo>()); setEditable(false); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -111,7 +111,7 @@ void QtVCardWidget::setEditable(bool editable) { void QtVCardWidget::setVCard(VCard::ref vcard) { clearFields(); - this->vcard = boost::make_shared<VCard>(*vcard); + this->vcard = std::make_shared<VCard>(*vcard); ui->photoAndName->setFormattedName(P2QSTRING(vcard->getFullName())); ui->photoAndName->setNickname(P2QSTRING(vcard->getNickname())); ui->photoAndName->setPrefix(P2QSTRING(vcard->getPrefix())); @@ -312,7 +312,7 @@ VCard::ref QtVCardWidget::getVCard() { void QtVCardWidget::addField() { QAction* action = nullptr; if ((action = dynamic_cast<QAction*>(sender()))) { - boost::shared_ptr<QtVCardFieldInfo> fieldInfo = actionFieldInfo[action]; + std::shared_ptr<QtVCardFieldInfo> fieldInfo = actionFieldInfo[action]; QWidget* newField = fieldInfo->createFieldInstance(this, ui->cardFields, true); QtVCardGeneralField* newGeneralField = dynamic_cast<QtVCardGeneralField*>(newField); if (newGeneralField) { @@ -341,7 +341,7 @@ void QtVCardWidget::removeField(QtVCardGeneralField *field) { delete field; } -void QtVCardWidget::addFieldType(QMenu* menu, boost::shared_ptr<QtVCardFieldInfo> fieldType) { +void QtVCardWidget::addFieldType(QMenu* menu, std::shared_ptr<QtVCardFieldInfo> fieldType) { if (!fieldType->getMenuName().isEmpty()) { QAction* action = new QAction(tr("Add %1").arg(fieldType->getMenuName()), this); actionFieldInfo[action] = fieldType; @@ -350,7 +350,7 @@ void QtVCardWidget::addFieldType(QMenu* menu, boost::shared_ptr<QtVCardFieldInfo } } -int QtVCardWidget::fieldTypeInstances(boost::shared_ptr<QtVCardFieldInfo> fieldType) { +int QtVCardWidget::fieldTypeInstances(std::shared_ptr<QtVCardFieldInfo> fieldType) { int instances = 0; for (int n = 0; n < ui->cardFields->count(); n++) { if (fieldType->testInstance(ui->cardFields->itemAt(n)->widget())) instances++; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h index 76fc46c..5334016 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <QToolButton> #include <QWidget> @@ -53,8 +53,8 @@ namespace Swift { void removeField(QtVCardGeneralField* field); private: - void addFieldType(QMenu*, boost::shared_ptr<QtVCardFieldInfo>); - int fieldTypeInstances(boost::shared_ptr<QtVCardFieldInfo>); + void addFieldType(QMenu*, std::shared_ptr<QtVCardFieldInfo>); + int fieldTypeInstances(std::shared_ptr<QtVCardFieldInfo>); void clearFields(); void clearEmptyFields(); void appendField(QtVCardGeneralField* field); @@ -67,7 +67,7 @@ namespace Swift { bool editable; QMenu* menu; std::list<QtVCardGeneralField*> fields; - std::map<QAction*, boost::shared_ptr<QtVCardFieldInfo> > actionFieldInfo; + std::map<QAction*, std::shared_ptr<QtVCardFieldInfo> > actionFieldInfo; }; } diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index 4193921..a40d0b3 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp @@ -118,7 +118,7 @@ void QtWebKitChatView::handleKeyPressEvent(QKeyEvent* event) { webView_->keyPressEvent(event); } -void QtWebKitChatView::addMessageBottom(boost::shared_ptr<ChatSnippet> snippet) { +void QtWebKitChatView::addMessageBottom(std::shared_ptr<ChatSnippet> snippet) { if (viewReady_) { addToDOM(snippet); } else { @@ -127,12 +127,12 @@ void QtWebKitChatView::addMessageBottom(boost::shared_ptr<ChatSnippet> snippet) } } -void QtWebKitChatView::addMessageTop(boost::shared_ptr<ChatSnippet> /* snippet */) { +void QtWebKitChatView::addMessageTop(std::shared_ptr<ChatSnippet> /* snippet */) { // TODO: Implement this in a sensible manner later. assert(false); } -void QtWebKitChatView::addToDOM(boost::shared_ptr<ChatSnippet> snippet) { +void QtWebKitChatView::addToDOM(std::shared_ptr<ChatSnippet> snippet) { //qDebug() << snippet->getContent(); rememberScrolledToBottom(); @@ -475,7 +475,7 @@ std::string QtWebKitChatView::addMessage( const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, - boost::shared_ptr<SecurityLabel> label, + std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { return addMessage(chatMessageToHTML(message), senderName, senderIsSelf, label, avatarPath, "", time, message.getFullMessageHighlightAction(), ChatSnippet::getDirection(message)); @@ -499,30 +499,30 @@ QString QtWebKitChatView::getHighlightSpanStart(const HighlightAction& highlight QString QtWebKitChatView::chatMessageToHTML(const ChatWindow::ChatMessage& message) { QString result; - foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { - boost::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; - boost::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart; - boost::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart; - boost::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart; + foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { + std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; + std::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart; + std::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart; + std::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart; - if ((textPart = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { + if ((textPart = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { QString text = QtUtilities::htmlEscape(P2QSTRING(textPart->text)); text.replace("\n","<br/>"); result += text; continue; } - if ((uriPart = boost::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(part))) { + if ((uriPart = std::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(part))) { QString uri = QtUtilities::htmlEscape(P2QSTRING(uriPart->target)); result += "<a href='" + uri + "' >" + uri + "</a>"; continue; } - if ((emoticonPart = boost::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(part))) { + if ((emoticonPart = std::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(part))) { QString textStyle = showEmoticons_ ? "style='display:none'" : ""; QString imageStyle = showEmoticons_ ? "" : "style='display:none'"; result += "<span class='swift_emoticon_image' " + imageStyle + "><img src='" + P2QSTRING(emoticonPart->imagePath) + "'/></span><span class='swift_emoticon_text' " + textStyle + ">" + QtUtilities::htmlEscape(P2QSTRING(emoticonPart->alternativeText)) + "</span>"; continue; } - if ((highlightPart = boost::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part))) { + if ((highlightPart = std::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part))) { QString spanStart = getHighlightSpanStart(highlightPart->action.getTextColor(), highlightPart->action.getTextBackground()); result += spanStart + QtUtilities::htmlEscape(P2QSTRING(highlightPart->text)) + "</span>"; continue; @@ -536,7 +536,7 @@ std::string QtWebKitChatView::addMessage( const QString& message, const std::string& senderName, bool senderIsSelf, - boost::shared_ptr<SecurityLabel> label, + std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time, @@ -563,7 +563,7 @@ std::string QtWebKitChatView::addMessage( QString qAvatarPath = scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), direction)); + addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), direction)); previousMessageWasSelf_ = senderIsSelf; previousSenderName_ = P2QSTRING(senderName); @@ -571,7 +571,7 @@ std::string QtWebKitChatView::addMessage( return id; } -std::string QtWebKitChatView::addAction(const ChatWindow::ChatMessage& message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { +std::string QtWebKitChatView::addAction(const ChatWindow::ChatMessage& message, const std::string &senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { return addMessage(" *" + chatMessageToHTML(message) + "*", senderName, senderIsSelf, label, avatarPath, "font-style:italic ", time, message.getFullMessageHighlightAction(), ChatSnippet::getDirection(message)); } @@ -622,13 +622,13 @@ std::string QtWebKitChatView::addFileTransfer(const std::string& senderName, boo "</div>"; } - //addMessage(message, senderName, senderIsSelf, boost::shared_ptr<SecurityLabel>(), "", boost::posix_time::second_clock::local_time()); + //addMessage(message, senderName, senderIsSelf, std::shared_ptr<SecurityLabel>(), "", boost::posix_time::second_clock::local_time()); bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasFileTransfer, senderName, senderIsSelf); QString qAvatarPath = "qrc:/icons/avatar.png"; std::string id = "ftmessage" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); + addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); previousMessageWasSelf_ = senderIsSelf; previousSenderName_ = P2QSTRING(senderName); @@ -662,7 +662,7 @@ std::string QtWebKitChatView::addWhiteboardRequest(const QString& contact, bool } QString qAvatarPath = "qrc:/icons/avatar.png"; std::string id = "wbmessage" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(contact), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, false, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); + addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(contact), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, false, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); previousMessageWasSelf_ = false; previousSenderName_ = contact; return Q2PSTRING(wb_id); @@ -780,7 +780,7 @@ void QtWebKitChatView::handleHTMLButtonClicked(QString id, QString encodedArgume QString elementID = arg3; QString isImpromptu = arg4; QString isContinuation = arg5; - eventStream_->send(boost::make_shared<JoinMUCUIEvent>(Q2PSTRING(roomJID), Q2PSTRING(password), boost::optional<std::string>(), false, false, isImpromptu.contains("true"), isContinuation.contains("true"))); + eventStream_->send(std::make_shared<JoinMUCUIEvent>(Q2PSTRING(roomJID), Q2PSTRING(password), boost::optional<std::string>(), false, false, isImpromptu.contains("true"), isContinuation.contains("true"))); setMUCInvitationJoined(elementID); } else { @@ -795,7 +795,7 @@ void QtWebKitChatView::addErrorMessage(const ChatWindow::ChatMessage& errorMessa QString errorMessageHTML(chatMessageToHTML(errorMessage)); std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<SystemMessageSnippet>("<span class=\"error\">" + errorMessageHTML + "</span>", QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), ChatSnippet::getDirection(errorMessage))); + addMessageBottom(std::make_shared<SystemMessageSnippet>("<span class=\"error\">" + errorMessageHTML + "</span>", QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), ChatSnippet::getDirection(errorMessage))); previousMessageWasSelf_ = false; previousMessageKind_ = PreviousMessageWasSystem; @@ -808,7 +808,7 @@ std::string QtWebKitChatView::addSystemMessage(const ChatWindow::ChatMessage& me QString messageHTML = chatMessageToHTML(message); std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); + addMessageBottom(std::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); previousMessageKind_ = PreviousMessageWasSystem; return id; @@ -874,7 +874,7 @@ void QtWebKitChatView::addPresenceMessage(const ChatWindow::ChatMessage& message QString messageHTML = chatMessageToHTML(message); std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); + addMessageBottom(std::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); previousMessageKind_ = PreviousMessageWasPresence; } @@ -913,7 +913,7 @@ void QtWebKitChatView::addMUCInvitation(const std::string& senderName, const JID QString qAvatarPath = "qrc:/icons/avatar.png"; - addMessageBottom(boost::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, appendToPrevious, theme_, id, ChatSnippet::getDirection(message))); + addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, appendToPrevious, theme_, id, ChatSnippet::getDirection(message))); previousMessageWasSelf_ = false; previousSenderName_ = P2QSTRING(senderName); previousMessageKind_ = PreviousMessageWasMUCInvite; diff --git a/Swift/QtUI/QtWebKitChatView.h b/Swift/QtUI/QtWebKitChatView.h index e3fb967..31bf8a5 100644 --- a/Swift/QtUI/QtWebKitChatView.h +++ b/Swift/QtUI/QtWebKitChatView.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QList> #include <QString> @@ -50,11 +50,11 @@ namespace Swift { /** Add message to window. * @return id of added message (for acks). */ - virtual std::string addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; + virtual std::string addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; /** Adds action to window. * @return id of added message (for acks); */ - virtual std::string addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; + virtual std::string addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; virtual std::string addSystemMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) SWIFTEN_OVERRIDE; virtual void addPresenceMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) SWIFTEN_OVERRIDE; @@ -75,8 +75,8 @@ namespace Swift { virtual void setMessageReceiptState(const std::string& id, ChatWindow::ReceiptState state) SWIFTEN_OVERRIDE; virtual void showEmoticons(bool show) SWIFTEN_OVERRIDE; - void addMessageTop(boost::shared_ptr<ChatSnippet> snippet); - void addMessageBottom(boost::shared_ptr<ChatSnippet> snippet); + void addMessageTop(std::shared_ptr<ChatSnippet> snippet); + void addMessageBottom(std::shared_ptr<ChatSnippet> snippet); int getSnippetPositionByDate(const QDate& date); // FIXME : This probably shouldn't have been public virtual void addLastSeenLine() SWIFTEN_OVERRIDE; @@ -140,7 +140,7 @@ namespace Swift { const QString& message, const std::string& senderName, bool senderIsSelf, - boost::shared_ptr<SecurityLabel> label, + std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time, @@ -162,7 +162,7 @@ namespace Swift { private: void headerEncode(); void messageEncode(); - void addToDOM(boost::shared_ptr<ChatSnippet> snippet); + void addToDOM(std::shared_ptr<ChatSnippet> snippet); QtChatWindow* window_; UIEventStream* eventStream_; diff --git a/Swift/QtUI/Roster/QtFilterWidget.cpp b/Swift/QtUI/Roster/QtFilterWidget.cpp index 3ed23b6..d2e4d09 100644 --- a/Swift/QtUI/Roster/QtFilterWidget.cpp +++ b/Swift/QtUI/Roster/QtFilterWidget.cpp @@ -77,7 +77,7 @@ bool QtFilterWidget::eventFilter(QObject*, QEvent* event) { } else if (keyEvent->key() == Qt::Key_Return) { JID target = treeView_->selectedJID(); if (target.isValid()) { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(target))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(target)); } filterLineEdit_->setText(""); updateRosterFilters(); diff --git a/Swift/QtUI/Roster/QtRosterWidget.cpp b/Swift/QtUI/Roster/QtRosterWidget.cpp index 92fed86..935d6f6 100644 --- a/Swift/QtUI/Roster/QtRosterWidget.cpp +++ b/Swift/QtUI/Roster/QtRosterWidget.cpp @@ -48,7 +48,7 @@ void QtRosterWidget::handleEditUserActionTriggered(bool /*checked*/) { } RosterItem* item = static_cast<RosterItem*>(index.internalPointer()); if (ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item)) { - eventStream_->send(boost::make_shared<RequestContactEditorUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<RequestContactEditorUIEvent>(contact->getJID())); } } @@ -95,15 +95,15 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { #endif QAction* result = contextMenu.exec(event->globalPos()); if (result == editContact) { - eventStream_->send(boost::make_shared<RequestContactEditorUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<RequestContactEditorUIEvent>(contact->getJID())); } else if (result == removeContact) { if (QtContactEditWindow::confirmContactDeletion(contact->getJID())) { - eventStream_->send(boost::make_shared<RemoveRosterItemUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<RemoveRosterItemUIEvent>(contact->getJID())); } } else if (result == showProfileForContact) { - eventStream_->send(boost::make_shared<ShowProfileForRosterItemUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<ShowProfileForRosterItemUIEvent>(contact->getJID())); } else if (unblockContact && result == unblockContact) { if (contact->blockState() == ContactRosterItem::IsDomainBlocked) { @@ -113,26 +113,26 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { messageBox.exec(); if (messageBox.clickedButton() == unblockDomainButton) { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, contact->getJID().getDomain())); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, contact->getJID().getDomain())); } } else { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, contact->getJID())); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, contact->getJID())); } } else if (blockContact && result == blockContact) { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Blocked, contact->getJID())); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Blocked, contact->getJID())); } #ifdef SWIFT_EXPERIMENTAL_FT else if (sendFile && result == sendFile) { QString fileName = QFileDialog::getOpenFileName(this, tr("Send File"), "", tr("All Files (*);;")); if (!fileName.isEmpty()) { - eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(fileName))); + eventStream_->send(std::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(fileName))); } } #endif #ifdef SWIFT_EXPERIMENTAL_WB else if (startWhiteboardChat && result == startWhiteboardChat) { - eventStream_->send(boost::make_shared<RequestWhiteboardUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<RequestWhiteboardUIEvent>(contact->getJID())); } #endif } @@ -155,7 +155,7 @@ void QtRosterWidget::renameGroup(GroupRosterItem* group) { bool 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))); + eventStream_->send(std::make_shared<RenameGroupUIEvent>(group->getDisplayName(), Q2PSTRING(newName))); } } diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index 16a186e..249523c 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -6,8 +6,9 @@ #include <Swift/QtUI/Roster/QtTreeWidget.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QLabel> #include <QMimeData> @@ -140,7 +141,7 @@ void QtTreeWidget::currentChanged(const QModelIndex& current, const QModelIndex& void QtTreeWidget::handleItemActivated(const QModelIndex& index) { JID target = jidFromIndex(index); if (target.isValid()) { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(target))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(target)); } } @@ -158,7 +159,7 @@ void QtTreeWidget::dropEvent(QDropEvent *event) { if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) { QString filename = event->mimeData()->urls().at(0).toLocalFile(); if (!filename.isEmpty()) { - eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(filename))); + eventStream_->send(std::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(filename))); } } } diff --git a/Swift/QtUI/SystemMessageSnippet.cpp b/Swift/QtUI/SystemMessageSnippet.cpp index fbf8810..eeb6b9a 100644 --- a/Swift/QtUI/SystemMessageSnippet.cpp +++ b/Swift/QtUI/SystemMessageSnippet.cpp @@ -12,7 +12,7 @@ namespace Swift { SystemMessageSnippet::SystemMessageSnippet(const QString& message, const QDateTime& time, bool appendToPrevious, QtChatTheme* theme, const QString& id, Direction direction) : ChatSnippet(appendToPrevious) { if (appendToPrevious) { - setContinuationFallbackSnippet(boost::shared_ptr<ChatSnippet>(new SystemMessageSnippet(message, time, false, theme, id, direction))); + setContinuationFallbackSnippet(std::make_shared<SystemMessageSnippet>(message, time, false, theme, id, direction)); } content_ = theme->getStatus(); 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> diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp index 2eae84d..62f5b89 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp @@ -13,10 +13,10 @@ #include <Swift/QtUI/Whiteboard/QtWhiteboardWindow.h> #include <iostream> +#include <memory> #include <boost/bind.hpp> #include <boost/numeric/conversion/cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QLabel> #include <QMessageBox> @@ -154,13 +154,13 @@ namespace Swift { } void QtWhiteboardWindow::handleWhiteboardOperationReceive(const WhiteboardOperation::ref operation) { - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); if (insertOp) { WhiteboardElementDrawingVisitor visitor(graphicsView, operation->getPos(), GView::New); insertOp->getElement()->accept(visitor); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); if (updateOp) { WhiteboardElementDrawingVisitor visitor(graphicsView, operation->getPos(), GView::Update); updateOp->getElement()->accept(visitor); @@ -169,7 +169,7 @@ namespace Swift { } } - WhiteboardDeleteOperation::ref deleteOp = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); + WhiteboardDeleteOperation::ref deleteOp = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); if (deleteOp) { graphicsView->deleteItem(P2QSTRING(deleteOp->getElementID())); } @@ -261,7 +261,7 @@ namespace Swift { 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()); + WhiteboardLineElement::ref element = std::make_shared<WhiteboardLineElement>(line.x1()+lineItem->pos().x(), line.y1()+lineItem->pos().y(), line.x2()+lineItem->pos().x(), line.y2()+lineItem->pos().y()); element->setColor(WhiteboardColor(color.red(), color.green(), color.blue(), color.alpha())); element->setPenWidth(lineItem->pen().width()); @@ -271,7 +271,7 @@ namespace Swift { FreehandLineItem* freehandLineItem = qgraphicsitem_cast<FreehandLineItem*>(item); if (freehandLineItem != nullptr) { - WhiteboardFreehandPathElement::ref element = boost::make_shared<WhiteboardFreehandPathElement>(); + WhiteboardFreehandPathElement::ref element = std::make_shared<WhiteboardFreehandPathElement>(); QColor color = freehandLineItem->pen().color(); std::vector<std::pair<int, int> > points; QVector<QPointF>::const_iterator it = freehandLineItem->points().constBegin(); @@ -292,7 +292,7 @@ namespace Swift { QGraphicsRectItem* rectItem = qgraphicsitem_cast<QGraphicsRectItem*>(item); 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()); + WhiteboardRectElement::ref element = std::make_shared<WhiteboardRectElement>(rect.x()+item->pos().x(), rect.y()+item->pos().y(), rect.width(), rect.height()); QColor penColor = rectItem->pen().color(); QColor brushColor = rectItem->brush().color(); @@ -307,7 +307,7 @@ namespace Swift { QGraphicsTextItem* textItem = qgraphicsitem_cast<QGraphicsTextItem*>(item); if (textItem != nullptr) { QPointF point = textItem->pos(); - WhiteboardTextElement::ref element = boost::make_shared<WhiteboardTextElement>(point.x(), point.y()); + WhiteboardTextElement::ref element = std::make_shared<WhiteboardTextElement>(point.x(), point.y()); element->setText(textItem->toPlainText().toStdString()); element->setSize(textItem->font().pointSize()); QColor color = textItem->defaultTextColor(); @@ -319,7 +319,7 @@ namespace Swift { QGraphicsPolygonItem* polygonItem = qgraphicsitem_cast<QGraphicsPolygonItem*>(item); if (polygonItem) { - WhiteboardPolygonElement::ref element = boost::make_shared<WhiteboardPolygonElement>(); + WhiteboardPolygonElement::ref element = std::make_shared<WhiteboardPolygonElement>(); QPolygonF polygon = polygonItem->polygon(); std::vector<std::pair<int, int> > points; QVector<QPointF>::const_iterator it = polygon.begin(); @@ -348,7 +348,7 @@ namespace Swift { int cy = boost::numeric_cast<int>(rect.y()+rect.height()/2 + item->pos().y()); int rx = boost::numeric_cast<int>(rect.width()/2); int ry = boost::numeric_cast<int>(rect.height()/2); - WhiteboardEllipseElement::ref element = boost::make_shared<WhiteboardEllipseElement>(cx, cy, rx, ry); + WhiteboardEllipseElement::ref element = std::make_shared<WhiteboardEllipseElement>(cx, cy, rx, ry); QColor penColor = ellipseItem->pen().color(); QColor brushColor = ellipseItem->brush().color(); @@ -361,12 +361,12 @@ namespace Swift { } if (type == GView::New) { - WhiteboardInsertOperation::ref insertOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref insertOp = std::make_shared<WhiteboardInsertOperation>(); insertOp->setPos(pos); insertOp->setElement(el); whiteboardSession_->sendOperation(insertOp); } else { - WhiteboardUpdateOperation::ref updateOp = boost::make_shared<WhiteboardUpdateOperation>(); + WhiteboardUpdateOperation::ref updateOp = std::make_shared<WhiteboardUpdateOperation>(); updateOp->setPos(pos); if (type == GView::Update) { updateOp->setNewPos(pos); @@ -381,7 +381,7 @@ namespace Swift { } void QtWhiteboardWindow::handleItemDeleted(QString id, int pos) { - WhiteboardDeleteOperation::ref deleteOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref deleteOp = std::make_shared<WhiteboardDeleteOperation>(); deleteOp->setElementID(Q2PSTRING(id)); deleteOp->setPos(pos); whiteboardSession_->sendOperation(deleteOp); diff --git a/Swift/QtUI/WinUIHelpers.cpp b/Swift/QtUI/WinUIHelpers.cpp index 30f18a6..4898916 100644 --- a/Swift/QtUI/WinUIHelpers.cpp +++ b/Swift/QtUI/WinUIHelpers.cpp @@ -17,7 +17,7 @@ #include <cryptuiapi.h> #pragma comment(lib, "cryptui.lib") -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/foreach.h> @@ -35,7 +35,7 @@ void WinUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std::ve } ByteArray certAsDER = chain[0]->toDER(); - boost::shared_ptr<const CERT_CONTEXT> certificate_chain; + std::shared_ptr<const CERT_CONTEXT> certificate_chain; { PCCERT_CONTEXT certChain; BOOL ok = CertAddCertificateContextToStore(chainStore, CertCreateCertificateContext(X509_ASN_ENCODING, vecptr(certAsDER), certAsDER.size()), CERT_STORE_ADD_ALWAYS, &certChain); |