mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 16:13:56 +02:00
Added speaker icon to volume menu item in group calls.
This commit is contained in:
parent
70cdc05544
commit
1cbb217210
6 changed files with 40 additions and 5 deletions
BIN
Telegram/Resources/icons/calls/volume/speaker.png
Normal file
BIN
Telegram/Resources/icons/calls/volume/speaker.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 556 B |
BIN
Telegram/Resources/icons/calls/volume/speaker@2x.png
Normal file
BIN
Telegram/Resources/icons/calls/volume/speaker@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 998 B |
BIN
Telegram/Resources/icons/calls/volume/speaker@3x.png
Normal file
BIN
Telegram/Resources/icons/calls/volume/speaker@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -778,7 +778,13 @@ groupCallMajorBlobMaxRadius: 4px;
|
||||||
groupCallMinorBlobIdleRadius: 3px;
|
groupCallMinorBlobIdleRadius: 3px;
|
||||||
groupCallMinorBlobMaxRadius: 12px;
|
groupCallMinorBlobMaxRadius: 12px;
|
||||||
|
|
||||||
groupCallMenuVolumeItemHeight: 100px;
|
groupCallMuteCrossLine: CrossLineAnimation {
|
||||||
|
fg: groupCallIconFg;
|
||||||
|
icon: icon {{ "calls/volume/speaker", groupCallIconFg }};
|
||||||
|
startPosition: point(2px, 5px);
|
||||||
|
endPosition: point(16px, 19px);
|
||||||
|
stroke: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
callTopBarMuteCrossLine: CrossLineAnimation {
|
callTopBarMuteCrossLine: CrossLineAnimation {
|
||||||
fg: callBarFg;
|
fg: callBarFg;
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "calls/calls_volume_item.h"
|
#include "calls/calls_volume_item.h"
|
||||||
|
|
||||||
#include "calls/calls_group_common.h"
|
#include "calls/calls_group_common.h"
|
||||||
|
#include "ui/effects/cross_line.h"
|
||||||
#include "ui/widgets/continuous_sliders.h"
|
#include "ui/widgets/continuous_sliders.h"
|
||||||
#include "styles/style_calls.h"
|
#include "styles/style_calls.h"
|
||||||
#include "styles/style_media_player.h"
|
#include "styles/style_media_player.h"
|
||||||
|
@ -34,11 +35,18 @@ MenuVolumeItem::MenuVolumeItem(
|
||||||
this,
|
this,
|
||||||
st::mediaPlayerPanelPlayback))
|
st::mediaPlayerPanelPlayback))
|
||||||
, _dummyAction(new QAction(parent))
|
, _dummyAction(new QAction(parent))
|
||||||
, _font(st.itemStyle.font) {
|
, _st(st)
|
||||||
|
, _font(st.itemStyle.font)
|
||||||
|
, _stCross(st::groupCallMuteCrossLine)
|
||||||
|
, _crossLineMute(std::make_unique<Ui::CrossLineAnimation>(_stCross, true)) {
|
||||||
|
|
||||||
initResizeHook(parent->sizeValue());
|
initResizeHook(parent->sizeValue());
|
||||||
enableMouseSelecting();
|
enableMouseSelecting();
|
||||||
|
|
||||||
|
const auto itemRect = rect() - st.itemPadding;
|
||||||
|
const auto speakerRect = QRect(itemRect.topLeft(), _stCross.icon.size());
|
||||||
|
const auto volumeRect = speakerRect.translated(_stCross.icon.width(), 0);
|
||||||
|
|
||||||
paintRequest(
|
paintRequest(
|
||||||
) | rpl::start_with_next([=](const QRect &clip) {
|
) | rpl::start_with_next([=](const QRect &clip) {
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
|
@ -53,7 +61,12 @@ MenuVolumeItem::MenuVolumeItem(
|
||||||
: (enabled ? st.itemFg : st.itemFgDisabled));
|
: (enabled ? st.itemFg : st.itemFgDisabled));
|
||||||
p.setFont(_font);
|
p.setFont(_font);
|
||||||
const auto volume = std::round(_slider->value() * kMaxVolumePercent);
|
const auto volume = std::round(_slider->value() * kMaxVolumePercent);
|
||||||
p.drawText(QPoint(0, _font->ascent), u"%1%"_q.arg(volume));
|
p.drawText(volumeRect, u"%1%"_q.arg(volume), style::al_center);
|
||||||
|
|
||||||
|
_crossLineMute->paint(
|
||||||
|
p,
|
||||||
|
speakerRect.topLeft(),
|
||||||
|
_crossLineAnimation.value(_localMuted ? 1. : 0.));
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
setCloudVolume(startVolume);
|
setCloudVolume(startVolume);
|
||||||
|
@ -63,10 +76,17 @@ MenuVolumeItem::MenuVolumeItem(
|
||||||
if (_localMuted != newMuted) {
|
if (_localMuted != newMuted) {
|
||||||
_localMuted = newMuted;
|
_localMuted = newMuted;
|
||||||
_toggleMuteLocallyRequests.fire_copy(newMuted);
|
_toggleMuteLocallyRequests.fire_copy(newMuted);
|
||||||
|
|
||||||
|
_crossLineAnimation.start(
|
||||||
|
[=] { update(speakerRect); },
|
||||||
|
_localMuted ? 0. : 1.,
|
||||||
|
_localMuted ? 1. : 0.,
|
||||||
|
st::callPanelDuration);
|
||||||
}
|
}
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
_changeVolumeLocallyRequests.fire(value * _maxVolume);
|
_changeVolumeLocallyRequests.fire(value * _maxVolume);
|
||||||
}
|
}
|
||||||
|
update(volumeRect);
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto returnVolume = [=] {
|
const auto returnVolume = [=] {
|
||||||
|
@ -122,7 +142,8 @@ MenuVolumeItem::MenuVolumeItem(
|
||||||
_waitingForUpdateVolume = false;
|
_waitingForUpdateVolume = false;
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_slider->setGeometry(rect());
|
_slider->setGeometry(itemRect
|
||||||
|
- style::margins(0, contentHeight() / 2, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuVolumeItem::setCloudVolume(int volume) {
|
void MenuVolumeItem::setCloudVolume(int volume) {
|
||||||
|
@ -148,7 +169,9 @@ bool MenuVolumeItem::isEnabled() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int MenuVolumeItem::contentHeight() const {
|
int MenuVolumeItem::contentHeight() const {
|
||||||
return st::groupCallMenuVolumeItemHeight;
|
return _st.itemPadding.top()
|
||||||
|
+ _st.itemPadding.bottom()
|
||||||
|
+ _stCross.icon.height() * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<bool> MenuVolumeItem::toggleMuteRequests() const {
|
rpl::producer<bool> MenuVolumeItem::toggleMuteRequests() const {
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/menu/menu_item_base.h"
|
#include "ui/widgets/menu/menu_item_base.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
class CrossLineAnimation;
|
||||||
class MediaSlider;
|
class MediaSlider;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
@ -55,7 +56,12 @@ private:
|
||||||
|
|
||||||
const base::unique_qptr<Ui::MediaSlider> _slider;
|
const base::unique_qptr<Ui::MediaSlider> _slider;
|
||||||
const not_null<QAction*> _dummyAction;
|
const not_null<QAction*> _dummyAction;
|
||||||
|
const style::Menu &_st;
|
||||||
const style::font &_font;
|
const style::font &_font;
|
||||||
|
const style::CrossLineAnimation &_stCross;
|
||||||
|
|
||||||
|
const std::unique_ptr<Ui::CrossLineAnimation> _crossLineMute;
|
||||||
|
Ui::Animations::Simple _crossLineAnimation;
|
||||||
|
|
||||||
rpl::event_stream<bool> _toggleMuteRequests;
|
rpl::event_stream<bool> _toggleMuteRequests;
|
||||||
rpl::event_stream<bool> _toggleMuteLocallyRequests;
|
rpl::event_stream<bool> _toggleMuteLocallyRequests;
|
||||||
|
|
Loading…
Add table
Reference in a new issue