File indexing completed on 2024-12-01 10:39:30

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include <QDebug>
0011 #include <QString>
0012 
0013 class LIBRUQOLACORE_EXPORT DeviceInfo
0014 {
0015 public:
0016     DeviceInfo();
0017     ~DeviceInfo();
0018 
0019     void parseDeviceInfo(const QJsonObject &object);
0020 
0021     [[nodiscard]] bool operator==(const DeviceInfo &other) const;
0022 
0023     [[nodiscard]] const QString &identifier() const;
0024     void setIdentifier(const QString &newIdentifier);
0025 
0026     [[nodiscard]] const QString &host() const;
0027     void setHost(const QString &newHost);
0028 
0029     [[nodiscard]] const QString &sessionId() const;
0030     void setSessionId(const QString &newSessionId);
0031 
0032     [[nodiscard]] const QString &ip() const;
0033     void setIp(const QString &newIp);
0034 
0035     [[nodiscard]] const QString &userId() const;
0036     void setUserId(const QString &newUserId);
0037 
0038     [[nodiscard]] qint64 loginAt() const;
0039     void setLoginAt(qint64 newLoginAt);
0040 
0041     [[nodiscard]] const QString &client() const;
0042     void setClient(const QString &newClient);
0043 
0044     [[nodiscard]] const QString &os() const;
0045     void setOs(const QString &newOs);
0046 
0047     [[nodiscard]] QString loginAtDisplay() const;
0048 
0049 private:
0050     QString mIdentifier;
0051     QString mHost;
0052     QString mSessionId;
0053     QString mIp;
0054     QString mUserId;
0055     QString mClient;
0056     QString mOs;
0057     QString mLoginAtDateTimeStr;
0058     qint64 mLoginAt = -1;
0059 };
0060 
0061 Q_DECLARE_METATYPE(DeviceInfo)
0062 Q_DECLARE_TYPEINFO(DeviceInfo, Q_MOVABLE_TYPE);
0063 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const DeviceInfo &t);