mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Added volume slider to settings box for rtmp live stream.
This commit is contained in:
parent
8d7abb1b8a
commit
be18be4a86
5 changed files with 73 additions and 10 deletions
|
@ -1441,6 +1441,19 @@ groupCallScheduleTimeField: InputField(groupCallScheduleDateField) {
|
||||||
placeholderFont: font(14px);
|
placeholderFont: font(14px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
groupCallVolumeSettings: Menu(groupCallPopupVolumeMenu) {
|
||||||
|
widthMin: 210px;
|
||||||
|
itemBg: groupCallMembersBg;
|
||||||
|
itemBgOver: groupCallMembersBgOver;
|
||||||
|
}
|
||||||
|
groupCallVolumeSettingsPadding: margins(24px, 8px, 24px, 6px);
|
||||||
|
groupCallVolumeSettingsSlider: MediaSlider(groupCallMenuVolumeSlider) {
|
||||||
|
activeFg: groupCallMenuBg;
|
||||||
|
inactiveFg: groupCallMenuBg;
|
||||||
|
activeFgOver: groupCallMenuBg;
|
||||||
|
inactiveFgOver: groupCallMenuBg;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
groupCallCalendarPreviousDisabled: icon {{ "calendar_down-flip_vertical", groupCallMemberNotJoinedStatus }};
|
groupCallCalendarPreviousDisabled: icon {{ "calendar_down-flip_vertical", groupCallMemberNotJoinedStatus }};
|
||||||
groupCallCalendarNextDisabled: icon {{ "calendar_down", groupCallMemberNotJoinedStatus }};
|
groupCallCalendarNextDisabled: icon {{ "calendar_down", groupCallMemberNotJoinedStatus }};
|
||||||
|
|
|
@ -1431,10 +1431,12 @@ void Members::Controller::addMuteActionsToContextMenu(
|
||||||
auto volumeItem = base::make_unique_q<MenuVolumeItem>(
|
auto volumeItem = base::make_unique_q<MenuVolumeItem>(
|
||||||
menu->menu(),
|
menu->menu(),
|
||||||
st::groupCallPopupVolumeMenu,
|
st::groupCallPopupVolumeMenu,
|
||||||
|
st::groupCallMenuVolumeSlider,
|
||||||
otherParticipantStateValue,
|
otherParticipantStateValue,
|
||||||
_call->rtmp() ? _call->rtmpVolume() : row->volume(),
|
_call->rtmp() ? _call->rtmpVolume() : row->volume(),
|
||||||
Group::kMaxVolume,
|
Group::kMaxVolume,
|
||||||
muted);
|
muted,
|
||||||
|
st::groupCallMenuVolumePadding);
|
||||||
|
|
||||||
mutesFromVolume = volumeItem->toggleMuteRequests();
|
mutesFromVolume = volumeItem->toggleMuteRequests();
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "calls/group/calls_group_menu.h" // LeaveBox.
|
#include "calls/group/calls_group_menu.h" // LeaveBox.
|
||||||
#include "calls/group/calls_group_common.h"
|
#include "calls/group/calls_group_common.h"
|
||||||
#include "calls/group/calls_choose_join_as.h"
|
#include "calls/group/calls_choose_join_as.h"
|
||||||
|
#include "calls/group/calls_volume_item.h"
|
||||||
#include "calls/calls_instance.h"
|
#include "calls/calls_instance.h"
|
||||||
#include "ui/widgets/level_meter.h"
|
#include "ui/widgets/level_meter.h"
|
||||||
#include "ui/widgets/continuous_sliders.h"
|
#include "ui/widgets/continuous_sliders.h"
|
||||||
|
@ -713,6 +714,50 @@ void SettingsBox(
|
||||||
addDivider();
|
addDivider();
|
||||||
Ui::AddSkip(layout);
|
Ui::AddSkip(layout);
|
||||||
}
|
}
|
||||||
|
if (rtmp) {
|
||||||
|
const auto volumeItem = layout->add(
|
||||||
|
object_ptr<MenuVolumeItem>(
|
||||||
|
layout,
|
||||||
|
st::groupCallVolumeSettings,
|
||||||
|
st::groupCallVolumeSettingsSlider,
|
||||||
|
call->otherParticipantStateValue(
|
||||||
|
) | rpl::filter([=](const Group::ParticipantState &data) {
|
||||||
|
return data.peer == peer;
|
||||||
|
}),
|
||||||
|
call->rtmpVolume(),
|
||||||
|
Group::kMaxVolume,
|
||||||
|
false,
|
||||||
|
st::groupCallVolumeSettingsPadding));
|
||||||
|
|
||||||
|
const auto toggleMute = crl::guard(layout, [=](bool m, bool local) {
|
||||||
|
if (call) {
|
||||||
|
call->toggleMute({
|
||||||
|
.peer = peer,
|
||||||
|
.mute = m,
|
||||||
|
.locallyOnly = local,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const auto changeVolume = crl::guard(layout, [=](int v, bool local) {
|
||||||
|
if (call) {
|
||||||
|
call->changeVolume({
|
||||||
|
.peer = peer,
|
||||||
|
.volume = std::clamp(v, 1, Group::kMaxVolume),
|
||||||
|
.locallyOnly = local,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
volumeItem->toggleMuteLocallyRequests(
|
||||||
|
) | rpl::start_with_next([=](bool muted) {
|
||||||
|
toggleMute(muted, true);
|
||||||
|
}, volumeItem->lifetime());
|
||||||
|
|
||||||
|
volumeItem->changeVolumeLocallyRequests(
|
||||||
|
) | rpl::start_with_next([=](int volume) {
|
||||||
|
changeVolume(volume, true);
|
||||||
|
}, volumeItem->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
if (peer->canManageGroupCall()) {
|
if (peer->canManageGroupCall()) {
|
||||||
layout->add(object_ptr<Ui::SettingsButton>(
|
layout->add(object_ptr<Ui::SettingsButton>(
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/effects/animation_value.h"
|
#include "ui/effects/animation_value.h"
|
||||||
#include "ui/effects/cross_line.h"
|
#include "ui/effects/cross_line.h"
|
||||||
#include "ui/widgets/continuous_sliders.h"
|
#include "ui/widgets/continuous_sliders.h"
|
||||||
|
#include "ui/rect.h"
|
||||||
#include "styles/style_calls.h"
|
#include "styles/style_calls.h"
|
||||||
|
|
||||||
#include "ui/paint/arcs.h"
|
#include "ui/paint/arcs.h"
|
||||||
|
@ -41,20 +42,21 @@ constexpr auto kVolumeStickedValues
|
||||||
MenuVolumeItem::MenuVolumeItem(
|
MenuVolumeItem::MenuVolumeItem(
|
||||||
not_null<RpWidget*> parent,
|
not_null<RpWidget*> parent,
|
||||||
const style::Menu &st,
|
const style::Menu &st,
|
||||||
|
const style::MediaSlider &stSlider,
|
||||||
rpl::producer<Group::ParticipantState> participantState,
|
rpl::producer<Group::ParticipantState> participantState,
|
||||||
int startVolume,
|
int startVolume,
|
||||||
int maxVolume,
|
int maxVolume,
|
||||||
bool muted)
|
bool muted,
|
||||||
|
const QMargins &padding)
|
||||||
: Ui::Menu::ItemBase(parent, st)
|
: Ui::Menu::ItemBase(parent, st)
|
||||||
, _maxVolume(maxVolume)
|
, _maxVolume(maxVolume)
|
||||||
, _cloudMuted(muted)
|
, _cloudMuted(muted)
|
||||||
, _localMuted(muted)
|
, _localMuted(muted)
|
||||||
, _slider(base::make_unique_q<Ui::MediaSlider>(
|
, _slider(base::make_unique_q<Ui::MediaSlider>(this, stSlider))
|
||||||
this,
|
|
||||||
st::groupCallMenuVolumeSlider))
|
|
||||||
, _dummyAction(new QAction(parent))
|
, _dummyAction(new QAction(parent))
|
||||||
, _st(st)
|
, _st(st)
|
||||||
, _stCross(st::groupCallMuteCrossLine)
|
, _stCross(st::groupCallMuteCrossLine)
|
||||||
|
, _padding(padding)
|
||||||
, _crossLineMute(std::make_unique<Ui::CrossLineAnimation>(_stCross, true))
|
, _crossLineMute(std::make_unique<Ui::CrossLineAnimation>(_stCross, true))
|
||||||
, _arcs(std::make_unique<Ui::Paint::ArcsAnimation>(
|
, _arcs(std::make_unique<Ui::Paint::ArcsAnimation>(
|
||||||
st::groupCallSpeakerArcsAnimation,
|
st::groupCallSpeakerArcsAnimation,
|
||||||
|
@ -71,7 +73,7 @@ MenuVolumeItem::MenuVolumeItem(
|
||||||
sizeValue(
|
sizeValue(
|
||||||
) | rpl::start_with_next([=](const QSize &size) {
|
) | rpl::start_with_next([=](const QSize &size) {
|
||||||
const auto geometry = QRect(QPoint(), size);
|
const auto geometry = QRect(QPoint(), size);
|
||||||
_itemRect = geometry - st::groupCallMenuVolumePadding;
|
_itemRect = geometry - _padding;
|
||||||
_speakerRect = QRect(_itemRect.topLeft(), _stCross.icon.size());
|
_speakerRect = QRect(_itemRect.topLeft(), _stCross.icon.size());
|
||||||
_arcPosition = _speakerRect.center()
|
_arcPosition = _speakerRect.center()
|
||||||
+ QPoint(0, st::groupCallMenuSpeakerArcsSkip);
|
+ QPoint(0, st::groupCallMenuSpeakerArcsSkip);
|
||||||
|
@ -280,9 +282,7 @@ bool MenuVolumeItem::isEnabled() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int MenuVolumeItem::contentHeight() const {
|
int MenuVolumeItem::contentHeight() const {
|
||||||
return st::groupCallMenuVolumePadding.top()
|
return rect::m::sum::v(_padding) + _stCross.icon.height();
|
||||||
+ st::groupCallMenuVolumePadding.bottom()
|
|
||||||
+ _stCross.icon.height();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<bool> MenuVolumeItem::toggleMuteRequests() const {
|
rpl::producer<bool> MenuVolumeItem::toggleMuteRequests() const {
|
||||||
|
|
|
@ -31,10 +31,12 @@ public:
|
||||||
MenuVolumeItem(
|
MenuVolumeItem(
|
||||||
not_null<RpWidget*> parent,
|
not_null<RpWidget*> parent,
|
||||||
const style::Menu &st,
|
const style::Menu &st,
|
||||||
|
const style::MediaSlider &stSlider,
|
||||||
rpl::producer<Group::ParticipantState> participantState,
|
rpl::producer<Group::ParticipantState> participantState,
|
||||||
int startVolume,
|
int startVolume,
|
||||||
int maxVolume,
|
int maxVolume,
|
||||||
bool muted);
|
bool muted,
|
||||||
|
const QMargins &padding);
|
||||||
|
|
||||||
not_null<QAction*> action() const override;
|
not_null<QAction*> action() const override;
|
||||||
bool isEnabled() const override;
|
bool isEnabled() const override;
|
||||||
|
@ -71,6 +73,7 @@ private:
|
||||||
const not_null<QAction*> _dummyAction;
|
const not_null<QAction*> _dummyAction;
|
||||||
const style::Menu &_st;
|
const style::Menu &_st;
|
||||||
const style::CrossLineAnimation &_stCross;
|
const style::CrossLineAnimation &_stCross;
|
||||||
|
const QMargins &_padding;
|
||||||
|
|
||||||
const std::unique_ptr<Ui::CrossLineAnimation> _crossLineMute;
|
const std::unique_ptr<Ui::CrossLineAnimation> _crossLineMute;
|
||||||
Ui::Animations::Simple _crossLineAnimation;
|
Ui::Animations::Simple _crossLineAnimation;
|
||||||
|
|
Loading…
Add table
Reference in a new issue