mirror of
https://github.com/celisej567/abaddon.git
synced 2025-12-31 17:48:26 +03:00
make image clamp dimensions a setting
This commit is contained in:
@@ -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 |
|
||||
|
||||
#### style
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -96,6 +96,8 @@ void SettingsManager::DefineSettings() {
|
||||
AddSetting("gui", "hide_to_try", false, &Settings::HideToTray);
|
||||
AddSetting("gui", "show_deleted_indicator", true, &Settings::ShowDeletedIndicator);
|
||||
AddSetting("gui", "font_scale", -1.0, &Settings::FontScale);
|
||||
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);
|
||||
|
||||
@@ -28,6 +28,8 @@ public:
|
||||
bool HideToTray;
|
||||
bool ShowDeletedIndicator;
|
||||
double FontScale;
|
||||
int ImageEmbedClampWidth;
|
||||
int ImageEmbedClampHeight;
|
||||
|
||||
// [http]
|
||||
int CacheHTTPConcurrency;
|
||||
|
||||
Reference in New Issue
Block a user