Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discord-style channel/server listing #242

Merged
merged 57 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
3e0cd83
start channel list refactor for server list
ouwou Oct 17, 2023
2646da3
check filter model conversions
ouwou Oct 17, 2023
4906775
remove tmp row map from channel list
ouwou Oct 17, 2023
201b114
refactor ChannelList -> ChannelListTree
ouwou Oct 25, 2023
8b034e4
add intermediate container for channel list
ouwou Oct 25, 2023
1821287
very very rudimentary classic channels list
ouwou Oct 25, 2023
2168f01
fix build
ouwou Oct 26, 2023
09cfa86
create folders in guild list
ouwou Oct 26, 2023
c35d8b4
Merge branch 'master' into classic-channels
ouwou Oct 27, 2023
1abe572
convert menu path from filter to child immediately
ouwou Oct 27, 2023
6fc3624
dont create folders in tree in classic, tmp remove expansion
ouwou Oct 29, 2023
8bd628c
show guild icon previews as grid in folder button
ouwou Nov 3, 2023
1bb7496
Merge branch 'master' into classic-channels
ouwou Dec 27, 2023
862079c
Merge branch 'master' into classic-channels
ouwou Dec 29, 2023
daa57bf
Merge branch 'master' into classic-channels
ouwou Dec 30, 2023
3095155
add selection and expansion back to channel list on open
ouwou Dec 31, 2023
a6e0a2a
Merge branch 'master' into classic-channels
ouwou Jan 8, 2024
6f84175
dont reveal folders by default
ouwou Jan 8, 2024
b700aa8
explicitly expand guild row when switching to it in classic view
ouwou Jan 8, 2024
9131158
add stack with icon and grid for classic listing folder icon
ouwou Jan 9, 2024
1e6d16f
hide dm header unless selected in classic channel list
ouwou Jan 9, 2024
781bdc5
add folder colors to symbol icon
ouwou Jan 9, 2024
fe95335
set folder name tooltip
ouwou Jan 9, 2024
615f2c8
add icon to dm button in classic channels list
ouwou Jan 9, 2024
09bf732
switch to correct guild on channel open in classic channels
ouwou Jan 12, 2024
27ac133
Merge branch 'master' into classic-channels
ouwou Jan 14, 2024
f38a893
make view channels option actually hide the panel
ouwou Jan 14, 2024
960da87
fix some criticals
ouwou Jan 15, 2024
7c8e911
save expansion state
ouwou Jan 15, 2024
af69c3d
fix more criticals
ouwou Jan 15, 2024
e9521ce
Merge branch 'master' into classic-channels
ouwou Jan 15, 2024
6e847ea
use expansion state
ouwou Jan 17, 2024
c384ed2
Merge branch 'master' into classic-channels
ouwou Jan 19, 2024
d1f6e1d
headers
ouwou Jan 19, 2024
15457c4
make classic channels a setting
ouwou Jan 21, 2024
d7bee05
add settings for channel list scrollbar policies
ouwou Jan 21, 2024
1d1bd7e
Revert "add settings for channel list scrollbar policies"
ouwou Jan 21, 2024
9cd9046
add class to entire channel/server browser pane
ouwou Jan 23, 2024
43b0552
add sort model in front of filter in channel tree
ouwou Feb 2, 2024
dbfdd01
add missing guild.HasIcon checks
ouwou Feb 2, 2024
c41ff1e
dont populate classic guilds list if not enabled
ouwou Feb 2, 2024
2be776b
add sort func to sort model
ouwou Feb 2, 2024
b92091b
hide scrollbar in classic guild list
ouwou Feb 2, 2024
746c24a
try fix build
ouwou Feb 2, 2024
a22036a
loosen sort condition
ouwou Feb 2, 2024
8f6bafa
add icons
ouwou Feb 2, 2024
bddaf99
add guild menus to classic guild list
ouwou Feb 11, 2024
0f5c452
make sure channel list view uses theme accent color fr
ouwou Feb 19, 2024
473ff6f
widget tweaking for styling
ouwou Feb 19, 2024
3badc04
unread indicators for classic guilds
ouwou Feb 20, 2024
3c54ff8
check unread status for classic guild on launch
ouwou Feb 24, 2024
cb6436f
Merge branch 'master' into classic-channels
ouwou Mar 6, 2024
bab713b
folder unread indicators
ouwou Mar 6, 2024
f142df9
mindeps build annoyance
ouwou Mar 6, 2024
969820f
fix overflow in sorting
ouwou Mar 8, 2024
143bb57
readme
ouwou Mar 8, 2024
ff76ec5
type nonsense
ouwou Mar 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,25 @@ For example, memory_db would be set by adding `memory_db = true` under the line

#### gui

| Setting | Type | Default | Description |
|-----------------------------|---------|---------|----------------------------------------------------------------------------------------------------------------------------|
| `member_list_discriminator` | boolean | true | show user discriminators in the member list |
| `stock_emojis` | boolean | true | allow abaddon to substitute unicode emojis with images from emojis.bin, must be false to allow GTK to render emojis itself |
| `custom_emojis` | boolean | true | download and use custom Discord emojis |
| `css` | string | | path to the main CSS file |
| `animations` | boolean | true | use animated images where available (e.g. server icons, emojis, avatars). false means static images will be used |
| `animated_guild_hover_only` | boolean | true | only animate guild icons when the guild is being hovered over |
| `owner_crown` | boolean | true | show a crown next to the owner |
| `unreads` | boolean | true | show unread indicators and mention badges |
| `save_state` | boolean | true | save the state of the gui (active channels, tabs, expanded channels) |
| `alt_menu` | boolean | false | keep the menu hidden unless revealed with alt key |
| `hide_to_tray` | boolean | false | hide abaddon to the system tray on window close |
| `show_deleted_indicator` | boolean | true | show \[deleted\] indicator next to deleted messages instead of actually deleting the message |
| `font_scale` | double | | scale font rendering. 1 is unchanged |
| `image_embed_clamp_width` | int | 400 | maximum width of image embeds |
| `image_embed_clamp_height` | int | 300 | maximum height of image embeds |
| Setting | Type | Default | Description |
|--------------------------------|---------|---------|----------------------------------------------------------------------------------------------------------------------------|
| `member_list_discriminator` | boolean | true | show user discriminators in the member list |
| `stock_emojis` | boolean | true | allow abaddon to substitute unicode emojis with images from emojis.bin, must be false to allow GTK to render emojis itself |
| `custom_emojis` | boolean | true | download and use custom Discord emojis |
| `css` | string | | path to the main CSS file |
| `animations` | boolean | true | use animated images where available (e.g. server icons, emojis, avatars). false means static images will be used |
| `animated_guild_hover_only` | boolean | true | only animate guild icons when the guild is being hovered over |
| `owner_crown` | boolean | true | show a crown next to the owner |
| `unreads` | boolean | true | show unread indicators and mention badges |
| `save_state` | boolean | true | save the state of the gui (active channels, tabs, expanded channels) |
| `alt_menu` | boolean | false | keep the menu hidden unless revealed with alt key |
| `hide_to_tray` | boolean | false | hide abaddon to the system tray on window close |
| `show_deleted_indicator` | boolean | true | show \[deleted\] indicator next to deleted messages instead of actually deleting the message |
| `font_scale` | double | | scale font rendering. 1 is unchanged |
| `image_embed_clamp_width` | int | 400 | maximum width of image embeds |
| `image_embed_clamp_height` | int | 300 | maximum height of image embeds |
| `classic_channels` | boolean | false | use classic Discord-style interface for server/channel listing |
| `classic_change_guild_on_open` | boolean | true | change displayed guild when selecting a channel (classic channel list) |

#### style

Expand Down
2 changes: 2 additions & 0 deletions ci/used-icons.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ actions/call-stop-symbolic
status/microphone-disabled-symbolic
status/audio-volume-muted-symbolic
devices/camera-web-symbolic
status/user-available-symbolic
places/folder-symbolic
34 changes: 34 additions & 0 deletions res/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,37 @@
.message-text.failed {
color: red;
}

.guild-list-scroll > scrollbar {
border: none;
}

.guild-list-scroll > scrollbar slider {
border: none;
margin: 0px;
min-width: 0px;
min-height: 0px;
}

.channel-list .view:selected {
background-color: @theme_selected_bg_color;
}

.classic-guild-list > row {
padding-left: 0px;
box-shadow: none;
border: none;
outline: none;
}

.classic-guild-list > row:hover {
background: none;
}

.classic-guild-list-guild.has-unread {
background: radial-gradient(7px circle at left, @theme_selected_bg_color 50%, transparent 20%);
}

.classic-guild-list-guild box, .classic-guild-list-folder stack {
padding-left: 10px;
}
5 changes: 4 additions & 1 deletion src/abaddon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ Abaddon::Abaddon()
: m_settings(Platform::FindConfigFile())
, m_discord(GetSettings().UseMemoryDB) // stupid but easy
, m_emojis(GetResPath("/emojis.bin"))
, m_audio(GetSettings().Backends) {
#ifdef WITH_VOICE
, m_audio(GetSettings().Backends)
#endif
{
LoadFromSettings();

// todo: set user agent for non-client(?)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "channelscellrenderer.hpp"
#include "cellrendererchannels.hpp"
#include <gdkmm/general.h>
#include "abaddon.hpp"

Expand Down
131 changes: 131 additions & 0 deletions src/components/channellist/channellist.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#include "channellist.hpp"

#include "abaddon.hpp"

ChannelList::ChannelList() {
get_style_context()->add_class("channel-browser-pane");

ConnectSignals();

m_guilds.set_halign(Gtk::ALIGN_START);

m_guilds_scroll.get_style_context()->add_class("guild-list-scroll");
m_guilds_scroll.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);

m_guilds.signal_guild_selected().connect([this](Snowflake guild_id) {
m_tree.SetSelectedGuild(guild_id);
});

m_guilds.signal_dms_selected().connect([this]() {
m_tree.SetSelectedDMs();
});

m_guilds.show();
m_tree.show();
m_guilds_scroll.add(m_guilds);
pack_start(m_guilds_scroll, false, false); // only take the space it needs
pack_start(m_tree, true, true); // use all the remaining space
}

void ChannelList::UpdateListing() {
m_tree.UpdateListing();
if (m_is_classic) m_guilds.UpdateListing();
}

void ChannelList::SetActiveChannel(Snowflake id, bool expand_to) {
if (Abaddon::Get().GetSettings().ClassicChangeGuildOnOpen) {
if (const auto channel = Abaddon::Get().GetDiscordClient().GetChannel(id); channel.has_value() && channel->GuildID.has_value()) {
m_tree.SetSelectedGuild(*channel->GuildID);
} else {
m_tree.SetSelectedDMs();
}
}

m_tree.SetActiveChannel(id, expand_to);
}

void ChannelList::UseExpansionState(const ExpansionStateRoot &state) {
m_tree.UseExpansionState(state);
}

ExpansionStateRoot ChannelList::GetExpansionState() const {
return m_tree.GetExpansionState();
}

void ChannelList::UsePanedHack(Gtk::Paned &paned) {
m_tree.UsePanedHack(paned);
}

void ChannelList::SetClassic(bool value) {
m_is_classic = value;
m_tree.SetClassic(value);
m_guilds_scroll.set_visible(value);
}

void ChannelList::ConnectSignals() {
// TODO: if these all just travel upwards to the singleton then get rid of them but mayeb they dont

#ifdef WITH_LIBHANDY
m_tree.signal_action_open_new_tab().connect([this](Snowflake id) {
m_signal_action_open_new_tab.emit(id);
});
#endif

#ifdef WITH_VOICE
m_tree.signal_action_join_voice_channel().connect([this](Snowflake id) {
m_signal_action_join_voice_channel.emit(id);
});

m_tree.signal_action_disconnect_voice().connect([this]() {
m_signal_action_disconnect_voice.emit();
});
#endif

m_tree.signal_action_channel_item_select().connect([this](Snowflake id) {
m_signal_action_channel_item_select.emit(id);
});

m_tree.signal_action_guild_leave().connect([this](Snowflake id) {
m_signal_action_guild_leave.emit(id);
});

m_tree.signal_action_guild_settings().connect([this](Snowflake id) {
m_signal_action_guild_settings.emit(id);
});

m_guilds.signal_action_guild_leave().connect([this](Snowflake id) {
m_signal_action_guild_leave.emit(id);
});

m_guilds.signal_action_guild_settings().connect([this](Snowflake id) {
m_signal_action_guild_settings.emit(id);
});
}

#ifdef WITH_LIBHANDY
ChannelList::type_signal_action_open_new_tab ChannelList::signal_action_open_new_tab() {
return m_signal_action_open_new_tab;
}
#endif

#ifdef WITH_VOICE
ChannelList::type_signal_action_join_voice_channel ChannelList::signal_action_join_voice_channel() {
return m_signal_action_join_voice_channel;
}

ChannelList::type_signal_action_disconnect_voice ChannelList::signal_action_disconnect_voice() {
return m_signal_action_disconnect_voice;
}
#endif

ChannelList::type_signal_action_channel_item_select ChannelList::signal_action_channel_item_select() {
return m_signal_action_channel_item_select;
}

ChannelList::type_signal_action_guild_leave ChannelList::signal_action_guild_leave() {
return m_signal_action_guild_leave;
}

ChannelList::type_signal_action_guild_settings ChannelList::signal_action_guild_settings() {
return m_signal_action_guild_settings;
}
71 changes: 71 additions & 0 deletions src/components/channellist/channellist.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#pragma once
#include <gtkmm/box.h>
#include <gtkmm/paned.h>
#include "channellisttree.hpp"
#include "classic/guildlist.hpp"
#include "discord/snowflake.hpp"
#include "state.hpp"

// Contains the actual ChannelListTree and the classic listing if enabled
class ChannelList : public Gtk::HBox {
// have to proxy public and signals to underlying tree... ew!!!
public:
ChannelList();

void UpdateListing();
void SetActiveChannel(Snowflake id, bool expand_to);

// channel list should be populated when this is called
void UseExpansionState(const ExpansionStateRoot &state);
ExpansionStateRoot GetExpansionState() const;

void UsePanedHack(Gtk::Paned &paned);

void SetClassic(bool value);

private:
void ConnectSignals();

ChannelListTree m_tree;

Gtk::ScrolledWindow m_guilds_scroll;
GuildList m_guilds;

bool m_is_classic = false;

public:
using type_signal_action_channel_item_select = sigc::signal<void, Snowflake>;
using type_signal_action_guild_leave = sigc::signal<void, Snowflake>;
using type_signal_action_guild_settings = sigc::signal<void, Snowflake>;

#ifdef WITH_LIBHANDY
using type_signal_action_open_new_tab = sigc::signal<void, Snowflake>;
type_signal_action_open_new_tab signal_action_open_new_tab();
#endif

#ifdef WITH_VOICE
using type_signal_action_join_voice_channel = sigc::signal<void, Snowflake>;
using type_signal_action_disconnect_voice = sigc::signal<void>;

type_signal_action_join_voice_channel signal_action_join_voice_channel();
type_signal_action_disconnect_voice signal_action_disconnect_voice();
#endif

type_signal_action_channel_item_select signal_action_channel_item_select();
type_signal_action_guild_leave signal_action_guild_leave();
type_signal_action_guild_settings signal_action_guild_settings();

private:
type_signal_action_channel_item_select m_signal_action_channel_item_select;
type_signal_action_guild_leave m_signal_action_guild_leave;
type_signal_action_guild_settings m_signal_action_guild_settings;

#ifdef WITH_LIBHANDY
type_signal_action_open_new_tab m_signal_action_open_new_tab;
#endif

#ifdef WITH_VOICE
type_signal_action_join_voice_channel m_signal_action_join_voice_channel;
type_signal_action_disconnect_voice m_signal_action_disconnect_voice;
#endif
};
Loading
Loading