tdesktop/Telegram/SourceFiles/boxes/background_box.cpp

657 lines
19 KiB
C++
Raw Normal View History

2015-02-03 15:02:46 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2015-02-03 15:02:46 +00:00
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
2015-02-03 15:02:46 +00:00
*/
2017-04-06 14:38:10 +00:00
#include "boxes/background_box.h"
2015-02-03 15:02:46 +00:00
2017-04-13 08:27:10 +00:00
#include "lang/lang_keys.h"
2015-02-03 15:02:46 +00:00
#include "mainwidget.h"
#include "mainwindow.h"
#include "window/themes/window_theme.h"
2016-11-21 17:46:29 +00:00
#include "ui/effects/round_checkbox.h"
2019-01-21 11:08:26 +00:00
#include "ui/toast/toast.h"
#include "ui/image/image.h"
#include "history/history.h"
#include "history/history_message.h"
#include "history/view/history_view_message.h"
#include "auth_session.h"
#include "apiwrap.h"
2019-01-03 12:36:01 +00:00
#include "data/data_session.h"
#include "data/data_user.h"
#include "data/data_document.h"
#include "core/application.h"
#include "boxes/confirm_box.h"
#include "styles/style_overview.h"
#include "styles/style_history.h"
#include "styles/style_boxes.h"
2015-02-03 15:02:46 +00:00
2019-01-16 12:25:29 +00:00
namespace {
constexpr auto kBackgroundsInRow = 3;
constexpr auto kMaxWallPaperSlugLength = 255;
[[nodiscard]] bool IsValidWallPaperSlug(const QString &slug) {
if (slug.isEmpty() || slug.size() > kMaxWallPaperSlugLength) {
return false;
}
return ranges::find_if(slug, [](QChar ch) {
return (ch != '.')
&& (ch != '_')
&& (ch != '-')
&& (ch < '0' || ch > '9')
&& (ch < 'a' || ch > 'z')
&& (ch < 'A' || ch > 'Z');
}) == slug.end();
}
AdminLog::OwnedItem GenerateTextItem(
not_null<HistoryView::ElementDelegate*> delegate,
not_null<History*> history,
const QString &text,
bool out) {
Expects(history->peer->isUser());
using Flag = MTPDmessage::Flag;
2019-02-01 08:32:34 +00:00
static auto id = ServerMaxMsgId + (ServerMaxMsgId / 3);
const auto flags = Flag::f_entities
| Flag::f_from_id
| (out ? Flag::f_out : Flag(0));
const auto replyTo = 0;
const auto viaBotId = 0;
const auto item = new HistoryMessage(
history,
2019-02-01 08:32:34 +00:00
++id,
flags,
replyTo,
viaBotId,
unixtime(),
out ? history->session().userId() : peerToUser(history->peer->id),
QString(),
TextWithEntities{ TextUtilities::Clean(text) });
return AdminLog::OwnedItem(delegate, item);
}
2019-01-29 07:29:38 +00:00
QImage PrepareScaledNonPattern(
const QImage &image,
2019-01-29 07:29:38 +00:00
Images::Option blur) {
const auto size = st::boxWideWidth;
const auto width = std::max(image.width(), 1);
const auto height = std::max(image.height(), 1);
const auto takeWidth = (width > height)
? (width * size / height)
: size;
const auto takeHeight = (width > height)
? size
: (height * size / width);
return Images::prepare(
image,
takeWidth * cIntRetinaFactor(),
takeHeight * cIntRetinaFactor(),
2019-01-29 07:29:38 +00:00
Images::Option::Smooth
| Images::Option::TransparentBackground
| blur,
size,
size);
}
2019-01-29 07:29:38 +00:00
QImage ColorizePattern(QImage image, QColor color) {
if (image.format() != QImage::Format_ARGB32_Premultiplied) {
image = std::move(image).convertToFormat(
QImage::Format_ARGB32_Premultiplied);
}
// Similar to style::colorizeImage.
// But style::colorizeImage takes pattern with all pixels having the
// same components value, from (0, 0, 0, 0) to (255, 255, 255, 255).
//
// While in patterns we have different value ranges, usually they are
// from (0, 0, 0, 0) to (0, 0, 0, 255), so we should use only 'alpha'.
const auto width = image.width();
const auto height = image.height();
const auto pattern = anim::shifted(color);
const auto resultBytesPerPixel = (image.depth() >> 3);
constexpr auto resultIntsPerPixel = 1;
const auto resultIntsPerLine = (image.bytesPerLine() >> 2);
const auto resultIntsAdded = resultIntsPerLine - width * resultIntsPerPixel;
auto resultInts = reinterpret_cast<uint32*>(image.bits());
Assert(resultIntsAdded >= 0);
Assert(image.depth() == static_cast<int>((resultIntsPerPixel * sizeof(uint32)) << 3));
Assert(image.bytesPerLine() == (resultIntsPerLine << 2));
const auto maskBytesPerPixel = (image.depth() >> 3);
const auto maskBytesPerLine = image.bytesPerLine();
const auto maskBytesAdded = maskBytesPerLine - width * maskBytesPerPixel;
// We want to read the last byte of four available.
// This is the difference with style::colorizeImage.
auto maskBytes = image.constBits() + (maskBytesPerPixel - 1);
Assert(maskBytesAdded >= 0);
Assert(image.depth() == (maskBytesPerPixel << 3));
for (auto y = 0; y != height; ++y) {
for (auto x = 0; x != width; ++x) {
auto maskOpacity = static_cast<anim::ShiftedMultiplier>(*maskBytes) + 1;
*resultInts = anim::unshifted(pattern * maskOpacity);
maskBytes += maskBytesPerPixel;
resultInts += resultIntsPerPixel;
}
maskBytes += maskBytesAdded;
resultInts += resultIntsAdded;
}
return image;
2019-01-29 07:29:38 +00:00
}
QImage PrepareScaledFromFull(
const QImage &image,
std::optional<QColor> patternBackground,
Images::Option blur = Images::Option(0)) {
auto result = PrepareScaledNonPattern(image, blur);
if (patternBackground) {
result = ColorizePattern(
std::move(result),
Data::PatternColor(*patternBackground));
2019-01-29 07:29:38 +00:00
}
2019-01-29 17:03:51 +00:00
return std::move(result).convertToFormat(
QImage::Format_ARGB32_Premultiplied);
}
2019-01-16 12:25:29 +00:00
} // namespace
2019-01-03 14:39:19 +00:00
class BackgroundBox::Inner
: public Ui::RpWidget
, private MTP::Sender
, private base::Subscriber {
public:
Inner(QWidget *parent);
void setBackgroundChosenCallback(Fn<void(int index)> callback) {
_backgroundChosenCallback = std::move(callback);
}
~Inner();
protected:
void paintEvent(QPaintEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
void mousePressEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
private:
void updateWallpapers();
2019-01-28 13:59:49 +00:00
void paintPaper(
Painter &p,
const Data::WallPaper &paper,
int column,
int row) const;
Fn<void(int index)> _backgroundChosenCallback;
int _over = -1;
int _overDown = -1;
2019-01-16 12:25:29 +00:00
std::unique_ptr<Ui::RoundCheckbox> _check; // this is not a widget
};
BackgroundBox::BackgroundBox(QWidget*) {
}
void BackgroundBox::prepare() {
setTitle(langFactory(lng_backgrounds_header));
2019-01-03 12:36:01 +00:00
addButton(langFactory(lng_close), [=] { closeBox(); });
setDimensions(st::boxWideWidth, st::boxMaxListHeight);
_inner = setInnerWidget(object_ptr<Inner>(this), st::backgroundScroll);
2019-01-03 12:36:01 +00:00
_inner->setBackgroundChosenCallback([=](int index) {
backgroundChosen(index);
});
}
void BackgroundBox::backgroundChosen(int index) {
2019-01-16 12:25:29 +00:00
const auto &papers = Auth().data().wallpapers();
if (index >= 0 && index < papers.size()) {
2019-01-21 11:08:26 +00:00
Ui::show(
Box<BackgroundPreviewBox>(papers[index]),
LayerOption::KeepOther);
}
}
2019-01-03 14:39:19 +00:00
BackgroundBox::Inner::Inner(QWidget *parent) : RpWidget(parent)
, _check(std::make_unique<Ui::RoundCheckbox>(st::overviewCheck, [=] { update(); })) {
_check->setChecked(true, Ui::RoundCheckbox::SetStyle::Fast);
2019-01-16 12:25:29 +00:00
if (Auth().data().wallpapers().empty()) {
resize(kBackgroundsInRow * (st::backgroundSize.width() + st::backgroundPadding) + st::backgroundPadding, 2 * (st::backgroundSize.height() + st::backgroundPadding) + st::backgroundPadding);
2015-02-03 15:02:46 +00:00
} else {
updateWallpapers();
}
2019-01-16 12:25:29 +00:00
request(MTPaccount_GetWallPapers(
MTP_int(Auth().data().wallpapersHash())
)).done([=](const MTPaccount_WallPapers &result) {
if (Auth().data().updateWallpapers(result)) {
updateWallpapers();
}
}).send();
2019-01-16 12:25:29 +00:00
subscribe(Auth().downloaderTaskFinished(), [=] { update(); });
subscribe(Window::Theme::Background(), [=](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
_check->invalidateCache();
}
});
2015-02-03 15:02:46 +00:00
setMouseTracking(true);
}
void BackgroundBox::Inner::updateWallpapers() {
2019-01-16 12:25:29 +00:00
const auto &papers = Auth().data().wallpapers();
const auto count = papers.size();
const auto rows = (count / kBackgroundsInRow)
+ (count % kBackgroundsInRow ? 1 : 0);
2015-02-03 15:02:46 +00:00
2019-01-16 12:25:29 +00:00
resize(kBackgroundsInRow * (st::backgroundSize.width() + st::backgroundPadding) + st::backgroundPadding, rows * (st::backgroundSize.height() + st::backgroundPadding) + st::backgroundPadding);
2015-02-03 15:02:46 +00:00
2019-01-16 12:25:29 +00:00
const auto preload = kBackgroundsInRow * 3;
for (const auto &paper : papers | ranges::view::take(preload)) {
2019-01-28 13:59:49 +00:00
paper.loadThumbnail();
2015-02-03 15:02:46 +00:00
}
}
void BackgroundBox::Inner::paintEvent(QPaintEvent *e) {
2015-02-03 15:02:46 +00:00
QRect r(e->rect());
Painter p(this);
2015-02-03 15:02:46 +00:00
2019-01-16 12:25:29 +00:00
const auto &papers = Auth().data().wallpapers();
if (papers.empty()) {
p.setFont(st::noContactsFont);
p.setPen(st::noContactsColor);
2015-02-03 15:02:46 +00:00
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_loading), style::al_center);
2019-01-16 12:25:29 +00:00
return;
2015-02-03 15:02:46 +00:00
}
2019-01-16 12:25:29 +00:00
auto row = 0;
auto column = 0;
for (const auto &paper : papers) {
const auto increment = gsl::finally([&] {
++column;
if (column == kBackgroundsInRow) {
column = 0;
++row;
}
});
if ((st::backgroundSize.height() + st::backgroundPadding) * (row + 1) <= r.top()) {
continue;
2019-01-28 13:59:49 +00:00
} else if ((st::backgroundSize.height() + st::backgroundPadding) * row >= r.top() + r.height()) {
break;
2019-01-16 12:25:29 +00:00
}
2019-01-28 13:59:49 +00:00
paintPaper(p, paper, column, row);
}
}
2015-02-03 15:02:46 +00:00
2019-01-28 13:59:49 +00:00
void BackgroundBox::Inner::paintPaper(
Painter &p,
const Data::WallPaper &paper,
int column,
int row) const {
Expects(paper.thumbnail() != nullptr);
const auto x = st::backgroundPadding + column * (st::backgroundSize.width() + st::backgroundPadding);
const auto y = st::backgroundPadding + row * (st::backgroundSize.height() + st::backgroundPadding);
const auto &pixmap = paper.thumbnail()->pix(
paper.fileOrigin(),
st::backgroundSize.width(),
st::backgroundSize.height());
p.drawPixmap(x, y, pixmap);
if (paper.id() == Window::Theme::Background()->id()) {
const auto checkLeft = x + st::backgroundSize.width() - st::overviewCheckSkip - st::overviewCheck.size;
const auto checkTop = y + st::backgroundSize.height() - st::overviewCheckSkip - st::overviewCheck.size;
_check->paint(p, getms(), checkLeft, checkTop, width());
2019-01-16 12:25:29 +00:00
}
}
2015-02-03 15:02:46 +00:00
2019-01-16 12:25:29 +00:00
void BackgroundBox::Inner::mouseMoveEvent(QMouseEvent *e) {
const auto newOver = [&] {
const auto x = e->pos().x();
const auto y = e->pos().y();
const auto width = st::backgroundSize.width();
const auto height = st::backgroundSize.height();
const auto skip = st::backgroundPadding;
const auto row = int((y - skip) / (height + skip));
const auto column = int((x - skip) / (width + skip));
if (y - row * (height + skip) > skip + height) {
return -1;
} else if (x - column * (width + skip) > skip + width) {
return -1;
}
const auto result = row * kBackgroundsInRow + column;
return (result < Auth().data().wallpapers().size()) ? result : -1;
}();
if (_over != newOver) {
2015-02-03 15:02:46 +00:00
_over = newOver;
2019-01-16 12:25:29 +00:00
setCursor((_over >= 0 || _overDown >= 0)
? style::cur_pointer
: style::cur_default);
2015-02-03 15:02:46 +00:00
}
}
void BackgroundBox::Inner::mousePressEvent(QMouseEvent *e) {
2015-02-03 15:02:46 +00:00
_overDown = _over;
}
void BackgroundBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
2015-02-03 15:02:46 +00:00
if (_overDown == _over && _over >= 0) {
if (_backgroundChosenCallback) {
_backgroundChosenCallback(_over);
}
2015-02-03 15:02:46 +00:00
} else if (_over < 0) {
setCursor(style::cur_default);
}
}
BackgroundBox::Inner::~Inner() = default;
BackgroundPreviewBox::BackgroundPreviewBox(
QWidget*,
const Data::WallPaper &paper)
: _text1(GenerateTextItem(
this,
2019-01-18 12:27:37 +00:00
Auth().data().history(peerFromUser(ServiceUserId)),
lang(lng_background_text1),
false))
, _text2(GenerateTextItem(
this,
2019-01-18 12:27:37 +00:00
Auth().data().history(peerFromUser(ServiceUserId)),
lang(lng_background_text2),
true))
, _paper(paper)
, _radial(animation(this, &BackgroundPreviewBox::step_radial)) {
subscribe(Auth().downloaderTaskFinished(), [=] { update(); });
}
void BackgroundPreviewBox::prepare() {
setTitle(langFactory(lng_background_header));
addButton(langFactory(lng_background_apply), [=] { apply(); });
addButton(langFactory(lng_cancel), [=] { closeBox(); });
2019-01-28 13:59:49 +00:00
if (_paper.hasShareUrl()) {
2019-01-21 11:08:26 +00:00
addLeftButton(langFactory(lng_background_share), [=] { share(); });
}
2019-01-29 17:03:51 +00:00
updateServiceBg(_paper.backgroundColor());
2019-01-28 13:59:49 +00:00
_paper.loadThumbnail();
_paper.loadDocument();
if (_paper.document() && _paper.document()->loading()) {
_radial.start(_paper.document()->progress());
}
2019-01-28 13:59:49 +00:00
setScaledFromThumb();
checkLoadedDocument();
_text1->setDisplayDate(true);
_text1->initDimensions();
_text1->resizeGetHeight(st::boxWideWidth);
_text2->initDimensions();
_text2->resizeGetHeight(st::boxWideWidth);
setDimensions(st::boxWideWidth, st::boxWideWidth);
}
void BackgroundPreviewBox::apply() {
App::main()->setChatBackground(_paper, std::move(_full));
closeBox();
}
2019-01-21 11:08:26 +00:00
void BackgroundPreviewBox::share() {
2019-01-28 13:59:49 +00:00
QApplication::clipboard()->setText(_paper.shareUrl());
2019-01-21 11:08:26 +00:00
Ui::Toast::Show(lang(lng_background_link_copied));
}
void BackgroundPreviewBox::paintEvent(QPaintEvent *e) {
Painter p(this);
const auto ms = getms();
2019-01-29 07:29:38 +00:00
const auto color = _paper.backgroundColor();
if (color) {
p.fillRect(e->rect(), *color);
2019-01-29 07:29:38 +00:00
}
if (!color || _paper.isPattern()) {
2019-01-28 13:59:49 +00:00
if (_scaled.isNull() && !setScaledFromThumb()) {
p.fillRect(e->rect(), st::boxBg);
return;
}
paintImage(p);
paintRadial(p, ms);
}
paintTexts(p, ms);
}
void BackgroundPreviewBox::paintImage(Painter &p) {
Expects(!_scaled.isNull());
2019-01-29 07:29:38 +00:00
p.setOpacity(_paper.isPattern()
? std::clamp(_paper.patternIntensity() / 100., 0., 1.)
: 1.);
const auto guard = gsl::finally([&] { p.setOpacity(1.); });
const auto factor = cIntRetinaFactor();
const auto size = st::boxWideWidth;
const auto from = QRect(
0,
(size - height()) / 2 * factor,
size * factor,
height() * factor);
p.drawPixmap(rect(), _scaled, from);
}
void BackgroundPreviewBox::paintRadial(Painter &p, TimeMs ms) {
bool radial = false;
float64 radialOpacity = 0;
if (_radial.animating()) {
_radial.step(ms);
radial = _radial.animating();
radialOpacity = _radial.opacity();
}
if (!radial) {
return;
}
auto inner = radialRect();
p.setPen(Qt::NoPen);
p.setOpacity(radialOpacity);
p.setBrush(st::radialBg);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
p.setOpacity(1);
QRect arc(inner.marginsRemoved(QMargins(st::radialLine, st::radialLine, st::radialLine, st::radialLine)));
_radial.draw(p, arc, st::radialLine, st::radialFg);
}
QRect BackgroundPreviewBox::radialRect() const {
const auto available = height()
- st::historyPaddingBottom
- _text1->height()
- _text2->height()
- st::historyPaddingBottom;
return QRect(
QPoint(
(width() - st::radialSize.width()) / 2,
(available - st::radialSize.height()) / 2),
st::radialSize);
}
void BackgroundPreviewBox::paintTexts(Painter &p, TimeMs ms) {
const auto height1 = _text1->height();
const auto height2 = _text2->height();
const auto top = height()
- height1
- height2
- st::historyPaddingBottom;
p.translate(0, top);
2019-01-29 17:03:51 +00:00
paintDate(p);
_text1->draw(p, rect(), TextSelection(), ms);
p.translate(0, height1);
_text2->draw(p, rect(), TextSelection(), ms);
p.translate(0, height2);
}
2019-01-29 17:03:51 +00:00
void BackgroundPreviewBox::paintDate(Painter &p) {
const auto date = _text1->Get<HistoryView::DateBadge>();
if (!date || !_serviceBg) {
return;
}
const auto text = date->text;
const auto bubbleHeight = st::msgServicePadding.top() + st::msgServiceFont->height + st::msgServicePadding.bottom();
const auto bubbleTop = st::msgServiceMargin.top();
const auto textWidth = st::msgServiceFont->width(text);
const auto bubbleWidth = st::msgServicePadding.left() + textWidth + st::msgServicePadding.right();
const auto bubbleLeft = (width() - bubbleWidth) / 2;
const auto radius = bubbleHeight / 2;
p.setPen(Qt::NoPen);
p.setBrush(*_serviceBg);
p.drawRoundedRect(bubbleLeft, bubbleTop, bubbleWidth, bubbleHeight, radius, radius);
p.setPen(st::msgServiceFg);
p.setFont(st::msgServiceFont);
p.drawText(bubbleLeft + st::msgServicePadding.left(), bubbleTop + st::msgServicePadding.top() + st::msgServiceFont->ascent, text);
}
void BackgroundPreviewBox::step_radial(TimeMs ms, bool timer) {
2019-01-28 13:59:49 +00:00
Expects(_paper.document() != nullptr);
2019-01-28 13:59:49 +00:00
const auto document = _paper.document();
const auto wasAnimating = _radial.animating();
const auto updated = _radial.update(
document->progress(),
!document->loading(),
ms);
if (timer
&& (wasAnimating || _radial.animating())
&& (!anim::Disabled() || updated)) {
update(radialRect());
}
checkLoadedDocument();
}
2019-01-28 13:59:49 +00:00
bool BackgroundPreviewBox::setScaledFromThumb() {
2019-01-29 07:29:38 +00:00
const auto thumbnail = _paper.thumbnail();
if (!thumbnail || !thumbnail->loaded()) {
2019-01-29 07:29:38 +00:00
return false;
}
setScaledFromImage(PrepareScaledFromFull(
thumbnail->original(),
patternBackgroundColor(),
_paper.document() ? Images::Option::Blurred : Images::Option(0)));
return true;
}
void BackgroundPreviewBox::setScaledFromImage(QImage &&image) {
2019-01-29 17:03:51 +00:00
updateServiceBg(Window::Theme::CountAverageColor(image));
2019-01-29 07:29:38 +00:00
_scaled = App::pixmapFromImageInPlace(std::move(image));
}
2019-01-29 17:03:51 +00:00
void BackgroundPreviewBox::updateServiceBg(std::optional<QColor> background) {
if (background) {
_serviceBg = Window::Theme::AdjustedColor(
st::msgServiceBg->c,
*background);
}
}
2019-01-29 07:29:38 +00:00
std::optional<QColor> BackgroundPreviewBox::patternBackgroundColor() const {
return _paper.isPattern() ? _paper.backgroundColor() : std::nullopt;
2019-01-28 13:59:49 +00:00
}
void BackgroundPreviewBox::checkLoadedDocument() {
2019-01-28 13:59:49 +00:00
const auto document = _paper.document();
if (!document
|| !document->loaded(DocumentData::FilePathResolveChecked)
|| _generating) {
return;
}
const auto generateCallback = [=](QImage &&image) {
auto [left, right] = base::make_binary_guard();
_generating = std::move(left);
crl::async([
this,
image = std::move(image),
2019-01-29 07:29:38 +00:00
patternBackground = patternBackgroundColor(),
guard = std::move(right)
]() mutable {
2019-01-29 07:29:38 +00:00
auto scaled = PrepareScaledFromFull(image, patternBackground);
crl::on_main([
this,
image = std::move(image),
scaled = std::move(scaled),
guard = std::move(guard)
]() mutable {
if (!guard) {
return;
}
2019-01-29 07:29:38 +00:00
setScaledFromImage(std::move(scaled));
_full = std::move(image);
update();
});
});
};
_generating = Data::ReadImageAsync(
document,
Window::Theme::ProcessBackgroundImage,
generateCallback);
}
2019-01-29 07:29:38 +00:00
bool BackgroundPreviewBox::Start(
const QString &slug,
const QMap<QString, QString> &params) {
2019-01-28 13:59:49 +00:00
if (const auto paper = Data::WallPaper::FromColorSlug(slug)) {
2019-01-29 07:29:38 +00:00
Ui::show(Box<BackgroundPreviewBox>(paper->withUrlParams(params)));
return true;
}
if (!IsValidWallPaperSlug(slug)) {
Ui::show(Box<InformBox>(lang(lng_background_bad_link)));
return false;
}
2019-01-29 07:29:38 +00:00
Auth().api().requestWallPaper(slug, [=](const Data::WallPaper &result) {
Ui::show(Box<BackgroundPreviewBox>(result.withUrlParams(params)));
}, [](const RPCError &error) {
Ui::show(Box<InformBox>(lang(lng_background_bad_link)));
});
return true;
}
HistoryView::Context BackgroundPreviewBox::elementContext() {
return HistoryView::Context::ContactPreview;
}
std::unique_ptr<HistoryView::Element> BackgroundPreviewBox::elementCreate(
not_null<HistoryMessage*> message) {
return std::make_unique<HistoryView::Message>(this, message);
}
std::unique_ptr<HistoryView::Element> BackgroundPreviewBox::elementCreate(
not_null<HistoryService*> message) {
Unexpected("Service message in BackgroundPreviewBox.");
}
bool BackgroundPreviewBox::elementUnderCursor(
not_null<const Element*> view) {
return false;
}
void BackgroundPreviewBox::elementAnimationAutoplayAsync(
not_null<const Element*> element) {
}
TimeMs BackgroundPreviewBox::elementHighlightTime(
not_null<const Element*> element) {
return TimeMs();
}
bool BackgroundPreviewBox::elementInSelectionMode() {
return false;
}