summary refs log tree commit diff
path: root/src/emoji
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-01-22 20:07:23 -0500
committerLoren Burkholder <computersemiexpert@outlook.com>2021-01-25 21:40:27 -0500
commitbc7cf9ef39d82da70af62e1433d5de2e2a7d45f7 (patch)
treec341102e9b2b4de955472e44082a69d4704fd2fb /src/emoji
parentTranslated using Weblate (Hungarian) (diff)
downloadnheko-bc7cf9ef39d82da70af62e1433d5de2e2a7d45f7.tar.xz
Get category switching working
Diffstat (limited to 'src/emoji')
-rw-r--r--src/emoji/EmojiModel.cpp6
-rw-r--r--src/emoji/EmojiModel.h10
-rw-r--r--src/emoji/Provider.h31
3 files changed, 24 insertions, 23 deletions
diff --git a/src/emoji/EmojiModel.cpp b/src/emoji/EmojiModel.cpp
index 85c2dd34..f207c740 100644
--- a/src/emoji/EmojiModel.cpp
+++ b/src/emoji/EmojiModel.cpp
@@ -63,14 +63,14 @@ EmojiProxyModel::EmojiProxyModel(QObject *parent)
 
 EmojiProxyModel::~EmojiProxyModel() {}
 
-EmojiCategory
+Emoji::Category
 EmojiProxyModel::category() const
 {
         return category_;
 }
 
 void
-EmojiProxyModel::setCategory(EmojiCategory cat)
+EmojiProxyModel::setCategory(Emoji::Category cat)
 {
         if (category_ == cat) {
                 return;
@@ -106,7 +106,7 @@ 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_ != EmojiCategory::Search) {
+        if (category_ != Emoji::Category::Search) {
                 return emoji.category == category_;
         }
 
diff --git a/src/emoji/EmojiModel.h b/src/emoji/EmojiModel.h
index 88bacdee..938db46d 100644
--- a/src/emoji/EmojiModel.h
+++ b/src/emoji/EmojiModel.h
@@ -36,15 +36,15 @@ class EmojiProxyModel : public QSortFilterProxyModel
         Q_OBJECT
 
         Q_PROPERTY(
-          emoji::EmojiCategory category READ category WRITE setCategory NOTIFY categoryChanged)
+          emoji::Emoji::Category 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;
 
-        EmojiCategory category() const;
-        void setCategory(EmojiCategory cat);
+        Emoji::Category category() const;
+        void setCategory(Emoji::Category cat);
 
         QString filter() const;
         void setFilter(const QString &filter);
@@ -57,7 +57,7 @@ protected:
         bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
 
 private:
-        EmojiCategory category_ = EmojiCategory::Search;
+        Emoji::Category category_ = Emoji::Category::Search;
         emoji::Provider emoji_provider_;
 };
-}
\ No newline at end of file
+}
diff --git a/src/emoji/Provider.h b/src/emoji/Provider.h
index ad03eb26..9b2234ba 100644
--- a/src/emoji/Provider.h
+++ b/src/emoji/Provider.h
@@ -26,32 +26,33 @@
 namespace emoji {
 Q_NAMESPACE
 
-enum class EmojiCategory
-{
-        People,
-        Nature,
-        Food,
-        Activity,
-        Travel,
-        Objects,
-        Symbols,
-        Flags,
-        Search
-};
-Q_ENUM_NS(EmojiCategory)
 
 struct Emoji
 {
         Q_GADGET
+public:
+        enum class Category
+        {
+                People,
+                Nature,
+                Food,
+                Activity,
+                Travel,
+                Objects,
+                Symbols,
+                Flags,
+                Search
+        };
+        Q_ENUM(Category)
 
         Q_PROPERTY(const QString &unicode MEMBER unicode)
         Q_PROPERTY(const QString &shortName MEMBER shortName)
-        Q_PROPERTY(emoji::EmojiCategory category MEMBER category)
+        Q_PROPERTY(emoji::Emoji::Category category MEMBER category)
 
 public:
         QString unicode;
         QString shortName;
-        EmojiCategory category;
+        Category category;
 };
 
 class Provider