From dfd642bb82d2998cc563f0f401f2d522632692c1 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 20 Jan 2022 01:34:36 -0500 Subject: show unread indicators for threads --- src/components/channelscellrenderer.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index 4578020..fa7880f 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -438,7 +438,39 @@ void CellRendererChannels::render_vfunc_thread(const Cairo::RefPtrset_source_rgb(1.0, 1.0, 1.0); + const auto x = background_area.get_x(); + const auto y = background_area.get_y(); + const auto w = background_area.get_width(); + const auto h = background_area.get_height(); + cr->rectangle(x, y, 3, h); + cr->fill(); + } + + if (unread_state < 1) return; + auto *paned = static_cast(widget.get_ancestor(Gtk::Paned::get_type())); + if (paned != nullptr) { + const auto edge = std::min(paned->get_position(), cell_area.get_width()); + + unread_render_mentions(cr, widget, unread_state, edge, cell_area); + } } // dm header -- cgit v1.2.3 From 0ce509f80e238f7ffe14623761269aba8295c0f4 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 21 Jan 2022 00:41:35 -0500 Subject: add settings for some colors --- src/components/channelscellrenderer.cpp | 53 +++++++++++++++++++++++++-------- src/settings.cpp | 6 ++++ src/settings.hpp | 5 +++- 3 files changed, 50 insertions(+), 14 deletions(-) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index fa7880f..a914d59 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -214,6 +214,8 @@ void CellRendererChannels::render_vfunc_guild(const Cairo::RefPtr & const auto id = m_property_id.get_value(); const bool is_muted = discord.IsChannelMuted(id); - if (is_muted) - m_renderer_text.property_foreground() = "#7f7f7f"; + static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelColor); + if (Abaddon::Get().GetDiscordClient().IsChannelMuted(m_property_id.get_value())) { + auto muted = color; + muted.set_red(muted.get_red() * 0.5); + muted.set_green(muted.get_green() * 0.5); + muted.set_blue(muted.get_blue() * 0.5); + m_renderer_text.property_foreground_rgba() = muted; + } else { + m_renderer_text.property_foreground_rgba() = color; + } m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); m_renderer_text.property_foreground_set() = false; @@ -617,12 +641,15 @@ void CellRendererChannels::unread_render_mentions(const Cairo::RefPtrget_pixel_size(width, height); { + static const auto bg = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeColor); + static const auto text = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeTextColor); + const auto x = cell_area.get_x() + edge - width - MentionsRightPad; const auto y = cell_area.get_y() + cell_area.get_height() / 2.0 - height / 2.0 - 1; cairo_path_rounded_rect(cr, x - 4, y + 2, width + 8, height, 5); - cr->set_source_rgb(184.0 / 255.0, 37.0 / 255.0, 37.0 / 255.0); + cr->set_source_rgb(bg.get_red(), bg.get_green(), bg.get_blue()); cr->fill(); - cr->set_source_rgb(1.0, 1.0, 1.0); + cr->set_source_rgb(text.get_red(), text.get_green(), text.get_blue()); cr->move_to(x, y); layout->show_in_cairo_context(cr); } diff --git a/src/settings.cpp b/src/settings.cpp index 6820ed0..999d323 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -52,6 +52,9 @@ void SettingsManager::ReadSettings() { SMSTR("style", "expandercolor", ChannelsExpanderColor); SMSTR("style", "linkcolor", LinkColor); SMSTR("style", "nsfwchannelcolor", NSFWChannelColor); + SMSTR("style", "channelcolor", ChannelColor); + SMSTR("style", "mentionbadgecolor", MentionBadgeColor); + SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor); #undef SMBOOL #undef SMSTR @@ -100,6 +103,9 @@ void SettingsManager::Close() { SMSTR("style", "expandercolor", ChannelsExpanderColor); SMSTR("style", "linkcolor", LinkColor); SMSTR("style", "nsfwchannelcolor", NSFWChannelColor); + SMSTR("style", "channelcolor", ChannelColor); + SMSTR("style", "mentionbadgecolor", MentionBadgeColor); + SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor); #undef SMSTR #undef SMBOOL diff --git a/src/settings.hpp b/src/settings.hpp index ca2303f..0d5f3a5 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -32,10 +32,13 @@ public: std::string UserAgent { "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36" }; // [style] - // TODO: convert to StyleProperty + // TODO: convert to StyleProperty... or maybe not? i still cant figure out what the "correct" method is for this std::string LinkColor { "rgba(40, 200, 180, 255)" }; std::string ChannelsExpanderColor { "rgba(255, 83, 112, 255)" }; std::string NSFWChannelColor { "#ed6666" }; + std::string ChannelColor { "#fbfbfb" }; + std::string MentionBadgeColor { "#b82525" }; + std::string MentionBadgeTextColor { "#fbfbfb" }; }; SettingsManager(const std::string &filename); -- cgit v1.2.3 From 738d50dd432b4270798d712656bceba677577309 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Wed, 26 Jan 2022 18:44:31 -0500 Subject: add setting to not show unread stuff --- src/components/channelscellrenderer.cpp | 6 ++++++ src/settings.cpp | 2 ++ src/settings.hpp | 1 + 3 files changed, 9 insertions(+) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index a914d59..1f7b6a7 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -249,6 +249,7 @@ void CellRendererChannels::render_vfunc_guild(const Cairo::RefPtr(widget.get_ancestor(Gtk::Paned::get_type())); if (paned != nullptr) { const auto edge = std::min(paned->get_position(), background_area.get_width()); @@ -603,6 +608,7 @@ void CellRendererChannels::render_vfunc_dm(const Cairo::RefPtr & cr->fill(); // unread + if (!Abaddon::Get().GetSettings().Unreads) return; const auto unread_state = discord.GetUnreadStateForChannel(id); if (unread_state < 0) return; diff --git a/src/settings.cpp b/src/settings.cpp index 999d323..9435999 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -47,6 +47,7 @@ void SettingsManager::ReadSettings() { SMBOOL("gui", "owner_crown", ShowOwnerCrown); SMBOOL("gui", "save_state", SaveState); SMBOOL("gui", "stock_emojis", ShowStockEmojis); + SMBOOL("gui", "unreads", Unreads); SMINT("http", "concurrent", CacheHTTPConcurrency); SMSTR("http", "user_agent", UserAgent); SMSTR("style", "expandercolor", ChannelsExpanderColor); @@ -98,6 +99,7 @@ void SettingsManager::Close() { SMBOOL("gui", "owner_crown", ShowOwnerCrown); SMBOOL("gui", "save_state", SaveState); SMBOOL("gui", "stock_emojis", ShowStockEmojis); + SMBOOL("gui", "unreads", Unreads); SMINT("http", "concurrent", CacheHTTPConcurrency); SMSTR("http", "user_agent", UserAgent); SMSTR("style", "expandercolor", ChannelsExpanderColor); diff --git a/src/settings.hpp b/src/settings.hpp index 0d5f3a5..2f48248 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -26,6 +26,7 @@ public: #else bool ShowStockEmojis { true }; #endif + bool Unreads { true }; // [http] int CacheHTTPConcurrency { 20 }; -- cgit v1.2.3 From ce238d08e96aafc956b5ecd7cf00796a227c5666 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 28 Jan 2022 14:46:33 -0500 Subject: add style option for unread indicator color --- README.md | 1 + src/components/channelscellrenderer.cpp | 12 ++++++++---- src/settings.cpp | 2 ++ src/settings.hpp | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/components/channelscellrenderer.cpp') diff --git a/README.md b/README.md index 1c72063..8d99cca 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,7 @@ For example, memory_db would be set by adding `memory_db = true` under the line * channelcolor (string) - color to use for SFW channels in the channel list * mentionbadgecolor (string) - background color for mention badges * mentionbadgetextcolor (string) - color to use for number displayed on mention badges +* unreadcolor (string) - color to use for the unread indicator ### Environment variables diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index 1f7b6a7..e657ed3 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -258,7 +258,8 @@ void CellRendererChannels::render_vfunc_guild(const Cairo::RefPtrset_source_rgb(1.0, 1.0, 1.0); + static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor); + cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue()); const auto x = background_area.get_x(); const auto y = background_area.get_y(); const auto w = background_area.get_width(); @@ -403,7 +404,8 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtrset_source_rgb(1.0, 1.0, 1.0); + static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor); + cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue()); const auto x = background_area.get_x(); const auto y = background_area.get_y(); const auto w = background_area.get_width(); @@ -474,7 +476,8 @@ void CellRendererChannels::render_vfunc_thread(const Cairo::RefPtrset_source_rgb(1.0, 1.0, 1.0); + static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor); + cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue()); const auto x = background_area.get_x(); const auto y = background_area.get_y(); const auto w = background_area.get_width(); @@ -614,7 +617,8 @@ void CellRendererChannels::render_vfunc_dm(const Cairo::RefPtr & if (unread_state < 0) return; if (!is_muted) { - cr->set_source_rgb(1.0, 1.0, 1.0); + static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor); + cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue()); const auto x = background_area.get_x(); const auto y = background_area.get_y(); const auto w = background_area.get_width(); diff --git a/src/settings.cpp b/src/settings.cpp index 9435999..242bd7c 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -56,6 +56,7 @@ void SettingsManager::ReadSettings() { SMSTR("style", "channelcolor", ChannelColor); SMSTR("style", "mentionbadgecolor", MentionBadgeColor); SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor); + SMSTR("style", "unreadcolor", UnreadIndicatorColor); #undef SMBOOL #undef SMSTR @@ -108,6 +109,7 @@ void SettingsManager::Close() { SMSTR("style", "channelcolor", ChannelColor); SMSTR("style", "mentionbadgecolor", MentionBadgeColor); SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor); + SMSTR("style", "unreadcolor", UnreadIndicatorColor); #undef SMSTR #undef SMBOOL diff --git a/src/settings.hpp b/src/settings.hpp index 2f48248..52b20b9 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -40,6 +40,7 @@ public: std::string ChannelColor { "#fbfbfb" }; std::string MentionBadgeColor { "#b82525" }; std::string MentionBadgeTextColor { "#fbfbfb" }; + std::string UnreadIndicatorColor { "#ffffff" }; }; SettingsManager(const std::string &filename); -- cgit v1.2.3