summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/EventViewer')
-rw-r--r--Swift/QtUI/EventViewer/EventDelegate.cpp14
-rw-r--r--Swift/QtUI/EventViewer/EventDelegate.h4
-rw-r--r--Swift/QtUI/EventViewer/EventModel.cpp4
-rw-r--r--Swift/QtUI/EventViewer/EventModel.h6
-rw-r--r--Swift/QtUI/EventViewer/QtEvent.cpp22
-rw-r--r--Swift/QtUI/EventViewer/QtEvent.h8
-rw-r--r--Swift/QtUI/EventViewer/QtEventWindow.cpp24
-rw-r--r--Swift/QtUI/EventViewer/QtEventWindow.h6
-rw-r--r--Swift/QtUI/EventViewer/main.cpp10
9 files changed, 49 insertions, 49 deletions
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();
}