diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-08-07 22:13:42 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-08-07 22:25:17 +0200 |
commit | e5a760371a158bec6a70353b96614611adecc4bc (patch) | |
tree | e0ac5a6eaf1e0aa72c31b397fa82b6a96c1784e8 | |
parent | bd649c591fa020fde0bd56a63c13025097b831ae (diff) | |
download | libquotient-e5a760371a158bec6a70353b96614611adecc4bc.tar.gz libquotient-e5a760371a158bec6a70353b96614611adecc4bc.zip |
Update non-generated code to work with QUrls in CS API
-rw-r--r-- | lib/avatar.h | 2 | ||||
-rw-r--r-- | lib/user.cpp | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/avatar.h b/lib/avatar.h index be125c17..37e1eeef 100644 --- a/lib/avatar.h +++ b/lib/avatar.h @@ -21,7 +21,7 @@ public: Avatar& operator=(Avatar&&); using get_callback_t = std::function<void()>; - using upload_callback_t = std::function<void(QString)>; + using upload_callback_t = std::function<void(QUrl)>; QImage get(Connection* connection, int dimension, get_callback_t callback) const; diff --git a/lib/user.cpp b/lib/user.cpp index 04afed2b..797576db 100644 --- a/lib/user.cpp +++ b/lib/user.cpp @@ -135,17 +135,17 @@ template <typename SourceT> inline bool User::doSetAvatar(SourceT&& source) { return d->defaultAvatar.upload( - connection(), source, [this](const QString& contentUri) { + connection(), source, [this](const QUrl& contentUri) { auto* j = connection()->callApi<SetAvatarUrlJob>(id(), contentUri); connect(j, &BaseJob::success, this, - [this, newUrl = QUrl(contentUri)] { - if (newUrl == d->defaultAvatar.url()) { - d->defaultAvatar.updateUrl(newUrl); + [this, contentUri] { + if (contentUri == d->defaultAvatar.url()) { + d->defaultAvatar.updateUrl(contentUri); emit defaultAvatarChanged(); } else qCWarning(MAIN) << "User" << id() << "already has avatar URL set to" - << newUrl.toDisplayString(); + << contentUri.toDisplayString(); }); }); } @@ -162,7 +162,7 @@ bool User::setAvatar(QIODevice* source) void User::removeAvatar() { - connection()->callApi<SetAvatarUrlJob>(id(), ""); + connection()->callApi<SetAvatarUrlJob>(id(), QUrl()); } void User::requestDirectChat() { connection()->requestDirectChat(this); } |