diff options
Diffstat (limited to 'src/windows/guildsettings')
-rw-r--r-- | src/windows/guildsettings/auditlogpane.cpp | 90 | ||||
-rw-r--r-- | src/windows/guildsettings/banspane.cpp | 4 | ||||
-rw-r--r-- | src/windows/guildsettings/emojispane.cpp | 12 | ||||
-rw-r--r-- | src/windows/guildsettings/infopane.cpp | 8 | ||||
-rw-r--r-- | src/windows/guildsettings/invitespane.cpp | 4 | ||||
-rw-r--r-- | src/windows/guildsettings/memberspane.cpp | 12 | ||||
-rw-r--r-- | src/windows/guildsettings/rolespane.cpp | 12 |
7 files changed, 70 insertions, 72 deletions
diff --git a/src/windows/guildsettings/auditlogpane.cpp b/src/windows/guildsettings/auditlogpane.cpp index 08f99da..868a18f 100644 --- a/src/windows/guildsettings/auditlogpane.cpp +++ b/src/windows/guildsettings/auditlogpane.cpp @@ -30,7 +30,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { auto &discord = Abaddon::Get().GetDiscordClient(); auto guild = *discord.GetGuild(GuildID); for (const auto &entry : data.Entries) { - if (entry.TargetID == "") continue; + if (entry.TargetID.empty()) continue; auto expander = Gtk::manage(new Gtk::Expander); auto label = Gtk::manage(new Gtk::Label); @@ -56,7 +56,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { if (entry.Changes.has_value()) for (const auto &change : *entry.Changes) { if (change.Key == "icon_hash") { - extra_markup.push_back("Set the server icon"); + extra_markup.emplace_back("Set the server icon"); } else if (change.Key == "name") { auto new_name = change.NewValue; if (new_name.has_value()) @@ -64,7 +64,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { Glib::Markup::escape_text(new_name->get<std::string>()) + "</b>"); else - extra_markup.push_back("Set the server name"); + extra_markup.emplace_back("Set the server name"); } } } break; @@ -82,8 +82,8 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { Glib::Markup::escape_text(change.NewValue->get<std::string>()) + "</b>"); else if (change.Key == "nsfw" && change.NewValue.has_value()) - extra_markup.push_back((*change.NewValue ? "Marked" : "Unmarked") + - " the channel as NSFW"s); + extra_markup.emplace_back((*change.NewValue ? "Marked" : "Unmarked") + + " the channel as NSFW"s); } } break; @@ -119,16 +119,16 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { Glib::Markup::escape_text(change.NewValue->get<std::string>()) + "</b>"); else - extra_markup.push_back("Cleared the topic"); + extra_markup.emplace_back("Cleared the topic"); } else if (change.Key == "nsfw" && change.NewValue.has_value()) { - extra_markup.push_back((*change.NewValue ? "Marked" : "Unmarked") + " the channel as NSFW"s); + extra_markup.emplace_back((*change.NewValue ? "Marked" : "Unmarked") + " the channel as NSFW"s); } else if (change.Key == "rate_limit_per_user" && change.NewValue.has_value()) { const int secs = change.NewValue->get<int>(); if (secs == 0) - extra_markup.push_back("Disabled slowmode"); + extra_markup.emplace_back("Disabled slowmode"); else - extra_markup.push_back("Set slowmode to <b>" + - std::to_string(secs) + " seconds</b>"); + extra_markup.emplace_back("Set slowmode to <b>" + + std::to_string(secs) + " seconds</b>"); } } } break; @@ -186,9 +186,9 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { " pruned <b>" + *entry.Options->MembersRemoved + "</b> members"; - extra_markup.push_back("For <b>" + - *entry.Options->DeleteMemberDays + - " days</b> of inactivity"); + extra_markup.emplace_back("For <b>" + + *entry.Options->DeleteMemberDays + + " days</b> of inactivity"); } break; case AuditLogActionType::MEMBER_BAN_ADD: { const auto target_user = discord.GetUser(entry.TargetID); @@ -213,13 +213,11 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { if (entry.Changes.has_value()) for (const auto &change : *entry.Changes) { if (change.Key == "deaf" && change.NewValue.has_value()) - extra_markup.push_back( - (change.NewValue->get<bool>() ? "<b>Deafened</b>"s : "<b>Undeafened</b>"s) + - " them"); + extra_markup.emplace_back((change.NewValue->get<bool>() ? "<b>Deafened</b>"s : "<b>Undeafened</b>"s) + + " them"); else if (change.Key == "mute" && change.NewValue.has_value()) - extra_markup.push_back( - (change.NewValue->get<bool>() ? "<b>Muted</b>"s : "<b>Unmuted</b>"s) + - " them"); + extra_markup.emplace_back((change.NewValue->get<bool>() ? "<b>Muted</b>"s : "<b>Unmuted</b>"s) + + " them"); else if (change.Key == "nick" && change.NewValue.has_value()) extra_markup.push_back("Set their nickname to <b>" + Glib::Markup::escape_text(change.NewValue->get<std::string>()) + @@ -289,17 +287,17 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { } else if (change.Key == "color" && change.NewValue.has_value()) { const auto col = change.NewValue->get<int>(); if (col == 0) - extra_markup.push_back("Removed the color"); + extra_markup.emplace_back("Removed the color"); else - extra_markup.push_back("Set the color to <b>" + - IntToCSSColor(col) + - "</b>"); + extra_markup.emplace_back("Set the color to <b>" + + IntToCSSColor(col) + + "</b>"); } else if (change.Key == "permissions") { - extra_markup.push_back("Updated the permissions"); + extra_markup.emplace_back("Updated the permissions"); } else if (change.Key == "mentionable" && change.NewValue.has_value()) { - extra_markup.push_back(change.NewValue->get<bool>() ? "Mentionable" : "Not mentionable"); + extra_markup.emplace_back(change.NewValue->get<bool>() ? "Mentionable" : "Not mentionable"); } else if (change.Key == "hoist" && change.NewValue.has_value()) { - extra_markup.push_back(change.NewValue->get<bool>() ? "Not hoisted" : "Hoisted"); + extra_markup.emplace_back(change.NewValue->get<bool>() ? "Not hoisted" : "Hoisted"); } } } break; @@ -324,13 +322,13 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { } else if (change.Key == "max_uses" && change.NewValue.has_value()) { const auto uses = change.NewValue->get<int>(); if (uses == 0) - extra_markup.push_back("Which has <b>unlimited</b> uses"); + extra_markup.emplace_back("Which has <b>unlimited</b> uses"); else - extra_markup.push_back("Which has <b>" + std::to_string(uses) + "</b> uses"); + extra_markup.emplace_back("Which has <b>" + std::to_string(uses) + "</b> uses"); } else if (change.Key == "temporary" && change.NewValue.has_value()) { - extra_markup.push_back("With temporary <b>"s + - (change.NewValue->get<bool>() ? "on" : "off") + - "</b>"); + extra_markup.emplace_back("With temporary <b>"s + + (change.NewValue->get<bool>() ? "on" : "off") + + "</b>"); } // no max_age cuz fuck time } } break; @@ -378,7 +376,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { Glib::Markup::escape_text(change.NewValue->get<std::string>()) + "</b>"); } else if (change.Key == "avatar_hash") { - extra_markup.push_back("Changed the avatar"); + extra_markup.emplace_back("Changed the avatar"); } else if (change.Key == "channel_id" && change.NewValue.has_value()) { const auto channel = discord.GetChannel(change.NewValue->get<Snowflake>()); if (channel.has_value()) { @@ -386,7 +384,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { Glib::Markup::escape_text(*channel->Name) + "</b>"); } else { - extra_markup.push_back("Changed the channel"); + extra_markup.emplace_back("Changed the channel"); } } } @@ -552,18 +550,18 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { if (change.Key == "name") extra_markup.push_back("Set the name to <b>" + Glib::Markup::escape_text(change.NewValue->get<std::string>()) + "</b>"); else if (change.Key == "archived") - extra_markup.push_back(change.NewValue->get<bool>() ? "Archived the thread" : "Unarchived the thread"); + extra_markup.emplace_back(change.NewValue->get<bool>() ? "Archived the thread" : "Unarchived the thread"); else if (change.Key == "auto_archive_duration") - extra_markup.push_back("Set auto archive duration to <b>"s + std::to_string(change.NewValue->get<int>()) + " minutes</b>"s); + extra_markup.emplace_back("Set auto archive duration to <b>"s + std::to_string(change.NewValue->get<int>()) + " minutes</b>"s); else if (change.Key == "rate_limit_per_user" && change.NewValue.has_value()) { const int secs = change.NewValue->get<int>(); if (secs == 0) - extra_markup.push_back("Disabled slowmode"); + extra_markup.emplace_back("Disabled slowmode"); else - extra_markup.push_back("Set slowmode to <b>" + - std::to_string(secs) + " seconds</b>"); + extra_markup.emplace_back("Set slowmode to <b>" + + std::to_string(secs) + " seconds</b>"); } else if (change.Key == "locked") - extra_markup.push_back(change.NewValue->get<bool>() ? "Locked the thread, restricting it to only be unarchived by moderators" : "Unlocked the thread, allowing it to be unarchived by non-moderators"); + extra_markup.emplace_back(change.NewValue->get<bool>() ? "Locked the thread, restricting it to only be unarchived by moderators" : "Unlocked the thread, allowing it to be unarchived by non-moderators"); } } } break; @@ -584,19 +582,19 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) { Glib::Markup::escape_text(change.NewValue->get<std::string>()) + "</b>"); else if (change.Key == "auto_archive_duration") - extra_markup.push_back("Set auto archive duration to <b>"s + std::to_string(change.NewValue->get<int>()) + " minutes</b>"s); + extra_markup.emplace_back("Set auto archive duration to <b>"s + std::to_string(change.NewValue->get<int>()) + " minutes</b>"s); else if (change.Key == "rate_limit_per_user" && change.NewValue.has_value()) { const int secs = change.NewValue->get<int>(); if (secs == 0) - extra_markup.push_back("Disabled slowmode"); + extra_markup.emplace_back("Disabled slowmode"); else - extra_markup.push_back("Set slowmode to <b>" + - std::to_string(secs) + - " seconds</b>"); + extra_markup.emplace_back("Set slowmode to <b>" + + std::to_string(secs) + + " seconds</b>"); } else if (change.Key == "locked") - extra_markup.push_back(change.NewValue->get<bool>() ? "Locked the thread, restricting it to only be unarchived by moderators" : "Unlocked the thread, allowing it to be unarchived by non-moderators"); + extra_markup.emplace_back(change.NewValue->get<bool>() ? "Locked the thread, restricting it to only be unarchived by moderators" : "Unlocked the thread, allowing it to be unarchived by non-moderators"); else if (change.Key == "archived") - extra_markup.push_back(change.NewValue->get<bool>() ? "Archived the thread" : "Unarchived the thread"); + extra_markup.emplace_back(change.NewValue->get<bool>() ? "Archived the thread" : "Unarchived the thread"); } } break; case AuditLogActionType::THREAD_DELETE: { diff --git a/src/windows/guildsettings/banspane.cpp b/src/windows/guildsettings/banspane.cpp index 97a70c4..d4b002c 100644 --- a/src/windows/guildsettings/banspane.cpp +++ b/src/windows/guildsettings/banspane.cpp @@ -94,7 +94,7 @@ void GuildSettingsBansPane::OnMenuUnban() { auto selected_row = *m_view.get_selection()->get_selected(); if (selected_row) { Snowflake id = selected_row[m_columns.m_col_id]; - auto cb = [this](DiscordError code) { + auto cb = [](DiscordError code) { if (code != DiscordError::NONE) { Gtk::MessageDialog dlg("Failed to unban user", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); dlg.set_position(Gtk::WIN_POS_CENTER); @@ -119,7 +119,7 @@ bool GuildSettingsBansPane::OnTreeButtonPress(GdkEventButton *event) { m_menu_unban.set_sensitive(can_ban); auto selection = m_view.get_selection(); Gtk::TreeModel::Path path; - if (m_view.get_path_at_pos(event->x, event->y, path)) { + if (m_view.get_path_at_pos(static_cast<int>(event->x), static_cast<int>(event->y), path)) { m_view.get_selection()->select(path); m_menu.popup_at_pointer(reinterpret_cast<GdkEvent *>(event)); } diff --git a/src/windows/guildsettings/emojispane.cpp b/src/windows/guildsettings/emojispane.cpp index 57b697c..bdab6b8 100644 --- a/src/windows/guildsettings/emojispane.cpp +++ b/src/windows/guildsettings/emojispane.cpp @@ -52,7 +52,7 @@ GuildSettingsEmojisPane::GuildSettingsEmojisPane(Snowflake guild_id) m_filter->set_visible_func([this](const Gtk::TreeModel::const_iterator &iter) -> bool { const auto text = m_search.get_text(); - if (text == "") return true; + if (text.empty()) return true; return StringContainsCaseless((*iter)[m_columns.m_col_name], text); }); m_view.set_enable_search(false); @@ -71,12 +71,12 @@ GuildSettingsEmojisPane::GuildSettingsEmojisPane(Snowflake guild_id) column->pack_start(*renderer); column->add_attribute(renderer->property_text(), m_columns.m_col_name); renderer->property_editable() = true; - renderer->signal_edited().connect([this, renderer, column](const Glib::ustring &path, const Glib::ustring &text) { + renderer->signal_edited().connect([this](const Glib::ustring &path, const Glib::ustring &text) { std::string new_str; int size = 0; for (const auto ch : text) { if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || ch == '_') - new_str += ch; + new_str += static_cast<char>(ch); else if (ch == ' ') new_str += '_'; if (++size == 32) break; @@ -174,7 +174,7 @@ void GuildSettingsEmojisPane::OnFetchEmojis(std::vector<EmojiData> emojis) { } void GuildSettingsEmojisPane::OnEditName(Snowflake id, const std::string &name) { - const auto cb = [this](DiscordError code) { + const auto cb = [](DiscordError code) { if (code != DiscordError::NONE) { Gtk::MessageDialog dlg("Failed to set emoji name", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK); dlg.set_position(Gtk::WIN_POS_CENTER); @@ -197,7 +197,7 @@ void GuildSettingsEmojisPane::OnMenuDelete() { const auto id = static_cast<Snowflake>(selected_row[m_columns.m_col_id]); if (auto *window = dynamic_cast<Gtk::Window *>(get_toplevel())) if (Abaddon::Get().ShowConfirm("Are you sure you want to delete " + name + "?", window)) { - const auto cb = [this](DiscordError code) { + const auto cb = [](DiscordError code) { if (code != DiscordError::NONE) { Gtk::MessageDialog dlg("Failed to delete emoji", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK); dlg.set_position(Gtk::WIN_POS_CENTER); @@ -234,7 +234,7 @@ bool GuildSettingsEmojisPane::OnTreeButtonPress(GdkEventButton *event) { auto selection = m_view.get_selection(); Gtk::TreeModel::Path path; - if (m_view.get_path_at_pos(event->x, event->y, path)) { + if (m_view.get_path_at_pos(static_cast<int>(event->x), static_cast<int>(event->y), path)) { m_view.get_selection()->select(path); m_menu.popup_at_pointer(reinterpret_cast<GdkEvent *>(event)); } diff --git a/src/windows/guildsettings/infopane.cpp b/src/windows/guildsettings/infopane.cpp index 9ef116f..bccfbf8 100644 --- a/src/windows/guildsettings/infopane.cpp +++ b/src/windows/guildsettings/infopane.cpp @@ -60,7 +60,7 @@ GuildSettingsInfoPane::GuildSettingsInfoPane(Snowflake id) guild_icon_url = guild.GetIconURL("gif", "512"); else guild_icon_url = guild.GetIconURL("png", "512"); - m_guild_icon_ev.signal_button_press_event().connect([this, guild_icon_url](GdkEventButton *event) -> bool { + m_guild_icon_ev.signal_button_press_event().connect([guild_icon_url](GdkEventButton *event) -> bool { if (event->type == GDK_BUTTON_PRESS) if (event->button == GDK_BUTTON_PRIMARY) LaunchBrowser(guild_icon_url); @@ -114,7 +114,7 @@ void GuildSettingsInfoPane::UpdateGuildIconFromData(const std::vector<uint8_t> & auto encoded = "data:" + mime + ";base64," + Glib::Base64::encode(std::string(data.begin(), data.end())); auto &discord = Abaddon::Get().GetDiscordClient(); - auto cb = [this](DiscordError code) { + auto cb = [](DiscordError code) { if (code != DiscordError::NONE) { Gtk::MessageDialog dlg("Failed to set guild icon", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); dlg.set_position(Gtk::WIN_POS_CENTER); @@ -160,7 +160,7 @@ void GuildSettingsInfoPane::UpdateGuildIconPicker() { loader->write(data.data(), data.size()); loader->close(); UpdateGuildIconFromPixbuf(loader->get_pixbuf()); - } catch (const std::exception &) {}; + } catch (const std::exception &) {} } }); @@ -209,7 +209,7 @@ void GuildSettingsInfoPane::UpdateGuildIconClipboard() { UpdateGuildIconFromPixbuf(pb); return; - } catch (const std::exception &) {}; + } catch (const std::exception &) {} } if (cb->wait_is_image_available()) { diff --git a/src/windows/guildsettings/invitespane.cpp b/src/windows/guildsettings/invitespane.cpp index bec4784..2d737e9 100644 --- a/src/windows/guildsettings/invitespane.cpp +++ b/src/windows/guildsettings/invitespane.cpp @@ -96,7 +96,7 @@ void GuildSettingsInvitesPane::OnMenuDelete() { auto selected_row = *m_view.get_selection()->get_selected(); if (selected_row) { auto code = static_cast<Glib::ustring>(selected_row[m_columns.m_col_code]); - auto cb = [this](DiscordError code) { + auto cb = [](DiscordError code) { if (code != DiscordError::NONE) { Gtk::MessageDialog dlg("Failed to delete invite", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); dlg.set_position(Gtk::WIN_POS_CENTER); @@ -115,7 +115,7 @@ bool GuildSettingsInvitesPane::OnTreeButtonPress(GdkEventButton *event) { m_menu_delete.set_sensitive(can_manage); auto selection = m_view.get_selection(); Gtk::TreeModel::Path path; - if (m_view.get_path_at_pos(event->x, event->y, path)) { + if (m_view.get_path_at_pos(static_cast<int>(event->x), static_cast<int>(event->y), path)) { m_view.get_selection()->select(path); m_menu.popup_at_pointer(reinterpret_cast<GdkEvent *>(event)); } diff --git a/src/windows/guildsettings/memberspane.cpp b/src/windows/guildsettings/memberspane.cpp index bda92b4..34650ad 100644 --- a/src/windows/guildsettings/memberspane.cpp +++ b/src/windows/guildsettings/memberspane.cpp @@ -64,7 +64,7 @@ GuildSettingsMembersPaneMembers::GuildSettingsMembersPaneMembers(Snowflake id) m_list.set_filter_func([this](Gtk::ListBoxRow *row_) -> bool { const auto search_term = m_search.get_text(); - if (search_term.size() == 0) return true; + if (search_term.empty()) return true; if (auto *row = dynamic_cast<GuildSettingsMembersListItem *>(row_)) return StringContainsCaseless(row->DisplayTerm, m_search.get_text()); return true; @@ -208,12 +208,12 @@ void GuildSettingsMembersPaneInfo::SetUser(Snowflake user_id) { m_id.set_text("User ID: " + std::to_string(user_id)); m_created.set_text("Account created: " + user_id.GetLocalTimestamp()); - if (member.JoinedAt != "") + if (!member.JoinedAt.empty()) m_joined.set_text("Joined server: " + FormatISO8601(member.JoinedAt)); else m_joined.set_text("Joined server: Unknown"); m_nickname.set_text("Nickname: " + member.Nickname); - m_nickname.set_visible(member.Nickname != ""); + m_nickname.set_visible(!member.Nickname.empty()); if (member.PremiumSince.has_value()) { m_boosting.set_text("Boosting since " + FormatISO8601(*member.PremiumSince)); m_boosting.show(); @@ -244,7 +244,7 @@ GuildSettingsMembersPaneRoles::GuildSettingsMembersPaneRoles(Snowflake guild_id) } } - m_list.set_sort_func([this](Gtk::ListBoxRow *a, Gtk::ListBoxRow *b) -> int { + m_list.set_sort_func([](Gtk::ListBoxRow *a, Gtk::ListBoxRow *b) -> int { auto *rowa = dynamic_cast<GuildSettingsMembersPaneRolesItem *>(a); auto *rowb = dynamic_cast<GuildSettingsMembersPaneRolesItem *>(b); return rowb->Position - rowa->Position; @@ -319,8 +319,8 @@ void GuildSettingsMembersPaneRoles::OnRoleToggle(Snowflake role_id, bool new_set // hack to prevent cb from being called if SetRoles is called before callback completion sigc::signal<void, bool> tmp; - m_update_connection.push_back(tmp.connect(std::move(cb))); - const auto tmp_cb = [this, tmp = std::move(tmp)](DiscordError code) { tmp.emit(code == DiscordError::NONE); }; + m_update_connection.emplace_back(tmp.connect(std::move(cb))); + const auto tmp_cb = [tmp = std::move(tmp)](DiscordError code) { tmp.emit(code == DiscordError::NONE); }; discord.SetMemberRoles(GuildID, UserID, m_set_role_ids.begin(), m_set_role_ids.end(), sigc::track_obj(tmp_cb, *this)); } diff --git a/src/windows/guildsettings/rolespane.cpp b/src/windows/guildsettings/rolespane.cpp index 3567e95..d4fa7c0 100644 --- a/src/windows/guildsettings/rolespane.cpp +++ b/src/windows/guildsettings/rolespane.cpp @@ -61,14 +61,14 @@ GuildSettingsRolesPaneRoles::GuildSettingsRolesPaneRoles(Snowflake guild_id) if (static_cast<size_t>(new_index) == num_rows) return true; // trying to move row below @everyone // make sure it wont modify a neighbor role u dont have perms to modify if (!discord.CanModifyRole(GuildID, row->RoleID)) return false; - const auto cb = [this](DiscordError code) { + const auto cb = [](DiscordError code) { if (code != DiscordError::NONE) { Gtk::MessageDialog dlg("Failed to set role position", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); dlg.set_position(Gtk::WIN_POS_CENTER_ON_PARENT); dlg.run(); } }; - discord.ModifyRolePosition(GuildID, row->RoleID, new_pos, sigc::track_obj(cb, *this)); + discord.ModifyRolePosition(GuildID, row->RoleID, static_cast<int>(new_pos), sigc::track_obj(cb, *this)); return true; } return false; @@ -95,7 +95,7 @@ GuildSettingsRolesPaneRoles::GuildSettingsRolesPaneRoles(Snowflake guild_id) } } - m_list.set_sort_func([this](Gtk::ListBoxRow *rowa_, Gtk::ListBoxRow *rowb_) -> int { + m_list.set_sort_func([](Gtk::ListBoxRow *rowa_, Gtk::ListBoxRow *rowb_) -> int { auto *rowa = dynamic_cast<GuildSettingsRolesPaneRolesListItem *>(rowa_); auto *rowb = dynamic_cast<GuildSettingsRolesPaneRolesListItem *>(rowb_); return rowb->Position - rowa->Position; @@ -104,7 +104,7 @@ GuildSettingsRolesPaneRoles::GuildSettingsRolesPaneRoles(Snowflake guild_id) m_list.set_filter_func([this](Gtk::ListBoxRow *row_) -> bool { const auto search_term = m_search.get_text(); - if (search_term.size() == 0) return true; + if (search_term.empty()) return true; if (auto *row = dynamic_cast<GuildSettingsRolesPaneRolesListItem *>(row_)) return StringContainsCaseless(row->DisplayTerm, m_search.get_text()); return true; @@ -380,8 +380,8 @@ void GuildSettingsRolesPaneInfo::OnPermissionToggle(Permission perm, bool new_se m_perms &= ~perm; sigc::signal<void, bool> tmp; - m_update_connections.push_back(tmp.connect(std::move(cb))); - const auto tmp_cb = [this, tmp = std::move(tmp)](DiscordError code) { tmp.emit(code == DiscordError::NONE); }; + m_update_connections.emplace_back(tmp.connect(std::move(cb))); + const auto tmp_cb = [tmp = std::move(tmp)](DiscordError code) { tmp.emit(code == DiscordError::NONE); }; discord.ModifyRolePermissions(GuildID, RoleID, m_perms, sigc::track_obj(tmp_cb, *this)); } |