// This is the source code of AyuGram for Desktop. // // We do not and cannot prevent the use of our code, // but be respectful and credit the original author. // // Copyright @Radolyn, 2024 #pragma once #include "window/section_widget.h" #include "window/section_memento.h" #include "ayu/ui/sections/edited/edited_log_item.h" #include "mtproto/sender.h" // don't reformat includes above namespace Ui { class ScrollArea; class PlainShadow; class FlatButton; } // namespace Ui namespace Profile { class BackButton; } // namespace Profile namespace EditedLog { class FixedBar; class InnerWidget; class SectionMemento; class Widget final : public Window::SectionWidget { public: Widget( QWidget *parent, not_null controller, not_null peer, not_null item); not_null channel() const; Dialogs::RowDescriptor activeChat() const override; bool hasTopBarShadow() const override { return true; } QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms) override; bool showInternal( not_null memento, const Window::SectionShow ¶ms) override; std::shared_ptr createMemento() override; void setInternalState(const QRect &geometry, not_null memento); // Float player interface. bool floatPlayerHandleWheelEvent(QEvent *e) override; QRect floatPlayerAvailableRect() override; protected: void resizeEvent(QResizeEvent *e) override; void paintEvent(QPaintEvent *e) override; void showAnimatedHook( const Window::SectionSlideParams ¶ms) override; void showFinishedHook() override; void doSetInnerFocus() override; private: void onScroll(); void updateAdaptiveLayout(); void saveState(not_null memento); void restoreState(not_null memento); void setupShortcuts(); object_ptr _scroll; QPointer _inner; object_ptr _fixedBar; object_ptr _fixedBarShadow; not_null _item; }; class SectionMemento : public Window::SectionMemento { public: using Element = HistoryView::Element; SectionMemento(not_null peer, not_null item) : _peer(peer), _item(item) { } object_ptr createWidget( QWidget *parent, not_null controller, Window::Column column, const QRect &geometry) override; not_null getPeer() const { return _peer; } void setScrollTop(int scrollTop) { _scrollTop = scrollTop; } int getScrollTop() const { return _scrollTop; } void setItems( std::vector &&items, std::set &&eventIds, bool upLoaded, bool downLoaded) { _items = std::move(items); _eventIds = std::move(eventIds); _upLoaded = upLoaded; _downLoaded = downLoaded; } std::vector takeItems() { return std::move(_items); } std::set takeEventIds() { return std::move(_eventIds); } bool upLoaded() const { return _upLoaded; } bool downLoaded() const { return _downLoaded; } private: not_null _peer; not_null _item; int _scrollTop = 0; std::vector> _admins; std::vector> _adminsCanEdit; std::vector _items; std::set _eventIds; bool _upLoaded = false; bool _downLoaded = true; }; } // namespace EditedLog