File indexing completed on 2024-12-08 07:34:18

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