2021-01-15 16:18: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/rp_widget.h"
|
|
|
|
#include "ui/widgets/menu/menu_item_base.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
2021-01-16 15:11:43 +00:00
|
|
|
class CrossLineAnimation;
|
2021-01-15 16:18:35 +00:00
|
|
|
class MediaSlider;
|
2021-01-17 21:44:03 +00:00
|
|
|
namespace Paint {
|
|
|
|
class ArcsAnimation;
|
|
|
|
} // namespace Paint
|
2021-01-15 16:18:35 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Calls {
|
|
|
|
|
|
|
|
namespace Group {
|
|
|
|
struct MuteRequest;
|
|
|
|
struct VolumeRequest;
|
|
|
|
struct ParticipantState;
|
|
|
|
} // namespace Group
|
|
|
|
|
|
|
|
class MenuVolumeItem final : public Ui::Menu::ItemBase {
|
|
|
|
public:
|
|
|
|
MenuVolumeItem(
|
|
|
|
not_null<RpWidget*> parent,
|
|
|
|
const style::Menu &st,
|
|
|
|
rpl::producer<Group::ParticipantState> participantState,
|
|
|
|
int startVolume,
|
|
|
|
int maxVolume,
|
|
|
|
bool muted);
|
|
|
|
|
|
|
|
not_null<QAction*> action() const override;
|
|
|
|
bool isEnabled() const override;
|
|
|
|
|
|
|
|
[[nodiscard]] rpl::producer<bool> toggleMuteRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<bool> toggleMuteLocallyRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<int> changeVolumeRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<int> changeVolumeLocallyRequests() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int contentHeight() const override;
|
|
|
|
|
|
|
|
private:
|
2021-01-17 21:44:03 +00:00
|
|
|
void initArcsAnimation();
|
|
|
|
|
2021-01-15 16:18:35 +00:00
|
|
|
void setCloudVolume(int volume);
|
|
|
|
void setSliderVolume(int volume);
|
2021-06-17 12:22:51 +00:00
|
|
|
void updateSliderColor(float64 value);
|
2021-01-15 16:18:35 +00:00
|
|
|
|
2021-01-16 20:10:15 +00:00
|
|
|
QColor unmuteColor() const;
|
|
|
|
QColor muteColor() const;
|
|
|
|
|
2021-01-15 16:18:35 +00:00
|
|
|
const int _maxVolume;
|
|
|
|
int _cloudVolume = 0;
|
|
|
|
bool _waitingForUpdateVolume = false;
|
|
|
|
bool _cloudMuted = false;
|
|
|
|
bool _localMuted = false;
|
|
|
|
|
2021-01-16 15:18:03 +00:00
|
|
|
QRect _itemRect;
|
|
|
|
QRect _speakerRect;
|
2021-01-17 21:44:03 +00:00
|
|
|
QPoint _arcPosition;
|
2021-01-16 15:18:03 +00:00
|
|
|
|
2021-01-15 16:18:35 +00:00
|
|
|
const base::unique_qptr<Ui::MediaSlider> _slider;
|
|
|
|
const not_null<QAction*> _dummyAction;
|
2021-01-16 15:11:43 +00:00
|
|
|
const style::Menu &_st;
|
|
|
|
const style::CrossLineAnimation &_stCross;
|
|
|
|
|
|
|
|
const std::unique_ptr<Ui::CrossLineAnimation> _crossLineMute;
|
|
|
|
Ui::Animations::Simple _crossLineAnimation;
|
2021-01-17 21:44:03 +00:00
|
|
|
const std::unique_ptr<Ui::Paint::ArcsAnimation> _arcs;
|
|
|
|
Ui::Animations::Basic _arcsAnimation;
|
2021-01-15 16:18:35 +00:00
|
|
|
|
|
|
|
rpl::event_stream<bool> _toggleMuteRequests;
|
|
|
|
rpl::event_stream<bool> _toggleMuteLocallyRequests;
|
|
|
|
rpl::event_stream<int> _changeVolumeRequests;
|
|
|
|
rpl::event_stream<int> _changeVolumeLocallyRequests;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Calls
|