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:
nerix
2022-09-11 16:37:13 +02:00
committed by GitHub
parent 5655a7d718
commit be72d73c3d
14 changed files with 344 additions and 12 deletions
+24
View File
@@ -8,6 +8,7 @@
#include "util/InitUpdateButton.hpp"
#include "widgets/Window.hpp"
#include "widgets/dialogs/SettingsDialog.hpp"
#include "widgets/helper/ChannelView.hpp"
#include "widgets/helper/NotebookButton.hpp"
#include "widgets/helper/NotebookTab.hpp"
#include "widgets/splits/Split.hpp"
@@ -1006,6 +1007,29 @@ SplitNotebook::SplitNotebook(Window *parent)
[this](SplitContainer *sc) {
this->select(sc);
});
this->signalHolder_.managedConnect(
getApp()->windows->scrollToMessageSignal,
[this](const MessagePtr &message) {
for (auto &&item : this->items())
{
if (auto sc = dynamic_cast<SplitContainer *>(item.page))
{
for (auto *split : sc->getSplits())
{
if (split->getChannel()->getType() !=
Channel::Type::TwitchMentions)
{
if (split->getChannelView().scrollToMessage(
message))
{
return;
}
}
}
}
}
});
}
void SplitNotebook::showEvent(QShowEvent *)