The way images are handled for the `gif` file format when pasting and receiving one in the chat
was here changed to support playing the animation. By default they do not play but whenever
an animation is not running this is indicated by a play-icon, thereby differentiating them
from still images on a glance. Whether the animation is paused is toggled by left-clicking it
and reset by middle-clicking it. Saving a `gif` image file from log is also supported
just as it is for other image file formats.
Additionally, one can also toggle video controls for animations via the log context menu on them.
This enables the following features:
- Jumping to any point of the animation via the video bar
- Viewing the current time and total time of the animation
- Switching caching of all frames on or off
- Switching loop mode between "Unchanged", "Loop" and "No loop"
- Traversing frame-by-frame backwards or forward
- Changing and resetting the playback speed
To turn on caching most notably boosts performance when jumping to frames that are sequentially
far apart due to `QMovie` only being able to switch frame in order from start to end and around
when caching is off, though it usually plays fine regardless except for when playing in reverse
in an animation with many frames. Reverse playback is also implemented here, so when decreasing
the speed to less than zero it will play at that speed in reverse as expected, taking a speed-step
that's twice as big if the speed would otherwise become zero so that the animation only pauses when
it's not playing. As for loop mode, "Unchanged" is to use the in-built setting in the `gif` image file
for how many times it is to repeat, whereas "Loop" and "No loop" override this behavior accordingly.
The main limitation is the character limit on text messages for images. Currently this is usually
set to 128 KB, which is very small for a `gif` image file and on top of this requires
the data to be 33% smaller before being sent in base64 encoding. This limit should be at least
ten times larger in order to fit many `gif` image files, or this should apply to another limit
specifically for animations. Other than that, the functionality for pasting images from
the clipboard itself, instead of by a file path from it, could not be implemented for `gif`
image files due to not being able to get compatible formatted data from the MIME data received.
Here are workarounds that can be applied to these limitations:
- Configure the server to increase or disable the limit on image message length
- Save copied `gif` images to file and then copy and paste those files
Lastly, if settings were to be added to this feature, then
here are some suggestions for those settings:
- Play animations by default
- Show video controls by default
- Cache all frames by default
- Specify the default loop mode
- Specify the default playback speed