2020-11-20 19:25:35 +00:00
|
|
|
/*
|
|
|
|
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 "ui/wrap/slide_wrap.h"
|
2020-12-11 13:16:37 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2020-11-20 19:25:35 +00:00
|
|
|
#include "base/object_ptr.h"
|
2021-04-06 09:59:14 +00:00
|
|
|
#include "base/timer.h"
|
2020-11-20 19:25:35 +00:00
|
|
|
|
|
|
|
class Painter;
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
|
|
|
|
class PlainShadow;
|
2020-11-29 13:12:46 +00:00
|
|
|
class RoundButton;
|
2020-12-25 10:10:03 +00:00
|
|
|
struct GroupCallUser;
|
|
|
|
class GroupCallUserpics;
|
2020-11-20 19:25:35 +00:00
|
|
|
|
|
|
|
struct GroupCallBarContent {
|
2021-04-05 10:29:03 +00:00
|
|
|
QString title;
|
|
|
|
TimeId scheduleDate = 0;
|
2020-11-20 19:25:35 +00:00
|
|
|
int count = 0;
|
|
|
|
bool shown = false;
|
2020-12-25 10:10:03 +00:00
|
|
|
std::vector<GroupCallUser> users;
|
2020-11-20 19:25:35 +00:00
|
|
|
};
|
|
|
|
|
2021-04-06 09:59:14 +00:00
|
|
|
class GroupCallScheduledLeft final {
|
|
|
|
public:
|
2021-04-09 11:55:31 +00:00
|
|
|
enum class Negative {
|
|
|
|
Show,
|
|
|
|
Ignore,
|
|
|
|
};
|
2021-04-06 09:59:14 +00:00
|
|
|
explicit GroupCallScheduledLeft(TimeId date);
|
|
|
|
|
|
|
|
void setDate(TimeId date);
|
|
|
|
|
2021-04-09 11:55:31 +00:00
|
|
|
[[nodiscard]] rpl::producer<QString> text(Negative negative) const;
|
|
|
|
[[nodiscard]] rpl::producer<bool> late() const;
|
2021-04-06 09:59:14 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
[[nodiscard]] crl::time computePreciseDate() const;
|
|
|
|
void restart();
|
|
|
|
void update();
|
|
|
|
|
|
|
|
rpl::variable<QString> _text;
|
2021-04-09 11:55:31 +00:00
|
|
|
rpl::variable<QString> _textNonNegative;
|
|
|
|
rpl::variable<bool> _late;
|
2021-04-06 09:59:14 +00:00
|
|
|
TimeId _date = 0;
|
|
|
|
crl::time _datePrecise = 0;
|
|
|
|
base::Timer _timer;
|
|
|
|
rpl::lifetime _lifetime;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-11-20 19:25:35 +00:00
|
|
|
class GroupCallBar final {
|
|
|
|
public:
|
|
|
|
GroupCallBar(
|
|
|
|
not_null<QWidget*> parent,
|
2020-12-14 16:58:22 +00:00
|
|
|
rpl::producer<GroupCallBarContent> content,
|
|
|
|
rpl::producer<bool> &&hideBlobs);
|
2020-11-20 19:25:35 +00:00
|
|
|
~GroupCallBar();
|
|
|
|
|
|
|
|
void show();
|
|
|
|
void hide();
|
|
|
|
void raise();
|
|
|
|
void finishAnimating();
|
|
|
|
|
|
|
|
void setShadowGeometryPostprocess(Fn<QRect(QRect)> postprocess);
|
|
|
|
|
|
|
|
void move(int x, int y);
|
|
|
|
void resizeToWidth(int width);
|
|
|
|
[[nodiscard]] int height() const;
|
|
|
|
[[nodiscard]] rpl::producer<int> heightValue() const;
|
|
|
|
[[nodiscard]] rpl::producer<> barClicks() const;
|
|
|
|
[[nodiscard]] rpl::producer<> joinClicks() const;
|
|
|
|
|
|
|
|
[[nodiscard]] rpl::lifetime &lifetime() {
|
|
|
|
return _wrap.lifetime();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2020-12-25 10:10:03 +00:00
|
|
|
using User = GroupCallUser;
|
2020-12-11 14:53:02 +00:00
|
|
|
|
2021-04-06 09:59:14 +00:00
|
|
|
void refreshOpenBrush();
|
|
|
|
void refreshScheduledProcess();
|
2020-11-20 19:25:35 +00:00
|
|
|
void updateShadowGeometry(QRect wrapGeometry);
|
|
|
|
void updateControlsGeometry(QRect wrapGeometry);
|
2020-12-25 10:10:03 +00:00
|
|
|
void updateUserpics();
|
2020-11-20 19:25:35 +00:00
|
|
|
void setupInner();
|
2021-04-06 09:59:14 +00:00
|
|
|
void setupRightButton(not_null<RoundButton*> button);
|
2020-11-20 19:25:35 +00:00
|
|
|
void paint(Painter &p);
|
|
|
|
|
2020-11-29 13:12:46 +00:00
|
|
|
SlideWrap<> _wrap;
|
|
|
|
not_null<RpWidget*> _inner;
|
|
|
|
std::unique_ptr<RoundButton> _join;
|
2021-04-06 09:59:14 +00:00
|
|
|
std::unique_ptr<RoundButton> _open;
|
|
|
|
rpl::event_stream<Qt::MouseButton> _joinClicks;
|
|
|
|
QBrush _openBrushOverride;
|
|
|
|
int _openBrushForWidth = 0;
|
2020-11-29 13:12:46 +00:00
|
|
|
std::unique_ptr<PlainShadow> _shadow;
|
2020-11-20 19:25:35 +00:00
|
|
|
rpl::event_stream<> _barClicks;
|
|
|
|
Fn<QRect(QRect)> _shadowGeometryPostprocess;
|
|
|
|
bool _shouldBeShown = false;
|
|
|
|
bool _forceHidden = false;
|
|
|
|
|
|
|
|
GroupCallBarContent _content;
|
2021-04-06 09:59:14 +00:00
|
|
|
std::unique_ptr<GroupCallScheduledLeft> _scheduledProcess;
|
2020-12-25 10:10:03 +00:00
|
|
|
std::unique_ptr<GroupCallUserpics> _userpics;
|
2020-11-20 19:25:35 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Ui
|