From 5038ae0a0099c2a5c6ffdd08734b597d92edac70 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 May 2017 20:02:34 +0900 Subject: Code cleanup and tweaking (partially driven by clang-tidy) Mainly it's about const-ification (in particular, passing const-refs instead of values) and deleting unneeded declarations/#includes. Since the changes alter the external interface, this is submitted as a PR for peer review. One of unneeded declarations/definitions is a virtual destructor in BaseJob descendants. Since a job object should be deleted through QObject::deleteLater() anyway (and it's the only correct way of disposing of the object), all deletions will call the stack of destructors through virtual QObject::~QObject(). Therefore even BaseJob could get on with a non-virtual destructor but for the sake of clarity BaseJob::~BaseJob() is still declared virtual. --- jobs/postmessagejob.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'jobs/postmessagejob.cpp') diff --git a/jobs/postmessagejob.cpp b/jobs/postmessagejob.cpp index 9a102325..df30614c 100644 --- a/jobs/postmessagejob.cpp +++ b/jobs/postmessagejob.cpp @@ -17,33 +17,29 @@ */ #include "postmessagejob.h" -#include "../connectiondata.h" #include "util.h" -#include - using namespace QMatrixClient; class PostMessageJob::Private { public: - Private() {} - QString eventId; // unused yet }; -PostMessageJob::PostMessageJob(ConnectionData* connection, const QString& roomId, - const QString& type, const QString& plainText) +PostMessageJob::PostMessageJob(const ConnectionData* connection, + const QString& roomId, const QString& type, + const QString& plainText) : BaseJob(connection, HttpVerb::Post, "PostMessageJob", - QString("_matrix/client/r0/rooms/%1/send/m.room.message").arg(roomId), + QStringLiteral("_matrix/client/r0/rooms/%1/send/m.room.message").arg(roomId), Query(), Data({ { "msgtype", type }, { "body", plainText } }) ) , d(new Private) { } -PostMessageJob::PostMessageJob(ConnectionData* connection, const QString& roomId, - const QString& type, const QString& plainText, - const QString& richText) +PostMessageJob::PostMessageJob(const ConnectionData* connection, + const QString& roomId, const QString& type, + const QString& plainText, const QString& richText) : BaseJob(connection, HttpVerb::Post, "PostMessageJob", QStringLiteral("_matrix/client/r0/rooms/%1/send/m.room.message").arg(roomId), Query(), -- cgit v1.2.3