init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
114
Telegram/SourceFiles/media/stories/media_stories_header.h
Normal file
114
Telegram/SourceFiles/media/stories/media_stories_header.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/timer.h"
|
||||
#include "ui/userpic_view.h"
|
||||
|
||||
namespace Data {
|
||||
enum class StoryPrivacy : uchar;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
class RpWidget;
|
||||
class FlatLabel;
|
||||
class IconButton;
|
||||
class AbstractButton;
|
||||
class UserpicButton;
|
||||
class ImportantTooltip;
|
||||
template <typename Widget>
|
||||
class FadeWrap;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Media::Stories {
|
||||
|
||||
class Controller;
|
||||
enum class PauseState;
|
||||
|
||||
struct HeaderData {
|
||||
not_null<PeerData*> peer;
|
||||
PeerData *fromPeer = nullptr;
|
||||
PeerData *repostPeer = nullptr;
|
||||
QString repostFrom;
|
||||
TimeId date = 0;
|
||||
int fullIndex = 0;
|
||||
int fullCount = 0;
|
||||
Data::StoryPrivacy privacy = {};
|
||||
bool edited = false;
|
||||
bool video = false;
|
||||
bool videoStream = false;
|
||||
bool silent = false;
|
||||
|
||||
friend inline auto operator<=>(HeaderData, HeaderData) = default;
|
||||
friend inline bool operator==(HeaderData, HeaderData) = default;
|
||||
};
|
||||
|
||||
class Header final {
|
||||
public:
|
||||
explicit Header(not_null<Controller*> controller);
|
||||
~Header();
|
||||
|
||||
void updatePauseState();
|
||||
void updateVolumeIcon();
|
||||
|
||||
void show(HeaderData data, rpl::producer<int> videoStreamViewers);
|
||||
void raise();
|
||||
|
||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||
[[nodiscard]] rpl::producer<bool> tooltipShownValue() const;
|
||||
|
||||
private:
|
||||
enum class Tooltip {
|
||||
None,
|
||||
SilentVideo,
|
||||
Privacy,
|
||||
};
|
||||
|
||||
void updateDateText();
|
||||
void applyPauseState();
|
||||
void createPlayPause();
|
||||
void createVolumeToggle();
|
||||
void rebuildVolumeControls(
|
||||
not_null<Ui::RpWidget*> dropdown,
|
||||
bool horizontal);
|
||||
void toggleTooltip(Tooltip type, bool show);
|
||||
void updateTooltipGeometry();
|
||||
void setVideoStreamViewers(rpl::producer<int> viewers);
|
||||
|
||||
const not_null<Controller*> _controller;
|
||||
|
||||
PauseState _pauseState = {};
|
||||
|
||||
std::unique_ptr<Ui::RpWidget> _widget;
|
||||
std::unique_ptr<Ui::AbstractButton> _info;
|
||||
std::unique_ptr<Ui::UserpicButton> _userpic;
|
||||
std::unique_ptr<Ui::FlatLabel> _name;
|
||||
std::unique_ptr<Ui::FlatLabel> _counter;
|
||||
std::unique_ptr<Ui::FlatLabel> _repost;
|
||||
std::unique_ptr<Ui::FlatLabel> _date;
|
||||
rpl::event_stream<> _dateUpdated;
|
||||
std::unique_ptr<Ui::RpWidget> _playPause;
|
||||
std::unique_ptr<Ui::RpWidget> _volumeToggle;
|
||||
std::unique_ptr<Ui::FadeWrap<Ui::RpWidget>> _volume;
|
||||
rpl::variable<const style::icon*> _volumeIcon;
|
||||
std::unique_ptr<Ui::RpWidget> _privacy;
|
||||
QRect _privacyBadgeGeometry;
|
||||
std::optional<HeaderData> _data;
|
||||
std::unique_ptr<Ui::ImportantTooltip> _tooltip;
|
||||
rpl::variable<bool> _tooltipShown = false;
|
||||
QRect _contentGeometry;
|
||||
Tooltip _tooltipType = {};
|
||||
base::Timer _dateUpdateTimer;
|
||||
bool _ignoreWindowMove = false;
|
||||
bool _privacyBadgeOver = false;
|
||||
|
||||
rpl::lifetime _videoStreamViewersLifetime;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Media::Stories
|
||||
Reference in New Issue
Block a user