From aacc4bcb4a487871daae6717f77605aaba444341 Mon Sep 17 00:00:00 2001 From: Marc Deop Date: Sat, 2 Mar 2019 12:26:57 +0100 Subject: style: apply .clang-format to all .cpp and .h files --- lib/events/roomavatarevent.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'lib/events/roomavatarevent.h') diff --git a/lib/events/roomavatarevent.h b/lib/events/roomavatarevent.h index a43d3a85..69cd1f9d 100644 --- a/lib/events/roomavatarevent.h +++ b/lib/events/roomavatarevent.h @@ -13,29 +13,29 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #pragma once -#include "stateevent.h" #include "eventcontent.h" +#include "stateevent.h" -namespace QMatrixClient -{ - class RoomAvatarEvent: public StateEvent +namespace QMatrixClient { + class RoomAvatarEvent : public StateEvent { - // It's a bit of an overkill to use a full-fledged ImageContent - // because in reality m.room.avatar usually only has a single URL, - // without a thumbnail. But The Spec says there be thumbnails, and - // we follow The Spec. + // It's a bit of an overkill to use a full-fledged ImageContent + // because in reality m.room.avatar usually only has a single URL, + // without a thumbnail. But The Spec says there be thumbnails, and + // we follow The Spec. public: - DEFINE_EVENT_TYPEID("m.room.avatar", RoomAvatarEvent) - explicit RoomAvatarEvent(const QJsonObject& obj) - : StateEvent(typeId(), obj) - { } - QUrl url() const { return content().url; } + DEFINE_EVENT_TYPEID("m.room.avatar", RoomAvatarEvent) + explicit RoomAvatarEvent(const QJsonObject& obj) + : StateEvent(typeId(), obj) + { + } + QUrl url() const { return content().url; } }; REGISTER_EVENT_TYPE(RoomAvatarEvent) DEFINE_EVENTTYPE_ALIAS(RoomAvatar, RoomAvatarEvent) -} // namespace QMatrixClient +} // namespace QMatrixClient -- cgit v1.2.3 From c05ade838f0fce81f2bbe80a3295618a8a26ff52 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Fri, 2 Aug 2019 19:59:40 +0900 Subject: Apply the new brace wrapping to source files --- lib/events/roomavatarevent.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/events/roomavatarevent.h') diff --git a/lib/events/roomavatarevent.h b/lib/events/roomavatarevent.h index ee460339..16aeb070 100644 --- a/lib/events/roomavatarevent.h +++ b/lib/events/roomavatarevent.h @@ -21,18 +21,15 @@ #include "eventcontent.h" #include "stateevent.h" -namespace QMatrixClient -{ -class RoomAvatarEvent : public StateEvent -{ +namespace QMatrixClient { +class RoomAvatarEvent : public StateEvent { // It's a bit of an overkill to use a full-fledged ImageContent // because in reality m.room.avatar usually only has a single URL, // without a thumbnail. But The Spec says there be thumbnails, and // we follow The Spec. public: DEFINE_EVENT_TYPEID("m.room.avatar", RoomAvatarEvent) - explicit RoomAvatarEvent(const QJsonObject& obj) - : StateEvent(typeId(), obj) + explicit RoomAvatarEvent(const QJsonObject& obj) : StateEvent(typeId(), obj) {} QUrl url() const { return content().url; } }; -- cgit v1.2.3 From 27ca32a1e5a56e09b9cc1d94224d2831004dcf3d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 19:32:34 +0900 Subject: Namespace: QMatrixClient -> Quotient (with back comp alias) --- lib/events/roomavatarevent.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/events/roomavatarevent.h') diff --git a/lib/events/roomavatarevent.h b/lib/events/roomavatarevent.h index 16aeb070..109f4014 100644 --- a/lib/events/roomavatarevent.h +++ b/lib/events/roomavatarevent.h @@ -21,7 +21,7 @@ #include "eventcontent.h" #include "stateevent.h" -namespace QMatrixClient { +namespace Quotient { class RoomAvatarEvent : public StateEvent { // It's a bit of an overkill to use a full-fledged ImageContent // because in reality m.room.avatar usually only has a single URL, @@ -35,4 +35,4 @@ public: }; REGISTER_EVENT_TYPE(RoomAvatarEvent) DEFINE_EVENTTYPE_ALIAS(RoomAvatar, RoomAvatarEvent) -} // namespace QMatrixClient +} // namespace Quotient -- cgit v1.2.3 From 9ce16ef3123d5e63b931cafefb7dba4e894fc82b Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 11 Aug 2019 13:18:40 +0900 Subject: Drop EventType namespace and DEFINE_EVENTTYPE_ALIAS macro They've been deprecated for almost a year by now. --- lib/events/roomavatarevent.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/events/roomavatarevent.h') diff --git a/lib/events/roomavatarevent.h b/lib/events/roomavatarevent.h index 109f4014..4013773c 100644 --- a/lib/events/roomavatarevent.h +++ b/lib/events/roomavatarevent.h @@ -34,5 +34,4 @@ public: QUrl url() const { return content().url; } }; REGISTER_EVENT_TYPE(RoomAvatarEvent) -DEFINE_EVENTTYPE_ALIAS(RoomAvatar, RoomAvatarEvent) } // namespace Quotient -- cgit v1.2.3 From 176b260bfaf8f575560bfe3fb520ee3fa0ad3a7a Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 26 Jul 2020 09:26:19 +0200 Subject: RoomAvatarEvent: add constructors from content So that room avatar events could also be sent, not only received. --- lib/events/roomavatarevent.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/events/roomavatarevent.h') diff --git a/lib/events/roomavatarevent.h b/lib/events/roomavatarevent.h index 4013773c..c2100eaa 100644 --- a/lib/events/roomavatarevent.h +++ b/lib/events/roomavatarevent.h @@ -31,6 +31,18 @@ public: DEFINE_EVENT_TYPEID("m.room.avatar", RoomAvatarEvent) explicit RoomAvatarEvent(const QJsonObject& obj) : StateEvent(typeId(), obj) {} + explicit RoomAvatarEvent(const EventContent::ImageContent& avatar) + : StateEvent(typeId(), matrixTypeId(), QString(), avatar) + {} + // A replica of EventContent::ImageInfo constructor + explicit RoomAvatarEvent(const QUrl& u, qint64 fileSize = -1, + QMimeType mimeType = {}, + const QSize& imageSize = {}, + const QString& originalFilename = {}) + : RoomAvatarEvent(EventContent::ImageContent { + u, fileSize, mimeType, imageSize, originalFilename }) + {} + QUrl url() const { return content().url; } }; REGISTER_EVENT_TYPE(RoomAvatarEvent) -- cgit v1.2.3