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
+2 -1
View File
@@ -33,7 +33,8 @@ AccountsPage::AccountsPage()
view->getTableView()->horizontalHeader()->setVisible(false);
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
view->addButtonPressed.connect([this] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([this] {
LoginDialog d(this);
d.exec();
});
+2 -1
View File
@@ -45,7 +45,8 @@ CommandPage::CommandPage()
view->setTitles({"Trigger", "Command", "Show In\nMessage Menu"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(
1, QHeaderView::Stretch);
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getApp()->commands->items.append(
Command{"/command", "I made a new command HeyGuys"});
});
+2 -1
View File
@@ -44,7 +44,8 @@ FiltersPage::FiltersPage()
view->getTableView()->setColumnWidth(2, 125);
});
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
ChannelFilterEditorDialog d(
static_cast<QWidget *>(&(getApp()->windows->getMainWindow())));
if (d.exec() == QDialog::Accepted)
+11 -7
View File
@@ -195,13 +195,17 @@ ColorButton *GeneralPageView::addColorButton(
auto dialog = new ColorPickerDialog(QColor(setting), this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
dialog->closed.connect([&setting, colorButton](QColor selected) {
if (selected.isValid())
{
setting = selected.name(QColor::HexArgb);
colorButton->setColor(selected);
}
});
// We can safely ignore this signal connection, for now, since the
// colorButton & setting are never deleted and the signal is deleted
// once the dialog is closed
std::ignore = dialog->closed.connect(
[&setting, colorButton](QColor selected) {
if (selected.isValid())
{
setting = selected.name(QColor::HexArgb);
colorButton->setColor(selected);
}
});
});
this->groups_.back().widgets.push_back({label, {text}});
+12 -5
View File
@@ -90,7 +90,8 @@ HighlightingPage::HighlightingPage()
view->getTableView()->setColumnWidth(0, 400);
});
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getSettings()->highlightedMessages.append(HighlightPhrase{
"my phrase", true, true, false, false, false, "",
*ColorProvider::instance().color(
@@ -141,7 +142,8 @@ HighlightingPage::HighlightingPage()
view->getTableView()->setColumnWidth(0, 200);
});
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getSettings()->highlightedUsers.append(HighlightPhrase{
"highlighted user", true, true, false, false, false, "",
*ColorProvider::instance().color(
@@ -182,7 +184,8 @@ HighlightingPage::HighlightingPage()
view->getTableView()->setColumnWidth(0, 200);
});
view->addButtonPressed.connect([this] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([this] {
auto d = std::make_shared<BadgePickerDialog>(
availableBadges, this);
@@ -236,7 +239,8 @@ HighlightingPage::HighlightingPage()
view->getTableView()->setColumnWidth(0, 200);
});
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getSettings()->blacklistedUsers.append(
HighlightBlacklistUser{"blacklisted user", false});
});
@@ -329,7 +333,10 @@ void HighlightingPage::openColorDialog(const QModelIndex &clicked,
auto dialog = new ColorPickerDialog(initial, this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
dialog->closed.connect([=](auto selected) {
// We can safely ignore this signal connection since the view and tab are never deleted
// TODO: The QModelIndex clicked is technically not safe to persist here since the model
// can be changed between the color dialog being created & the color dialog being closed
std::ignore = dialog->closed.connect([=](auto selected) {
if (selected.isValid())
{
view->getModel()->setData(clicked, selected, Qt::DecorationRole);
+2 -1
View File
@@ -63,7 +63,8 @@ void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
view->getTableView()->setColumnWidth(0, 200);
});
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getSettings()->ignoredMessages.append(
IgnorePhrase{"my pattern", false, false,
getSettings()->ignoredPhraseReplace.getValue(), true});
@@ -34,7 +34,8 @@ KeyboardSettingsPage::KeyboardSettingsPage()
view->getTableView()->horizontalHeader()->setSectionResizeMode(
1, QHeaderView::Stretch);
view->addButtonPressed.connect([view, model] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([view, model] {
EditHotkeyDialog dialog(nullptr);
bool wasAccepted = dialog.exec() == 1;
+4 -2
View File
@@ -169,7 +169,8 @@ ModerationPage::ModerationPage()
view->getTableView()->horizontalHeader()->setSectionResizeMode(
0, QHeaderView::Stretch);
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getSettings()->loggedChannels.append(ChannelLog("channel"));
});
@@ -209,7 +210,8 @@ ModerationPage::ModerationPage()
view->getTableView()->horizontalHeader()->setSectionResizeMode(
0, QHeaderView::Stretch);
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getSettings()->moderationActions.append(
ModerationAction("/timeout {user.name} 300"));
});
+2 -1
View File
@@ -36,7 +36,8 @@ NicknamesPage::NicknamesPage()
view->getTableView()->horizontalHeader()->setSectionResizeMode(
1, QHeaderView::Stretch);
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getSettings()->nicknames.append(
Nickname{"Username", "Nickname", false, false});
});
@@ -109,7 +109,8 @@ NotificationPage::NotificationPage()
view->getTableView()->setColumnWidth(0, 200);
});
view->addButtonPressed.connect([] {
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getApp()
->notifications->channelMap[Platform::Twitch]
.append("channel");