/* This file is part of Telegram Desktop, the official desktop version of Telegram messaging app, see https://telegram.org Telegram Desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #pragma once #include #include "window/section_widget.h" namespace Ui { class SettingsSlider; class FadeShadow; } // namespace Ui namespace Info { namespace Profile { class Widget; } // namespace Profile namespace Media { class Widget; } // namespace Media class Section; class Memento; class MoveMemento; class ContentWidget; class TopBar; enum class Wrap { Layer, Narrow, Side, }; class Section final { public: enum class Type { Profile, Media, CommonGroups, }; using MediaType = Storage::SharedMediaType; Section(Type type) : _type(type) { Expects(type != Type::Media); } Section(MediaType mediaType) : _type(Type::Media) , _mediaType(mediaType) { } Type type() const { return _type; } MediaType mediaType() const { Expects(_type == Type::Media); return _mediaType; } private: Type _type; Storage::SharedMediaType _mediaType; }; class WrapWidget final : public Ui::RpWidget { public: WrapWidget( QWidget *parent, not_null controller, Wrap wrap, not_null memento); not_null peer() const; Wrap wrap() const; void setWrap(Wrap wrap); bool hasTopBarShadow() const; QPixmap grabForShowAnimation( const Window::SectionSlideParams ¶ms); bool showInternal( not_null memento); std::unique_ptr createMemento(); rpl::producer desiredHeightValue() const; void setInnerFocus(); void showFinished(); void updateInternalState(not_null memento); void saveState(not_null memento); // Float player interface. bool wheelEventFromFloatPlayer(QEvent *e); QRect rectForFloatPlayer() const; protected: void resizeEvent(QResizeEvent *e); void paintEvent(QPaintEvent *e); not_null controller() const { return _controller; } private: enum class Tab { Profile, Media, None, }; void applyState(Wrap wrap, not_null memento); void setupTop(Wrap wrap, const Section §ion, PeerId peerId); void setupTabbedTop(const Section §ion); void setupTabs(Tab tab); void createTabs(); void createTopBar( Wrap wrap, const Section §ion, PeerId peerId); not_null topWidget() const; QRect contentGeometry() const; rpl::producer desiredHeightForContent() const; void finishShowContent(); void updateContentGeometry(); void showTab(Tab tab); void showContent(object_ptr content); object_ptr createContent(Tab tab); object_ptr createProfileWidget(); object_ptr createMediaWidget(); not_null _controller; object_ptr _content = { nullptr }; object_ptr _topTabs = { nullptr }; object_ptr _topBar = { nullptr }; object_ptr _topShadow = { nullptr }; Tab _tab = Tab::Profile; rpl::event_stream> _desiredHeights; }; } // namespace Info