From 3ed7489e0fe23a1935b92cc9634eaf96567fc7c8 Mon Sep 17 00:00:00 2001 From: Patrick Geneva Date: Sat, 12 Nov 2022 10:53:42 -0500 Subject: [PATCH] Add settings to increase split and usercard scrollback (#3811) Co-authored-by: Rasmus Karlsson --- CHANGELOG.md | 2 ++ src/singletons/Settings.hpp | 8 ++++++++ src/widgets/dialogs/UserInfoPopup.cpp | 3 ++- src/widgets/helper/ChannelView.cpp | 4 +++- src/widgets/helper/ChannelView.hpp | 3 ++- src/widgets/settingspages/GeneralPage.cpp | 5 +++++ src/widgets/splits/Split.cpp | 3 ++- 7 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5d6df01b..5f2487037 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ - Major: Added multi-channel searching to search dialog via keyboard shortcut. (Ctrl+Shift+F by default) (#3694, #3875) - Major: Added support for emotes and badges from [7TV](https://7tv.app). [Wiki Page](https://wiki.chatterino.com/Third_party_services/#7tv) (#4002, #4062) - Major: Added support for Right-to-Left Languages (#3958, #4139) +- Minor: Added setting to keep more message history in splits. (#3811) +- Minor: Added setting to keep more message history in usercards. (#3811) - Minor: Added ability to pin Usercards to stay open even if it loses focus. Only available if "Automatically close usercard when it loses focus" is enabled. (#3884) - Minor: Allow hiding moderation actions in streamer mode. (#3926) - Minor: Added highlights for `Elevated Messages`. (#4016) diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index ef67ec0dc..e63484ec1 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -430,6 +430,14 @@ public: "/misc/twitch/messageHistoryLimit", 800, }; + IntSetting scrollbackSplitLimit = { + "/misc/scrollback/splitLimit", + 1000, + }; + IntSetting scrollbackUsercardLimit = { + "/misc/scrollback/usercardLimit", + 1000, + }; // Temporary time-gate-overrides EnumSetting helixTimegateRaid = { diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 2dd28e294..271c311d9 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -512,7 +512,8 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent, this->ui_.noMessagesLabel->setVisible(false); this->ui_.latestMessages = - new ChannelView(this, this->split_, ChannelView::Context::UserCard); + new ChannelView(this, this->split_, ChannelView::Context::UserCard, + getSettings()->scrollbackUsercardLimit); this->ui_.latestMessages->setMinimumSize(400, 275); this->ui_.latestMessages->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 94579bcc9..e0944684a 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -137,12 +137,14 @@ namespace { } } // namespace -ChannelView::ChannelView(BaseWidget *parent, Split *split, Context context) +ChannelView::ChannelView(BaseWidget *parent, Split *split, Context context, + size_t messagesLimit) : BaseWidget(parent) , split_(split) , scrollBar_(new Scrollbar(this)) , highlightAnimation_(this) , context_(context) + , messages_(messagesLimit) { this->setMouseTracking(true); diff --git a/src/widgets/helper/ChannelView.hpp b/src/widgets/helper/ChannelView.hpp index c27652f3f..685b783d9 100644 --- a/src/widgets/helper/ChannelView.hpp +++ b/src/widgets/helper/ChannelView.hpp @@ -71,7 +71,8 @@ public: }; explicit ChannelView(BaseWidget *parent = nullptr, Split *split = nullptr, - Context context = Context::None); + Context context = Context::None, + size_t messagesLimit = 1000); void queueUpdate(); Scrollbar &getScrollBar(); diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index a8d09f2b2..4f827d8c5 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -767,6 +767,11 @@ void GeneralPage::initLayout(GeneralPageView &layout) layout.addIntInput("Max number of history messages to load on connect", s.twitchMessageHistoryLimit, 10, 800, 10); + layout.addIntInput("Split message scrollback limit (requires restart)", + s.scrollbackSplitLimit, 100, 100000, 100); + layout.addIntInput("Usercard scrollback limit (requires restart)", + s.scrollbackUsercardLimit, 100, 100000, 100); + layout.addCheckbox("Enable experimental IRC support (requires restart)", s.enableExperimentalIrc); layout.addCheckbox("Show unhandled IRC messages", diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 282590e96..d7c16a968 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -86,7 +86,8 @@ Split::Split(QWidget *parent) , channel_(Channel::getEmpty()) , vbox_(new QVBoxLayout(this)) , header_(new SplitHeader(this)) - , view_(new ChannelView(this, this)) + , view_(new ChannelView(this, this, ChannelView::Context::None, + getSettings()->scrollbackSplitLimit)) , input_(new SplitInput(this)) , overlay_(new SplitOverlay(this)) {