2017-09-13 17:01:23 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-09-13 17:01:23 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-09-13 17:01:23 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
#include "ui/layers/layer_widget.h"
|
2018-11-05 13:18:54 +00:00
|
|
|
#include "media/player/media_player_float.h"
|
2017-09-13 17:01:23 +00:00
|
|
|
|
|
|
|
namespace Window {
|
2019-06-06 10:21:40 +00:00
|
|
|
class SessionController;
|
2017-09-13 17:01:23 +00:00
|
|
|
} // namespace Window
|
|
|
|
|
|
|
|
namespace Info {
|
|
|
|
|
|
|
|
class Memento;
|
2017-09-15 17:34:41 +00:00
|
|
|
class MoveMemento;
|
2017-09-30 18:26:45 +00:00
|
|
|
class WrapWidget;
|
2017-09-13 17:01:23 +00:00
|
|
|
class TopBar;
|
|
|
|
|
2018-11-05 13:18:54 +00:00
|
|
|
class LayerWidget
|
2019-09-18 11:19:05 +00:00
|
|
|
: public Ui::LayerWidget
|
2018-11-05 13:18:54 +00:00
|
|
|
, private ::Media::Player::FloatDelegate {
|
2017-09-13 17:01:23 +00:00
|
|
|
public:
|
2017-09-30 18:26:45 +00:00
|
|
|
LayerWidget(
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2017-09-13 17:01:23 +00:00
|
|
|
not_null<Memento*> memento);
|
2017-09-30 18:26:45 +00:00
|
|
|
LayerWidget(
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2017-09-15 17:34:41 +00:00
|
|
|
not_null<MoveMemento*> memento);
|
2017-09-13 17:01:23 +00:00
|
|
|
|
|
|
|
void showFinished() override;
|
|
|
|
void parentResized() override;
|
|
|
|
|
2017-09-19 10:32:34 +00:00
|
|
|
bool takeToThirdSection() override;
|
2017-10-03 13:05:58 +00:00
|
|
|
bool showSectionInternal(
|
|
|
|
not_null<Window::SectionMemento*> memento,
|
|
|
|
const Window::SectionShow ¶ms) override;
|
2017-09-19 10:32:34 +00:00
|
|
|
|
2018-09-12 16:14:11 +00:00
|
|
|
bool closeByOutsideClick() const override;
|
|
|
|
|
2017-09-15 17:34:41 +00:00
|
|
|
static int MinimalSupportedWidth();
|
|
|
|
|
2018-11-05 13:18:54 +00:00
|
|
|
~LayerWidget();
|
|
|
|
|
2017-09-13 17:01:23 +00:00
|
|
|
protected:
|
2017-09-15 17:34:41 +00:00
|
|
|
int resizeGetHeight(int newWidth) override;
|
2018-09-06 13:48:01 +00:00
|
|
|
void doSetInnerFocus() override;
|
2017-09-13 17:01:23 +00:00
|
|
|
|
2017-09-15 17:34:41 +00:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2017-09-13 17:01:23 +00:00
|
|
|
|
|
|
|
private:
|
2018-11-09 15:16:27 +00:00
|
|
|
void closeHook() override;
|
|
|
|
|
|
|
|
void restoreFloatPlayerDelegate();
|
2018-11-05 13:18:54 +00:00
|
|
|
not_null<::Media::Player::FloatDelegate*> floatPlayerDelegate();
|
|
|
|
not_null<Ui::RpWidget*> floatPlayerWidget() override;
|
2020-06-25 14:17:37 +00:00
|
|
|
not_null<::Media::Player::FloatSectionDelegate*> floatPlayerGetSection(
|
2018-11-05 13:18:54 +00:00
|
|
|
Window::Column column) override;
|
|
|
|
void floatPlayerEnumerateSections(Fn<void(
|
2020-06-25 14:17:37 +00:00
|
|
|
not_null<::Media::Player::FloatSectionDelegate*> widget,
|
2018-11-05 13:18:54 +00:00
|
|
|
Window::Column widgetColumn)> callback) override;
|
|
|
|
bool floatPlayerIsVisible(not_null<HistoryItem*> item) override;
|
2021-06-15 23:06:22 +00:00
|
|
|
void floatPlayerDoubleClickEvent(
|
|
|
|
not_null<const HistoryItem*> item) override;
|
2018-11-05 13:18:54 +00:00
|
|
|
|
2017-09-15 17:34:41 +00:00
|
|
|
void setupHeightConsumers();
|
2022-04-12 12:07:25 +00:00
|
|
|
void setContentHeight(int height);
|
2022-04-27 11:19:52 +00:00
|
|
|
[[nodiscard]] QRect countGeometry(int newWidth);
|
2017-09-15 17:34:41 +00:00
|
|
|
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> _controller;
|
2017-09-30 18:26:45 +00:00
|
|
|
object_ptr<WrapWidget> _content;
|
2017-09-13 17:01:23 +00:00
|
|
|
|
|
|
|
int _desiredHeight = 0;
|
2022-04-12 12:07:25 +00:00
|
|
|
int _contentHeight = 0;
|
|
|
|
int _savedHeight = 0;
|
|
|
|
Ui::Animations::Simple _heightAnimation;
|
|
|
|
Ui::Animations::Simple _savedHeightAnimation;
|
|
|
|
bool _heightAnimated = false;
|
2017-11-23 12:48:56 +00:00
|
|
|
bool _inResize = false;
|
2022-04-27 11:19:52 +00:00
|
|
|
bool _pendingResize = false;
|
2017-11-23 12:48:56 +00:00
|
|
|
bool _tillBottom = false;
|
2022-05-23 08:04:31 +00:00
|
|
|
bool _contentTillBottom = false;
|
2017-09-13 17:01:23 +00:00
|
|
|
|
2018-11-09 15:16:27 +00:00
|
|
|
bool _floatPlayerDelegateRestored = false;
|
|
|
|
|
2017-09-13 17:01:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Info
|