From 7ef5d0b10ae214f7c58aa77fb84547be1388f2d6 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 25 Dec 2017 17:20:27 +0900 Subject: Now really switching to the new toolchain: C++14, GCC/Clang 5, Qt 5.6 Also a bit of code tightening with some C++14 (but not only) things. --- room.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'room.h') diff --git a/room.h b/room.h index 08327917..77d56377 100644 --- a/room.h +++ b/room.h @@ -18,8 +18,9 @@ #pragma once -#include -#include +#include "jobs/syncjob.h" +#include "events/roommessageevent.h" +#include "joinstate.h" #include #include @@ -27,9 +28,9 @@ #include #include -#include "jobs/syncjob.h" -#include "events/roommessageevent.h" -#include "joinstate.h" +#include +#include +#include namespace QMatrixClient { @@ -58,8 +59,7 @@ namespace QMatrixClient // Used for event redaction RoomEventPtr replaceEvent(RoomEventPtr&& other) { - evt.swap(other); - return move(other); + return std::exchange(evt, std::move(other)); } private: -- cgit v1.2.3 From 72ac40aec4685781d8d669cb69a70c6baf167500 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 25 Dec 2017 20:12:58 +0900 Subject: Room: Remove C++14 code from the header file This will provide some backwards-compatibility to clients that are not ready to move _their_ code to C++14 (at least, it will allow them to not add C++14 requirement to their makefiles as of yet). --- room.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'room.h') diff --git a/room.h b/room.h index 77d56377..9a458c4e 100644 --- a/room.h +++ b/room.h @@ -57,10 +57,7 @@ namespace QMatrixClient index_t index() const { return idx; } // Used for event redaction - RoomEventPtr replaceEvent(RoomEventPtr&& other) - { - return std::exchange(evt, std::move(other)); - } + RoomEventPtr replaceEvent(RoomEventPtr&& other); private: RoomEventPtr evt; -- cgit v1.2.3 From a3b9fe1ddd2d3b0a0cbb07ffc42317b30a1a3899 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 28 Dec 2017 11:26:59 +0900 Subject: Switch from QPixmap to QImage; add convenience avatar() overloads to Room and User The switch is necessary because MediaThumbnailJob is supposed to return something that can be worked on in non-GUI threads (as is the case of QML image providers), and QPixmap is not supposed for usage out of the main thread. --- room.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'room.h') diff --git a/room.h b/room.h index 9a458c4e..f863d41b 100644 --- a/room.h +++ b/room.h @@ -108,11 +108,20 @@ namespace QMatrixClient Q_INVOKABLE int timelineSize() const; /** - * Returns a room avatar and requests it from the network if needed + * Returns a square room avatar with the given size and requests it + * from the network if needed * @return a pixmap with the avatar or a placeholder if there's none * available yet */ - Q_INVOKABLE QPixmap avatar(int width, int height); + Q_INVOKABLE QImage avatar(int dimension); + /** + * Returns a room avatar with the given dimensions and requests it + * from the network if needed + * @return a pixmap with the avatar or a placeholder if there's none + * available yet + */ + Q_INVOKABLE QImage avatar(int width, int height); + /** * @brief Produces a disambiguated name for a given user in * the context of the room -- cgit v1.2.3