From 491e392af73be3ebfd928e80efc0514fd43b8e87 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 16 Nov 2017 14:10:08 +0900 Subject: Simplify code that loads events from JSON arrays --- jobs/roommessagesjob.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'jobs/roommessagesjob.cpp') diff --git a/jobs/roommessagesjob.cpp b/jobs/roommessagesjob.cpp index 078c692a..c527cc71 100644 --- a/jobs/roommessagesjob.cpp +++ b/jobs/roommessagesjob.cpp @@ -58,8 +58,8 @@ QString RoomMessagesJob::end() const BaseJob::Status RoomMessagesJob::parseJson(const QJsonDocument& data) { - QJsonObject obj = data.object(); - d->events.assign(makeEvents(obj.value("chunk").toArray())); + const auto obj = data.object(); + d->events.fromJson(obj, "chunk"); d->end = obj.value("end").toString(); return Success; } -- cgit v1.2.3 From 128b7259a7f6cc39545711323a074103ea9520f7 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 21 Nov 2017 17:33:26 +0900 Subject: Use QStringLiteral instead of bare QString constructors for string constants For job endpoints, we should eventually move to QLatin1String or QByteArray instead. Maybe later. --- jobs/roommessagesjob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'jobs/roommessagesjob.cpp') diff --git a/jobs/roommessagesjob.cpp b/jobs/roommessagesjob.cpp index c527cc71..9af1b3a6 100644 --- a/jobs/roommessagesjob.cpp +++ b/jobs/roommessagesjob.cpp @@ -30,7 +30,7 @@ class RoomMessagesJob::Private RoomMessagesJob::RoomMessagesJob(const QString& roomId, const QString& from, int limit, FetchDirection dir) : BaseJob(HttpVerb::Get, "RoomMessagesJob", - QString("/_matrix/client/r0/rooms/%1/messages").arg(roomId), + QStringLiteral("/_matrix/client/r0/rooms/%1/messages").arg(roomId), Query( { { "from", from } , { "dir", dir == FetchDirection::Backward ? "b" : "f" } -- cgit v1.2.3