aboutsummaryrefslogtreecommitdiff
path: root/events/eventcontent.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-31 13:12:33 +0300
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-31 13:12:33 +0300
commitda8bb556dca628e20be732b4a30895010abcc9bf (patch)
tree8b7a4f2ffc423c72f8a283d1c747d647d4c782f4 /events/eventcontent.cpp
parentf4ef8a48fedb77b81465e7ac2f8e124db8cbd754 (diff)
downloadlibquotient-da8bb556dca628e20be732b4a30895010abcc9bf.tar.gz
libquotient-da8bb556dca628e20be732b4a30895010abcc9bf.zip
Streamline EventContent hierarchy
Two changes to make EventContent hierarchy easier to understand and use: - InfoBase is unbound from Base, and downstream classes use multiple inheritance to work "info" objects - MIME types are separated from Base into a separate TypedBase class because MIME typing is not common to all content kinds.
Diffstat (limited to 'events/eventcontent.cpp')
-rw-r--r--events/eventcontent.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/events/eventcontent.cpp b/events/eventcontent.cpp
index 205d404b..dcbccf08 100644
--- a/events/eventcontent.cpp
+++ b/events/eventcontent.cpp
@@ -37,6 +37,8 @@ QJsonObject InfoBase::toInfoJson() const
return info;
}
+void InfoBase::fillInfoJson(QJsonObject*) const { }
+
FileInfo::FileInfo(const QUrl& u, int payloadSize, const QMimeType& mimeType,
const QString& originalFilename)
: InfoBase(mimeType), url(u), payloadSize(payloadSize)
@@ -59,13 +61,3 @@ void FileInfo::fillInfoJson(QJsonObject* infoJson) const
infoJson->insert("size", payloadSize);
infoJson->insert("mimetype", mimeType.name());
}
-
-void FileInfo::fillJson(QJsonObject* json) const
-{
- Q_ASSERT(json);
- json->insert("url", url.toString());
- if (!originalName.isEmpty())
- json->insert("filename", originalName);
- json->insert("info", toInfoJson());
-}
-