Add search to emote popup (#3404)

Co-authored-by: Paweł <zneix@zneix.eu>
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Adam Davies
2022-01-02 08:59:16 -06:00
committed by GitHub
parent 2b9e2bd1b0
commit 8e5468c316
3 changed files with 202 additions and 40 deletions
+19 -1
View File
@@ -1,10 +1,14 @@
#pragma once
#include "providers/emoji/Emojis.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include "widgets/BasePopup.hpp"
#include "widgets/Notebook.hpp"
#include <pajlada/signals/signal.hpp>
#include <QLineEdit>
namespace chatterino {
struct Link;
@@ -18,7 +22,6 @@ public:
EmotePopup(QWidget *parent = nullptr);
void loadChannel(ChannelPtr channel);
void loadEmojis();
virtual void closeEvent(QCloseEvent *event) override;
@@ -29,8 +32,23 @@ private:
ChannelView *channelEmotesView_{};
ChannelView *subEmotesView_{};
ChannelView *viewEmojis_{};
/**
* @brief Visible only when the user has specified a search query into the `search_` input.
* Otherwise the `notebook_` and all other views are visible.
*/
ChannelView *searchView_{};
ChannelPtr channel_;
TwitchChannel *twitchChannel_{};
QLineEdit *search_;
Notebook *notebook_;
void loadEmojis(ChannelView &view, EmojiMap &emojiMap);
void loadEmojis(Channel &channel, EmojiMap &emojiMap, const QString &title);
void filterEmotes(const QString &text);
EmoteMap *filterEmoteMap(const QString &text,
std::shared_ptr<const EmoteMap> emotes);
void addShortcuts() override;
};