media_stories_view.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #include "media/stories/media_stories_view.h"
  8. #include "data/data_file_origin.h"
  9. #include "media/stories/media_stories_controller.h"
  10. #include "media/stories/media_stories_delegate.h"
  11. #include "media/stories/media_stories_header.h"
  12. #include "media/stories/media_stories_slider.h"
  13. #include "media/stories/media_stories_reply.h"
  14. namespace Media::Stories {
  15. View::View(not_null<Delegate*> delegate)
  16. : _controller(std::make_unique<Controller>(delegate)) {
  17. }
  18. View::~View() = default;
  19. void View::show(
  20. not_null<Data::Story*> story,
  21. Data::StoriesContext context) {
  22. _controller->show(story, context);
  23. }
  24. void View::ready() {
  25. _controller->ready();
  26. }
  27. Data::Story *View::story() const {
  28. return _controller->story();
  29. }
  30. QRect View::finalShownGeometry() const {
  31. return _controller->layout().content;
  32. }
  33. rpl::producer<QRect> View::finalShownGeometryValue() const {
  34. return _controller->layoutValue(
  35. ) | rpl::map([=](const Layout &layout) {
  36. return layout.content;
  37. }) | rpl::distinct_until_changed();
  38. }
  39. ContentLayout View::contentLayout() const {
  40. return _controller->contentLayout();
  41. }
  42. bool View::closeByClickAt(QPoint position) const {
  43. return _controller->closeByClickAt(position);
  44. }
  45. void View::updatePlayback(const Player::TrackState &state) {
  46. _controller->updateVideoPlayback(state);
  47. }
  48. ClickHandlerPtr View::lookupAreaHandler(QPoint point) const {
  49. return _controller->lookupAreaHandler(point);
  50. }
  51. bool View::subjumpAvailable(int delta) const {
  52. return _controller->subjumpAvailable(delta);
  53. }
  54. bool View::subjumpFor(int delta) const {
  55. return _controller->subjumpFor(delta);
  56. }
  57. bool View::jumpFor(int delta) const {
  58. return _controller->jumpFor(delta);
  59. }
  60. bool View::paused() const {
  61. return _controller->paused();
  62. }
  63. void View::togglePaused(bool paused) {
  64. _controller->togglePaused(paused);
  65. }
  66. void View::contentPressed(bool pressed) {
  67. _controller->contentPressed(pressed);
  68. }
  69. void View::menuShown(bool shown) {
  70. _controller->setMenuShown(shown);
  71. }
  72. void View::shareRequested() {
  73. _controller->shareRequested();
  74. }
  75. void View::deleteRequested() {
  76. _controller->deleteRequested();
  77. }
  78. void View::reportRequested() {
  79. _controller->reportRequested();
  80. }
  81. void View::toggleInProfileRequested(bool inProfile) {
  82. _controller->toggleInProfileRequested(inProfile);
  83. }
  84. bool View::ignoreWindowMove(QPoint position) const {
  85. return _controller->ignoreWindowMove(position);
  86. }
  87. void View::tryProcessKeyInput(not_null<QKeyEvent*> e) {
  88. _controller->tryProcessKeyInput(e);
  89. }
  90. bool View::allowStealthMode() const {
  91. return _controller->allowStealthMode();
  92. }
  93. void View::setupStealthMode() {
  94. _controller->setupStealthMode();
  95. }
  96. auto View::attachReactionsToMenu(
  97. not_null<Ui::PopupMenu*> menu,
  98. QPoint desiredPosition)
  99. -> AttachStripResult {
  100. return _controller->attachReactionsToMenu(menu, desiredPosition);
  101. }
  102. SiblingView View::sibling(SiblingType type) const {
  103. return _controller->sibling(type);
  104. }
  105. Data::FileOrigin View::fileOrigin() const {
  106. return _controller->fileOrigin();
  107. }
  108. TextWithEntities View::captionText() const {
  109. return _controller->captionText();
  110. }
  111. bool View::skipCaption() const {
  112. return _controller->skipCaption();
  113. }
  114. bool View::repost() const {
  115. return _controller->repost();
  116. }
  117. QMargins View::repostCaptionPadding() const {
  118. return _controller->repostCaptionPadding();
  119. }
  120. void View::drawRepostInfo(
  121. Painter &p,
  122. int x,
  123. int y,
  124. int availableWidth) const {
  125. _controller->drawRepostInfo(p, x, y, availableWidth);
  126. }
  127. RepostClickHandler View::lookupRepostHandler(QPoint position) const {
  128. return _controller->lookupRepostHandler(position);
  129. }
  130. void View::showFullCaption() {
  131. _controller->showFullCaption();
  132. }
  133. std::shared_ptr<ChatHelpers::Show> View::uiShow() const {
  134. return _controller->uiShow();
  135. }
  136. rpl::lifetime &View::lifetime() {
  137. return _controller->lifetime();
  138. }
  139. } // namespace Media::Stories