2019-09-08 22:27:57 +02:00
|
|
|
#pragma once
|
|
|
|
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include "ForwardDecl.hpp"
|
2019-09-08 22:27:57 +02:00
|
|
|
#include "messages/LimitedQueueSnapshot.hpp"
|
2019-12-14 12:57:16 +01:00
|
|
|
#include "widgets/BasePopup.hpp"
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
class QLineEdit;
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
2022-12-31 15:41:01 +01:00
|
|
|
class Split;
|
|
|
|
class MessagePredicate;
|
|
|
|
|
2019-12-14 12:57:16 +01:00
|
|
|
class SearchPopup : public BasePopup
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
|
|
|
public:
|
2022-07-31 12:45:25 +02:00
|
|
|
SearchPopup(QWidget *parent, Split *split = nullptr);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2022-05-23 02:47:16 +02:00
|
|
|
virtual void addChannel(ChannelView &channel);
|
2022-09-11 16:37:13 +02:00
|
|
|
void goToMessage(const MessagePtr &message);
|
|
|
|
/**
|
|
|
|
* This method should only be used for searches that
|
|
|
|
* don't include a mentions channel,
|
|
|
|
* since it will only search in the opened channels (not globally).
|
|
|
|
* @param messageId
|
|
|
|
*/
|
|
|
|
void goToMessageId(const QString &messageId);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void updateWindowTitle();
|
2022-05-23 02:47:16 +02:00
|
|
|
void showEvent(QShowEvent *event) override;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void initLayout();
|
|
|
|
void search();
|
2021-11-21 18:46:21 +01:00
|
|
|
void addShortcuts() override;
|
2022-05-23 02:47:16 +02:00
|
|
|
LimitedQueueSnapshot<MessagePtr> buildSnapshot();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2019-09-09 15:21:49 +02:00
|
|
|
/**
|
|
|
|
* @brief Only retains those message from a list of messages that satisfy a
|
|
|
|
* search query.
|
|
|
|
*
|
|
|
|
* @param text the search query -- will be parsed for MessagePredicates
|
|
|
|
* @param channelName name of the channel to be returned
|
|
|
|
* @param snapshot list of messages to filter
|
2020-10-18 15:16:56 +02:00
|
|
|
* @param filterSet channel filter to apply
|
2019-09-09 15:21:49 +02:00
|
|
|
*
|
|
|
|
* @return a ChannelPtr with "channelName" and the filtered messages from
|
|
|
|
* "snapshot"
|
|
|
|
*/
|
|
|
|
static ChannelPtr filter(const QString &text, const QString &channelName,
|
2022-05-23 02:47:16 +02:00
|
|
|
const LimitedQueueSnapshot<MessagePtr> &snapshot);
|
2019-09-09 15:21:49 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Checks the input for tags and registers their corresponding
|
|
|
|
* predicates.
|
|
|
|
*
|
|
|
|
* @param input the string to check for tags
|
|
|
|
* @return a vector of MessagePredicates requested in the input
|
|
|
|
*/
|
|
|
|
static std::vector<std::unique_ptr<MessagePredicate>> parsePredicates(
|
|
|
|
const QString &input);
|
|
|
|
|
2019-09-08 22:27:57 +02:00
|
|
|
LimitedQueueSnapshot<MessagePtr> snapshot_;
|
|
|
|
QLineEdit *searchInput_{};
|
|
|
|
ChannelView *channelView_{};
|
|
|
|
QString channelName_{};
|
2022-07-31 12:45:25 +02:00
|
|
|
Split *split_ = nullptr;
|
2022-05-23 02:47:16 +02:00
|
|
|
QList<std::reference_wrapper<ChannelView>> searchChannels_;
|
2019-09-08 22:27:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|