Skip to content

Commit

Permalink
Merge branch 'master' into classic-channels
Browse files Browse the repository at this point in the history
  • Loading branch information
ouwou committed Jan 14, 2024
2 parents 09bf732 + 012c2da commit 27ac133
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ For example, memory_db would be set by adding `memory_db = true` under the line
| `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_change_guild_on_open` | boolean | true | change displayed guild when selecting a channel (classic channel list) |
#### style
Expand Down
8 changes: 6 additions & 2 deletions src/components/chatmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,9 @@ Gtk::Widget *ChatMessageItemContainer::CreateEmbedComponent(const EmbedData &emb

if (embed.Image.has_value() && embed.Image->ProxyURL.has_value()) {
int w = 0, h = 0;
GetImageDimensions(*embed.Image->Width, *embed.Image->Height, w, h, EmbedImageWidth, EmbedImageHeight);
const int clamp_width = Abaddon::Get().GetSettings().ImageEmbedClampWidth;
const int clamp_height = Abaddon::Get().GetSettings().ImageEmbedClampHeight;
GetImageDimensions(*embed.Image->Width, *embed.Image->Height, w, h, clamp_width, clamp_height);

auto *img = Gtk::manage(new LazyImage(*embed.Image->ProxyURL, w, h, false));
img->set_halign(Gtk::ALIGN_CENTER);
Expand Down Expand Up @@ -488,7 +490,9 @@ Gtk::Widget *ChatMessageItemContainer::CreateEmbedComponent(const EmbedData &emb

Gtk::Widget *ChatMessageItemContainer::CreateImageComponent(const std::string &proxy_url, const std::string &url, int inw, int inh) {
int w, h;
GetImageDimensions(inw, inh, w, h);
const int clamp_width = Abaddon::Get().GetSettings().ImageEmbedClampWidth;
const int clamp_height = Abaddon::Get().GetSettings().ImageEmbedClampHeight;
GetImageDimensions(inw, inh, w, h, clamp_width, clamp_height);

Gtk::EventBox *ev = Gtk::manage(new Gtk::EventBox);
Gtk::Image *widget = Gtk::manage(new LazyImage(proxy_url, w, h, false));
Expand Down
2 changes: 0 additions & 2 deletions src/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ constexpr static int BoostLevel3AttachmentSizeLimit = 100 * 1024 * 1024;
constexpr static int MaxMessagePayloadSize = 199 * 1024 * 1024;
constexpr static int EmojiSize = 24; // settings eventually
constexpr static int AvatarSize = 32;
constexpr static int EmbedImageWidth = 400;
constexpr static int EmbedImageHeight = 300;
constexpr static int ThumbnailSize = 100;
constexpr static int StickerComponentSize = 160;
2 changes: 2 additions & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ void SettingsManager::DefineSettings() {
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("gui", "image_embed_clamp_width", 400, &Settings::ImageEmbedClampWidth);
AddSetting("gui", "image_embed_clamp_height", 300, &Settings::ImageEmbedClampHeight);

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);
Expand Down
2 changes: 2 additions & 0 deletions src/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class SettingsManager {
double FontScale;
bool FolderIconOnly;
bool ClassicChangeGuildOnOpen;
int ImageEmbedClampWidth;
int ImageEmbedClampHeight;

// [http]
int CacheHTTPConcurrency;
Expand Down

0 comments on commit 27ac133

Please sign in to comment.