aboutsummaryrefslogtreecommitdiff
path: root/lib/events/eventcontent.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events/eventcontent.h')
-rw-r--r--lib/events/eventcontent.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/events/eventcontent.h b/lib/events/eventcontent.h
index f609a603..de9a792b 100644
--- a/lib/events/eventcontent.h
+++ b/lib/events/eventcontent.h
@@ -6,14 +6,15 @@
// This file contains generic event content definitions, applicable to room
// message events as well as other events (e.g., avatars).
+#include "encryptedfile.h"
+#include "quotient_export.h"
+
#include <QtCore/QJsonObject>
#include <QtCore/QMimeType>
#include <QtCore/QSize>
#include <QtCore/QUrl>
#include <QtCore/QMetaType>
-#include "encryptedfile.h"
-
class QFileInfo;
namespace Quotient {
@@ -28,7 +29,7 @@ namespace EventContent {
* assumed but not required that a content object can also be created
* from plain data.
*/
- class Base {
+ class QUOTIENT_API Base {
public:
explicit Base(QJsonObject o = {}) : originalJson(std::move(o)) {}
virtual ~Base() = default;
@@ -76,7 +77,7 @@ namespace EventContent {
*
* This class is not polymorphic.
*/
- class FileInfo {
+ class QUOTIENT_API FileInfo {
public:
FileInfo() = default;
explicit FileInfo(const QFileInfo& fi);
@@ -105,7 +106,7 @@ namespace EventContent {
QJsonObject originalInfoJson;
QMimeType mimeType;
QUrl url;
- qint64 payloadSize;
+ qint64 payloadSize = 0;
QString originalName;
Omittable<EncryptedFile> file = none;
};
@@ -121,7 +122,7 @@ namespace EventContent {
/**
* A content info class for image content types: image, thumbnail, video
*/
- class ImageInfo : public FileInfo {
+ class QUOTIENT_API ImageInfo : public FileInfo {
public:
ImageInfo() = default;
explicit ImageInfo(const QFileInfo& fi, QSize imageSize = {});
@@ -146,12 +147,10 @@ namespace EventContent {
* the JSON representation of event content; namely,
* "info/thumbnail_url" and "info/thumbnail_info" fields are used.
*/
- class Thumbnail : public ImageInfo {
+ class QUOTIENT_API Thumbnail : public ImageInfo {
public:
- Thumbnail() = default; // Allow empty thumbnails
- Thumbnail(const QJsonObject& infoJson, const Omittable<EncryptedFile> &file = none);
- Thumbnail(const ImageInfo& info) : ImageInfo(info) {}
using ImageInfo::ImageInfo;
+ Thumbnail(const QJsonObject& infoJson, const Omittable<EncryptedFile> &file = none);
/**
* Writes thumbnail information to "thumbnail_info" subobject
@@ -160,7 +159,7 @@ namespace EventContent {
void fillInfoJson(QJsonObject* infoJson) const;
};
- class TypedBase : public Base {
+ class QUOTIENT_API TypedBase : public Base {
public:
virtual QMimeType type() const = 0;
virtual const FileInfo* fileInfo() const { return nullptr; }
@@ -183,7 +182,7 @@ namespace EventContent {
* \tparam InfoT base info class
*/
template <class InfoT>
- class UrlBasedContent : public TypedBase, public InfoT {
+ class QUOTIENT_API UrlBasedContent : public TypedBase, public InfoT {
public:
using InfoT::InfoT;
explicit UrlBasedContent(const QJsonObject& json)
@@ -215,7 +214,7 @@ namespace EventContent {
};
template <typename InfoT>
- class UrlWithThumbnailContent : public UrlBasedContent<InfoT> {
+ class QUOTIENT_API UrlWithThumbnailContent : public UrlBasedContent<InfoT> {
public:
// NB: when using inherited constructors, thumbnail has to be
// initialised separately