From ac49e63f75c3e342ceb0ec7dafbe8fb3fb8cfd9f Mon Sep 17 00:00:00 2001 From: Cranken Date: Tue, 12 Sep 2017 14:05:27 +0200 Subject: [PATCH] Reverted popup changes back. --- src/widgets/accountpopup.cpp | 9 ++++++++- src/widgets/accountpopup.hpp | 5 ++++- src/widgets/chatwidget.cpp | 3 +++ src/widgets/chatwidgetview.cpp | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/widgets/accountpopup.cpp b/src/widgets/accountpopup.cpp index 5c6288274..93e526afa 100644 --- a/src/widgets/accountpopup.cpp +++ b/src/widgets/accountpopup.cpp @@ -1,4 +1,5 @@ #include "widgets/accountpopup.hpp" +#include "channel.hpp" #include "credentials.hpp" #include "ui_accountpopupform.h" @@ -13,9 +14,10 @@ namespace chatterino { namespace widgets { -AccountPopupWidget::AccountPopupWidget() +AccountPopupWidget::AccountPopupWidget(std::shared_ptr channel) : QWidget(nullptr) , _ui(new Ui::AccountPopup) + , _channel(channel) { _ui->setupUi(this); @@ -29,6 +31,11 @@ AccountPopupWidget::AccountPopupWidget() }); } +void AccountPopupWidget::setChannel(std::shared_ptr channel) +{ + this->_channel = channel; +} + void AccountPopupWidget::setName(const QString &name) { _ui->lblUsername->setText(name); diff --git a/src/widgets/accountpopup.hpp b/src/widgets/accountpopup.hpp index 346ac934b..ccbf57317 100644 --- a/src/widgets/accountpopup.hpp +++ b/src/widgets/accountpopup.hpp @@ -19,9 +19,10 @@ class AccountPopupWidget : public QWidget { Q_OBJECT public: - AccountPopupWidget(); + AccountPopupWidget(std::shared_ptr channel); void setName(const QString &name); + void setChannel(std::shared_ptr channel); private: Ui::AccountPopup *_ui; @@ -30,6 +31,8 @@ private: void getUserData(); void loadAvatar(const QUrl &avatarUrl); + std::shared_ptr _channel; + QString userID; QPixmap avatar; diff --git a/src/widgets/chatwidget.cpp b/src/widgets/chatwidget.cpp index 6c0f6cc41..97fd13010 100644 --- a/src/widgets/chatwidget.cpp +++ b/src/widgets/chatwidget.cpp @@ -48,6 +48,7 @@ ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent) , completionManager(parent->completionManager) , channelName("/chatWidgets/" + std::to_string(index++) + "/channelName") , channel(_channelManager.emptyChannel) + , userPopupWidget(_channelManager.emptyChannel) , vbox(this) , header(this) , view(this) @@ -100,6 +101,8 @@ void ChatWidget::setChannel(std::shared_ptr _newChannel) this->header.checkLive(); }); + this->userPopupWidget.setChannel(_newChannel); + // on new message this->messageAppendedConnection = this->channel->messageAppended.connect([this](SharedMessage &message) { diff --git a/src/widgets/chatwidgetview.cpp b/src/widgets/chatwidgetview.cpp index a05d3f7ed..70f1dc2c9 100644 --- a/src/widgets/chatwidgetview.cpp +++ b/src/widgets/chatwidgetview.cpp @@ -24,6 +24,7 @@ ChatWidgetView::ChatWidgetView(ChatWidget *_chatWidget) : BaseWidget(_chatWidget) , chatWidget(_chatWidget) , scrollBar(this) + , userPopupWidget(_chatWidget->getChannelRef()) , selectionStart(0, 0) , selectionEnd(0, 0) , selectionMin(0, 0)