1#ifndef INLINE_GIF_PLAYER_H
2#define INLINE_GIF_PLAYER_H
30 explicit GifPlayer(
const QByteArray &gif_data, QWidget *parent =
nullptr);
50 [[nodiscard]] QSize
sizeHint()
const override;
114 void HandleGifInfo(
int width,
int height,
double duration,
double frame_rate);
Decodes GIF data frame by frame using FFmpeg libraries in a separate thread.
Definition gif_decoder.h:29
double current_position_
Current playback position in seconds. Updated by UpdatePosition.
Definition gif_player.h:141
std::shared_ptr< GifDecoder > decoder_
Shared pointer to the GifDecoder instance responsible for decoding.
Definition gif_player.h:127
void HandleGifInfo(int width, int height, double duration, double frame_rate)
Slot connected to the decoder's gifInfo signal. Stores the GIF's dimensions, duration,...
Definition gif_player.cpp:114
void leaveEvent(QEvent *event) override
Handles mouse leave events. Calls StopPlayback() to pause animation when the mouse cursor leaves the ...
Definition gif_player.cpp:84
void DisplayThumbnail(const QImage &frame)
Slot connected to the decoder's firstFrameReady signal. Displays the provided frame as a static thumb...
Definition gif_player.cpp:89
double gif_duration_
Total duration of the GIF in seconds. Set by HandleGifInfo.
Definition gif_player.h:137
QSize sizeHint() const override
Provides a size hint based on the original dimensions of the GIF. Returns the actual GIF width and he...
Definition gif_player.cpp:58
void UpdateFrame(const QImage &frame) const
Slot connected to the decoder's frameReady signal. Updates the QLabel to display the new frame,...
Definition gif_player.cpp:102
void HandleError(const QString &message)
Slot connected to the decoder's error signal. Logs the error message and displays it in the QLabel....
Definition gif_player.cpp:107
QLabel * gif_label_
QLabel used to display the GIF frames. ScaledContents is enabled.
Definition gif_player.h:125
QPixmap thumbnail_pixmap_
Stores the first frame as a QPixmap for efficient display as a thumbnail.
Definition gif_player.h:145
TranslationManager * translator_
Pointer to the translation manager for handling UI translations.
Definition gif_player.h:147
QByteArray gif_data_
Stores the raw GIF data passed in the constructor.
Definition gif_player.h:130
void ReleaseResources()
Stops the decoder thread, waits for it to finish (with timeout), and resets the decoder pointer....
Definition gif_player.cpp:47
void StartPlayback()
Starts or resumes GIF playback. Sets the is_playing_ flag and calls Resume() on the GifDecoder....
Definition gif_player.cpp:65
void gifLoaded()
Emitted after the GIF information (dimensions, duration, etc.) has been successfully received from th...
int gif_height_
Original height of the GIF in pixels. Set by HandleGifInfo.
Definition gif_player.h:135
double frame_rate_
Average frame rate of the GIF. Set by HandleGifInfo.
Definition gif_player.h:139
void enterEvent(QEvent *event) override
Handles mouse enter events. Calls StartPlayback() to begin animation when the mouse cursor enters the...
Definition gif_player.cpp:79
bool is_playing_
Flag indicating if the GIF is currently playing (mouse hover).
Definition gif_player.h:143
void StopPlayback()
Stops or pauses GIF playback. Clears the is_playing_ flag and calls Pause() on the GifDecoder....
Definition gif_player.cpp:72
GifPlayer(const QByteArray &gif_data, QWidget *parent=nullptr)
Constructs an InlineGifPlayer widget. Initializes the UI (QLabel for display), creates the GifDecoder...
Definition gif_player.cpp:11
int gif_width_
Original width of the GIF in pixels. Set by HandleGifInfo.
Definition gif_player.h:133
~GifPlayer() override
Destructor. Ensures resources are released by calling ReleaseResources().
Definition gif_player.h:35
Manages the loading and delivery of translations for applications.
Definition translation_manager.h:15