matrixion/src/ui/UserProfile.h

49 lines
1.2 KiB
C
Raw Normal View History

2020-05-17 16:34:47 +03:00
#pragma once
#include <QObject>
#include <QString>
2020-05-22 08:47:02 +03:00
#include "MatrixClient.h"
class DeviceInfo
2020-05-17 16:34:47 +03:00
{
2020-05-22 08:47:02 +03:00
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;
}
2020-05-17 16:34:47 +03:00
QString device_id;
QString display_name;
};
2020-05-22 08:47:02 +03:00
Q_DECLARE_METATYPE(DeviceInfo);
2020-05-17 16:34:47 +03:00
class UserProfile : public QObject
{
Q_OBJECT
2020-05-22 08:47:02 +03:00
Q_PROPERTY(QVector<DeviceInfo> deviceList READ getDeviceList NOTIFY deviceListUpdated)
Q_PROPERTY(QString userId READ getUserId WRITE setUserId)
2020-05-17 16:34:47 +03:00
public:
2020-05-22 08:47:02 +03:00
// constructor
2020-05-17 16:34:47 +03:00
explicit UserProfile(QObject *parent = 0);
2020-05-22 08:47:02 +03:00
// getters
QVector<DeviceInfo> getDeviceList();
QString getUserId();
// setters
void setUserId(const QString &userId);
2020-05-17 16:34:47 +03:00
Q_INVOKABLE void fetchDeviceList(const QString &userID);
signals:
2020-05-22 08:47:02 +03:00
void deviceListUpdated();
2020-05-17 16:34:47 +03:00
private:
2020-05-22 08:47:02 +03:00
QVector<DeviceInfo> deviceList;
QString userId;
2020-05-17 16:34:47 +03:00
};