diff --git a/Telegram/Resources/icons/ayu/top_bar_admins.png b/Telegram/Resources/icons/ayu/top_bar_admins.png new file mode 100644 index 000000000..3d44dba28 Binary files /dev/null and b/Telegram/Resources/icons/ayu/top_bar_admins.png differ diff --git a/Telegram/Resources/icons/ayu/top_bar_admins@2x.png b/Telegram/Resources/icons/ayu/top_bar_admins@2x.png new file mode 100644 index 000000000..f7b78dd75 Binary files /dev/null and b/Telegram/Resources/icons/ayu/top_bar_admins@2x.png differ diff --git a/Telegram/Resources/icons/ayu/top_bar_admins@3x.png b/Telegram/Resources/icons/ayu/top_bar_admins@3x.png new file mode 100644 index 000000000..d5db872dd Binary files /dev/null and b/Telegram/Resources/icons/ayu/top_bar_admins@3x.png differ diff --git a/Telegram/Resources/icons/ayu/top_bar_recent_actions.png b/Telegram/Resources/icons/ayu/top_bar_recent_actions.png new file mode 100644 index 000000000..fd9fa185a Binary files /dev/null and b/Telegram/Resources/icons/ayu/top_bar_recent_actions.png differ diff --git a/Telegram/Resources/icons/ayu/top_bar_recent_actions@2x.png b/Telegram/Resources/icons/ayu/top_bar_recent_actions@2x.png new file mode 100644 index 000000000..89cd652d6 Binary files /dev/null and b/Telegram/Resources/icons/ayu/top_bar_recent_actions@2x.png differ diff --git a/Telegram/Resources/icons/ayu/top_bar_recent_actions@3x.png b/Telegram/Resources/icons/ayu/top_bar_recent_actions@3x.png new file mode 100644 index 000000000..e518f8a55 Binary files /dev/null and b/Telegram/Resources/icons/ayu/top_bar_recent_actions@3x.png differ diff --git a/Telegram/SourceFiles/ayu/ui/ayu_styles.style b/Telegram/SourceFiles/ayu/ui/ayu_styles.style index e55d1df8b..719086b53 100644 --- a/Telegram/SourceFiles/ayu/ui/ayu_styles.style +++ b/Telegram/SourceFiles/ayu/ui/ayu_styles.style @@ -10,6 +10,7 @@ using "ui/basic.style"; using "ui/colors.palette"; using "ui/widgets/widgets.style"; +using "info/info.style"; iconPreviewStroke: activeButtonBg; @@ -25,3 +26,33 @@ cpIconSize: 64px; recentStickersLimitPadding: margins(22px, 4px, 22px, 8px); imageViewPadding: margins(22px, 10px, 22px, 10px); imageViewInnerPadding: margins(16px, 16px, 16px, 16px); + +topBarAdmins: IconButton { + width: 40px; + height: topBarHeight; + + icon: icon {{ "ayu/top_bar_admins", menuIconFg }}; + iconOver: icon {{ "ayu/top_bar_admins", menuIconFgOver }}; + iconPosition: point(4px, 11px); + + rippleAreaPosition: point(0px, 7px); + rippleAreaSize: 40px; + ripple: RippleAnimation(defaultRippleAnimation) { + color: windowBgOver; + } +} + +topBarRecentActions: IconButton { + width: 40px; + height: topBarHeight; + + icon: icon {{ "ayu/top_bar_recent_actions", menuIconFg }}; + iconOver: icon {{ "ayu/top_bar_recent_actions", menuIconFgOver }}; + iconPosition: point(4px, 11px); + + rippleAreaPosition: point(0px, 7px); + rippleAreaSize: 40px; + ripple: RippleAnimation(defaultRippleAnimation) { + color: windowBgOver; + } +} diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 1408ce523..b72ca7adc 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -69,7 +69,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL // AyuGram includes #include "ayu/ayu_settings.h" +#include "boxes/peers/edit_participants_box.h" #include "data/data_chat_filters.h" +#include "history/admin_log/history_admin_log_section.h" +#include "styles/style_ayu_styles.h" namespace HistoryView { @@ -127,6 +130,8 @@ TopBarWidget::TopBarWidget( , _search(this, st::topBarSearch) , _infoToggle(this, st::topBarInfo) , _menuToggle(this, st::topBarMenuToggle) +, _recentActions(this, st::topBarRecentActions) +, _admins(this, st::topBarAdmins) , _titlePeerText(st::windowMinWidth / 3) , _onlineUpdater([=] { updateOnlineDisplay(); }) { setAttribute(Qt::WA_OpaquePaintEvent); @@ -149,6 +154,21 @@ TopBarWidget::TopBarWidget( _groupCall->setClickedCallback([=] { groupCall(); }); _menuToggle->setClickedCallback([=] { showPeerMenu(); }); _infoToggle->setClickedCallback([=] { toggleInfoSection(); }); + + _recentActions->setClickedCallback([=] + { + const auto channel = _activeChat.key.peer()->asChannel(); + _controller->showSection(std::make_shared(channel)); + }); + _admins->setClickedCallback([=] + { + ParticipantsBoxController::Start( + controller, + _activeChat.key.peer(), + ParticipantsBoxController::Role::Admins + ); + }); + _back->setAcceptBoth(); _back->addClickHandler([=](Qt::MouseButton) { InvokeQueued(_back.data(), [=] { backClicked(); }); @@ -1071,6 +1091,16 @@ void TopBarWidget::updateControlsGeometry() { _groupCall->moveToRight(_rightTaken, otherButtonsTop); _rightTaken += _call->width(); } + + _recentActions->moveToRight(_rightTaken, otherButtonsTop); + if (!_recentActions->isHidden()) { + _rightTaken += _recentActions->width(); + } + _admins->moveToRight(_rightTaken, otherButtonsTop); + if (!_admins->isHidden()) { + _rightTaken += _admins->width(); + } + _search->moveToRight(_rightTaken, otherButtonsTop); if (!_search->isHidden()) { _rightTaken += _search->width() + st::topBarCallSkip; @@ -1180,6 +1210,39 @@ void TopBarWidget::updateControlsVisibility() { && !isOneColumn && _controller->canShowThirdSection() && !_chooseForReportReason); + + const auto showRecentActions = [&] + { + if (_activeChat.section == Section::ChatsList) { + return false; + } + if (const auto peer = _activeChat.key.peer()) { + if (peer->isMegagroup() || peer->isChannel()) { + const auto channel = peer->asChannel(); + return channel->hasAdminRights() || channel->amCreator(); + } + } + return false; + }(); + _recentActions->setVisible(showRecentActions); + const auto showAdmins = [&] + { + if (_activeChat.section == Section::ChatsList) { + return false; + } + if (const auto peer = _activeChat.key.peer()) { + if (peer->isMegagroup()) { + return true; + } + if (peer->isChannel()) { + const auto channel = peer->asChannel(); + return channel->hasAdminRights() || channel->amCreator(); + } + } + return false; + }(); + _admins->setVisible(showAdmins); + const auto callsEnabled = [&] { if (const auto peer = _activeChat.key.peer()) { if (const auto user = peer->asUser()) { diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h index d4cb8b2d6..fc8045868 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h @@ -232,6 +232,8 @@ private: object_ptr _search; object_ptr _infoToggle; object_ptr _menuToggle; + object_ptr _recentActions; + object_ptr _admins; base::unique_qptr _menu; object_ptr _membersShowArea = { nullptr };