2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2021-03-05 02:35:15 +03:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-05-13 07:35:26 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QSet>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
#include "Provider.h"
|
|
|
|
|
|
|
|
namespace emoji {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Provides access to the emojis in Provider.h to QML
|
|
|
|
*/
|
|
|
|
class EmojiModel : public QAbstractListModel
|
|
|
|
{
|
2021-09-18 01:22:33 +03:00
|
|
|
Q_OBJECT
|
2020-05-13 07:35:26 +03:00
|
|
|
public:
|
2021-09-18 01:22:33 +03:00
|
|
|
enum Roles
|
|
|
|
{
|
|
|
|
Unicode = Qt::UserRole, // unicode of emoji
|
|
|
|
Category, // category of emoji
|
|
|
|
ShortName, // shortext of the emoji
|
2022-04-22 19:49:57 +03:00
|
|
|
UnicodeName, // true unicode name of the emoji
|
2021-09-18 01:22:33 +03:00
|
|
|
Emoji, // Contains everything from the Emoji
|
|
|
|
};
|
2020-05-13 07:35:26 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
using QAbstractListModel::QAbstractListModel;
|
2020-05-13 07:35:26 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
Q_INVOKABLE int categoryToIndex(int category);
|
2021-04-18 21:21:03 +03:00
|
|
|
|
2021-09-18 01:22:33 +03:00
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
2020-05-13 07:35:26 +03:00
|
|
|
};
|
2021-01-23 04:07:23 +03:00
|
|
|
}
|