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 "widgets/accountpopup.hpp"
#include "channel.hpp"
#include "credentials.hpp" #include "credentials.hpp"
#include "ui_accountpopupform.h" #include "ui_accountpopupform.h"
@ -13,9 +14,10 @@
namespace chatterino { namespace chatterino {
namespace widgets { namespace widgets {
AccountPopupWidget::AccountPopupWidget() AccountPopupWidget::AccountPopupWidget(std::shared_ptr<Channel> channel)
: QWidget(nullptr) : QWidget(nullptr)
, _ui(new Ui::AccountPopup) , _ui(new Ui::AccountPopup)
, _channel(channel)
{ {
_ui->setupUi(this); _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) void AccountPopupWidget::setName(const QString &name)
{ {
_ui->lblUsername->setText(name); _ui->lblUsername->setText(name);

View file

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

View file

@ -48,6 +48,7 @@ ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent)
, completionManager(parent->completionManager) , completionManager(parent->completionManager)
, channelName("/chatWidgets/" + std::to_string(index++) + "/channelName") , channelName("/chatWidgets/" + std::to_string(index++) + "/channelName")
, channel(_channelManager.emptyChannel) , channel(_channelManager.emptyChannel)
, userPopupWidget(_channelManager.emptyChannel)
, vbox(this) , vbox(this)
, header(this) , header(this)
, view(this) , view(this)
@ -100,6 +101,8 @@ void ChatWidget::setChannel(std::shared_ptr<Channel> _newChannel)
this->header.checkLive(); this->header.checkLive();
}); });
this->userPopupWidget.setChannel(_newChannel);
// on new message // on new message
this->messageAppendedConnection = this->messageAppendedConnection =
this->channel->messageAppended.connect([this](SharedMessage &message) { this->channel->messageAppended.connect([this](SharedMessage &message) {

View file

@ -24,6 +24,7 @@ ChatWidgetView::ChatWidgetView(ChatWidget *_chatWidget)
: BaseWidget(_chatWidget) : BaseWidget(_chatWidget)
, chatWidget(_chatWidget) , chatWidget(_chatWidget)
, scrollBar(this) , scrollBar(this)
, userPopupWidget(_chatWidget->getChannelRef())
, selectionStart(0, 0) , selectionStart(0, 0)
, selectionEnd(0, 0) , selectionEnd(0, 0)
, selectionMin(0, 0) , selectionMin(0, 0)