From da8bb556dca628e20be732b4a30895010abcc9bf Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 31 Oct 2017 13:12:33 +0300 Subject: 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. --- events/eventcontent.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'events/eventcontent.cpp') 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()); -} - -- cgit v1.2.3