forked from OpenGamers/abaddon
add more granular control over emojis
This commit is contained in:
@@ -184,7 +184,8 @@ For example, memory_db would be set by adding `memory_db = true` under the line
|
|||||||
|
|
||||||
#### gui
|
#### gui
|
||||||
* member_list_discriminator (true or false, default true) - show user discriminators in the member list
|
* member_list_discriminator (true or false, default true) - show user discriminators in the member list
|
||||||
* emojis (true or false, default true) - resolve unicode and custom emojis to images. this needs to be false to allow GTK to render emojis by itself
|
* stock_emojis (true or false, default true) - allow abaddon to substitute unicode emojis with images from emojis.bin, must be false to allow GTK to render emojis itself
|
||||||
|
* custom_emojis (true or false, default true) - download and use custom Discord emojis
|
||||||
* css (string) - path to the main CSS file
|
* css (string) - path to the main CSS file
|
||||||
* animations (true or false, default true) - use animated images where available (e.g. server icons, emojis, avatars). false means static images will be used
|
* animations (true or false, default true) - use animated images where available (e.g. server icons, emojis, avatars). false means static images will be used
|
||||||
* owner_crown (true or false, default true) - show a crown next to the owner
|
* owner_crown (true or false, default true) - show a crown next to the owner
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ ChannelListRowDMChannel::ChannelListRowDMChannel(const ChannelData *data) {
|
|||||||
else if (data->Type == ChannelType::GROUP_DM)
|
else if (data->Type == ChannelType::GROUP_DM)
|
||||||
buf->set_text(std::to_string(recipients.size()) + " users");
|
buf->set_text(std::to_string(recipients.size()) + " users");
|
||||||
|
|
||||||
static bool show_emojis = Abaddon::Get().GetSettings().GetShowEmojis();
|
static bool show_emojis = Abaddon::Get().GetSettings().GetShowStockEmojis();
|
||||||
if (show_emojis)
|
if (show_emojis)
|
||||||
Abaddon::Get().GetEmojis().ReplaceEmojis(buf, ChannelEmojiSize);
|
Abaddon::Get().GetEmojis().ReplaceEmojis(buf, ChannelEmojiSize);
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ ChannelListRowGuild::ChannelListRowGuild(const GuildData *data) {
|
|||||||
Gtk::TextBuffer::iterator start, end;
|
Gtk::TextBuffer::iterator start, end;
|
||||||
buf->get_bounds(start, end);
|
buf->get_bounds(start, end);
|
||||||
buf->insert_markup(start, "<b>" + Glib::Markup::escape_text(data->Name) + "</b>");
|
buf->insert_markup(start, "<b>" + Glib::Markup::escape_text(data->Name) + "</b>");
|
||||||
static bool show_emojis = Abaddon::Get().GetSettings().GetShowEmojis();
|
static bool show_emojis = Abaddon::Get().GetSettings().GetShowStockEmojis();
|
||||||
if (show_emojis)
|
if (show_emojis)
|
||||||
Abaddon::Get().GetEmojis().ReplaceEmojis(buf, ChannelEmojiSize);
|
Abaddon::Get().GetEmojis().ReplaceEmojis(buf, ChannelEmojiSize);
|
||||||
m_box->set_halign(Gtk::ALIGN_START);
|
m_box->set_halign(Gtk::ALIGN_START);
|
||||||
@@ -220,7 +220,7 @@ ChannelListRowCategory::ChannelListRowCategory(const ChannelData *data) {
|
|||||||
|
|
||||||
auto buf = m_lbl->get_buffer();
|
auto buf = m_lbl->get_buffer();
|
||||||
buf->set_text(*data->Name);
|
buf->set_text(*data->Name);
|
||||||
static bool show_emojis = Abaddon::Get().GetSettings().GetShowEmojis();
|
static bool show_emojis = Abaddon::Get().GetSettings().GetShowStockEmojis();
|
||||||
if (show_emojis)
|
if (show_emojis)
|
||||||
Abaddon::Get().GetEmojis().ReplaceEmojis(buf, ChannelEmojiSize);
|
Abaddon::Get().GetEmojis().ReplaceEmojis(buf, ChannelEmojiSize);
|
||||||
m_box->set_halign(Gtk::ALIGN_START);
|
m_box->set_halign(Gtk::ALIGN_START);
|
||||||
@@ -275,7 +275,7 @@ ChannelListRowChannel::ChannelListRowChannel(const ChannelData *data) {
|
|||||||
lbl->get_style_context()->add_class("nsfw");
|
lbl->get_style_context()->add_class("nsfw");
|
||||||
}
|
}
|
||||||
buf->set_text("#" + *data->Name);
|
buf->set_text("#" + *data->Name);
|
||||||
static bool show_emojis = Abaddon::Get().GetSettings().GetShowEmojis();
|
static bool show_emojis = Abaddon::Get().GetSettings().GetShowStockEmojis();
|
||||||
if (show_emojis)
|
if (show_emojis)
|
||||||
Abaddon::Get().GetEmojis().ReplaceEmojis(buf, ChannelEmojiSize);
|
Abaddon::Get().GetEmojis().ReplaceEmojis(buf, ChannelEmojiSize);
|
||||||
ev->add(*lbl);
|
ev->add(*lbl);
|
||||||
|
|||||||
@@ -810,11 +810,11 @@ void ChatMessageItemContainer::HandleCustomEmojis(Gtk::TextView &tv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ChatMessageItemContainer::HandleEmojis(Gtk::TextView &tv) {
|
void ChatMessageItemContainer::HandleEmojis(Gtk::TextView &tv) {
|
||||||
static bool emojis = Abaddon::Get().GetSettings().GetShowEmojis();
|
static const bool stock_emojis = Abaddon::Get().GetSettings().GetShowStockEmojis();
|
||||||
if (emojis) {
|
static const bool custom_emojis = Abaddon::Get().GetSettings().GetShowCustomEmojis();
|
||||||
HandleStockEmojis(tv);
|
|
||||||
HandleCustomEmojis(tv);
|
if (stock_emojis) HandleStockEmojis(tv);
|
||||||
}
|
if (custom_emojis) HandleCustomEmojis(tv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatMessageItemContainer::CleanupEmojis(Glib::RefPtr<Gtk::TextBuffer> buf) {
|
void ChatMessageItemContainer::CleanupEmojis(Glib::RefPtr<Gtk::TextBuffer> buf) {
|
||||||
|
|||||||
@@ -54,8 +54,12 @@ bool SettingsManager::GetShowMemberListDiscriminators() const {
|
|||||||
return GetSettingBool("gui", "member_list_discriminator", true);
|
return GetSettingBool("gui", "member_list_discriminator", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SettingsManager::GetShowEmojis() const {
|
bool SettingsManager::GetShowStockEmojis() const {
|
||||||
return GetSettingBool("gui", "emojis", true);
|
return GetSettingBool("gui", "stock_emojis", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SettingsManager::GetShowCustomEmojis() const {
|
||||||
|
return GetSettingBool("gui", "custom_emojis", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SettingsManager::GetLinkColor() const {
|
std::string SettingsManager::GetLinkColor() const {
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public:
|
|||||||
std::string GetUserAgent() const;
|
std::string GetUserAgent() const;
|
||||||
std::string GetDiscordToken() const;
|
std::string GetDiscordToken() const;
|
||||||
bool GetShowMemberListDiscriminators() const;
|
bool GetShowMemberListDiscriminators() const;
|
||||||
bool GetShowEmojis() const;
|
bool GetShowStockEmojis() const;
|
||||||
|
bool GetShowCustomEmojis() const;
|
||||||
std::string GetLinkColor() const;
|
std::string GetLinkColor() const;
|
||||||
int GetCacheHTTPConcurrency() const;
|
int GetCacheHTTPConcurrency() const;
|
||||||
bool GetPrefetch() const;
|
bool GetPrefetch() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user