Fix imageprovider.
This commit is contained in:
@@ -10,7 +10,7 @@ Controller::Controller(QObject *parent) : QObject(parent) {
|
||||
}
|
||||
|
||||
Controller::~Controller() {
|
||||
|
||||
m_connection->stopSync();
|
||||
}
|
||||
|
||||
void Controller::login() {
|
||||
|
||||
@@ -10,14 +10,6 @@
|
||||
|
||||
using QMatrixClient::MediaThumbnailJob;
|
||||
|
||||
ImageProviderConnection::ImageProviderConnection(QObject* parent) : QObject(parent) {
|
||||
|
||||
}
|
||||
|
||||
ImageProviderConnection::~ImageProviderConnection() {
|
||||
|
||||
}
|
||||
|
||||
ImageProvider::ImageProvider(QObject* parent)
|
||||
: QQuickImageProvider(QQmlImageProviderBase::Image,
|
||||
QQmlImageProviderBase::ForceAsynchronousImageLoading)
|
||||
|
||||
@@ -6,28 +6,7 @@
|
||||
#include <QObject>
|
||||
|
||||
#include "libqmatrixclient/connection.h"
|
||||
|
||||
class ImageProviderConnection: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QMatrixClient::Connection* connection READ getConnection WRITE setConnection NOTIFY connectionChanged)
|
||||
|
||||
public:
|
||||
explicit ImageProviderConnection(QObject* parent = nullptr);
|
||||
~ImageProviderConnection();
|
||||
|
||||
QMatrixClient::Connection* getConnection() { return m_connection; }
|
||||
Q_INVOKABLE void setConnection(QMatrixClient::Connection* connection) {
|
||||
qDebug() << "Connection changed.";
|
||||
emit connectionChanged();
|
||||
m_connection = connection;
|
||||
}
|
||||
private:
|
||||
QMatrixClient::Connection* m_connection;
|
||||
signals:
|
||||
void connectionChanged();
|
||||
};
|
||||
#include "imageproviderconnection.h"
|
||||
|
||||
class ImageProvider: public QQuickImageProvider
|
||||
{
|
||||
|
||||
9
matrix/imageproviderconnection.cpp
Normal file
9
matrix/imageproviderconnection.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "imageproviderconnection.h"
|
||||
|
||||
ImageProviderConnection::ImageProviderConnection(QObject* parent) : QObject(parent) {
|
||||
|
||||
}
|
||||
|
||||
ImageProviderConnection::~ImageProviderConnection() {
|
||||
|
||||
}
|
||||
29
matrix/imageproviderconnection.h
Normal file
29
matrix/imageproviderconnection.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef IMAGEPROVIDERCONNECTION_H
|
||||
#define IMAGEPROVIDERCONNECTION_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "libqmatrixclient/connection.h"
|
||||
|
||||
class ImageProviderConnection : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QMatrixClient::Connection* connection READ getConnection WRITE setConnection NOTIFY connectionChanged)
|
||||
|
||||
public:
|
||||
explicit ImageProviderConnection(QObject* parent = nullptr);
|
||||
~ImageProviderConnection();
|
||||
|
||||
QMatrixClient::Connection* getConnection() { return m_connection; }
|
||||
void setConnection(QMatrixClient::Connection* connection) {
|
||||
emit connectionChanged();
|
||||
m_connection = connection;
|
||||
}
|
||||
private:
|
||||
QMatrixClient::Connection* m_connection;
|
||||
signals:
|
||||
void connectionChanged();
|
||||
};
|
||||
|
||||
#endif // IMAGEPROVIDERCONNECTION_H
|
||||
@@ -70,12 +70,12 @@ QVariant RoomListModel::data(const QModelIndex& index, int role) const
|
||||
}
|
||||
if( role == Qt::DecorationRole )
|
||||
{
|
||||
if(room->avatarUrl().toString() != "") {
|
||||
if ( room->avatarUrl().toString() != "" ) {
|
||||
return room->avatarUrl();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
if (role == Qt::StatusTipRole )
|
||||
if ( role == Qt::StatusTipRole )
|
||||
{
|
||||
return room->topic();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user