mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +02:00
Replaced DropdownMenu with PopupMenu in top bar of sections.
This commit is contained in:
parent
c520cb777c
commit
77659c64e0
3 changed files with 17 additions and 32 deletions
|
@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/application.h"
|
||||
#include "core/core_settings.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/dropdown_menu.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/effects/radial_animation.h"
|
||||
#include "ui/toasts/common_toasts.h"
|
||||
#include "ui/boxes/report_box.h" // Ui::ReportReason
|
||||
|
@ -283,8 +283,8 @@ bool TopBarWidget::createMenu(not_null<Ui::IconButton*> button) {
|
|||
if (!_activeChat.key || _menu) {
|
||||
return false;
|
||||
}
|
||||
_menu.create(parentWidget(), st::dropdownMenuWithIcons);
|
||||
_menu->setHiddenCallback([
|
||||
_menu.create(this, st::popupMenuWithIcons);
|
||||
_menu->setDestroyedCallback([
|
||||
weak = Ui::MakeWeak(this),
|
||||
weakButton = Ui::MakeWeak(button),
|
||||
menu = _menu.data()] {
|
||||
|
@ -296,17 +296,7 @@ bool TopBarWidget::createMenu(not_null<Ui::IconButton*> button) {
|
|||
}
|
||||
}
|
||||
});
|
||||
_menu->setShowStartCallback(crl::guard(this, [=, menu = _menu.data()] {
|
||||
if (_menu == menu) {
|
||||
button->setForceRippled(true);
|
||||
}
|
||||
}));
|
||||
_menu->setHideStartCallback(crl::guard(this, [=, menu = _menu.data()] {
|
||||
if (_menu == menu) {
|
||||
button->setForceRippled(false);
|
||||
}
|
||||
}));
|
||||
button->installEventFilter(_menu);
|
||||
button->setForceRippled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -323,10 +313,10 @@ void TopBarWidget::showPeerMenu() {
|
|||
if (_menu->empty()) {
|
||||
_menu.destroy();
|
||||
} else {
|
||||
_menu->moveToRight(
|
||||
(parentWidget()->width() - width()) + st::topBarMenuPosition.x(),
|
||||
st::topBarMenuPosition.y());
|
||||
_menu->showAnimated(Ui::PanelAnimation::Origin::TopRight);
|
||||
_menu->setForcedOrigin(Ui::PanelAnimation::Origin::TopRight);
|
||||
_menu->popup(mapToGlobal(QPoint(
|
||||
width() + st::topBarMenuPosition.x(),
|
||||
st::topBarMenuPosition.y())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,14 +348,10 @@ void TopBarWidget::showGroupCallMenu(not_null<PeerData*> peer) {
|
|||
: tr::lng_menu_start_group_call_with(tr::now),
|
||||
[=] { callback({ .rtmpNeeded = true }); },
|
||||
&st::menuIconStartStreamWith);
|
||||
_menu->moveToRight(
|
||||
(parentWidget()->width() - width())
|
||||
+ (width()
|
||||
- _groupCall->x()
|
||||
- _groupCall->width()
|
||||
- st::topBarMenuGroupCallSkip),
|
||||
st::topBarMenuPosition.y());
|
||||
_menu->showAnimated(Ui::PanelAnimation::Origin::TopRight);
|
||||
_menu->setForcedOrigin(Ui::PanelAnimation::Origin::TopRight);
|
||||
_menu->popup(mapToGlobal(QPoint(
|
||||
_groupCall->x() + _groupCall->width() + st::topBarMenuGroupCallSkip,
|
||||
st::topBarMenuPosition.y())));
|
||||
}
|
||||
|
||||
void TopBarWidget::toggleInfoSection() {
|
||||
|
@ -729,8 +715,7 @@ void TopBarWidget::setActiveChat(
|
|||
updateUnreadBadge();
|
||||
refreshInfoButton();
|
||||
if (_menu) {
|
||||
_menuToggle->removeEventFilter(_menu);
|
||||
_menu->hideFast();
|
||||
_menu = nullptr;
|
||||
}
|
||||
updateOnlineDisplay();
|
||||
updateControlsVisibility();
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Ui {
|
|||
class AbstractButton;
|
||||
class RoundButton;
|
||||
class IconButton;
|
||||
class DropdownMenu;
|
||||
class PopupMenu;
|
||||
class UnreadBadge;
|
||||
class InfiniteRadialAnimation;
|
||||
enum class ReportReason;
|
||||
|
@ -179,7 +179,7 @@ private:
|
|||
object_ptr<Ui::IconButton> _search;
|
||||
object_ptr<Ui::IconButton> _infoToggle;
|
||||
object_ptr<Ui::IconButton> _menuToggle;
|
||||
object_ptr<Ui::DropdownMenu> _menu = { nullptr };
|
||||
object_ptr<Ui::PopupMenu> _menu = { nullptr };
|
||||
|
||||
object_ptr<TWidget> _membersShowArea = { nullptr };
|
||||
rpl::event_stream<bool> _membersShowAreaActive;
|
||||
|
|
|
@ -664,8 +664,8 @@ historyTopBarBack: IconButton(infoTopBarBack) {
|
|||
width: 52px;
|
||||
}
|
||||
topBarHeight: 54px;
|
||||
topBarMenuPosition: point(-2px, 35px);
|
||||
topBarMenuGroupCallSkip: 40px;
|
||||
topBarMenuPosition: point(-6px, 45px);
|
||||
topBarMenuGroupCallSkip: 20px;
|
||||
topBarDuration: 200;
|
||||
topBarBackward: icon {{ "title_back", menuIconFg }};
|
||||
topBarForwardAlpha: 0.6;
|
||||
|
|
Loading…
Add table
Reference in a new issue