diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-06-22 02:52:35 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-07-12 11:54:29 +0200 |
commit | 44aeb57e196bcd9e041c498a212f17b0dcd1244f (patch) | |
tree | 75c4c687673615e907a97609e73a3ffacfbeefce /lib/events/eventcontent.cpp | |
parent | ab2d78de6a9d33e1470ae9db2ed6ed9565c817e5 (diff) | |
download | libquotient-44aeb57e196bcd9e041c498a212f17b0dcd1244f.tar.gz libquotient-44aeb57e196bcd9e041c498a212f17b0dcd1244f.zip |
Refactor things around EncryptionEvent[Content]
EncryptionEvent was marked as Q_GADGET only for the sake of defining
EncryptionType inside of it as Q_ENUM, with aliases also available under
Quotient:: and EncryptionEventContent. This is a legacy from
pre-Q_ENUM_NS times. However, event types are not really made to be
proper Q_GADGETs: Q_GADGET implies access by value or reference
but event types are uncopyable for the former and QML is ill-equipped
for the latter.
This commit moves EncryptionType definition to where other such
enumerations reside - on the namespace level in quotient_common.h; and
the other two places are now deprecated; and EncryptionEvent is no more
Q_GADGET.
With fromJson/toJson refactored in the previous commit there's no more
need to specialise JsonConverter<>: specialising fromJson() is just
enough.
Moving EncryptionType to quotient_common.h exposed the clash
of two Undefined enumerators (in RoomType and EncryptionType),
warranting both enumerations to become scoped (which they ought to be,
anyway). And while we're at it, the base type of enumerations is
specified explicitly, as MSVC apparently uses a signed base type (int?)
by default, unlike other compilers, and the upcoming enum converters
will assume an unsigned base type.
Finally, using fillFromJson() instead of fromJson() in
the EncryptionEventContent constructor allowed to make default values
explicit in the header file, rather than buried in the initialisation
code.
Diffstat (limited to 'lib/events/eventcontent.cpp')
0 files changed, 0 insertions, 0 deletions