mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Moved creating UserInfoPopup in one place. (#761)
* Moved creating UserInfoPopup in one place. * Added forgotten 'this'. Fixes #759
This commit is contained in:
parent
b4683c5b35
commit
9f5da50bce
4 changed files with 21 additions and 31 deletions
|
@ -1197,6 +1197,17 @@ void ChannelView::hideEvent(QHideEvent *)
|
|||
this->messagesOnScreen_.clear();
|
||||
}
|
||||
|
||||
void ChannelView::showUserInfoPopup(const QString &userName)
|
||||
{
|
||||
auto *userPopup = new UserInfoPopup;
|
||||
userPopup->setData(userName, this->channel_);
|
||||
userPopup->setActionOnFocusLoss(BaseWindow::Delete);
|
||||
QPoint offset(int(150 * this->getScale()),
|
||||
int(70 * this->getScale()));
|
||||
userPopup->move(QCursor::pos() - offset);
|
||||
userPopup->show();
|
||||
}
|
||||
|
||||
void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
|
||||
MessageLayout *layout)
|
||||
{
|
||||
|
@ -1208,17 +1219,8 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
|
|||
case Link::UserWhisper:
|
||||
case Link::UserInfo: {
|
||||
auto user = link.value;
|
||||
|
||||
auto *userPopup = new UserInfoPopup;
|
||||
userPopup->setData(user, this->channel_);
|
||||
userPopup->setActionOnFocusLoss(BaseWindow::Delete);
|
||||
QPoint offset(int(150 * this->getScale()),
|
||||
int(70 * this->getScale()));
|
||||
userPopup->move(QCursor::pos() - offset);
|
||||
userPopup->show();
|
||||
|
||||
this->showUserInfoPopup(user);
|
||||
qDebug() << "Clicked " << user << "s message";
|
||||
|
||||
} break;
|
||||
|
||||
case Link::Url: {
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
void layoutMessages();
|
||||
|
||||
void clearMessages();
|
||||
void showUserInfoPopup(const QString &userName);
|
||||
|
||||
pajlada::Signals::Signal<QMouseEvent *> mouseDown;
|
||||
pajlada::Signals::NoArgSignal selectionChanged;
|
||||
|
|
|
@ -527,16 +527,18 @@ void Split::showViewerList()
|
|||
QObject::connect(viewerDock, &QDockWidget::topLevelChanged, this,
|
||||
[=]() { viewerDock->setMinimumWidth(300); });
|
||||
|
||||
QObject::connect(chattersList, &QListWidget::doubleClicked, this, [=]() {
|
||||
if (!labels.contains(chattersList->currentItem()->text())) {
|
||||
showUserInfoPopup(chattersList->currentItem()->text());
|
||||
auto listDoubleClick = [=](QString userName) {
|
||||
if (!labels.contains(userName)) {
|
||||
this->view_->showUserInfoPopup(userName);
|
||||
}
|
||||
};
|
||||
|
||||
QObject::connect(chattersList, &QListWidget::doubleClicked, this, [=]() {
|
||||
listDoubleClick(chattersList->currentItem()->text());
|
||||
});
|
||||
|
||||
QObject::connect(resultList, &QListWidget::doubleClicked, this, [=]() {
|
||||
if (!labels.contains(resultList->currentItem()->text())) {
|
||||
showUserInfoPopup(resultList->currentItem()->text());
|
||||
}
|
||||
listDoubleClick(resultList->currentItem()->text());
|
||||
});
|
||||
|
||||
dockVbox->addWidget(searchBar);
|
||||
|
@ -551,16 +553,6 @@ void Split::showViewerList()
|
|||
viewerDock->show();
|
||||
}
|
||||
|
||||
void Split::showUserInfoPopup(const UserName &user)
|
||||
{
|
||||
auto *userPopup = new UserInfoPopup;
|
||||
userPopup->setData(user.string, this->getChannel());
|
||||
userPopup->setAttribute(Qt::WA_DeleteOnClose);
|
||||
userPopup->move(QCursor::pos() - QPoint(int(150 * this->getScale()),
|
||||
int(70 * this->getScale())));
|
||||
userPopup->show();
|
||||
}
|
||||
|
||||
void Split::copyToClipboard()
|
||||
{
|
||||
QApplication::clipboard()->setText(this->view_->getSelectedText());
|
||||
|
|
|
@ -88,11 +88,6 @@ protected:
|
|||
void focusInEvent(QFocusEvent *event) override;
|
||||
|
||||
private:
|
||||
void showUserInfoPopup(const QString &userName)
|
||||
{
|
||||
this->showUserInfoPopup(UserName{userName});
|
||||
}
|
||||
void showUserInfoPopup(const UserName &user);
|
||||
void channelNameUpdated(const QString &newChannelName);
|
||||
void handleModifiers(Qt::KeyboardModifiers modifiers);
|
||||
|
||||
|
|
Loading…
Reference in a new issue