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

complex layouts for context gifs started

This commit is contained in:
John Preston
2015-12-30 19:56:05 +08:00
parent fa9850c319
commit e58c8a6fcb
12 changed files with 766 additions and 442 deletions

View File

@@ -490,19 +490,24 @@ struct ContextResult;
class LayoutContextItem : public LayoutItem {
public:
LayoutContextItem(ContextResult *result);
LayoutContextItem(DocumentData *doc);
LayoutContextItem(ContextResult *result, DocumentData *doc, PhotoData *photo);
virtual void setPosition(int32 position, int32 width);
virtual void setPosition(int32 position);
int32 position() const;
DocumentData *document() const;
virtual bool fullLine() const {
return true;
}
ContextResult *result() const;
DocumentData *document() const;
PhotoData *photo() const;
void preload();
protected:
ContextResult *_result;
DocumentData *_doc;
PhotoData *_photo;
int32 _position; // < 0 means removed from layout
@@ -532,11 +537,15 @@ private:
class LayoutContextGif : public LayoutContextItem {
public:
LayoutContextGif(DocumentData *data, bool saved);
LayoutContextGif(ContextResult *result, DocumentData *doc, bool saved);
virtual void setPosition(int32 position, int32 width);
virtual void setPosition(int32 position);
virtual void initDimensions();
virtual bool fullLine() const {
return false;
}
virtual void paint(Painter &p, const QRect &clip, uint32 selection, const PaintContext *context) const;
virtual void getState(TextLinkPtr &link, HistoryCursorState &cursor, int32 x, int32 y) const;
virtual void linkOver(const TextLinkPtr &lnk);
@@ -547,6 +556,17 @@ public:
private:
QSize countFrameSize() const;
int32 content_width() const;
int32 content_height() const;
bool content_loading() const;
bool content_displayLoading() const;
bool content_loaded() const;
float64 content_progress() const;
void content_automaticLoad() const;
void content_forget();
FileLocation content_location() const;
QByteArray content_data() const;
enum StateFlags {
StateOver = 0x01,
StateDeleteOver = 0x02,
@@ -559,6 +579,7 @@ private:
return (!_gif || _gif == BadClipReader) ? false : true;
}
QPixmap _thumb;
void prepareThumb(int32 width, int32 height, const QSize &frame) const;
void ensureAnimation() const;
bool isRadialAnimation(uint64 ms) const;