File indexing completed on 2024-02-25 16:44:41

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 "libruqolacore_export.h"
0010 #include "teams/teamroomcompleter.h"
0011 #include <QAbstractListModel>
0012 
0013 class LIBRUQOLACORE_EXPORT TeamRoomCompleterModel : public QAbstractListModel
0014 {
0015     Q_OBJECT
0016 public:
0017     // TeamRoomCompleter
0018     enum TeamRoomCompleterRoles {
0019         TeamName = Qt::UserRole + 1,
0020         TeamId,
0021         TeamIcon,
0022     };
0023     Q_ENUM(TeamRoomCompleterRoles)
0024 
0025     explicit TeamRoomCompleterModel(QObject *parent = nullptr);
0026     ~TeamRoomCompleterModel() override;
0027 
0028     [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0029     [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0030 
0031     void clear();
0032     void setRooms(const QVector<TeamRoomCompleter> &rooms);
0033 
0034 private:
0035     Q_DISABLE_COPY(TeamRoomCompleterModel)
0036     QVector<TeamRoomCompleter> mRooms;
0037 };