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/leaveroomjob.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'jobs/leaveroomjob.cpp') diff --git a/jobs/leaveroomjob.cpp b/jobs/leaveroomjob.cpp index 22a5d34b..5557b8e4 100644 --- a/jobs/leaveroomjob.cpp +++ b/jobs/leaveroomjob.cpp @@ -22,10 +22,7 @@ using namespace QMatrixClient; -LeaveRoomJob::LeaveRoomJob(ConnectionData* data, Room* room) +LeaveRoomJob::LeaveRoomJob(const ConnectionData* data, Room* room) : BaseJob(data, HttpVerb::Post, "LeaveRoomJob", QString("_matrix/client/r0/rooms/%1/leave").arg(room->id())) { } - -LeaveRoomJob::~LeaveRoomJob() -{ } -- cgit v1.2.3 From b903a3776aabb44863a9a9a4d83c6ee4e033cd5d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 8 May 2017 21:38:44 +0900 Subject: LeaveRoomJob now accepts a roomId, not a Room object; Room::leaveRoom() introduced; Connection and Room cleanup Helps to better encapsulate Room --- jobs/leaveroomjob.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'jobs/leaveroomjob.cpp') diff --git a/jobs/leaveroomjob.cpp b/jobs/leaveroomjob.cpp index 5557b8e4..f73919ac 100644 --- a/jobs/leaveroomjob.cpp +++ b/jobs/leaveroomjob.cpp @@ -18,11 +18,9 @@ #include "leaveroomjob.h" -#include "../room.h" - using namespace QMatrixClient; -LeaveRoomJob::LeaveRoomJob(const ConnectionData* data, Room* room) +LeaveRoomJob::LeaveRoomJob(const ConnectionData* data, const QString& roomId) : BaseJob(data, HttpVerb::Post, "LeaveRoomJob", - QString("_matrix/client/r0/rooms/%1/leave").arg(room->id())) + QStringLiteral("_matrix/client/r0/rooms/%1/leave").arg(roomId)) { } -- cgit v1.2.3