Commit 586d545
committed
CHANGE(client,images): Reorganize code for animations and make various adjustments
Made the following changes:
General:
- Move functions into more suitable classes, where `clearDocument` (renamed to `clear`) is placed in the `LogTextBrowser` class and `toggleVideoControls` is placed in the `AnimationTextObject` class
- Add support for `width` and `height` attributes applied to animations
- Add support for use with WEBP, MNG, (A)PNG and AVIF, which are other image formats that may contain animations. WEBP and MNG are included in Qt's additional library "Qt Image Formats", though only WEBP is bundled with official builds of Qt.
CustomElements.cpp:
- Reorganize video controls into a dedicated class, as well as related rather generic functions
- Return default value after `switch` in `loopModeToString`, which would make compilers warn here if not all values of the enum are handled
- Also clear the counter and focus index for custom items when the document is cleared
- Select the last custom item if the number entered (CTRL+[series of 0-9] with the log in focus) is too high
- Set the playback speed to the value it had at the previous reset if the speed is reset again while at the original speed
- Add fullscreen mode, useable from the UI and via keybindings where F toggles it and Escape exits it
- Add keybinding to invert the playback speed with X
- Switch keybindings for jumping 5 frames backwards or forward to B and N as well as for jumping 5 seconds backwards or forward to U and I
- Account for scrolling on both axes when getting the position of a click
- Make video bar background brighter when caching is on to further distinguish it
- Fix text object size so that it reliably changes the intrinsic size (layout) by applying the max size first
- Scale the animation to a min width for the video controls to ensure they fit
- Use a regular still image for images that may contain an animation but do not have multiple frames
MainWindow.cpp:
- Use `enum class` instead of `enum` in new code, making it more type safe and specific in scope
- Use function pointers instead of the `SLOT` macro for new actions in the log's context menu
- Save the given image in another format if specified with the file extension for animations as well
- Use precise image detection for context menu options via `formatAt` instead of `cursorAtPosition`, enabling direct detection of a text object at the given position and with more accuracy than just somewhere within its vertical space
Log.cpp:
- Reorganize the log routine for animations, where code having to do with creating and running an animation is placed in its own class, `AnimationTextObject`, while getting data and inserting animations is left to the `Log` class
- Make the log routine for animations generic for all custom text objects, enabling more to be added alongside each other as well as regular HTML in the same message
- Return early from `htmlWithCustomTextObjects` if the text to log is empty or too small to contain any tag
- Use more stable specific reference points when parsing tags containing custom text object data
- Still images use the given image format instead of JPG where possible, enabling transparency and maintaining the highest image quality (may still be reduced if the the file size exceeds the given image message limit). The default image format is now PNG to enable transparency even if the format was not detected or supported, where PNG is in the base support for image formats in Qt.1 parent 8a5bcc0 commit 586d545
File tree
6 files changed
+1402
-889
lines changed- src/mumble
6 files changed
+1402
-889
lines changed
0 commit comments