Crete a proxy for media to uniquely match signal to the caller
This commit is contained in:
parent
ea22bdce18
commit
39abf163b8
7 changed files with 57 additions and 48 deletions
|
|
@ -22,6 +22,15 @@
|
|||
#include <QUrl>
|
||||
#include <mtx.hpp>
|
||||
|
||||
class DownloadMediaProxy : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void imageDownloaded(const QPixmap &data);
|
||||
void fileDownloaded(const QByteArray &data);
|
||||
};
|
||||
|
||||
/*
|
||||
* MatrixClient provides the high level API to communicate with
|
||||
* a Matrix homeserver. All the responses are returned through signals.
|
||||
|
|
@ -55,8 +64,8 @@ public:
|
|||
void fetchCommunityAvatar(const QString &communityId, const QUrl &avatarUrl);
|
||||
void fetchCommunityProfile(const QString &communityId);
|
||||
void fetchCommunityRooms(const QString &communityId);
|
||||
void downloadImage(const QString &event_id, const QUrl &url);
|
||||
void downloadFile(const QString &event_id, const QUrl &url);
|
||||
DownloadMediaProxy *downloadImage(const QUrl &url);
|
||||
DownloadMediaProxy *downloadFile(const QUrl &url);
|
||||
void messages(const QString &room_id, const QString &from_token, int limit = 30) noexcept;
|
||||
void uploadImage(const QString &roomid,
|
||||
const QString &filename,
|
||||
|
|
@ -140,8 +149,6 @@ signals:
|
|||
void communityAvatarRetrieved(const QString &communityId, const QPixmap &img);
|
||||
void communityProfileRetrieved(const QString &communityId, const QJsonObject &profile);
|
||||
void communityRoomsRetrieved(const QString &communityId, const QJsonObject &rooms);
|
||||
void imageDownloaded(const QString &event_id, const QPixmap &img);
|
||||
void fileDownloaded(const QString &event_id, const QByteArray &data);
|
||||
|
||||
// Returned profile data for the user's account.
|
||||
void getOwnProfileResponse(const QUrl &avatar_url, const QString &display_name);
|
||||
|
|
|
|||
|
|
@ -72,11 +72,9 @@ protected:
|
|||
void paintEvent(QPaintEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void fileDownloaded(const QString &event_id, const QByteArray &data);
|
||||
|
||||
private:
|
||||
void init();
|
||||
void fileDownloaded(const QByteArray &data);
|
||||
|
||||
enum class AudioState
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,12 +60,10 @@ protected:
|
|||
void paintEvent(QPaintEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void fileDownloaded(const QString &event_id, const QByteArray &data);
|
||||
|
||||
private:
|
||||
void openUrl();
|
||||
void init();
|
||||
void fileDownloaded(const QByteArray &data);
|
||||
|
||||
QUrl url_;
|
||||
QString text_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue