aboutsummaryrefslogtreecommitdiff
path: root/lib/events/roomevent.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-26 13:44:39 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-26 13:44:39 +0100
commitf6155d62740a88b020273ba623c816f7b9805772 (patch)
tree87824e5db591955638655b2e12bd9a5484efcb0a /lib/events/roomevent.h
parent91c1d93d3389ac924f1013dc7b37dfe70a17e57e (diff)
downloadlibquotient-f6155d62740a88b020273ba623c816f7b9805772.tar.gz
libquotient-f6155d62740a88b020273ba623c816f7b9805772.zip
Drop Q_GADGET from most uncopyable classes; other minor cleanup
Q_GADGET is generally used to enable two things outside of QObject: Q_PROPERTY/Q_INVOKABLE and Q_ENUM/Q_FLAG. While the latter can be used in its own right in QML, the former requires Q_GADGET instances to be passed to QML by value, which is not really possible with uncopyable/unassignable classes. Bottom line is that Q_PROPERTY in anything derived from Quotient::Event is not viable, making Q_GADGET macro useless unless there's a Q_ENUM/Q_FLAG (as is the case with RoomMessageEvent, e.g.).
Diffstat (limited to 'lib/events/roomevent.h')
-rw-r--r--lib/events/roomevent.h41
1 files changed, 13 insertions, 28 deletions
diff --git a/lib/events/roomevent.h b/lib/events/roomevent.h
index 3174764f..a6cd84ca 100644
--- a/lib/events/roomevent.h
+++ b/lib/events/roomevent.h
@@ -12,16 +12,6 @@ class RedactionEvent;
/** This class corresponds to m.room.* events */
class RoomEvent : public Event {
- Q_GADGET
- Q_PROPERTY(QString id READ id)
- //! \deprecated Use originTimestamp instead
- Q_PROPERTY(QDateTime timestamp READ originTimestamp CONSTANT)
- Q_PROPERTY(QDateTime originTimestamp READ originTimestamp CONSTANT)
- Q_PROPERTY(QString roomId READ roomId CONSTANT)
- Q_PROPERTY(QString senderId READ senderId CONSTANT)
- Q_PROPERTY(QString redactionReason READ redactionReason)
- Q_PROPERTY(bool isRedacted READ isRedacted)
- Q_PROPERTY(QString transactionId READ transactionId WRITE setTransactionId)
public:
using factory_t = EventFactory<RoomEvent>;
@@ -51,28 +41,23 @@ public:
QString transactionId() const;
QString stateKey() const;
+ //! \brief Fill the pending event object with the room id
void setRoomId(const QString& roomId);
+ //! \brief Fill the pending event object with the sender id
void setSender(const QString& senderId);
-
- /**
- * Sets the transaction id for locally created events. This should be
- * done before the event is exposed to any code using the respective
- * Q_PROPERTY.
- *
- * \param txnId - transaction id, normally obtained from
- * Connection::generateTxnId()
- */
+ //! \brief Fill the pending event object with the transaction id
+ //! \param txnId - transaction id, normally obtained from
+ //! Connection::generateTxnId()
void setTransactionId(const QString& txnId);
- /**
- * Sets event id for locally created events
- *
- * When a new event is created locally, it has no server id yet.
- * This function allows to add the id once the confirmation from
- * the server is received. There should be no id set previously
- * in the event. It's the responsibility of the code calling addId()
- * to notify clients that use Q_PROPERTY(id) about its change
- */
+ //! \brief Add an event id to locally created events after they are sent
+ //!
+ //! When a new event is created locally, it has no id; the homeserver
+ //! assigns it once the event is sent. This function allows to add the id
+ //! once the confirmation from the server is received. There should be no id
+ //! set previously in the event. It's the responsibility of the code calling
+ //! addId() to notify clients about the change; there's no signal or
+ //! callback for that in RoomEvent.
void addId(const QString& newId);
protected: