2016-04-12 21:31:28 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-04-12 21:31:28 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2021-07-26 05:45:07 +00:00
|
|
|
#include "layout/layout_item_base.h"
|
2021-07-26 05:38:10 +00:00
|
|
|
#include "layout/layout_document_generic_preview.h"
|
2021-07-22 16:15:30 +00:00
|
|
|
#include "media/clip/media_clip_reader.h"
|
2016-04-12 21:31:28 +00:00
|
|
|
#include "core/click_handler_types.h"
|
2019-04-02 09:13:30 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2016-09-28 10:15:03 +00:00
|
|
|
#include "ui/effects/radial_animation.h"
|
2016-10-13 15:04:40 +00:00
|
|
|
#include "styles/style_overview.h"
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2020-05-29 14:08:18 +00:00
|
|
|
class Image;
|
|
|
|
|
2017-11-23 14:58:00 +00:00
|
|
|
namespace style {
|
|
|
|
struct RoundCheckbox;
|
|
|
|
} // namespace style
|
|
|
|
|
2018-01-14 16:02:25 +00:00
|
|
|
namespace Data {
|
|
|
|
class Media;
|
2020-05-25 14:16:04 +00:00
|
|
|
class PhotoMedia;
|
2020-03-27 11:40:50 +00:00
|
|
|
class DocumentMedia;
|
2018-01-14 16:02:25 +00:00
|
|
|
} // namespace Data
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
namespace Overview {
|
|
|
|
namespace Layout {
|
|
|
|
|
2017-11-23 14:58:00 +00:00
|
|
|
class Checkbox;
|
2020-05-21 12:27:04 +00:00
|
|
|
class ItemBase;
|
|
|
|
class Delegate;
|
2017-11-23 14:58:00 +00:00
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
class PaintContext : public PaintContextBase {
|
|
|
|
public:
|
2019-03-15 12:09:05 +00:00
|
|
|
PaintContext(crl::time ms, bool selecting) : PaintContextBase(ms, selecting) {
|
2016-04-12 21:31:28 +00:00
|
|
|
}
|
2019-03-15 12:09:05 +00:00
|
|
|
bool isAfterDate = false;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-06-14 06:51:14 +00:00
|
|
|
class ItemBase : public LayoutItemBase, public base::has_weak_ptr {
|
2016-04-12 21:31:28 +00:00
|
|
|
public:
|
2020-05-21 12:27:04 +00:00
|
|
|
ItemBase(not_null<Delegate*> delegate, not_null<HistoryItem*> parent);
|
|
|
|
~ItemBase();
|
2017-10-05 15:35:52 +00:00
|
|
|
|
2020-05-21 12:49:47 +00:00
|
|
|
virtual void paint(
|
|
|
|
Painter &p,
|
|
|
|
const QRect &clip,
|
|
|
|
TextSelection selection,
|
|
|
|
const PaintContext *context) = 0;
|
|
|
|
|
2018-02-03 19:52:35 +00:00
|
|
|
QDateTime dateTime() const;
|
|
|
|
|
2020-05-21 12:49:47 +00:00
|
|
|
HistoryItem *getItem() const {
|
2016-04-12 21:31:28 +00:00
|
|
|
return _parent;
|
|
|
|
}
|
|
|
|
|
2016-12-09 18:56:01 +00:00
|
|
|
void clickHandlerActiveChanged(const ClickHandlerPtr &action, bool active) override;
|
|
|
|
void clickHandlerPressedChanged(const ClickHandlerPtr &action, bool pressed) override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2020-05-21 12:49:47 +00:00
|
|
|
void invalidateCache();
|
2017-11-23 14:58:00 +00:00
|
|
|
|
2020-05-21 12:27:04 +00:00
|
|
|
virtual void clearHeavyPart() {
|
|
|
|
}
|
2017-11-23 14:58:00 +00:00
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
protected:
|
2020-05-21 12:27:04 +00:00
|
|
|
[[nodiscard]] not_null<HistoryItem*> parent() const {
|
2017-11-23 14:58:00 +00:00
|
|
|
return _parent;
|
|
|
|
}
|
2020-05-21 12:27:04 +00:00
|
|
|
[[nodiscard]] not_null<Delegate*> delegate() const {
|
|
|
|
return _delegate;
|
|
|
|
}
|
2017-11-23 14:58:00 +00:00
|
|
|
void paintCheckbox(
|
|
|
|
Painter &p,
|
|
|
|
QPoint position,
|
|
|
|
bool selected,
|
|
|
|
const PaintContext *context);
|
|
|
|
virtual const style::RoundCheckbox &checkboxStyle() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void ensureCheckboxCreated();
|
|
|
|
|
2020-05-21 12:27:04 +00:00
|
|
|
const not_null<Delegate*> _delegate;
|
2018-02-03 19:52:35 +00:00
|
|
|
const not_null<HistoryItem*> _parent;
|
|
|
|
const QDateTime _dateTime;
|
2017-11-23 14:58:00 +00:00
|
|
|
std::unique_ptr<Checkbox> _check;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class RadialProgressItem : public ItemBase {
|
|
|
|
public:
|
2020-05-21 12:27:04 +00:00
|
|
|
RadialProgressItem(
|
|
|
|
not_null<Delegate*> delegate,
|
|
|
|
not_null<HistoryItem*> parent)
|
|
|
|
: ItemBase(delegate, parent) {
|
2016-04-12 21:31:28 +00:00
|
|
|
}
|
|
|
|
RadialProgressItem(const RadialProgressItem &other) = delete;
|
|
|
|
|
2016-12-09 18:56:01 +00:00
|
|
|
void clickHandlerActiveChanged(const ClickHandlerPtr &action, bool active) override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
~RadialProgressItem();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
ClickHandlerPtr _openl, _savel, _cancell;
|
2017-10-05 15:35:52 +00:00
|
|
|
void setLinks(
|
|
|
|
ClickHandlerPtr &&openl,
|
|
|
|
ClickHandlerPtr &&savel,
|
|
|
|
ClickHandlerPtr &&cancell);
|
2021-07-22 16:12:30 +00:00
|
|
|
void setDocumentLinks(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
bool forceOpen = false);
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2019-04-04 15:24:13 +00:00
|
|
|
void radialAnimationCallback(crl::time now) const;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2016-11-21 16:24:23 +00:00
|
|
|
void ensureRadial();
|
2019-04-01 17:44:54 +00:00
|
|
|
void checkRadialFinished() const;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2019-04-04 15:24:13 +00:00
|
|
|
bool isRadialAnimation() const {
|
|
|
|
if (_radial) {
|
|
|
|
if (_radial->animating()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
checkRadialFinished();
|
|
|
|
}
|
|
|
|
return false;
|
2016-04-12 21:31:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual float64 dataProgress() const = 0;
|
|
|
|
virtual bool dataFinished() const = 0;
|
|
|
|
virtual bool dataLoaded() const = 0;
|
|
|
|
virtual bool iconAnimated() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-04-01 17:44:54 +00:00
|
|
|
mutable std::unique_ptr<Ui::RadialAnimation> _radial;
|
2019-04-02 09:13:30 +00:00
|
|
|
Ui::Animations::Simple _a_iconOver;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-11-21 16:24:23 +00:00
|
|
|
class StatusText {
|
2016-04-12 21:31:28 +00:00
|
|
|
public:
|
2016-11-21 16:24:23 +00:00
|
|
|
// duration = -1 - no duration, duration = -2 - "GIF" duration
|
2019-02-19 06:57:53 +00:00
|
|
|
void update(int newSize, int fullSize, int duration, crl::time realDuration);
|
2016-11-21 16:24:23 +00:00
|
|
|
void setSize(int newSize);
|
|
|
|
|
|
|
|
int size() const {
|
|
|
|
return _size;
|
|
|
|
}
|
|
|
|
QString text() const {
|
|
|
|
return _text;
|
2016-04-12 21:31:28 +00:00
|
|
|
}
|
|
|
|
|
2016-11-21 16:24:23 +00:00
|
|
|
private:
|
|
|
|
// >= 0 will contain download / upload string, _size = loaded bytes
|
|
|
|
// < 0 will contain played string, _size = -(seconds + 1) played
|
2016-04-12 21:31:28 +00:00
|
|
|
// 0x7FFFFFF0 will contain status for not yet downloaded file
|
|
|
|
// 0x7FFFFFF1 will contain status for already downloaded file
|
|
|
|
// 0x7FFFFFF2 will contain status for failed to download / upload file
|
2016-11-21 16:24:23 +00:00
|
|
|
int _size = 0;
|
|
|
|
QString _text;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-01-14 16:02:25 +00:00
|
|
|
struct Info : public RuntimeComponent<Info, LayoutItemBase> {
|
2016-04-12 21:31:28 +00:00
|
|
|
int top = 0;
|
|
|
|
};
|
|
|
|
|
2020-05-21 12:27:04 +00:00
|
|
|
class Photo final : public ItemBase {
|
2016-04-12 21:31:28 +00:00
|
|
|
public:
|
2017-10-05 15:35:52 +00:00
|
|
|
Photo(
|
2020-05-21 12:27:04 +00:00
|
|
|
not_null<Delegate*> delegate,
|
2017-10-05 15:35:52 +00:00
|
|
|
not_null<HistoryItem*> parent,
|
|
|
|
not_null<PhotoData*> photo);
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
void initDimensions() override;
|
|
|
|
int32 resizeGetHeight(int32 width) override;
|
2016-11-21 16:24:23 +00:00
|
|
|
void paint(Painter &p, const QRect &clip, TextSelection selection, const PaintContext *context) override;
|
2018-01-27 13:59:24 +00:00
|
|
|
TextState getState(
|
2017-10-13 19:07:04 +00:00
|
|
|
QPoint point,
|
2018-01-27 13:59:24 +00:00
|
|
|
StateRequest request) const override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2020-05-25 14:16:04 +00:00
|
|
|
void clearHeavyPart() override;
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
private:
|
2020-05-25 14:16:04 +00:00
|
|
|
void ensureDataMediaCreated() const;
|
2019-01-25 14:37:28 +00:00
|
|
|
void setPixFrom(not_null<Image*> image);
|
|
|
|
|
2020-05-25 14:16:04 +00:00
|
|
|
const not_null<PhotoData*> _data;
|
|
|
|
mutable std::shared_ptr<Data::PhotoMedia> _dataMedia;
|
2016-04-12 21:31:28 +00:00
|
|
|
ClickHandlerPtr _link;
|
|
|
|
|
2016-11-21 16:24:23 +00:00
|
|
|
QPixmap _pix;
|
|
|
|
bool _goodLoaded = false;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-07-22 16:15:30 +00:00
|
|
|
class Gif final : public RadialProgressItem {
|
|
|
|
public:
|
|
|
|
Gif(
|
|
|
|
not_null<Delegate*> delegate,
|
|
|
|
not_null<HistoryItem*> parent,
|
|
|
|
not_null<DocumentData*> gif);
|
|
|
|
~Gif();
|
|
|
|
|
|
|
|
void initDimensions() override;
|
|
|
|
int32 resizeGetHeight(int32 width) override;
|
|
|
|
void paint(
|
|
|
|
Painter &p,
|
|
|
|
const QRect &clip,
|
|
|
|
TextSelection selection,
|
|
|
|
const PaintContext *context) override;
|
|
|
|
TextState getState(
|
|
|
|
QPoint point,
|
|
|
|
StateRequest request) const override;
|
|
|
|
|
|
|
|
void clearHeavyPart() override;
|
2021-07-25 22:37:06 +00:00
|
|
|
void setPosition(int32 position) override;
|
2021-07-22 16:15:30 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
float64 dataProgress() const override;
|
|
|
|
bool dataFinished() const override;
|
|
|
|
bool dataLoaded() const override;
|
|
|
|
bool iconAnimated() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QSize countFrameSize() const;
|
|
|
|
int contentWidth() const;
|
|
|
|
int contentHeight() const;
|
|
|
|
|
|
|
|
void validateThumbnail(
|
|
|
|
Image *image,
|
|
|
|
QSize size,
|
|
|
|
QSize frame,
|
|
|
|
bool good);
|
|
|
|
void prepareThumbnail(QSize size, QSize frame);
|
|
|
|
|
|
|
|
void update();
|
|
|
|
|
|
|
|
void ensureDataMediaCreated() const;
|
|
|
|
void updateStatusText();
|
|
|
|
|
|
|
|
void clipCallback(Media::Clip::Notification notification);
|
|
|
|
|
|
|
|
Media::Clip::ReaderPointer _gif;
|
|
|
|
|
|
|
|
const not_null<DocumentData*> _data;
|
|
|
|
mutable std::shared_ptr<Data::DocumentMedia> _dataMedia;
|
|
|
|
StatusText _status;
|
|
|
|
|
|
|
|
QPixmap _thumb;
|
|
|
|
bool _thumbGood = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-03-27 11:40:50 +00:00
|
|
|
class Video final : public RadialProgressItem {
|
2016-04-12 21:31:28 +00:00
|
|
|
public:
|
2017-10-05 15:35:52 +00:00
|
|
|
Video(
|
2020-05-21 12:27:04 +00:00
|
|
|
not_null<Delegate*> delegate,
|
2017-10-05 15:35:52 +00:00
|
|
|
not_null<HistoryItem*> parent,
|
|
|
|
not_null<DocumentData*> video);
|
2020-03-27 11:40:50 +00:00
|
|
|
~Video();
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
void initDimensions() override;
|
|
|
|
int32 resizeGetHeight(int32 width) override;
|
2016-11-21 16:24:23 +00:00
|
|
|
void paint(Painter &p, const QRect &clip, TextSelection selection, const PaintContext *context) override;
|
2018-01-27 13:59:24 +00:00
|
|
|
TextState getState(
|
2017-10-13 19:07:04 +00:00
|
|
|
QPoint point,
|
2018-01-27 13:59:24 +00:00
|
|
|
StateRequest request) const override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2020-05-21 13:13:29 +00:00
|
|
|
void clearHeavyPart() override;
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
protected:
|
2017-09-26 11:49:16 +00:00
|
|
|
float64 dataProgress() const override;
|
|
|
|
bool dataFinished() const override;
|
|
|
|
bool dataLoaded() const override;
|
|
|
|
bool iconAnimated() const override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
private:
|
2020-03-27 11:40:50 +00:00
|
|
|
void ensureDataMediaCreated() const;
|
|
|
|
void updateStatusText();
|
|
|
|
|
2020-05-25 14:16:04 +00:00
|
|
|
const not_null<DocumentData*> _data;
|
2020-03-27 11:40:50 +00:00
|
|
|
mutable std::shared_ptr<Data::DocumentMedia> _dataMedia;
|
2016-11-21 16:24:23 +00:00
|
|
|
StatusText _status;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
QString _duration;
|
2016-11-21 16:24:23 +00:00
|
|
|
QPixmap _pix;
|
2019-04-08 10:35:25 +00:00
|
|
|
bool _pixBlurred = true;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-04-08 15:09:29 +00:00
|
|
|
class Voice final : public RadialProgressItem {
|
2016-04-12 21:31:28 +00:00
|
|
|
public:
|
2017-10-05 15:35:52 +00:00
|
|
|
Voice(
|
2020-05-21 12:27:04 +00:00
|
|
|
not_null<Delegate*> delegate,
|
2017-10-05 15:35:52 +00:00
|
|
|
not_null<HistoryItem*> parent,
|
|
|
|
not_null<DocumentData*> voice,
|
|
|
|
const style::OverviewFileLayout &st);
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
void initDimensions() override;
|
2016-11-21 16:24:23 +00:00
|
|
|
void paint(Painter &p, const QRect &clip, TextSelection selection, const PaintContext *context) override;
|
2018-01-27 13:59:24 +00:00
|
|
|
TextState getState(
|
2017-10-13 19:07:04 +00:00
|
|
|
QPoint point,
|
2018-01-27 13:59:24 +00:00
|
|
|
StateRequest request) const override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2020-05-21 13:13:29 +00:00
|
|
|
void clearHeavyPart() override;
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
protected:
|
2017-09-26 11:49:16 +00:00
|
|
|
float64 dataProgress() const override;
|
|
|
|
bool dataFinished() const override;
|
|
|
|
bool dataLoaded() const override;
|
|
|
|
bool iconAnimated() const override;
|
2017-11-23 14:58:00 +00:00
|
|
|
const style::RoundCheckbox &checkboxStyle() const override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
private:
|
2020-04-08 15:09:29 +00:00
|
|
|
void ensureDataMediaCreated() const;
|
2018-11-05 08:22:05 +00:00
|
|
|
int duration() const;
|
|
|
|
|
2017-10-05 15:35:52 +00:00
|
|
|
not_null<DocumentData*> _data;
|
2020-04-08 15:09:29 +00:00
|
|
|
mutable std::shared_ptr<Data::DocumentMedia> _dataMedia;
|
2016-11-21 16:24:23 +00:00
|
|
|
StatusText _status;
|
2016-04-12 21:31:28 +00:00
|
|
|
ClickHandlerPtr _namel;
|
|
|
|
|
2016-12-08 14:08:54 +00:00
|
|
|
const style::OverviewFileLayout &_st;
|
|
|
|
|
2019-06-12 13:26:04 +00:00
|
|
|
Ui::Text::String _name, _details;
|
2016-11-21 16:24:23 +00:00
|
|
|
int _nameVersion;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2016-11-21 16:24:23 +00:00
|
|
|
void updateName();
|
|
|
|
bool updateStatusText();
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-04-08 15:09:29 +00:00
|
|
|
class Document final : public RadialProgressItem {
|
2016-04-12 21:31:28 +00:00
|
|
|
public:
|
2017-10-05 15:35:52 +00:00
|
|
|
Document(
|
2020-05-21 12:27:04 +00:00
|
|
|
not_null<Delegate*> delegate,
|
2017-10-05 15:35:52 +00:00
|
|
|
not_null<HistoryItem*> parent,
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
const style::OverviewFileLayout &st);
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
void initDimensions() override;
|
2016-11-21 16:24:23 +00:00
|
|
|
void paint(Painter &p, const QRect &clip, TextSelection selection, const PaintContext *context) override;
|
2018-01-27 13:59:24 +00:00
|
|
|
TextState getState(
|
2017-10-13 19:07:04 +00:00
|
|
|
QPoint point,
|
2018-01-27 13:59:24 +00:00
|
|
|
StateRequest request) const override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2020-05-21 13:13:29 +00:00
|
|
|
void clearHeavyPart() override;
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
protected:
|
2017-09-26 11:49:16 +00:00
|
|
|
float64 dataProgress() const override;
|
|
|
|
bool dataFinished() const override;
|
|
|
|
bool dataLoaded() const override;
|
|
|
|
bool iconAnimated() const override;
|
2017-11-23 14:58:00 +00:00
|
|
|
const style::RoundCheckbox &checkboxStyle() const override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
private:
|
2019-03-15 12:09:05 +00:00
|
|
|
[[nodiscard]] bool downloadInCorner() const;
|
|
|
|
void drawCornerDownload(Painter &p, bool selected, const PaintContext *context) const;
|
|
|
|
[[nodiscard]] TextState cornerDownloadTextState(
|
|
|
|
QPoint point,
|
|
|
|
StateRequest request) const;
|
|
|
|
|
2020-04-08 15:09:29 +00:00
|
|
|
void ensureDataMediaCreated() const;
|
|
|
|
|
2017-10-05 15:35:52 +00:00
|
|
|
not_null<DocumentData*> _data;
|
2020-04-08 15:09:29 +00:00
|
|
|
mutable std::shared_ptr<Data::DocumentMedia> _dataMedia;
|
2016-11-21 16:24:23 +00:00
|
|
|
StatusText _status;
|
2016-04-12 21:31:28 +00:00
|
|
|
ClickHandlerPtr _msgl, _namel;
|
|
|
|
|
2016-10-13 15:04:40 +00:00
|
|
|
const style::OverviewFileLayout &_st;
|
2021-07-26 05:38:10 +00:00
|
|
|
const ::Layout::DocumentGenericPreview _generic;
|
2016-10-13 15:04:40 +00:00
|
|
|
|
2019-01-25 14:37:28 +00:00
|
|
|
bool _thumbLoaded = false;
|
2016-11-21 16:24:23 +00:00
|
|
|
QPixmap _thumb;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2019-06-12 13:26:04 +00:00
|
|
|
Ui::Text::String _name;
|
2016-10-13 15:04:40 +00:00
|
|
|
QString _date, _ext;
|
|
|
|
int32 _datew, _extw;
|
2021-07-26 05:38:10 +00:00
|
|
|
int32 _thumbw;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2017-09-26 11:49:16 +00:00
|
|
|
bool withThumb() const;
|
2016-11-21 16:24:23 +00:00
|
|
|
bool updateStatusText();
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-04-08 15:09:29 +00:00
|
|
|
class Link final : public ItemBase {
|
2016-04-12 21:31:28 +00:00
|
|
|
public:
|
2017-10-05 15:35:52 +00:00
|
|
|
Link(
|
2020-05-21 12:27:04 +00:00
|
|
|
not_null<Delegate*> delegate,
|
2017-10-05 15:35:52 +00:00
|
|
|
not_null<HistoryItem*> parent,
|
2018-01-14 16:02:25 +00:00
|
|
|
Data::Media *media);
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
void initDimensions() override;
|
|
|
|
int32 resizeGetHeight(int32 width) override;
|
2016-11-21 16:24:23 +00:00
|
|
|
void paint(Painter &p, const QRect &clip, TextSelection selection, const PaintContext *context) override;
|
2018-01-27 13:59:24 +00:00
|
|
|
TextState getState(
|
2017-10-13 19:07:04 +00:00
|
|
|
QPoint point,
|
2018-01-27 13:59:24 +00:00
|
|
|
StateRequest request) const override;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2020-05-21 13:13:29 +00:00
|
|
|
void clearHeavyPart() override;
|
|
|
|
|
2017-11-23 14:58:00 +00:00
|
|
|
protected:
|
|
|
|
const style::RoundCheckbox &checkboxStyle() const override;
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
private:
|
2020-05-25 14:16:04 +00:00
|
|
|
void ensurePhotoMediaCreated();
|
2020-04-15 14:06:34 +00:00
|
|
|
void ensureDocumentMediaCreated();
|
2020-05-21 10:59:55 +00:00
|
|
|
void validateThumbnail();
|
2020-04-15 14:06:34 +00:00
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
ClickHandlerPtr _photol;
|
|
|
|
|
|
|
|
QString _title, _letter;
|
|
|
|
int _titlew = 0;
|
|
|
|
WebPageData *_page = nullptr;
|
2020-05-25 14:16:04 +00:00
|
|
|
std::shared_ptr<Data::PhotoMedia> _photoMedia;
|
2020-04-15 14:06:34 +00:00
|
|
|
std::shared_ptr<Data::DocumentMedia> _documentMedia;
|
2016-04-12 21:31:28 +00:00
|
|
|
int _pixw = 0;
|
|
|
|
int _pixh = 0;
|
2019-06-12 13:26:04 +00:00
|
|
|
Ui::Text::String _text = { st::msgMinWidth };
|
2020-05-21 10:59:55 +00:00
|
|
|
QPixmap _thumbnail;
|
2020-12-30 12:12:39 +00:00
|
|
|
bool _thumbnailBlurred = true;
|
2016-04-12 21:31:28 +00:00
|
|
|
|
|
|
|
struct LinkEntry {
|
|
|
|
LinkEntry() : width(0) {
|
|
|
|
}
|
|
|
|
LinkEntry(const QString &url, const QString &text);
|
|
|
|
QString text;
|
|
|
|
int32 width;
|
2017-12-18 10:38:14 +00:00
|
|
|
std::shared_ptr<TextClickHandler> lnk;
|
2016-04-12 21:31:28 +00:00
|
|
|
};
|
|
|
|
QVector<LinkEntry> _links;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Layout
|
|
|
|
} // namespace Overview
|