mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-24 03:58:49 +03:00
Speedup provider compilation
This commit is contained in:
parent
81d4285580
commit
f8e6c9c53c
4 changed files with 5 additions and 8 deletions
|
@ -14,7 +14,7 @@ class Emoji(object):
|
|||
|
||||
def generate_qml_list(**kwargs):
|
||||
tmpl = Template('''
|
||||
const QVector<Emoji> emoji::Provider::emoji = {
|
||||
const std::array<Emoji, {{ sum([len(c[1]) for c in kwargs.items()]) }}> emoji::Provider::emoji = {
|
||||
{%- for c in kwargs.items() %}
|
||||
// {{ c[0].capitalize() }}
|
||||
{%- for e in c[1] %}
|
||||
|
|
|
@ -45,7 +45,7 @@ EmojiModel::roleNames() const
|
|||
int
|
||||
EmojiModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent == QModelIndex() ? Provider::emoji.count() : 0;
|
||||
return parent == QModelIndex() ? Provider::emoji.size() : 0;
|
||||
}
|
||||
|
||||
QVariant
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
using namespace emoji;
|
||||
|
||||
const QVector<Emoji> emoji::Provider::emoji = {
|
||||
const std::array<Emoji, 3650> emoji::Provider::emoji = {
|
||||
// People
|
||||
Emoji{QStringLiteral(u"\U0001F600"),
|
||||
QStringLiteral(u"grinning"),
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
namespace emoji {
|
||||
Q_NAMESPACE
|
||||
|
@ -49,7 +46,7 @@ class Provider
|
|||
{
|
||||
public:
|
||||
// all emoji for QML purposes
|
||||
static const QVector<Emoji> emoji;
|
||||
static const std::array<Emoji, 3650> emoji;
|
||||
};
|
||||
|
||||
} // namespace emoji
|
||||
|
|
Loading…
Reference in a new issue