Remove ImageItem, Paintable and use unified image provider.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#ifndef SpectralRoom_H
|
||||
#define SpectralRoom_H
|
||||
|
||||
#include "paintable.h"
|
||||
#include "room.h"
|
||||
#include "spectraluser.h"
|
||||
|
||||
@@ -11,29 +10,8 @@
|
||||
|
||||
using namespace QMatrixClient;
|
||||
|
||||
class RoomPaintable : public Paintable {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RoomPaintable(Room* parent) : Paintable(parent), m_room(parent) {
|
||||
connect(m_room, &Room::avatarChanged, [=] { emit paintableChanged(); });
|
||||
}
|
||||
|
||||
QImage image(int dimension) override {
|
||||
if (!m_room) return {};
|
||||
return m_room->avatar(dimension);
|
||||
}
|
||||
QImage image(int width, int height) override {
|
||||
if (!m_room) return {};
|
||||
return m_room->avatar(width, height);
|
||||
}
|
||||
|
||||
private:
|
||||
Room* m_room;
|
||||
};
|
||||
|
||||
class SpectralRoom : public Room {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Paintable* paintable READ paintable CONSTANT)
|
||||
Q_PROPERTY(bool hasUsersTyping READ hasUsersTyping NOTIFY typingChanged)
|
||||
Q_PROPERTY(QString usersTyping READ getUsersTyping NOTIFY typingChanged)
|
||||
Q_PROPERTY(QString cachedInput READ cachedInput WRITE setCachedInput NOTIFY
|
||||
@@ -48,8 +26,6 @@ class SpectralRoom : public Room {
|
||||
explicit SpectralRoom(Connection* connection, QString roomId,
|
||||
JoinState joinState = {});
|
||||
|
||||
Paintable* paintable() { return &m_paintable; }
|
||||
|
||||
const QString& cachedInput() const { return m_cachedInput; }
|
||||
void setCachedInput(const QString& input) {
|
||||
if (input != m_cachedInput) {
|
||||
@@ -132,9 +108,6 @@ class SpectralRoom : public Room {
|
||||
void sendTypingNotification(bool isTyping);
|
||||
void sendReply(QString userId, QString eventId, QString replyContent,
|
||||
QString sendContent);
|
||||
|
||||
private:
|
||||
RoomPaintable m_paintable;
|
||||
};
|
||||
|
||||
#endif // SpectralRoom_H
|
||||
|
||||
Reference in New Issue
Block a user