Fix signal connection nodiscard warnings (#4818)

This commit is contained in:
pajlada
2023-09-16 13:52:51 +02:00
committed by GitHub
parent 2d5f078306
commit 8fe3af3522
40 changed files with 709 additions and 554 deletions
+3 -1
View File
@@ -246,7 +246,9 @@ EmotePopup::EmotePopup(QWidget *parent)
MessageElementFlag::Default, MessageElementFlag::AlwaysShow,
MessageElementFlag::EmoteImages});
view->setEnableScrollingToBottom(false);
view->linkClicked.connect(clicked);
// We can safely ignore this signal connection since the ChannelView is deleted
// either when the notebook is deleted, or when our main layout is deleted.
std::ignore = view->linkClicked.connect(clicked);
if (addToNotebook)
{
+13 -6
View File
@@ -84,9 +84,12 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, QWidget *parent,
this->ui_.threadView->setMinimumSize(400, 100);
this->ui_.threadView->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
this->ui_.threadView->mouseDown.connect([this](QMouseEvent *) {
this->giveFocus(Qt::MouseFocusReason);
});
// We can safely ignore this signal's connection since threadView will always be deleted before
// the ReplyThreadPopup
std::ignore =
this->ui_.threadView->mouseDown.connect([this](QMouseEvent *) {
this->giveFocus(Qt::MouseFocusReason);
});
// Create SplitInput with inline replying disabled
this->ui_.replyInput =
@@ -97,8 +100,10 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, QWidget *parent,
this->updateInputUI();
}));
// clear SplitInput selection when selecting in ChannelView
this->ui_.threadView->selectionChanged.connect([this]() {
// We can safely ignore this signal's connection since threadView will always be deleted before
// the ReplyThreadPopup
std::ignore = this->ui_.threadView->selectionChanged.connect([this]() {
// clear SplitInput selection when selecting in ChannelView
if (this->ui_.replyInput->hasSelection())
{
this->ui_.replyInput->clearSelection();
@@ -106,7 +111,9 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, QWidget *parent,
});
// clear ChannelView selection when selecting in SplitInput
this->ui_.replyInput->selectionChanged.connect([this]() {
// We can safely ignore this signal's connection since replyInput will always be deleted before
// the ReplyThreadPopup
std::ignore = this->ui_.replyInput->selectionChanged.connect([this]() {
if (this->ui_.threadView->hasSelection())
{
this->ui_.threadView->clearSelection();
+3 -1
View File
@@ -170,7 +170,9 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
view->getTableView()->horizontalHeader()->setSectionHidden(4, true);
view->getTableView()->horizontalHeader()->setSectionHidden(5, true);
view->addButtonPressed.connect([] {
// We can safely ignore this signal's connection since the button won't be
// accessible after this dialog is closed
std::ignore = view->addButtonPressed.connect([] {
auto unique = IrcServerData{};
unique.id = Irc::instance().uniqueId();
+18 -11
View File
@@ -438,8 +438,10 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent,
});
// userstate
this->userStateChanged_.connect([this, mod, unmod, vip,
unvip]() mutable {
// We can safely ignore this signal connection since this is a private signal, and
// we only connect once
std::ignore = this->userStateChanged_.connect([this, mod, unmod, vip,
unvip]() mutable {
TwitchChannel *twitchChannel =
dynamic_cast<TwitchChannel *>(this->underlyingChannel_.get());
@@ -469,17 +471,22 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent,
{
auto timeout = moderation.emplace<TimeoutWidget>();
this->userStateChanged_.connect([this, lineMod, timeout]() mutable {
TwitchChannel *twitchChannel =
dynamic_cast<TwitchChannel *>(this->underlyingChannel_.get());
// We can safely ignore this signal connection since this is a private signal, and
// we only connect once
std::ignore =
this->userStateChanged_.connect([this, lineMod, timeout]() mutable {
TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(
this->underlyingChannel_.get());
bool hasModRights =
twitchChannel ? twitchChannel->hasModRights() : false;
lineMod->setVisible(hasModRights);
timeout->setVisible(hasModRights);
});
bool hasModRights =
twitchChannel ? twitchChannel->hasModRights() : false;
lineMod->setVisible(hasModRights);
timeout->setVisible(hasModRights);
});
timeout->buttonClicked.connect([this](auto item) {
// We can safely ignore this signal connection since we own the button, and
// the button will always be destroyed before the UserInfoPopup
std::ignore = timeout->buttonClicked.connect([this](auto item) {
TimeoutWidget::Action action;
int arg;
std::tie(action, arg) = item;