Moved creating UserInfoPopup in one place. (#761)

* Moved creating UserInfoPopup in one place.

* Added forgotten 'this'.

Fixes #759
This commit is contained in:
23rd
2018-10-06 13:13:14 +03:00
committed by pajlada
parent b4683c5b35
commit 9f5da50bce
4 changed files with 21 additions and 31 deletions
+8 -16
View File
@@ -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());