tdesktop/Telegram/SourceFiles/history/media/history_media_video.h

93 lines
2.3 KiB
C++

/*
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/media/history_media_file.h"
class HistoryVideo : public HistoryFileMedia {
public:
HistoryVideo(
not_null<Element*> parent,
not_null<HistoryItem*> realParent,
not_null<DocumentData*> document);
void draw(Painter &p, const QRect &r, TextSelection selection, TimeMs 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();
}
TextWithEntities selectedText(TextSelection selection) const override;
DocumentData *getDocument() const override {
return _data;
}
QSize sizeForGrouping() const override;
void drawGrouped(
Painter &p,
const QRect &clip,
TextSelection selection,
TimeMs ms,
const QRect &geometry,
RectParts corners,
not_null<uint64*> cacheKey,
not_null<QPixmap*> cache) const override;
TextState getStateGrouped(
const QRect &geometry,
QPoint point,
StateRequest request) const override;
bool uploading() const override;
TextWithEntities getCaption() const override {
return _caption.originalTextWithEntities();
}
bool needsBubble() const override;
bool customInfoLayout() const override {
return _caption.isEmpty();
}
bool skipBubbleTail() const override {
return isBubbleBottom() && _caption.isEmpty();
}
void parentTextUpdated() override;
protected:
float64 dataProgress() const override;
bool dataFinished() const override;
bool dataLoaded() const override;
private:
QSize countOptimalSize() override;
QSize countCurrentSize(int newWidth) override;
void validateGroupedCache(
const QRect &geometry,
RectParts corners,
not_null<uint64*> cacheKey,
not_null<QPixmap*> cache) const;
void setStatusSize(int newSize) const;
void updateStatusText() const;
not_null<DocumentData*> _data;
int _thumbw = 1;
int _thumbh = 1;
Text _caption;
};