Don't show important tooltips above layers.

This commit is contained in:
John Preston 2021-09-07 21:31:35 +03:00
parent abbac61702
commit d00226d51e
2 changed files with 33 additions and 11 deletions

View file

@ -312,7 +312,7 @@ void Panel::endCall() {
_call->hangup(); _call->hangup();
return; return;
} }
_layerBg->showBox(Box( showBox(Box(
LeaveBox, LeaveBox,
_call, _call,
false, false,
@ -342,7 +342,7 @@ void Panel::startScheduledNow() {
.callback = done, .callback = done,
}); });
*box = owned.data(); *box = owned.data();
_layerBg->showBox(std::move(owned)); showBox(std::move(owned));
} }
} }
@ -459,7 +459,7 @@ void Panel::refreshLeftButton() {
_callShare.destroy(); _callShare.destroy();
_settings.create(widget(), st::groupCallSettings); _settings.create(widget(), st::groupCallSettings);
_settings->setClickedCallback([=] { _settings->setClickedCallback([=] {
_layerBg->showBox(Box(SettingsBox, _call)); showBox(Box(SettingsBox, _call));
}); });
} }
const auto raw = _callShare ? _callShare.data() : _settings.data(); const auto raw = _callShare ? _callShare.data() : _settings.data();
@ -584,7 +584,7 @@ void Panel::hideNiceTooltip() {
void Panel::initShareAction() { void Panel::initShareAction() {
const auto showBoxCallback = [=](object_ptr<Ui::BoxContent> next) { const auto showBoxCallback = [=](object_ptr<Ui::BoxContent> next) {
_layerBg->showBox(std::move(next)); showBox(std::move(next));
}; };
const auto showToastCallback = [=](QString text) { const auto showToastCallback = [=](QString text) {
showToast({ text }); showToast({ text });
@ -1138,7 +1138,7 @@ void Panel::refreshTopButton() {
void Panel::screenSharingPrivacyRequest() { void Panel::screenSharingPrivacyRequest() {
if (auto box = ScreenSharingPrivacyRequestBox()) { if (auto box = ScreenSharingPrivacyRequestBox()) {
_layerBg->showBox(std::move(box)); showBox(std::move(box));
} }
} }
@ -1188,7 +1188,7 @@ void Panel::chooseShareScreenSource() {
.callback = done, .callback = done,
}); });
*shared = box.data(); *shared = box.data();
_layerBg->showBox(std::move(box)); showBox(std::move(box));
} }
void Panel::chooseJoinAs() { void Panel::chooseJoinAs() {
@ -1197,7 +1197,7 @@ void Panel::chooseJoinAs() {
_call->rejoinAs(info); _call->rejoinAs(info);
}; };
const auto showBoxCallback = [=](object_ptr<Ui::BoxContent> next) { const auto showBoxCallback = [=](object_ptr<Ui::BoxContent> next) {
_layerBg->showBox(std::move(next)); showBox(std::move(next));
}; };
const auto showToastCallback = [=](QString text) { const auto showToastCallback = [=](QString text) {
showToast({ text }); showToast({ text });
@ -1227,7 +1227,7 @@ void Panel::showMainMenu() {
wide, wide,
[=] { chooseJoinAs(); }, [=] { chooseJoinAs(); },
[=] { chooseShareScreenSource(); }, [=] { chooseShareScreenSource(); },
[=](auto box) { _layerBg->showBox(std::move(box)); }); [=](auto box) { showBox(std::move(box)); });
if (_menu->empty()) { if (_menu->empty()) {
_wideMenuShown = false; _wideMenuShown = false;
_menu.destroy(); _menu.destroy();
@ -1292,12 +1292,12 @@ void Panel::addMembers() {
showToast(std::move(text)); showToast(std::move(text));
}; };
if (auto box = PrepareInviteBox(_call, showToastCallback)) { if (auto box = PrepareInviteBox(_call, showToastCallback)) {
_layerBg->showBox(std::move(box)); showBox(std::move(box));
} }
} }
void Panel::kickParticipant(not_null<PeerData*> participantPeer) { void Panel::kickParticipant(not_null<PeerData*> participantPeer) {
_layerBg->showBox(Box([=](not_null<Ui::GenericBox*> box) { showBox(Box([=](not_null<Ui::GenericBox*> box) {
box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box.get(), box.get(),
@ -1328,6 +1328,18 @@ void Panel::kickParticipant(not_null<PeerData*> participantPeer) {
})); }));
} }
void Panel::showBox(object_ptr<Ui::BoxContent> box) {
showBox(std::move(box), Ui::LayerOption::KeepOther, anim::type::normal);
}
void Panel::showBox(
object_ptr<Ui::BoxContent> box,
Ui::LayerOptions options,
anim::type animated) {
hideStickedTooltip(StickedTooltipHide::Unavailable);
_layerBg->showBox(std::move(box), options, animated);
}
void Panel::kickParticipantSure(not_null<PeerData*> participantPeer) { void Panel::kickParticipantSure(not_null<PeerData*> participantPeer) {
if (const auto chat = _peer->asChat()) { if (const auto chat = _peer->asChat()) {
chat->session().api().kickParticipant(chat, participantPeer); chat->session().api().kickParticipant(chat, participantPeer);
@ -1666,7 +1678,8 @@ void Panel::showStickedTooltip() {
if (!(_stickedTooltipsShown & StickedTooltip::Microphone) if (!(_stickedTooltipsShown & StickedTooltip::Microphone)
&& callReady && callReady
&& _mute && _mute
&& !_call->mutedByAdmin()) { && !_call->mutedByAdmin()
&& !_layerBg->topShownLayer()) {
if (_stickedTooltipClose) { if (_stickedTooltipClose) {
// Showing already. // Showing already.
return; return;

View file

@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/weak_ptr.h" #include "base/weak_ptr.h"
#include "base/timer.h" #include "base/timer.h"
#include "base/flags.h"
#include "base/object_ptr.h" #include "base/object_ptr.h"
#include "calls/group/calls_group_call.h" #include "calls/group/calls_group_call.h"
#include "calls/group/calls_group_common.h" #include "calls/group/calls_group_common.h"
@ -27,6 +28,9 @@ class GroupCall;
} // namespace Data } // namespace Data
namespace Ui { namespace Ui {
class BoxContent;
enum class LayerOption;
using LayerOptions = base::flags<LayerOption>;
class AbstractButton; class AbstractButton;
class ImportantTooltip; class ImportantTooltip;
class DropdownMenu; class DropdownMenu;
@ -74,6 +78,11 @@ public:
[[nodiscard]] bool isActive() const; [[nodiscard]] bool isActive() const;
void showToast(TextWithEntities &&text, crl::time duration = 0); void showToast(TextWithEntities &&text, crl::time duration = 0);
void showBox(object_ptr<Ui::BoxContent> box);
void showBox(
object_ptr<Ui::BoxContent> box,
Ui::LayerOptions options,
anim::type animated = anim::type::normal);
void minimize(); void minimize();
void close(); void close();