Chatterino
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SearchPopup.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ForwardDecl.hpp"
7 #include "widgets/BasePopup.hpp"
9 
10 #include <memory>
11 
12 class QLineEdit;
13 
14 namespace chatterino {
15 
16 class SearchPopup : public BasePopup
17 {
18 public:
19  SearchPopup(QWidget *parent, Split *split = nullptr);
20 
21  virtual void addChannel(ChannelView &channel);
22  void goToMessage(const MessagePtr &message);
29  void goToMessageId(const QString &messageId);
30 
31 protected:
32  virtual void updateWindowTitle();
33  void showEvent(QShowEvent *event) override;
34 
35 private:
36  void initLayout();
37  void search();
38  void addShortcuts() override;
39  LimitedQueueSnapshot<MessagePtr> buildSnapshot();
40 
53  static ChannelPtr filter(const QString &text, const QString &channelName,
54  const LimitedQueueSnapshot<MessagePtr> &snapshot);
55 
63  static std::vector<std::unique_ptr<MessagePredicate>> parsePredicates(
64  const QString &input);
65 
67  QLineEdit *searchInput_{};
68  ChannelView *channelView_{};
69  QString channelName_{};
70  Split *split_ = nullptr;
71  QList<std::reference_wrapper<ChannelView>> searchChannels_;
72 };
73 
74 } // namespace chatterino
virtual void updateWindowTitle()
Definition: SearchPopup.cpp:145
SearchPopup(QWidget *parent, Split *split=nullptr)
Definition: SearchPopup.cpp:60
void goToMessage(const MessagePtr &message)
Definition: SearchPopup.cpp:117
Definition: Application.cpp:48
Definition: BasePopup.hpp:10
Definition: Split.hpp:36
virtual void addChannel(ChannelView &channel)
Definition: SearchPopup.cpp:94
Definition: ChannelView.hpp:61
Definition: SearchPopup.hpp:16
std::shared_ptr< const Message > MessagePtr
Definition: Channel.hpp:18
void showEvent(QShowEvent *event) override
Definition: SearchPopup.cpp:172
std::shared_ptr< Channel > ChannelPtr
Definition: Channel.hpp:125
void goToMessageId(const QString &messageId)
Definition: SearchPopup.cpp:134
virtual bool event(QEvent *event) override
Definition: BaseWindow.cpp:333