1 /*
2    SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
3 
4    SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "channel.h"
10 #include "libruqolacore_export.h"
11 #include <QAbstractListModel>
12 
13 class LIBRUQOLACORE_EXPORT ChannelCompleterModel : public QAbstractListModel
14 {
15     Q_OBJECT
16 public:
17     enum ChannelRoles {
18         RoomName = Qt::UserRole + 1,
19         ChannelId,
20     };
21     Q_ENUM(ChannelRoles)
22 
23     explicit ChannelCompleterModel(QObject *parent = nullptr);
24     ~ChannelCompleterModel() override;
25 
26     Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override;
27     Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
28 
29     void clear();
30     void insertChannels(const QVector<Channel> &users);
31 
32 private:
33     Q_DISABLE_COPY(ChannelCompleterModel)
34     QVector<Channel> mChannels;
35 };
36