Reverted popup changes back.

This commit is contained in:
Cranken 2017-09-12 14:05:27 +02:00
parent 2fbf8654f9
commit ac49e63f75
4 changed files with 16 additions and 2 deletions

View file

@ -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> 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> channel)
{
this->_channel = channel;
}
void AccountPopupWidget::setName(const QString &name)
{
_ui->lblUsername->setText(name);

View file

@ -19,9 +19,10 @@ class AccountPopupWidget : public QWidget
{
Q_OBJECT
public:
AccountPopupWidget();
AccountPopupWidget(std::shared_ptr<Channel> channel);
void setName(const QString &name);
void setChannel(std::shared_ptr<Channel> channel);
private:
Ui::AccountPopup *_ui;
@ -30,6 +31,8 @@ private:
void getUserData();
void loadAvatar(const QUrl &avatarUrl);
std::shared_ptr<Channel> _channel;
QString userID;
QPixmap avatar;

View file

@ -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<Channel> _newChannel)
this->header.checkLive();
});
this->userPopupWidget.setChannel(_newChannel);
// on new message
this->messageAppendedConnection =
this->channel->messageAppended.connect([this](SharedMessage &message) {

View file

@ -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)