remove dumb template stuff
This commit is contained in:
@@ -301,7 +301,7 @@ void ChatWindow::StartReplying(Snowflake message_id) {
|
||||
m_is_replying = true;
|
||||
m_input->StartReplying();
|
||||
if (author.has_value())
|
||||
m_input_indicator->SetCustomMarkup("Replying to " + author->GetUsernameEscapedBold<false>());
|
||||
m_input_indicator->SetCustomMarkup("Replying to " + author->GetUsernameEscapedBold());
|
||||
else
|
||||
m_input_indicator->SetCustomMarkup("Replying...");
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ FriendPickerDialogItem::FriendPickerDialogItem(Snowflake user_id)
|
||||
, m_layout(Gtk::ORIENTATION_HORIZONTAL) {
|
||||
auto user = *Abaddon::Get().GetDiscordClient().GetUser(user_id);
|
||||
|
||||
m_name.set_markup(user.GetUsernameEscapedBold<false>());
|
||||
m_name.set_markup(user.GetUsernameEscapedBold());
|
||||
m_name.set_single_line_mode(true);
|
||||
|
||||
m_avatar.property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(32);
|
||||
|
@@ -89,14 +89,6 @@ std::string UserData::GetDisplayName() const {
|
||||
return Username;
|
||||
}
|
||||
|
||||
std::string UserData::GetUsername() const {
|
||||
if (IsPomelo()) {
|
||||
return Username;
|
||||
}
|
||||
|
||||
return Username + "#" + Discriminator;
|
||||
}
|
||||
|
||||
std::string UserData::GetDisplayNameEscaped() const {
|
||||
return Glib::Markup::escape_text(GetDisplayName());
|
||||
}
|
||||
@@ -105,11 +97,34 @@ std::string UserData::GetDisplayNameEscapedBold() const {
|
||||
return "<b>" + Glib::Markup::escape_text(GetDisplayName()) + "</b>";
|
||||
}
|
||||
|
||||
std::string UserData::GetUsername() const {
|
||||
if (IsPomelo()) {
|
||||
return Username;
|
||||
}
|
||||
|
||||
return Username + "#" + Discriminator;
|
||||
}
|
||||
|
||||
std::string UserData::GetUsernameEscaped() const {
|
||||
if (IsPomelo()) {
|
||||
return GetDisplayNameEscaped();
|
||||
return Glib::Markup::escape_text(Username);
|
||||
}
|
||||
return Glib::Markup::escape_text(GetDisplayName()) + "#" + Discriminator;
|
||||
|
||||
return Glib::Markup::escape_text(Username) + "#" + Discriminator;
|
||||
}
|
||||
|
||||
std::string UserData::GetUsernameEscapedBold() const {
|
||||
if (IsPomelo()) {
|
||||
return "<b>" + Glib::Markup::escape_text(Username) + "</b>";
|
||||
}
|
||||
return "<b>" + Glib::Markup::escape_text(Username) + "</b>#" + Discriminator;
|
||||
}
|
||||
|
||||
std::string UserData::GetUsernameEscapedBoldAt() const {
|
||||
if (IsPomelo()) {
|
||||
return "<b>@" + Glib::Markup::escape_text(Username) + "</b>";
|
||||
}
|
||||
return "<b>@" + Glib::Markup::escape_text(Username) + "</b>#" + Discriminator;
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &j, UserData &m) {
|
||||
|
@@ -84,17 +84,6 @@ struct UserData {
|
||||
[[nodiscard]] std::string GetDisplayNameEscapedBold() const;
|
||||
[[nodiscard]] std::string GetUsername() const;
|
||||
[[nodiscard]] std::string GetUsernameEscaped() const;
|
||||
template<bool with_at>
|
||||
[[nodiscard]] inline std::string GetUsernameEscapedBold() const {
|
||||
// stupid microoptimization (nanooptimization) that shouldnt exist
|
||||
if constexpr (with_at) {
|
||||
std::string r = "<b>@" + Glib::Markup::escape_text(Username) + "</b>";
|
||||
if (!IsPomelo()) r += "#" + Discriminator;
|
||||
return r;
|
||||
} else {
|
||||
std::string r = "<b>" + Glib::Markup::escape_text(Username) + "</b>";
|
||||
if (!IsPomelo()) r += "#" + Discriminator;
|
||||
return r;
|
||||
}
|
||||
}
|
||||
[[nodiscard]] std::string GetUsernameEscapedBold() const;
|
||||
[[nodiscard]] std::string GetUsernameEscapedBoldAt() const;
|
||||
};
|
||||
|
@@ -76,15 +76,15 @@ void HandleUserMentions(const Glib::RefPtr<Gtk::TextBuffer> &buf, Snowflake chan
|
||||
if (plain) {
|
||||
replacement = "@" + user->GetUsername();
|
||||
} else {
|
||||
replacement = user->GetUsernameEscapedBold<true>();
|
||||
replacement = user->GetUsernameEscapedBoldAt();
|
||||
}
|
||||
} else {
|
||||
const auto role_id = user->GetHoistedRole(*channel->GuildID, true);
|
||||
const auto role = discord.GetRole(role_id);
|
||||
if (!role.has_value())
|
||||
replacement = user->GetUsernameEscapedBold<true>();
|
||||
replacement = user->GetUsernameEscapedBoldAt();
|
||||
else
|
||||
replacement = "<span color=\"#" + IntToCSSColor(role->Color) + "\">" + user->GetUsernameEscapedBold<true>() + "</span>";
|
||||
replacement = "<span color=\"#" + IntToCSSColor(role->Color) + "\">" + user->GetUsernameEscapedBoldAt() + "</span>";
|
||||
}
|
||||
|
||||
// regex returns byte positions and theres no straightforward way in the c++ bindings to deal with that :(
|
||||
|
@@ -38,7 +38,7 @@ void GuildSettingsAuditLogPane::OnAuditLogFetch(const AuditLogData &data) {
|
||||
Glib::ustring user_markup = "<b>Unknown User</b>";
|
||||
if (entry.UserID.has_value()) {
|
||||
if (auto user = discord.GetUser(*entry.UserID); user.has_value())
|
||||
user_markup = discord.GetUser(*entry.UserID)->GetUsernameEscapedBold<false>();
|
||||
user_markup = discord.GetUser(*entry.UserID)->GetUsernameEscapedBold();
|
||||
}
|
||||
|
||||
// spaghetti moment
|
||||
|
@@ -150,9 +150,9 @@ void GuildSettingsMembersListItem::UpdateColor() {
|
||||
const auto user = *discord.GetUser(UserID);
|
||||
if (auto color_id = discord.GetMemberHoistedRole(GuildID, UserID, true); color_id.IsValid()) {
|
||||
auto role = *discord.GetRole(color_id);
|
||||
m_name.set_markup("<span color='#" + IntToCSSColor(role.Color) + "'>" + user.GetUsernameEscapedBold<false>() + "</span>");
|
||||
m_name.set_markup("<span color='#" + IntToCSSColor(role.Color) + "'>" + user.GetUsernameEscapedBold() + "</span>");
|
||||
} else
|
||||
m_name.set_markup(user.GetUsernameEscapedBold<false>());
|
||||
m_name.set_markup(user.GetUsernameEscapedBold());
|
||||
}
|
||||
|
||||
GuildSettingsMembersPaneInfo::GuildSettingsMembersPaneInfo(Snowflake guild_id)
|
||||
|
@@ -22,7 +22,7 @@ MutualFriendItem::MutualFriendItem(const UserData &user)
|
||||
img.LoadFromURL(user.GetAvatarURL("png", "32"), sigc::track_obj(cb, *this));
|
||||
}
|
||||
|
||||
m_name.set_markup(user.GetUsernameEscapedBold<false>());
|
||||
m_name.set_markup(user.GetUsernameEscapedBold());
|
||||
|
||||
m_name.set_valign(Gtk::ALIGN_CENTER);
|
||||
add(m_avatar);
|
||||
|
Reference in New Issue
Block a user