mirror of https://github.com/Nheko-Reborn/nheko
parent
64f204d984
commit
a54a973ad6
@ -1,29 +1,49 @@ |
|||||||
#pragma once |
#pragma once |
||||||
|
|
||||||
#include <QMap> |
|
||||||
#include <QObject> |
#include <QObject> |
||||||
#include <QString> |
#include <QString> |
||||||
|
|
||||||
struct DeviceInfo |
#include "MatrixClient.h" |
||||||
|
|
||||||
|
class DeviceInfo |
||||||
{ |
{ |
||||||
|
public: |
||||||
|
explicit DeviceInfo(QString device_id,QString display_name){ |
||||||
|
this->device_id = device_id; |
||||||
|
this->display_name = display_name; |
||||||
|
} |
||||||
|
~DeviceInfo() = default; |
||||||
|
DeviceInfo(const DeviceInfo &device){ |
||||||
|
this->device_id = device.device_id; |
||||||
|
this->display_name = device.display_name; |
||||||
|
} |
||||||
|
|
||||||
QString device_id; |
QString device_id; |
||||||
QString display_name; |
QString display_name; |
||||||
}; |
}; |
||||||
|
Q_DECLARE_METATYPE(DeviceInfo); |
||||||
|
|
||||||
class UserProfile : public QObject |
class UserProfile : public QObject |
||||||
{ |
{ |
||||||
Q_OBJECT |
Q_OBJECT |
||||||
Q_PROPERTY(QMap deviceList READ getDeviceList NOTIFY DeviceListUpdated) |
Q_PROPERTY(QVector<DeviceInfo> deviceList READ getDeviceList NOTIFY deviceListUpdated) |
||||||
|
Q_PROPERTY(QString userId READ getUserId WRITE setUserId) |
||||||
|
|
||||||
public: |
public: |
||||||
|
// constructor
|
||||||
explicit UserProfile(QObject *parent = 0); |
explicit UserProfile(QObject *parent = 0); |
||||||
QMap<QString, QString> getDeviceList(); |
// getters
|
||||||
|
QVector<DeviceInfo> getDeviceList(); |
||||||
|
QString getUserId(); |
||||||
|
// setters
|
||||||
|
void setUserId(const QString &userId); |
||||||
|
|
||||||
Q_INVOKABLE void fetchDeviceList(const QString &userID); |
Q_INVOKABLE void fetchDeviceList(const QString &userID); |
||||||
|
|
||||||
signals: |
signals: |
||||||
void DeviceListUpdated(); |
void deviceListUpdated(); |
||||||
|
|
||||||
private: |
private: |
||||||
QMap<QString, QString> deviceList; |
QVector<DeviceInfo> deviceList; |
||||||
|
QString userId; |
||||||
}; |
}; |
Loading…
Reference in new issue