File indexing completed on 2024-12-08 12:53:32

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "custombasemodel.h"
0010 #include "libruqolacore_export.h"
0011 #include "roominfo/roomsinfo.h"
0012 
0013 class LIBRUQOLACORE_EXPORT DirectoryTeamsModel : public CustomBaseModel
0014 {
0015     Q_OBJECT
0016 public:
0017     enum DirectoryTeamsRoles {
0018         TeamName,
0019         RoomsCount,
0020         TeamIdentifier,
0021         CreateTeamDateTime,
0022         CreateTeam,
0023         RoomIdentifier,
0024         LastColumn = CreateTeam,
0025     };
0026     Q_ENUM(DirectoryTeamsRoles)
0027     explicit DirectoryTeamsModel(QObject *parent = nullptr);
0028     ~DirectoryTeamsModel() override;
0029 
0030     [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0031     [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
0032     [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
0033     [[nodiscard]] int columnCount(const QModelIndex &parent = {}) const override;
0034 
0035     void parseElements(const QJsonObject &obj) override;
0036     void addMoreElements(const QJsonObject &obj) override;
0037 
0038     [[nodiscard]] int total() const override;
0039 
0040 protected:
0041     [[nodiscard]] QList<int> hideColumns() const override;
0042 
0043 private:
0044     LIBRUQOLACORE_NO_EXPORT void checkFullList() override;
0045     RoomsInfo mRoomsInfo;
0046 };