2018-12-18 10:45:06 +00:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
|
2019-08-02 13:21:09 +00:00
|
|
|
#include "history/view/media/history_view_file.h"
|
2019-09-13 06:06:02 +00:00
|
|
|
#include "media/clip/media_clip_reader.h"
|
2018-12-18 10:45:06 +00:00
|
|
|
|
|
|
|
struct HistoryMessageVia;
|
|
|
|
struct HistoryMessageReply;
|
|
|
|
struct HistoryMessageForwarded;
|
|
|
|
|
|
|
|
namespace Media {
|
2019-02-27 11:36:19 +00:00
|
|
|
namespace View {
|
|
|
|
class PlaybackProgress;
|
|
|
|
} // namespace View
|
2019-03-26 08:54:51 +00:00
|
|
|
} // namespace Media
|
2018-12-18 10:45:06 +00:00
|
|
|
|
2019-03-26 08:54:51 +00:00
|
|
|
namespace Media {
|
|
|
|
namespace Streaming {
|
2019-12-11 12:09:21 +00:00
|
|
|
class Instance;
|
2019-07-30 15:46:13 +00:00
|
|
|
struct Update;
|
|
|
|
struct Information;
|
|
|
|
enum class Error;
|
2019-03-26 08:54:51 +00:00
|
|
|
} // namespace Streaming
|
2018-12-18 10:45:06 +00:00
|
|
|
} // namespace Media
|
|
|
|
|
2019-08-02 13:21:09 +00:00
|
|
|
namespace HistoryView {
|
|
|
|
|
2019-07-30 15:46:13 +00:00
|
|
|
class Gif final : public File {
|
2018-12-18 10:45:06 +00:00
|
|
|
public:
|
2019-08-02 13:21:09 +00:00
|
|
|
Gif(
|
2018-12-18 10:45:06 +00:00
|
|
|
not_null<Element*> parent,
|
|
|
|
not_null<DocumentData*> document);
|
2019-07-30 15:46:13 +00:00
|
|
|
~Gif();
|
2018-12-18 10:45:06 +00:00
|
|
|
|
2019-02-19 06:57:53 +00:00
|
|
|
void draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms) const override;
|
2018-12-18 10:45:06 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2019-04-08 15:10:06 +00:00
|
|
|
TextForMimeData selectedText(TextSelection selection) const override;
|
2018-12-18 10:45:06 +00:00
|
|
|
|
|
|
|
bool uploading() const override;
|
|
|
|
|
|
|
|
DocumentData *getDocument() const override {
|
|
|
|
return _data;
|
|
|
|
}
|
|
|
|
|
|
|
|
void stopAnimation() override;
|
2019-07-30 15:46:13 +00:00
|
|
|
void checkAnimation() override;
|
2018-12-18 10:45:06 +00:00
|
|
|
|
|
|
|
TextWithEntities getCaption() const override {
|
2019-04-08 11:53:08 +00:00
|
|
|
return _caption.toTextWithEntities();
|
2018-12-18 10:45:06 +00:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
|
2019-07-30 15:46:13 +00:00
|
|
|
private:
|
2018-12-18 10:45:06 +00:00
|
|
|
float64 dataProgress() const override;
|
|
|
|
bool dataFinished() const override;
|
|
|
|
bool dataLoaded() const override;
|
|
|
|
|
2019-08-01 11:42:24 +00:00
|
|
|
[[nodiscard]] bool autoplayEnabled() const;
|
2019-07-30 15:46:13 +00:00
|
|
|
|
2018-12-18 10:45:06 +00:00
|
|
|
void playAnimation(bool autoplay) override;
|
|
|
|
QSize countOptimalSize() override;
|
|
|
|
QSize countCurrentSize(int newWidth) override;
|
2019-03-26 08:54:51 +00:00
|
|
|
QSize videoSize() const;
|
2019-12-11 12:09:21 +00:00
|
|
|
::Media::Streaming::Instance *activeRoundStreamed() const;
|
|
|
|
const ::Media::Streaming::Instance *activeOwnStreamed() const;
|
|
|
|
const ::Media::Streaming::Instance *activeCurrentStreamed() const;
|
2019-08-02 13:21:09 +00:00
|
|
|
::Media::View::PlaybackProgress *videoPlayback() const;
|
2019-07-30 15:46:13 +00:00
|
|
|
|
2019-12-11 10:15:48 +00:00
|
|
|
bool createStreamedPlayer();
|
2019-12-11 12:09:21 +00:00
|
|
|
void setStreamed(std::unique_ptr<::Media::Streaming::Instance> value);
|
2019-07-30 15:46:13 +00:00
|
|
|
void handleStreamingUpdate(::Media::Streaming::Update &&update);
|
|
|
|
void handleStreamingError(::Media::Streaming::Error &&error);
|
|
|
|
void streamingReady(::Media::Streaming::Information &&info);
|
2018-12-18 10:45:06 +00:00
|
|
|
|
|
|
|
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;
|
2019-12-11 12:09:21 +00:00
|
|
|
std::unique_ptr<::Media::Streaming::Instance> _streamed;
|
2018-12-18 10:45:06 +00:00
|
|
|
|
|
|
|
void setStatusSize(int newSize) const;
|
|
|
|
void updateStatusText() const;
|
|
|
|
|
|
|
|
};
|
2019-08-02 13:21:09 +00:00
|
|
|
|
|
|
|
} // namespace HistoryView
|