mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
be72d73c3d
* feat: add `Go to message` action in search popup * chore: add changelog entry * fix: only scroll if the scrollbar is shown * fix: go to message when view isn't focused * feat: animate highlighted message * fix: missing includes * fix: order of initialization * fix: add `ChannelView::mayContainMessage` to filter messages * feat: add `Go to message` action in `/mentions` * fix: ignore any mentions channel when searching for split * feat: add `Go to message` action in reply-threads * fix: remove redundant `source` parameter * feat: add `Go to message` action in user-cards * feat: add link to deleted message * fix: set current time to 0 when starting animation * chore: update changelog * fix: add default case (unreachable) * chore: removed unused variable * fix: search in mentions * fix: always attempt to focus split * fix: rename `Link::MessageId` to `Link::JumpToMessage` * fix: rename `selectAndScrollToMessage` to `scrollToMessage` * fix: rename internal `scrollToMessage` to `scrollToMessageLayout` * fix: deleted message link in search popup * chore: reword explanation * fix: use for-loop instead of `std::find_if` * refactor: define highlight colors in `BaseTheme` * core: replace `iff` with `if` * fix: only return if the message found * Reword/phrase/dot changelog entries Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
74 lines
2.2 KiB
C++
74 lines
2.2 KiB
C++
#pragma once
|
|
|
|
#include "ForwardDecl.hpp"
|
|
#include "controllers/filters/FilterSet.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
|