2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Copied GIF Layout from inline bots results to overview.

This commit is contained in:
23rd
2021-07-22 19:15:30 +03:00
committed by John Preston
parent 81c39af122
commit 1fa71b6569
2 changed files with 383 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once
#include "layout.h"
#include "media/clip/media_clip_reader.h"
#include "core/click_handler_types.h"
#include "ui/effects/animations.h"
#include "ui/effects/radial_animation.h"
@@ -202,6 +203,63 @@ private:
};
class Gif final : public RadialProgressItem {
public:
Gif(
not_null<Delegate*> delegate,
not_null<HistoryItem*> parent,
not_null<DocumentData*> gif);
~Gif();
void initDimensions() override;
int32 resizeGetHeight(int32 width) override;
void paint(
Painter &p,
const QRect &clip,
TextSelection selection,
const PaintContext *context) override;
TextState getState(
QPoint point,
StateRequest request) const override;
void clearHeavyPart() override;
protected:
float64 dataProgress() const override;
bool dataFinished() const override;
bool dataLoaded() const override;
bool iconAnimated() const override;
private:
QSize countFrameSize() const;
int contentWidth() const;
int contentHeight() const;
void validateThumbnail(
Image *image,
QSize size,
QSize frame,
bool good);
void prepareThumbnail(QSize size, QSize frame);
void update();
void ensureDataMediaCreated() const;
void updateStatusText();
void clipCallback(Media::Clip::Notification notification);
Media::Clip::ReaderPointer _gif;
const not_null<DocumentData*> _data;
mutable std::shared_ptr<Data::DocumentMedia> _dataMedia;
StatusText _status;
QPixmap _thumb;
bool _thumbGood = false;
};
class Video final : public RadialProgressItem {
public:
Video(