mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Warn user about pinning of his screencast.
This commit is contained in:
parent
ba6cee6f81
commit
dfcc13c7e6
1 changed files with 51 additions and 6 deletions
|
@ -764,14 +764,17 @@ void Panel::refreshVideoButtons(std::optional<bool> overrideWideMode) {
|
||||||
&& real
|
&& real
|
||||||
&& real->canStartVideo();
|
&& real->canStartVideo();
|
||||||
const auto create = overrideWideMode.value_or(mode() == PanelMode::Wide)
|
const auto create = overrideWideMode.value_or(mode() == PanelMode::Wide)
|
||||||
|| canStartVideo;
|
|| canStartVideo
|
||||||
|
|| _call->isSharingCamera();
|
||||||
const auto created = _video && _screenShare;
|
const auto created = _video && _screenShare;
|
||||||
if (created == create) {
|
if (created == create) {
|
||||||
return;
|
return;
|
||||||
} else if (created) {
|
} else if (created) {
|
||||||
_video.destroy();
|
_video.destroy();
|
||||||
_screenShare.destroy();
|
_screenShare.destroy();
|
||||||
updateButtonsGeometry();
|
if (!overrideWideMode) {
|
||||||
|
updateButtonsGeometry();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto toggleableOverrides = [&](rpl::producer<bool> active) {
|
auto toggleableOverrides = [&](rpl::producer<bool> active) {
|
||||||
|
@ -1275,9 +1278,17 @@ void Panel::subscribeToChanges(not_null<Data::GroupCall*> real) {
|
||||||
}, widget()->lifetime());
|
}, widget()->lifetime());
|
||||||
validateRecordingMark(real->recordStartDate() != 0);
|
validateRecordingMark(real->recordStartDate() != 0);
|
||||||
|
|
||||||
real->canStartVideoValue(
|
rpl::combine(
|
||||||
|
real->canStartVideoValue(),
|
||||||
|
_call->isSharingCameraValue()
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
refreshVideoButtons();
|
refreshVideoButtons();
|
||||||
|
}, widget()->lifetime());
|
||||||
|
|
||||||
|
rpl::combine(
|
||||||
|
real->canStartVideoValue(),
|
||||||
|
_call->isSharingScreenValue()
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
refreshTopButton();
|
refreshTopButton();
|
||||||
}, widget()->lifetime());
|
}, widget()->lifetime());
|
||||||
|
|
||||||
|
@ -1295,7 +1306,8 @@ void Panel::refreshTopButton() {
|
||||||
const auto hasJoinAs = _call->showChooseJoinAs();
|
const auto hasJoinAs = _call->showChooseJoinAs();
|
||||||
const auto wide = (_mode.current() == PanelMode::Wide);
|
const auto wide = (_mode.current() == PanelMode::Wide);
|
||||||
const auto showNarrowMenu = _call->canManage()
|
const auto showNarrowMenu = _call->canManage()
|
||||||
|| (real && real->canStartVideo());
|
|| (real && real->canStartVideo())
|
||||||
|
|| _call->isSharingScreen();
|
||||||
const auto showNarrowUserpic = !showNarrowMenu && hasJoinAs;
|
const auto showNarrowUserpic = !showNarrowMenu && hasJoinAs;
|
||||||
if (showNarrowMenu) {
|
if (showNarrowMenu) {
|
||||||
_joinAsToggle.destroy();
|
_joinAsToggle.destroy();
|
||||||
|
@ -1333,9 +1345,42 @@ void Panel::refreshTopButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::chooseShareScreenSource() {
|
void Panel::chooseShareScreenSource() {
|
||||||
if (!_call->emitShareScreenError()) {
|
if (_call->emitShareScreenError()) {
|
||||||
Ui::DesktopCapture::ChooseSource(this);
|
return;
|
||||||
}
|
}
|
||||||
|
const auto choose = [=] {
|
||||||
|
Ui::DesktopCapture::ChooseSource(this);
|
||||||
|
};
|
||||||
|
const auto screencastFromPeer = [&]() -> PeerData* {
|
||||||
|
for (const auto &[endpoint, track] : _call->activeVideoTracks()) {
|
||||||
|
if (endpoint.type == VideoEndpointType::Screen) {
|
||||||
|
return endpoint.peer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}();
|
||||||
|
if (!screencastFromPeer) {
|
||||||
|
choose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto text = tr::lng_group_call_sure_screencast(
|
||||||
|
tr::now,
|
||||||
|
lt_user,
|
||||||
|
screencastFromPeer->shortName());
|
||||||
|
const auto shared = std::make_shared<QPointer<Ui::GenericBox>>();
|
||||||
|
const auto done = [=] {
|
||||||
|
if (*shared) {
|
||||||
|
base::take(*shared)->closeBox();
|
||||||
|
}
|
||||||
|
choose();
|
||||||
|
};
|
||||||
|
auto box = ConfirmBox({
|
||||||
|
.text = { text },
|
||||||
|
.button = tr::lng_continue(),
|
||||||
|
.callback = done,
|
||||||
|
});
|
||||||
|
*shared = box.data();
|
||||||
|
_layerBg->showBox(std::move(box));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::chooseJoinAs() {
|
void Panel::chooseJoinAs() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue