2023-05-03 22:30:37 +04:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
#include "media/stories/media_stories_view.h"
|
|
|
|
|
2023-05-26 12:45:50 +04:00
|
|
|
#include "data/data_file_origin.h"
|
2023-05-05 14:40:51 +04:00
|
|
|
#include "media/stories/media_stories_controller.h"
|
2023-05-03 22:30:37 +04:00
|
|
|
#include "media/stories/media_stories_delegate.h"
|
|
|
|
#include "media/stories/media_stories_header.h"
|
|
|
|
#include "media/stories/media_stories_slider.h"
|
|
|
|
#include "media/stories/media_stories_reply.h"
|
|
|
|
|
|
|
|
namespace Media::Stories {
|
|
|
|
|
|
|
|
View::View(not_null<Delegate*> delegate)
|
2023-05-05 14:40:51 +04:00
|
|
|
: _controller(std::make_unique<Controller>(delegate)) {
|
2023-05-03 22:30:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
View::~View() = default;
|
|
|
|
|
2023-06-05 16:10:34 +04:00
|
|
|
void View::show(
|
|
|
|
not_null<Data::Story*> story,
|
|
|
|
Data::StoriesContext context) {
|
|
|
|
_controller->show(story, context);
|
2023-05-05 14:40:51 +04:00
|
|
|
}
|
2023-05-03 22:30:37 +04:00
|
|
|
|
2023-05-07 00:20:21 +04:00
|
|
|
void View::ready() {
|
|
|
|
_controller->ready();
|
|
|
|
}
|
|
|
|
|
2023-06-22 19:29:11 +04:00
|
|
|
Data::Story *View::story() const {
|
|
|
|
return _controller->story();
|
2023-05-09 19:37:40 +04:00
|
|
|
}
|
|
|
|
|
2023-05-11 18:36:59 +04:00
|
|
|
QRect View::finalShownGeometry() const {
|
2023-05-05 14:40:51 +04:00
|
|
|
return _controller->layout().content;
|
2023-05-03 22:30:37 +04:00
|
|
|
}
|
|
|
|
|
2023-05-11 18:36:59 +04:00
|
|
|
rpl::producer<QRect> View::finalShownGeometryValue() const {
|
2023-05-09 14:31:48 +04:00
|
|
|
return _controller->layoutValue(
|
|
|
|
) | rpl::map([=](const Layout &layout) {
|
|
|
|
return layout.content;
|
|
|
|
}) | rpl::distinct_until_changed();
|
|
|
|
}
|
|
|
|
|
2023-05-11 18:36:59 +04:00
|
|
|
ContentLayout View::contentLayout() const {
|
|
|
|
return _controller->contentLayout();
|
2023-05-10 14:33:17 +04:00
|
|
|
}
|
|
|
|
|
2023-06-27 13:59:36 +04:00
|
|
|
bool View::closeByClickAt(QPoint position) const {
|
|
|
|
return _controller->closeByClickAt(position);
|
|
|
|
}
|
|
|
|
|
2023-05-07 00:20:21 +04:00
|
|
|
void View::updatePlayback(const Player::TrackState &state) {
|
|
|
|
_controller->updateVideoPlayback(state);
|
|
|
|
}
|
|
|
|
|
2023-08-29 21:34:21 +04:00
|
|
|
ClickHandlerPtr View::lookupAreaHandler(QPoint point) const {
|
|
|
|
return _controller->lookupAreaHandler(point);
|
2023-08-07 11:21:03 +02:00
|
|
|
}
|
|
|
|
|
2023-05-09 14:31:48 +04:00
|
|
|
bool View::subjumpAvailable(int delta) const {
|
|
|
|
return _controller->subjumpAvailable(delta);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool View::subjumpFor(int delta) const {
|
|
|
|
return _controller->subjumpFor(delta);
|
2023-05-07 00:20:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool View::jumpFor(int delta) const {
|
|
|
|
return _controller->jumpFor(delta);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool View::paused() const {
|
|
|
|
return _controller->paused();
|
|
|
|
}
|
|
|
|
|
|
|
|
void View::togglePaused(bool paused) {
|
|
|
|
_controller->togglePaused(paused);
|
|
|
|
}
|
|
|
|
|
2023-06-08 19:54:21 +04:00
|
|
|
void View::contentPressed(bool pressed) {
|
|
|
|
_controller->contentPressed(pressed);
|
|
|
|
}
|
|
|
|
|
2023-06-30 15:24:59 +04:00
|
|
|
void View::menuShown(bool shown) {
|
|
|
|
_controller->setMenuShown(shown);
|
|
|
|
}
|
|
|
|
|
2023-06-22 19:29:11 +04:00
|
|
|
void View::shareRequested() {
|
|
|
|
_controller->shareRequested();
|
|
|
|
}
|
|
|
|
|
|
|
|
void View::deleteRequested() {
|
|
|
|
_controller->deleteRequested();
|
|
|
|
}
|
|
|
|
|
|
|
|
void View::reportRequested() {
|
|
|
|
_controller->reportRequested();
|
2023-06-12 20:41:26 +04:00
|
|
|
}
|
|
|
|
|
2023-06-30 15:24:59 +04:00
|
|
|
void View::togglePinnedRequested(bool pinned) {
|
|
|
|
_controller->togglePinnedRequested(pinned);
|
|
|
|
}
|
|
|
|
|
2023-07-20 10:00:29 +04:00
|
|
|
bool View::ignoreWindowMove(QPoint position) const {
|
|
|
|
return _controller->ignoreWindowMove(position);
|
|
|
|
}
|
|
|
|
|
2023-07-20 19:31:43 +04:00
|
|
|
void View::tryProcessKeyInput(not_null<QKeyEvent*> e) {
|
|
|
|
_controller->tryProcessKeyInput(e);
|
|
|
|
}
|
|
|
|
|
2023-08-01 19:09:09 +02:00
|
|
|
bool View::allowStealthMode() const {
|
|
|
|
return _controller->allowStealthMode();
|
|
|
|
}
|
|
|
|
|
|
|
|
void View::setupStealthMode() {
|
|
|
|
_controller->setupStealthMode();
|
|
|
|
}
|
|
|
|
|
2023-08-08 17:59:13 +02:00
|
|
|
auto View::attachReactionsToMenu(
|
|
|
|
not_null<Ui::PopupMenu*> menu,
|
|
|
|
QPoint desiredPosition)
|
|
|
|
-> AttachStripResult {
|
|
|
|
return _controller->attachReactionsToMenu(menu, desiredPosition);
|
|
|
|
}
|
|
|
|
|
2023-05-11 18:36:59 +04:00
|
|
|
SiblingView View::sibling(SiblingType type) const {
|
|
|
|
return _controller->sibling(type);
|
2023-05-09 14:31:48 +04:00
|
|
|
}
|
|
|
|
|
2023-05-26 12:45:50 +04:00
|
|
|
Data::FileOrigin View::fileOrigin() const {
|
|
|
|
return _controller->fileOrigin();
|
|
|
|
}
|
|
|
|
|
2023-05-12 13:41:25 +04:00
|
|
|
TextWithEntities View::captionText() const {
|
|
|
|
return _controller->captionText();
|
|
|
|
}
|
|
|
|
|
2023-07-25 17:37:56 +04:00
|
|
|
bool View::skipCaption() const {
|
|
|
|
return _controller->skipCaption();
|
2023-07-21 16:40:20 +04:00
|
|
|
}
|
|
|
|
|
2023-11-24 13:02:03 +04:00
|
|
|
bool View::repost() const {
|
|
|
|
return _controller->repost();
|
|
|
|
}
|
|
|
|
|
2023-11-24 22:11:40 +04:00
|
|
|
QMargins View::repostCaptionPadding() const {
|
|
|
|
return _controller->repostCaptionPadding();
|
2023-11-24 13:02:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void View::drawRepostInfo(
|
|
|
|
Painter &p,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int availableWidth) const {
|
|
|
|
_controller->drawRepostInfo(p, x, y, availableWidth);
|
|
|
|
}
|
|
|
|
|
2023-11-26 22:42:05 +04:00
|
|
|
RepostClickHandler View::lookupRepostHandler(QPoint position) const {
|
|
|
|
return _controller->lookupRepostHandler(position);
|
|
|
|
}
|
|
|
|
|
2023-05-12 21:10:00 +04:00
|
|
|
void View::showFullCaption() {
|
|
|
|
_controller->showFullCaption();
|
|
|
|
}
|
|
|
|
|
2023-05-09 14:31:48 +04:00
|
|
|
rpl::lifetime &View::lifetime() {
|
|
|
|
return _controller->lifetime();
|
|
|
|
}
|
|
|
|
|
2023-05-03 22:30:37 +04:00
|
|
|
} // namespace Media::Stories
|