1#ifndef ATTACHMENT_PLACEHOLDER_H
2#define ATTACHMENT_PLACEHOLDER_H
33 explicit AttachmentPlaceholder(
const QString &filename,
const QString &type, QWidget *parent =
nullptr);
63 void SetBase64Data(
const QString &base64_data,
const QString &mime_type);
93 void SetError(
const QString &error_msg);
113 void AdjustAndShowDialog(QDialog *dialog,
const QScrollArea *scroll_area, QWidget *content_widget,
114 QSize original_content_size)
const;
191 bool eventFilter(QObject *watched, QEvent *event)
override;
void ShowCyberVideo(const QByteArray &data)
Creates and displays a CyberAttachmentViewer containing a video preview (thumbnail + play button)....
Definition attachment_placeholder.cpp:534
QWidget * content_container_
Container widget holding the loaded attachment content.
Definition attachment_placeholder.h:167
void SetBase64Data(const QString &base64_data, const QString &mime_type)
Sets the attachment data directly as a base64 encoded string.
Definition attachment_placeholder.cpp:187
QLabel * info_label_
Label displaying the attachment icon and filename.
Definition attachment_placeholder.h:161
bool has_reference_
Flag indicating if attachment_id_ refers to data in AttachmentDataStore.
Definition attachment_placeholder.h:181
void AdjustAndShowDialog(QDialog *dialog, const QScrollArea *scroll_area, QWidget *content_widget, QSize original_content_size) const
Adjusts the size and position of the full-size dialog and shows it. Calculates the preferred dialog s...
Definition attachment_placeholder.cpp:394
QString mime_type_
The MIME type of the attachment (e.g., "image/png").
Definition attachment_placeholder.h:159
QLabel * progress_label_
Label displaying loading progress or error messages.
Definition attachment_placeholder.h:163
QString base64_data_
Stores the base64 encoded data if provided directly.
Definition attachment_placeholder.h:157
void SetContent(QWidget *content)
Sets the actual content widget to be displayed within the placeholder. Replaces any existing content,...
Definition attachment_placeholder.cpp:104
void NotifyLoaded()
Emits the attachmentLoaded signal after ensuring layout updates. Called internally after SetContent c...
Definition attachment_placeholder.cpp:672
void ShowCyberAudio(const QByteArray &data)
Creates and displays a CyberAttachmentViewer containing an audio player. Uses InlineAudioPlayer.
Definition attachment_placeholder.cpp:518
AttachmentPlaceholder(const QString &filename, const QString &type, QWidget *parent=nullptr)
Constructs an AttachmentPlaceholder widget. Initializes the UI elements (labels, button,...
Definition attachment_placeholder.cpp:25
void SetLoading(bool loading) const
Updates the UI elements to reflect the loading state. Disables/enables the load button and shows/hide...
Definition attachment_placeholder.cpp:192
void ShowCyberGif(const QByteArray &data)
Creates and displays a CyberAttachmentViewer containing a GIF. Wraps an InlineGifPlayer in an AutoSca...
Definition attachment_placeholder.cpp:490
QString attachment_id_
Stores the attachment ID if data is referenced from AttachmentDataStore.
Definition attachment_placeholder.h:179
QByteArray video_data_
Temporary storage for video data when opening the player overlay.
Definition attachment_placeholder.h:173
void onLoadButtonClicked()
Slot triggered when the load/retry button is clicked or automatically after initialization....
Definition attachment_placeholder.cpp:213
QLabel * thumbnail_label_
Pointer to the QLabel used for the video thumbnail preview.
Definition attachment_placeholder.h:175
void SetError(const QString &error_msg)
Updates the UI to display an error message. Enables the retry button and shows the error message in t...
Definition attachment_placeholder.cpp:287
QSize sizeHint() const override
Provides a size hint for the placeholder widget. Returns a base size if no content is loaded,...
Definition attachment_placeholder.cpp:155
std::function< void()> ClickHandler_
Function object (lambda) storing the action to perform when the video thumbnail is clicked.
Definition attachment_placeholder.h:177
QVBoxLayout * content_layout_
Layout for the content_container_.
Definition attachment_placeholder.h:169
QString filename_
The original filename of the attachment.
Definition attachment_placeholder.h:155
void attachmentLoaded()
Emitted after the attachment content has been successfully loaded, set, and the layout updated.
void ShowCyberImage(const QByteArray &data)
Creates and displays a CyberAttachmentViewer containing an image. Wraps an InlineImageViewer in an Au...
Definition attachment_placeholder.cpp:461
bool eventFilter(QObject *watched, QEvent *event) override
Filters events, specifically handling mouse clicks on the video thumbnail label.
Definition attachment_placeholder.cpp:662
void ShowFullSizeDialog(const QByteArray &data, bool is_gif)
Creates and shows a non-modal dialog to display the full-size attachment (image or GIF)....
Definition attachment_placeholder.cpp:296
bool is_loaded_
Flag indicating if the attachment content has been successfully loaded and set.
Definition attachment_placeholder.h:171
QPushButton * load_button_
Button to initiate loading or retry on error.
Definition attachment_placeholder.h:165
void GenerateThumbnail(const QByteArray &video_data, QLabel *thumbnail_label)
Generates a thumbnail image from the first frame of a video in a background thread....
Definition attachment_placeholder.cpp:611
void SetAttachmentReference(const QString &attachment_id, const QString &mime_type)
Sets the reference ID and MIME type for an attachment whose data is stored in AttachmentDataStore.
Definition attachment_placeholder.cpp:181
TranslationManager * translator_
Translation manager for handling UI text translations.
Definition attachment_placeholder.h:183
Manages the loading and delivery of translations for applications.
Definition translation_manager.h:15