From 54b162afdddc55629ef2d24171ae86c918d88e03 Mon Sep 17 00:00:00 2001 From: TranRed Date: Thu, 25 Jul 2019 13:55:37 +0200 Subject: [PATCH] removed experimental profile banner code for now --- src/widgets/dialogs/UserInfoPopup.cpp | 38 ++++----------------------- src/widgets/dialogs/UserInfoPopup.hpp | 4 +-- 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index dbd7631cd..9fd1671ce 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -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 #include @@ -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 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); } diff --git a/src/widgets/dialogs/UserInfoPopup.hpp b/src/widgets/dialogs/UserInfoPopup.hpp index d65ca1463..4a07f2f9d 100644 --- a/src/widgets/dialogs/UserInfoPopup.hpp +++ b/src/widgets/dialogs/UserInfoPopup.hpp @@ -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;