summary refs log tree commit diff
path: root/src/ui/UserProfile.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/UserProfile.h')
-rw-r--r--src/ui/UserProfile.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/ui/UserProfile.h b/src/ui/UserProfile.h

index d003e6ca..bbf57c7b 100644 --- a/src/ui/UserProfile.h +++ b/src/ui/UserProfile.h
@@ -1,29 +1,49 @@ #pragma once -#include <QMap> #include <QObject> #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 display_name; }; +Q_DECLARE_METATYPE(DeviceInfo); class UserProfile : public QObject { 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: + // constructor 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); signals: - void DeviceListUpdated(); + void deviceListUpdated(); private: - QMap<QString, QString> deviceList; + QVector<DeviceInfo> deviceList; + QString userId; }; \ No newline at end of file