File indexing completed on 2024-05-12 16:25:36

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "customsoundinfo.h"
0010 #include "libruqolacore_export.h"
0011 #include <QDebug>
0012 #include <QVector>
0013 class LIBRUQOLACORE_EXPORT CustomSoundsInfo
0014 {
0015 public:
0016     enum ParseType {
0017         Administrator,
0018         Directory,
0019     };
0020     CustomSoundsInfo();
0021 
0022     [[nodiscard]] bool isEmpty() const;
0023     void clear();
0024     [[nodiscard]] int count() const;
0025     [[nodiscard]] CustomSoundInfo at(int index) const;
0026 
0027     [[nodiscard]] int offset() const;
0028     void setOffset(int offset);
0029 
0030     [[nodiscard]] int total() const;
0031     void setTotal(int total);
0032 
0033     void parseCustomSounds(const QJsonObject &obj);
0034     void parseMoreCustomSounds(const QJsonObject &obj);
0035 
0036     [[nodiscard]] int roomsCount() const;
0037     void setRoomsCount(int adminroomsCount);
0038 
0039     [[nodiscard]] const QVector<CustomSoundInfo> &customSoundInfos() const;
0040     void setCustomSoundInfos(const QVector<CustomSoundInfo> &newCustomSoundInfos);
0041 
0042     [[nodiscard]] CustomSoundInfo takeAt(int index);
0043 
0044 private:
0045     LIBRUQOLACORE_NO_EXPORT void parseListCustomSound(const QJsonObject &obj);
0046     QVector<CustomSoundInfo> mCustomSoundInfos;
0047     int mRoomsCount = 0;
0048     int mOffset = 0;
0049     int mTotal = 0;
0050 };
0051 
0052 Q_DECLARE_METATYPE(CustomSoundsInfo)
0053 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const CustomSoundsInfo &t);