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

Inline bot video and sticker layout and sending done.

This commit is contained in:
John Preston
2016-04-03 13:11:41 +04:00
parent c5111c9a51
commit 35785efa50
52 changed files with 301 additions and 197 deletions

View File

@@ -492,14 +492,18 @@ public:
virtual void setPosition(int32 position);
int32 position() const;
virtual bool fullLine() const {
virtual bool isFullLine() const {
return true;
}
virtual bool hasRightSkip() const {
return false;
}
InlineResult *getInlineResult() const;
DocumentData *getDocument() const;
PhotoData *getPhoto() const;
void preload();
virtual void preload() const;
void update();
@@ -572,16 +576,18 @@ public:
void setPosition(int32 position) override;
void initDimensions() override;
bool fullLine() const override {
bool isFullLine() const override {
return false;
}
bool hasRightSkip() const override {
return true;
}
void paint(Painter &p, const QRect &clip, uint32 selection, const PaintContext *context) const override;
void getState(ClickHandlerPtr &link, HistoryCursorState &cursor, int32 x, int32 y) const override;
// ClickHandlerHost interface
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
void clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) override;
~LayoutInlineGif();
@@ -635,9 +641,12 @@ public:
void initDimensions() override;
bool fullLine() const override {
bool isFullLine() const override {
return false;
}
bool hasRightSkip() const override {
return true;
}
void paint(Painter &p, const QRect &clip, uint32 selection, const PaintContext *context) const override;
void getState(ClickHandlerPtr &link, HistoryCursorState &cursor, int32 x, int32 y) const override;
@@ -673,26 +682,36 @@ public:
void initDimensions() override;
bool fullLine() const override {
bool isFullLine() const override {
return false;
}
bool hasRightSkip() const override {
return false;
}
void preload() const override;
void paint(Painter &p, const QRect &clip, uint32 selection, const PaintContext *context) const override;
void getState(ClickHandlerPtr &link, HistoryCursorState &cursor, int32 x, int32 y) const override;
// ClickHandlerHost interface
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
private:
QSize getThumbSize() const;
mutable FloatAnimation _a_over;
mutable bool _active = false;
mutable QPixmap _thumb;
mutable bool _thumbLoaded = false;
void prepareThumb() const;
};
class LayoutInlineWebVideo : public LayoutInlineItem {
class LayoutInlineVideo : public LayoutInlineItem {
public:
LayoutInlineWebVideo(InlineResult *result);
LayoutInlineVideo(InlineResult *result);
void initDimensions() override;
@@ -701,6 +720,20 @@ public:
private:
ImagePtr getThumb() const {
if (_result->document && !_result->document->thumb->isNull()) {
return _result->document->thumb;
} else if (_result->photo && !_result->photo->thumb->isNull()) {
return _result->photo->thumb;
}
return _result->thumb;
}
int getDuration() const {
if (_result->document && _result->document->duration() > 0) {
return _result->document->duration();
}
return _result->duration;
}
ClickHandlerPtr _link;
mutable QPixmap _thumb;