Added channelView with last messages to user popup

currently uses last messages from that channel - might want to use online logs later (or make a setting for that)
This commit is contained in:
TranRed 2019-07-20 18:49:17 +02:00
parent dc01cbf2a3
commit f417006d6a
2 changed files with 23 additions and 0 deletions

View file

@ -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 <QCheckBox>
#include <QDesktopServices>
@ -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<MessagePtr> 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()

View file

@ -1,6 +1,7 @@
#pragma once
#include "widgets/BaseWindow.hpp"
#include "widgets/helper/ChannelView.hpp"
#include <pajlada/signals/signal.hpp>
@ -36,6 +37,7 @@ private:
QString userName_;
QString userId_;
ChannelPtr channel_;
ChannelView* lastMessages_;
pajlada::Signals::NoArgSignal userStateChanged_;