File indexing completed on 2024-10-06 04:34:00

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 "videoconference/videoconferenceinfo.h"
0011 #include <QDebug>
0012 
0013 class LIBRUQOLACORE_EXPORT Block
0014 {
0015     Q_GADGET
0016 public:
0017     enum BlockType {
0018         Unknown,
0019         VideoConf,
0020     };
0021     Q_ENUM(BlockType)
0022 
0023     Block();
0024     [[nodiscard]] bool operator==(const Block &other) const;
0025 
0026     static QJsonObject serialize(const Block &block);
0027     static Block deserialize(const QJsonObject &o);
0028     void parseBlock(const QJsonObject &block);
0029 
0030     [[nodiscard]] QString blockId() const;
0031     void setBlockId(const QString &newBlockId);
0032 
0033     [[nodiscard]] QString callId() const;
0034     void setCallId(const QString &newCallId);
0035 
0036     [[nodiscard]] QString appId() const;
0037     void setAppId(const QString &newAppId);
0038 
0039     [[nodiscard]] BlockType blockType() const;
0040     void setBlockType(BlockType newBlockType);
0041 
0042     [[nodiscard]] bool isValid() const;
0043 
0044     [[nodiscard]] QString title() const;
0045 
0046     [[nodiscard]] QString blockTypeStr() const;
0047     void setBlockTypeStr(const QString &newBlockStr);
0048 
0049     [[nodiscard]] VideoConferenceInfo videoConferenceInfo() const;
0050     void setVideoConferenceInfo(const VideoConferenceInfo &newInfo);
0051 
0052 private:
0053     [[nodiscard]] LIBRUQOLACORE_NO_EXPORT QString convertEnumToStr(BlockType newBlockType) const;
0054     [[nodiscard]] LIBRUQOLACORE_NO_EXPORT Block::BlockType convertBlockTypeToEnum(const QString &type);
0055     QString mBlockId;
0056     QString mCallId;
0057     QString mAppId;
0058     QString mBlockStr;
0059     BlockType mBlockType = Unknown;
0060     VideoConferenceInfo mVideoConferenceInfo;
0061 };
0062 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const Block &t);
0063 Q_DECLARE_TYPEINFO(Block, Q_RELOCATABLE_TYPE);