removed experimental profile banner code for now

This commit is contained in:
TranRed 2019-07-25 13:55:37 +02:00
parent 125774ecb2
commit 54b162afdd
2 changed files with 6 additions and 36 deletions

View file

@ -14,10 +14,9 @@
#include "util/PostToThread.hpp"
#include "widgets/Label.hpp"
#include "widgets/dialogs/LogsPopup.hpp"
#include "widgets/helper/ChannelView.hpp"
#include "widgets/helper/EffectLabel.hpp"
#include "widgets/helper/Line.hpp"
#include "widgets/helper/ChannelView.hpp"
#include <QCheckBox>
#include <QDesktopServices>
@ -377,9 +376,6 @@ void UserInfoPopup::updateUserData()
this->loadAvatar(QUrl(obj.value("logo").toString()));
this->loadProfileBanner(
QUrl(obj.value("profile_banner").toString()));
return Success;
});
@ -464,31 +460,6 @@ void UserInfoPopup::loadAvatar(const QUrl &url)
});
}
void UserInfoPopup::loadProfileBanner(const QUrl &url)
{
QNetworkRequest req(url);
static auto manager = new QNetworkAccessManager();
auto *reply = manager->get(req);
QObject::connect(reply, &QNetworkReply::finished, this, [=] {
if (reply->error() == QNetworkReply::NoError)
{
const auto data = reply->readAll();
// might want to cache the banner image
QPixmap banner;
banner.loadFromData(data);
this->ui_.profileBanner =
banner.scaled(600, 200, Qt::KeepAspectRatio);
}
else
{
QPixmap emptyBanner;
this->ui_.profileBanner = emptyBanner;
}
});
}
//
// TimeoutWidget
//
@ -614,14 +585,15 @@ void UserInfoPopup::TimeoutWidget::paintEvent(QPaintEvent *)
// / 2);
}
void UserInfoPopup::fillLatestMessages(){
void UserInfoPopup::fillLatestMessages()
{
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
&& !message->flags.has(MessageFlag::Whisper) )
if (message->loginName.compare(this->userName_, Qt::CaseInsensitive) == 0
&& !message->flags.has(MessageFlag::Whisper))
{
channelPtr->addMessage(message);
}

View file

@ -31,14 +31,13 @@ private:
void fillLatestMessages();
void loadAvatar(const QUrl &url);
void loadProfileBanner(const QUrl &url);
bool isMod_;
bool isBroadcaster_;
QString userName_;
QString userId_;
ChannelPtr channel_;
ChannelView* latestMessages_;
ChannelView *latestMessages_;
pajlada::Signals::NoArgSignal userStateChanged_;
@ -48,7 +47,6 @@ private:
Button *avatarButton = nullptr;
// RippleEffectLabel2 *viewLogs = nullptr;
QPixmap profileBanner;
Label *nameLabel = nullptr;
Label *viewCountLabel = nullptr;
Label *followerCountLabel = nullptr;