mirror-chatterino2/src/widgets/helper/SearchPopup.hpp
pajlada 032f290767
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

74 lines
2.2 KiB
C++

#pragma once
#include "controllers/filters/FilterSet.hpp"
#include "ForwardDecl.hpp"
#include "messages/LimitedQueueSnapshot.hpp"
#include "messages/search/MessagePredicate.hpp"
#include "widgets/BasePopup.hpp"
#include "widgets/splits/Split.hpp"
#include <memory>
class QLineEdit;
namespace chatterino {
class SearchPopup : public BasePopup
{
public:
SearchPopup(QWidget *parent, Split *split = nullptr);
virtual void addChannel(ChannelView &channel);
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);
protected:
virtual void updateWindowTitle();
void showEvent(QShowEvent *event) override;
private:
void initLayout();
void search();
void addShortcuts() override;
LimitedQueueSnapshot<MessagePtr> buildSnapshot();
/**
* @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
* @param filterSet channel filter to apply
*
* @return a ChannelPtr with "channelName" and the filtered messages from
* "snapshot"
*/
static ChannelPtr filter(const QString &text, const QString &channelName,
const LimitedQueueSnapshot<MessagePtr> &snapshot);
/**
* @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);
LimitedQueueSnapshot<MessagePtr> snapshot_;
QLineEdit *searchInput_{};
ChannelView *channelView_{};
QString channelName_{};
Split *split_ = nullptr;
QList<std::reference_wrapper<ChannelView>> searchChannels_;
};
} // namespace chatterino