mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 09:30:47 +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):
|
def generate_qml_list(**kwargs):
|
||||||
tmpl = Template('''
|
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() %}
|
{%- for c in kwargs.items() %}
|
||||||
// {{ c[0].capitalize() }}
|
// {{ c[0].capitalize() }}
|
||||||
{%- for e in c[1] %}
|
{%- for e in c[1] %}
|
||||||
|
|
|
@ -45,7 +45,7 @@ EmojiModel::roleNames() const
|
||||||
int
|
int
|
||||||
EmojiModel::rowCount(const QModelIndex &parent) const
|
EmojiModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
return parent == QModelIndex() ? Provider::emoji.count() : 0;
|
return parent == QModelIndex() ? Provider::emoji.size() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
using namespace emoji;
|
using namespace emoji;
|
||||||
|
|
||||||
const QVector<Emoji> emoji::Provider::emoji = {
|
const std::array<Emoji, 3650> emoji::Provider::emoji = {
|
||||||
// People
|
// People
|
||||||
Emoji{QStringLiteral(u"\U0001F600"),
|
Emoji{QStringLiteral(u"\U0001F600"),
|
||||||
QStringLiteral(u"grinning"),
|
QStringLiteral(u"grinning"),
|
||||||
|
|
|
@ -7,10 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSet>
|
#include <array>
|
||||||
#include <QString>
|
|
||||||
#include <QVector>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace emoji {
|
namespace emoji {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
|
@ -49,7 +46,7 @@ class Provider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// all emoji for QML purposes
|
// all emoji for QML purposes
|
||||||
static const QVector<Emoji> emoji;
|
static const std::array<Emoji, 3650> emoji;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emoji
|
} // namespace emoji
|
||||||
|
|
Loading…
Reference in a new issue