2016-10-12 19:34:25 +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.
|
2016-10-12 19:34:25 +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
|
2016-10-12 19:34:25 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-12-09 15:13:06 +00:00
|
|
|
#include "base/timer.h"
|
|
|
|
#include "ui/rp_widget.h"
|
2019-04-02 09:13:30 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2017-12-09 15:13:06 +00:00
|
|
|
#include "info/info_controller.h"
|
|
|
|
|
|
|
|
namespace Window {
|
2019-06-06 10:21:40 +00:00
|
|
|
class SessionController;
|
2017-12-09 15:13:06 +00:00
|
|
|
} // namespace Window
|
|
|
|
|
2016-10-13 15:04:40 +00:00
|
|
|
namespace Ui {
|
2016-11-16 10:44:06 +00:00
|
|
|
class ScrollArea;
|
2016-12-13 17:07:56 +00:00
|
|
|
class Shadow;
|
2016-10-13 15:04:40 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
namespace Media {
|
|
|
|
namespace Player {
|
|
|
|
|
|
|
|
class CoverWidget;
|
|
|
|
|
2017-12-09 15:13:06 +00:00
|
|
|
class Panel : public Ui::RpWidget, private Info::AbstractController {
|
2016-10-12 19:34:25 +00:00
|
|
|
public:
|
2017-12-09 15:13:06 +00:00
|
|
|
Panel(
|
|
|
|
QWidget *parent,
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller);
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
bool overlaps(const QRect &globalRect);
|
|
|
|
|
2016-10-14 17:10:15 +00:00
|
|
|
void hideIgnoringEnterEvents();
|
2016-10-12 19:34:25 +00:00
|
|
|
|
2016-10-14 17:10:15 +00:00
|
|
|
void showFromOther();
|
|
|
|
void hideFromOther();
|
|
|
|
|
|
|
|
int bestPositionFor(int left) const;
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2021-10-19 13:00:21 +00:00
|
|
|
void enterEventHook(QEnterEvent *e) override;
|
2017-02-11 11:24:37 +00:00
|
|
|
void leaveEventHook(QEvent *e) override;
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
private:
|
2017-12-09 15:13:06 +00:00
|
|
|
// Info::AbstractController implementation.
|
2018-01-22 19:51:38 +00:00
|
|
|
Info::Key key() const override;
|
2017-12-09 15:13:06 +00:00
|
|
|
PeerData *migrated() const override;
|
|
|
|
Info::Section section() const override;
|
|
|
|
|
|
|
|
void startShow();
|
|
|
|
void startHide();
|
|
|
|
void startHideChecked();
|
|
|
|
bool preventAutoHide() const;
|
|
|
|
void listHeightUpdated(int newHeight);
|
|
|
|
int emptyInnerHeight() const;
|
|
|
|
bool contentTooSmall() const;
|
|
|
|
|
2016-10-14 17:10:15 +00:00
|
|
|
void ensureCreated();
|
|
|
|
void performDestroy();
|
|
|
|
|
|
|
|
void updateControlsGeometry();
|
2017-12-09 15:13:06 +00:00
|
|
|
void refreshList();
|
2016-10-13 15:04:40 +00:00
|
|
|
void updateSize();
|
2016-10-12 19:34:25 +00:00
|
|
|
void appearanceCallback();
|
2016-10-26 16:43:13 +00:00
|
|
|
void hideFinished();
|
2016-10-12 19:34:25 +00:00
|
|
|
int contentLeft() const;
|
2016-10-14 17:10:15 +00:00
|
|
|
int contentTop() const;
|
|
|
|
int contentRight() const;
|
|
|
|
int contentBottom() const;
|
|
|
|
int scrollMarginBottom() const;
|
2016-10-12 19:34:25 +00:00
|
|
|
int contentWidth() const {
|
2016-10-14 17:10:15 +00:00
|
|
|
return width() - contentLeft() - contentRight();
|
|
|
|
}
|
|
|
|
int contentHeight() const {
|
|
|
|
return height() - contentTop() - contentBottom();;
|
2016-10-12 19:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void startAnimation();
|
2016-10-14 17:10:15 +00:00
|
|
|
void scrollPlaylistToCurrentTrack();
|
2017-12-09 15:13:06 +00:00
|
|
|
not_null<Info::AbstractController*> infoController() {
|
|
|
|
return static_cast<Info::AbstractController*>(this);
|
|
|
|
}
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
bool _hiding = false;
|
|
|
|
|
|
|
|
QPixmap _cache;
|
2019-04-02 09:13:30 +00:00
|
|
|
Ui::Animations::Simple _a_appearance;
|
2016-10-12 19:34:25 +00:00
|
|
|
|
2016-10-14 17:10:15 +00:00
|
|
|
bool _ignoringEnterEvents = false;
|
|
|
|
|
2017-12-09 15:13:06 +00:00
|
|
|
base::Timer _showTimer;
|
|
|
|
base::Timer _hideTimer;
|
2016-10-12 19:34:25 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::ScrollArea> _scroll;
|
2016-10-12 19:34:25 +00:00
|
|
|
|
2017-12-09 15:13:06 +00:00
|
|
|
rpl::lifetime _refreshListLifetime;
|
|
|
|
PeerData *_listPeer = nullptr;
|
|
|
|
PeerData *_listMigratedPeer = nullptr;
|
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
};
|
|
|
|
|
2019-02-27 11:36:19 +00:00
|
|
|
} // namespace Player
|
2016-10-12 19:34:25 +00:00
|
|
|
} // namespace Media
|