switch to correct guild on channel open in classic channels

This commit is contained in:
ouwou 2024-01-11 21:28:55 -05:00
parent 615f2c80f1
commit 09bf732a12
4 changed files with 26 additions and 15 deletions

View File

@ -291,21 +291,22 @@ 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 |
| 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 |
| `classic_change_guild_on_open` | boolean | true | change displayed guild when selecting a channel (classic channel list) |
#### style

View File

@ -28,6 +28,14 @@ void ChannelList::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);
}

View File

@ -97,6 +97,7 @@ void SettingsManager::DefineSettings() {
AddSetting("gui", "show_deleted_indicator", true, &Settings::ShowDeletedIndicator);
AddSetting("gui", "font_scale", -1.0, &Settings::FontScale);
AddSetting("gui", "folder_icon_only", false, &Settings::FolderIconOnly);
AddSetting("gui", "classic_change_guild_on_open", true, &Settings::ClassicChangeGuildOnOpen);
AddSetting("http", "concurrent", 20, &Settings::CacheHTTPConcurrency);
AddSetting("http", "user_agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"s, &Settings::UserAgent);

View File

@ -29,6 +29,7 @@ public:
bool ShowDeletedIndicator;
double FontScale;
bool FolderIconOnly;
bool ClassicChangeGuildOnOpen;
// [http]
int CacheHTTPConcurrency;