aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-03-30 21:57:40 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-03-31 07:33:27 +0200
commit86b29318385edf07ecbaca975e5ab90f11304d1a (patch)
treebae4424fd5df54631f23bf2e2086e6ad3f433d17 /lib/connection.h
parent0a7008bfd345afb083d8ac8c0c6cf21f879aedc6 (diff)
downloadlibquotient-86b29318385edf07ecbaca975e5ab90f11304d1a.tar.gz
libquotient-86b29318385edf07ecbaca975e5ab90f11304d1a.zip
Reparent all jobs to their connections
(Mostly) fixes #397. Fixes #398. If there's a need to reparent the job to some other object, it should now be done after callApi()/run() call (not that there were many touch points before that moment, anyway). Collateral damage: job-starting methods are no more const (but that didn't belong them anyway, too).
Diffstat (limited to 'lib/connection.h')
-rw-r--r--lib/connection.h38
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/connection.h b/lib/connection.h
index 350571f1..b0263732 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -423,7 +423,7 @@ public:
void setLazyLoading(bool newValue);
/*! Start a pre-created job object on this connection */
- void run(BaseJob* job, RunningPolicy runningPolicy = ForegroundRequest) const;
+ void run(BaseJob* job, RunningPolicy runningPolicy = ForegroundRequest);
/*! Start a job of a specified type with specified arguments and policy
*
@@ -438,7 +438,7 @@ public:
* \sa BaseJob::isBackground. QNetworkRequest::BackgroundRequestAttribute
*/
template <typename JobT, typename... JobArgTs>
- JobT* callApi(RunningPolicy runningPolicy, JobArgTs&&... jobArgs) const
+ JobT* callApi(RunningPolicy runningPolicy, JobArgTs&&... jobArgs)
{
auto job = new JobT(std::forward<JobArgTs>(jobArgs)...);
run(job, runningPolicy);
@@ -450,7 +450,7 @@ public:
* This is an overload that runs the job with "foreground" policy.
*/
template <typename JobT, typename... JobArgTs>
- JobT* callApi(JobArgTs&&... jobArgs) const
+ JobT* callApi(JobArgTs&&... jobArgs)
{
return callApi<JobT>(ForegroundRequest,
std::forward<JobArgTs>(jobArgs)...);
@@ -544,25 +544,24 @@ public slots:
virtual MediaThumbnailJob*
getThumbnail(const QString& mediaId, QSize requestedSize,
- RunningPolicy policy = BackgroundRequest) const;
- MediaThumbnailJob*
- getThumbnail(const QUrl& url, QSize requestedSize,
- RunningPolicy policy = BackgroundRequest) const;
- MediaThumbnailJob*
- getThumbnail(const QUrl& url, int requestedWidth, int requestedHeight,
- RunningPolicy policy = BackgroundRequest) const;
+ RunningPolicy policy = BackgroundRequest);
+ MediaThumbnailJob* getThumbnail(const QUrl& url, QSize requestedSize,
+ RunningPolicy policy = BackgroundRequest);
+ MediaThumbnailJob* getThumbnail(const QUrl& url, int requestedWidth,
+ int requestedHeight,
+ RunningPolicy policy = BackgroundRequest);
// QIODevice* should already be open
- UploadContentJob*
- uploadContent(QIODevice* contentSource, const QString& filename = {},
- const QString& overrideContentType = {}) const;
+ UploadContentJob* uploadContent(QIODevice* contentSource,
+ const QString& filename = {},
+ const QString& overrideContentType = {});
UploadContentJob* uploadFile(const QString& fileName,
const QString& overrideContentType = {});
- GetContentJob* getContent(const QString& mediaId) const;
- GetContentJob* getContent(const QUrl& url) const;
+ GetContentJob* getContent(const QString& mediaId);
+ GetContentJob* getContent(const QUrl& url);
// If localFilename is empty, a temporary file will be created
DownloadFileJob* downloadFile(const QUrl& url,
- const QString& localFilename = {}) const;
+ const QString& localFilename = {});
/**
* \brief Create a room (generic method)
@@ -641,11 +640,10 @@ public slots:
ForgetRoomJob* forgetRoom(const QString& id);
SendToDeviceJob* sendToDevices(const QString& eventType,
- const UsersToDevicesToEvents& eventsMap) const;
+ const UsersToDevicesToEvents& eventsMap);
/** \deprecated This method is experimental and may be removed any time */
- SendMessageJob* sendMessage(const QString& roomId,
- const RoomEvent& event) const;
+ SendMessageJob* sendMessage(const QString& roomId, const RoomEvent& event);
/** \deprecated Do not use this directly, use Room::leaveRoom() instead */
virtual LeaveRoomJob* leaveRoom(Room* room);
@@ -654,7 +652,7 @@ public slots:
/** @deprecated Use callApi<PostReceiptJob>() or Room::postReceipt() instead
*/
- virtual PostReceiptJob* postReceipt(Room* room, RoomEvent* event) const;
+ virtual PostReceiptJob* postReceipt(Room* room, RoomEvent* event);
signals:
/**