feat: add Go to message action in various places (#3953)
* 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>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <QPaintEvent>
|
||||
#include <QScroller>
|
||||
#include <QTimer>
|
||||
#include <QVariantAnimation>
|
||||
#include <QWheelEvent>
|
||||
#include <QWidget>
|
||||
#include <pajlada/signals/signal.hpp>
|
||||
@@ -83,6 +84,17 @@ public:
|
||||
const boost::optional<MessageElementFlags> &getOverrideFlags() const;
|
||||
void updateLastReadMessage();
|
||||
|
||||
/**
|
||||
* Attempts to scroll to a message in this channel.
|
||||
* @return <code>true</code> if the message was found and highlighted.
|
||||
*/
|
||||
bool scrollToMessage(const MessagePtr &message);
|
||||
/**
|
||||
* Attempts to scroll to a message id in this channel.
|
||||
* @return <code>true</code> if the message was found and highlighted.
|
||||
*/
|
||||
bool scrollToMessageId(const QString &id);
|
||||
|
||||
/// Pausing
|
||||
bool pausable() const;
|
||||
void setPausable(bool value);
|
||||
@@ -119,6 +131,13 @@ public:
|
||||
void showUserInfoPopup(const QString &userName,
|
||||
QString alternativePopoutChannel = QString());
|
||||
|
||||
/**
|
||||
* @brief This method is meant to be used when filtering out channels.
|
||||
* It <b>must</b> return true if a message belongs in this channel.
|
||||
* It <b>might</b> return true if a message doesn't belong in this channel.
|
||||
*/
|
||||
bool mayContainMessage(const MessagePtr &message);
|
||||
|
||||
pajlada::Signals::Signal<QMouseEvent *> mouseDown;
|
||||
pajlada::Signals::NoArgSignal selectionChanged;
|
||||
pajlada::Signals::Signal<HighlightState> tabHighlightRequested;
|
||||
@@ -208,6 +227,14 @@ private:
|
||||
void enableScrolling(const QPointF &scrollStart);
|
||||
void disableScrolling();
|
||||
|
||||
/**
|
||||
* Scrolls to a message layout that must be from this view.
|
||||
*
|
||||
* @param layout Must be from this channel.
|
||||
* @param messageIdx Must be an index into this channel.
|
||||
*/
|
||||
void scrollToMessageLayout(MessageLayout *layout, size_t messageIdx);
|
||||
|
||||
void setInputReply(const MessagePtr &message);
|
||||
void showReplyThreadPopup(const MessagePtr &message);
|
||||
bool canReplyToMessages() const;
|
||||
@@ -241,6 +268,7 @@ private:
|
||||
|
||||
Scrollbar *scrollBar_;
|
||||
EffectLabel *goToBottom_;
|
||||
bool showScrollBar_ = false;
|
||||
|
||||
FilterSetPtr channelFilters_;
|
||||
|
||||
@@ -272,6 +300,11 @@ private:
|
||||
QPointF currentMousePosition_;
|
||||
QTimer scrollTimer_;
|
||||
|
||||
// We're only interested in the pointer, not the contents
|
||||
MessageLayout *highlightedMessage_;
|
||||
QVariantAnimation highlightAnimation_;
|
||||
void setupHighlightAnimationColors();
|
||||
|
||||
struct {
|
||||
QCursor neutral;
|
||||
QCursor up;
|
||||
|
||||
Reference in New Issue
Block a user