2017-04-25 20:36:04 +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-04-25 20:36:04 +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-04-25 20:36:04 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-11-30 17:33:27 +00:00
|
|
|
#include "base/weak_ptr.h"
|
2017-04-25 20:36:04 +00:00
|
|
|
#include "base/timer.h"
|
2019-09-13 12:22:54 +00:00
|
|
|
#include "base/object_ptr.h"
|
2020-12-08 20:16:27 +00:00
|
|
|
#include "base/unique_qptr.h"
|
2020-12-01 11:56:32 +00:00
|
|
|
#include "ui/effects/animations.h"
|
|
|
|
#include "ui/effects/gradient.h"
|
2017-09-13 16:57:44 +00:00
|
|
|
#include "ui/rp_widget.h"
|
2017-04-25 20:36:04 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class IconButton;
|
|
|
|
class AbstractButton;
|
|
|
|
class LabelSimple;
|
2017-05-14 19:44:50 +00:00
|
|
|
class FlatLabel;
|
2020-12-25 10:10:03 +00:00
|
|
|
struct GroupCallUser;
|
|
|
|
class GroupCallUserpics;
|
2022-06-14 11:20:38 +00:00
|
|
|
class Show;
|
2017-04-25 20:36:04 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2019-08-06 16:40:08 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2017-04-25 20:36:04 +00:00
|
|
|
namespace Calls {
|
|
|
|
|
|
|
|
class Call;
|
2020-11-24 14:40:10 +00:00
|
|
|
class GroupCall;
|
2018-05-27 08:24:47 +00:00
|
|
|
class SignalBars;
|
2020-12-01 16:44:05 +00:00
|
|
|
class Mute;
|
2020-12-01 11:56:32 +00:00
|
|
|
enum class MuteState;
|
2020-12-18 18:02:19 +00:00
|
|
|
enum class BarState;
|
2017-04-25 20:36:04 +00:00
|
|
|
|
2020-07-16 16:23:55 +00:00
|
|
|
class TopBar : public Ui::RpWidget {
|
2017-04-25 20:36:04 +00:00
|
|
|
public:
|
2022-06-14 11:20:38 +00:00
|
|
|
TopBar(
|
|
|
|
QWidget *parent,
|
|
|
|
const base::weak_ptr<Call> &call,
|
|
|
|
std::shared_ptr<Ui::Show> show);
|
|
|
|
TopBar(
|
|
|
|
QWidget *parent,
|
|
|
|
const base::weak_ptr<GroupCall> &call,
|
|
|
|
std::shared_ptr<Ui::Show> show);
|
2017-04-25 20:36:04 +00:00
|
|
|
~TopBar();
|
|
|
|
|
2020-12-09 11:43:54 +00:00
|
|
|
void initBlobsUnder(
|
|
|
|
QWidget *blobsParent,
|
|
|
|
rpl::producer<QRect> barGeometry);
|
|
|
|
|
2017-04-25 20:36:04 +00:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
|
|
|
|
private:
|
2020-12-11 11:04:34 +00:00
|
|
|
struct User;
|
|
|
|
|
2020-11-24 14:40:10 +00:00
|
|
|
TopBar(
|
|
|
|
QWidget *parent,
|
2022-06-14 11:20:38 +00:00
|
|
|
std::shared_ptr<Ui::Show> show,
|
2020-11-24 14:40:10 +00:00
|
|
|
const base::weak_ptr<Call> &call,
|
|
|
|
const base::weak_ptr<GroupCall> &groupCall);
|
|
|
|
|
2017-04-25 20:36:04 +00:00
|
|
|
void initControls();
|
2017-05-14 19:44:50 +00:00
|
|
|
void updateInfoLabels();
|
|
|
|
void setInfoLabels();
|
2017-04-25 20:36:04 +00:00
|
|
|
void updateDurationText();
|
|
|
|
void updateControlsGeometry();
|
2019-02-19 06:57:53 +00:00
|
|
|
void startDurationUpdateTimer(crl::time currentDuration);
|
2017-05-02 07:25:20 +00:00
|
|
|
void setMuted(bool mute);
|
2017-04-25 20:36:04 +00:00
|
|
|
|
2020-11-29 13:12:46 +00:00
|
|
|
void subscribeToMembersChanges(not_null<GroupCall*> call);
|
2020-12-25 10:10:03 +00:00
|
|
|
void updateUserpics();
|
2020-11-29 13:12:46 +00:00
|
|
|
|
2019-08-06 16:40:08 +00:00
|
|
|
const base::weak_ptr<Call> _call;
|
2020-11-24 14:40:10 +00:00
|
|
|
const base::weak_ptr<GroupCall> _groupCall;
|
2022-06-14 11:20:38 +00:00
|
|
|
const std::shared_ptr<Ui::Show> _show;
|
2017-04-25 20:36:04 +00:00
|
|
|
|
|
|
|
bool _muted = false;
|
2020-12-25 10:10:03 +00:00
|
|
|
std::vector<Ui::GroupCallUser> _users;
|
|
|
|
std::unique_ptr<Ui::GroupCallUserpics> _userpics;
|
|
|
|
int _userpicsWidth = 0;
|
2017-04-25 20:36:04 +00:00
|
|
|
object_ptr<Ui::LabelSimple> _durationLabel;
|
2018-05-27 08:24:47 +00:00
|
|
|
object_ptr<SignalBars> _signalBars;
|
2017-05-14 19:44:50 +00:00
|
|
|
object_ptr<Ui::FlatLabel> _fullInfoLabel;
|
|
|
|
object_ptr<Ui::FlatLabel> _shortInfoLabel;
|
2017-04-25 20:36:04 +00:00
|
|
|
object_ptr<Ui::LabelSimple> _hangupLabel;
|
2020-12-01 16:44:05 +00:00
|
|
|
object_ptr<Mute> _mute;
|
2017-04-25 20:36:04 +00:00
|
|
|
object_ptr<Ui::AbstractButton> _info;
|
|
|
|
object_ptr<Ui::IconButton> _hangup;
|
2020-12-08 20:16:27 +00:00
|
|
|
base::unique_qptr<Ui::RpWidget> _blobs;
|
2017-04-25 20:36:04 +00:00
|
|
|
|
2020-12-18 18:02:19 +00:00
|
|
|
rpl::variable<bool> _isGroupConnecting = false;
|
|
|
|
|
2020-12-01 11:56:32 +00:00
|
|
|
QBrush _groupBrush;
|
2020-12-18 18:02:19 +00:00
|
|
|
anim::linear_gradients<BarState> _gradients;
|
2020-12-01 11:56:32 +00:00
|
|
|
Ui::Animations::Simple _switchStateAnimation;
|
|
|
|
|
2017-04-25 20:36:04 +00:00
|
|
|
base::Timer _updateDurationTimer;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Calls
|