diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 80ccdcf0f..fd9633e4b 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -5,6 +5,7 @@ #include "common/NetworkRequest.hpp" #include "controllers/accounts/AccountController.hpp" #include "controllers/highlights/HighlightController.hpp" +#include "messages/Message.hpp" #include "providers/twitch/PartialTwitchUser.hpp" #include "providers/twitch/TwitchChannel.hpp" #include "singletons/Resources.hpp" @@ -15,6 +16,8 @@ #include "widgets/dialogs/LogsPopup.hpp" #include "widgets/helper/EffectLabel.hpp" #include "widgets/helper/Line.hpp" +#include "widgets/helper/ChannelView.hpp" + #include #include @@ -200,6 +203,11 @@ UserInfoPopup::UserInfoPopup() }); } + // fourth line (last messages) + this->lastMessages_ = new ChannelView(); + this->lastMessages_->setScaleIndependantHeight(150); + layout.append(this->lastMessages_); + this->setStyleSheet("font-size: 11pt;"); this->installEvents(); @@ -338,6 +346,19 @@ void UserInfoPopup::setData(const QString &name, const ChannelPtr &channel) this->updateUserData(); this->userStateChanged_.invoke(); + + LimitedQueueSnapshot snapshot = this->channel_->getMessageSnapshot(); + ChannelPtr channelPtr(new Channel("search", Channel::Type::None)); + for (size_t i = 0; i < snapshot.size(); i++) + { + MessagePtr message = snapshot[i]; + if ( message->loginName.compare(this->userName_, Qt::CaseInsensitive) == 0) + { + channelPtr->addMessage(message); + } + } + + this->lastMessages_->setChannel(channelPtr); } void UserInfoPopup::updateUserData() diff --git a/src/widgets/dialogs/UserInfoPopup.hpp b/src/widgets/dialogs/UserInfoPopup.hpp index 8699f8dde..9a603b405 100644 --- a/src/widgets/dialogs/UserInfoPopup.hpp +++ b/src/widgets/dialogs/UserInfoPopup.hpp @@ -1,6 +1,7 @@ #pragma once #include "widgets/BaseWindow.hpp" +#include "widgets/helper/ChannelView.hpp" #include @@ -36,6 +37,7 @@ private: QString userName_; QString userId_; ChannelPtr channel_; + ChannelView* lastMessages_; pajlada::Signals::NoArgSignal userStateChanged_;