tdesktop/Telegram/SourceFiles/history/view/media/history_view_gif.h

126 lines
3.3 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "history/view/media/history_view_file.h"
#include "media/clip/media_clip_reader.h"
struct HistoryMessageVia;
struct HistoryMessageReply;
struct HistoryMessageForwarded;
namespace Media {
2019-02-27 11:36:19 +00:00
namespace View {
class PlaybackProgress;
} // namespace View
} // namespace Media
namespace Media {
namespace Streaming {
class Instance;
struct Update;
struct Information;
enum class Error;
} // namespace Streaming
} // namespace Media
namespace HistoryView {
class Gif final : public File {
public:
Gif(
not_null<Element*> parent,
not_null<DocumentData*> document);
~Gif();
void draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms) const override;
TextState textState(QPoint point, StateRequest request) const override;
[[nodiscard]] TextSelection adjustSelection(
TextSelection selection,
TextSelectType type) const override {
return _caption.adjustSelection(selection, type);
}
uint16 fullSelectionLength() const override {
return _caption.length();
}
bool hasTextForCopy() const override {
return !_caption.isEmpty();
}
TextForMimeData selectedText(TextSelection selection) const override;
bool uploading() const override;
DocumentData *getDocument() const override {
return _data;
}
void stopAnimation() override;
void checkAnimation() override;
TextWithEntities getCaption() const override {
return _caption.toTextWithEntities();
}
bool needsBubble() const override;
bool customInfoLayout() const override {
return _caption.isEmpty();
}
QString additionalInfoString() const override;
bool skipBubbleTail() const override {
return isBubbleBottom() && _caption.isEmpty();
}
bool isReadyForOpen() const override;
void parentTextUpdated() override;
private:
float64 dataProgress() const override;
bool dataFinished() const override;
bool dataLoaded() const override;
2019-08-01 11:42:24 +00:00
[[nodiscard]] bool autoplayEnabled() const;
void playAnimation(bool autoplay) override;
QSize countOptimalSize() override;
QSize countCurrentSize(int newWidth) override;
QSize videoSize() const;
::Media::Streaming::Instance *activeRoundStreamed() const;
const ::Media::Streaming::Instance *activeOwnStreamed() const;
const ::Media::Streaming::Instance *activeCurrentStreamed() const;
::Media::View::PlaybackProgress *videoPlayback() const;
2019-12-11 10:15:48 +00:00
bool createStreamedPlayer();
void setStreamed(std::unique_ptr<::Media::Streaming::Instance> value);
void handleStreamingUpdate(::Media::Streaming::Update &&update);
void handleStreamingError(::Media::Streaming::Error &&error);
void streamingReady(::Media::Streaming::Information &&info);
bool needInfoDisplay() const;
int additionalWidth(
const HistoryMessageVia *via,
const HistoryMessageReply *reply,
const HistoryMessageForwarded *forwarded) const;
int additionalWidth() const;
QString mediaTypeString() const;
bool isSeparateRoundVideo() const;
not_null<DocumentData*> _data;
int _thumbw = 1;
int _thumbh = 1;
2019-06-12 13:26:04 +00:00
Ui::Text::String _caption;
std::unique_ptr<::Media::Streaming::Instance> _streamed;
void setStatusSize(int newSize) const;
void updateStatusText() const;
};
} // namespace HistoryView