summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2024-01-13 21:18:36 -0500
committerouwou <26526779+ouwou@users.noreply.github.com>2024-01-13 21:18:36 -0500
commit27ac13334e5bc1cc9c7bb5b3ed08a1731599984c (patch)
tree83379489ad5785e6a613b84cfb9317584cced4cf
parent09bf732a122760a1f1d6ba005d066d107c57edad (diff)
parent012c2dab59b0202586a88af6286b27d79eac61b6 (diff)
downloadabaddon-portaudio-27ac13334e5bc1cc9c7bb5b3ed08a1731599984c.tar.gz
abaddon-portaudio-27ac13334e5bc1cc9c7bb5b3ed08a1731599984c.zip
Merge branch 'master' into classic-channels
-rw-r--r--README.md2
-rw-r--r--src/components/chatmessage.cpp8
-rw-r--r--src/constants.hpp2
-rw-r--r--src/settings.cpp2
-rw-r--r--src/settings.hpp2
5 files changed, 12 insertions, 4 deletions
diff --git a/README.md b/README.md
index d9bacb6..9b4a2d7 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/src/components/chatmessage.cpp b/src/components/chatmessage.cpp
index a503294..05954da 100644
--- a/src/components/chatmessage.cpp
+++ b/src/components/chatmessage.cpp
@@ -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);
@@ -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));
diff --git a/src/constants.hpp b/src/constants.hpp
index 5ed123c..8f39530 100644
--- a/src/constants.hpp
+++ b/src/constants.hpp
@@ -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;
diff --git a/src/settings.cpp b/src/settings.cpp
index 36fffb0..45bb449 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -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);
diff --git a/src/settings.hpp b/src/settings.hpp
index b8e27a4..65b5b63 100644
--- a/src/settings.hpp
+++ b/src/settings.hpp
@@ -30,6 +30,8 @@ public:
double FontScale;
bool FolderIconOnly;
bool ClassicChangeGuildOnOpen;
+ int ImageEmbedClampWidth;
+ int ImageEmbedClampHeight;
// [http]
int CacheHTTPConcurrency;