Fix build issue on some versions of clang
This commit is contained in:
parent
39b240e25a
commit
5e355c36fd
11 changed files with 6735 additions and 15143 deletions
|
|
@ -62,12 +62,12 @@ Category::Category(QString category, std::vector<Emoji> emoji, QWidget *parent)
|
|||
emojiListView_->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
|
||||
for (const auto &e : emoji) {
|
||||
data_->setUnicode(e.unicode());
|
||||
data_->unicode = e.unicode;
|
||||
|
||||
auto item = new QStandardItem;
|
||||
item->setSizeHint(QSize(emojiSize, emojiSize));
|
||||
|
||||
QVariant unicode(data_->unicode());
|
||||
QVariant unicode(data_->unicode);
|
||||
item->setData(unicode.toString(), Qt::UserRole);
|
||||
|
||||
itemModel_->appendRow(item);
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@ EmojiModel::data(const QModelIndex &index, int role) const
|
|||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
case static_cast<int>(EmojiModel::Roles::Unicode):
|
||||
return Provider::emoji[index.row()].unicode();
|
||||
return Provider::emoji[index.row()].unicode;
|
||||
|
||||
case Qt::ToolTipRole:
|
||||
case static_cast<int>(EmojiModel::Roles::ShortName):
|
||||
return Provider::emoji[index.row()].shortName();
|
||||
return Provider::emoji[index.row()].shortName;
|
||||
|
||||
case static_cast<int>(EmojiModel::Roles::Category):
|
||||
return QVariant::fromValue(Provider::emoji[index.row()].category());
|
||||
return QVariant::fromValue(Provider::emoji[index.row()].category);
|
||||
|
||||
case static_cast<int>(EmojiModel::Roles::Emoji):
|
||||
return QVariant::fromValue(Provider::emoji[index.row()]);
|
||||
|
|
@ -59,14 +59,14 @@ EmojiProxyModel::EmojiProxyModel(QObject *parent)
|
|||
|
||||
EmojiProxyModel::~EmojiProxyModel() {}
|
||||
|
||||
Emoji::Category
|
||||
EmojiCategory
|
||||
EmojiProxyModel::category() const
|
||||
{
|
||||
return category_;
|
||||
}
|
||||
|
||||
void
|
||||
EmojiProxyModel::setCategory(Emoji::Category cat)
|
||||
EmojiProxyModel::setCategory(EmojiCategory cat)
|
||||
{
|
||||
if (category_ == cat) {
|
||||
return;
|
||||
|
|
@ -102,9 +102,9 @@ EmojiProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent
|
|||
const Emoji emoji = index.data(static_cast<int>(EmojiModel::Roles::Emoji)).value<Emoji>();
|
||||
|
||||
// TODO: Add favorites / recently used
|
||||
if (category_ != Emoji::Category::Search) {
|
||||
return emoji.category() == category_;
|
||||
if (category_ != EmojiCategory::Search) {
|
||||
return emoji.category == category_;
|
||||
}
|
||||
|
||||
return filterRegExp().isEmpty() ? true : filterRegExp().indexIn(emoji.shortName()) != -1;
|
||||
return filterRegExp().isEmpty() ? true : filterRegExp().indexIn(emoji.shortName) != -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@ public:
|
|||
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;
|
||||
|
||||
// TODO: Need a signal for when an emoji is selected
|
||||
// public signals:
|
||||
// void emojiSelected(const QString &emoji);
|
||||
};
|
||||
|
||||
class EmojiProxyModel : public QSortFilterProxyModel
|
||||
|
|
@ -40,15 +36,15 @@ class EmojiProxyModel : public QSortFilterProxyModel
|
|||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(
|
||||
emoji::Emoji::Category category READ category WRITE setCategory NOTIFY categoryChanged)
|
||||
emoji::EmojiCategory category READ category WRITE setCategory NOTIFY categoryChanged)
|
||||
Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
|
||||
|
||||
public:
|
||||
explicit EmojiProxyModel(QObject *parent = nullptr);
|
||||
~EmojiProxyModel() override;
|
||||
|
||||
Emoji::Category category() const;
|
||||
void setCategory(Emoji::Category cat);
|
||||
EmojiCategory category() const;
|
||||
void setCategory(EmojiCategory cat);
|
||||
|
||||
QString filter() const;
|
||||
void setFilter(const QString &filter);
|
||||
|
|
@ -61,7 +57,7 @@ protected:
|
|||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
|
||||
private:
|
||||
Emoji::Category category_ = Emoji::Category::Search;
|
||||
EmojiCategory category_ = EmojiCategory::Search;
|
||||
emoji::Provider emoji_provider_;
|
||||
};
|
||||
|
||||
|
|
|
|||
18404
src/emoji/Provider.cpp
18404
src/emoji/Provider.cpp
File diff suppressed because it is too large
Load diff
|
|
@ -24,47 +24,34 @@
|
|||
#include <vector>
|
||||
|
||||
namespace emoji {
|
||||
Q_NAMESPACE
|
||||
|
||||
class Emoji
|
||||
enum class EmojiCategory
|
||||
{
|
||||
People,
|
||||
Nature,
|
||||
Food,
|
||||
Activity,
|
||||
Travel,
|
||||
Objects,
|
||||
Symbols,
|
||||
Flags,
|
||||
Search
|
||||
};
|
||||
Q_ENUM_NS(EmojiCategory)
|
||||
|
||||
struct Emoji
|
||||
{
|
||||
Q_GADGET
|
||||
|
||||
Q_PROPERTY(const QString &unicode READ unicode CONSTANT)
|
||||
Q_PROPERTY(const QString &shortName READ shortName CONSTANT)
|
||||
Q_PROPERTY(emoji::Emoji::Category category READ category CONSTANT)
|
||||
Q_PROPERTY(const QString &unicode MEMBER unicode)
|
||||
Q_PROPERTY(const QString &shortName MEMBER shortName)
|
||||
Q_PROPERTY(emoji::EmojiCategory category MEMBER category)
|
||||
|
||||
public:
|
||||
enum class Category
|
||||
{
|
||||
People,
|
||||
Nature,
|
||||
Food,
|
||||
Activity,
|
||||
Travel,
|
||||
Objects,
|
||||
Symbols,
|
||||
Flags,
|
||||
Search
|
||||
};
|
||||
Q_ENUM(Category)
|
||||
|
||||
Emoji(const QString &unicode = {},
|
||||
const QString &shortName = {},
|
||||
Emoji::Category cat = Emoji::Category::Search)
|
||||
: unicode_(unicode)
|
||||
, shortName_(shortName)
|
||||
, category_(cat)
|
||||
{}
|
||||
|
||||
inline const QString &unicode() const { return unicode_; }
|
||||
inline const QString &shortName() const { return shortName_; }
|
||||
inline Emoji::Category category() const { return category_; }
|
||||
inline void setUnicode(const QString &unicode) { unicode_ = unicode; }
|
||||
|
||||
private:
|
||||
QString unicode_;
|
||||
QString shortName_;
|
||||
Emoji::Category category_;
|
||||
QString unicode;
|
||||
QString shortName;
|
||||
EmojiCategory category;
|
||||
};
|
||||
|
||||
class Provider
|
||||
|
|
|
|||
3339
src/emoji/Provider_new.cpp
Normal file
3339
src/emoji/Provider_new.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -80,6 +80,8 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettin
|
|||
"im.nheko.EmojiModel", 1, 0, "QAbstractItemModel", "Used by proxy models");
|
||||
qmlRegisterUncreatableType<emoji::Emoji>(
|
||||
"im.nheko.EmojiModel", 1, 0, "Emoji", "Used by emoji models");
|
||||
qmlRegisterUncreatableMetaObject(emoji::staticMetaObject,
|
||||
"im.nheko.EmojiModel", 1, 0, "EmojiCategory", "Error: Only enums");
|
||||
|
||||
#ifdef USE_QUICK_VIEW
|
||||
view = new QQuickView();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue