mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Allow opening top peers in a new window.
This commit is contained in:
parent
4cdd939028
commit
3dbadeb232
6 changed files with 35 additions and 16 deletions
|
@ -5094,8 +5094,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_recent_clear" = "Clear";
|
||||
"lng_recent_clear_sure" = "Do you want to clear your search history?";
|
||||
"lng_recent_remove" = "Remove from Recent";
|
||||
"lng_recent_hide_top" = "Hide all";
|
||||
"lng_recent_hide_sure" = "Are you sure you want to hide frequent contacts list?\n\nYou can always return this list in Settings > Privacy > Suggest Frequent Contacts.";
|
||||
"lng_recent_hide_top" = "Remove all & Disable";
|
||||
"lng_recent_hide_sure" = "Are you sure you want to clear and disable frequent contacts list?\n\nYou can always turn this feature back on in Settings > Privacy > Suggest Frequent Contacts.";
|
||||
"lng_recent_hide_button" = "Hide";
|
||||
|
||||
// Wnd specific
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "dialogs/dialogs_widget.h"
|
||||
|
||||
#include "base/qt/qt_key_modifiers.h"
|
||||
#include "base/options.h"
|
||||
#include "dialogs/ui/dialogs_stories_content.h"
|
||||
#include "dialogs/ui/dialogs_stories_list.h"
|
||||
|
@ -1123,7 +1124,12 @@ void Widget::updateSuggestions(anim::type animated) {
|
|||
|
||||
_suggestions->topPeerChosen(
|
||||
) | rpl::start_with_next([=](PeerId id) {
|
||||
controller()->showPeerHistory(id);
|
||||
const auto peer = session().data().peer(id);
|
||||
if (base::IsCtrlPressed()) {
|
||||
controller()->showInNewWindow(peer);
|
||||
} else {
|
||||
controller()->showPeerHistory(peer);
|
||||
}
|
||||
}, _suggestions->lifetime());
|
||||
|
||||
_suggestions->show();
|
||||
|
|
|
@ -22,8 +22,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/labels.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/delayed_activation.h"
|
||||
#include "ui/dynamic_thumbnails.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "window/window_peer_menu.h"
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
@ -43,14 +45,11 @@ void FillTopPeerMenu(
|
|||
const auto group = peer->isMegagroup();
|
||||
const auto channel = peer->isChannel();
|
||||
|
||||
add({
|
||||
.text = tr::lng_recent_remove(tr::now),
|
||||
.handler = [=] { remove(peer); },
|
||||
.icon = &st::menuIconDeleteAttention,
|
||||
.isAttention = true,
|
||||
});
|
||||
|
||||
add({ .separatorSt = &st::expandedMenuSeparator });
|
||||
add(tr::lng_context_new_window(tr::now), [=] {
|
||||
Ui::PreventDelayedActivation();
|
||||
controller->showInNewWindow(peer);
|
||||
}, &st::menuIconNewWindow);
|
||||
Window::AddSeparatorAndShiftUp(add);
|
||||
|
||||
const auto showHistoryText = group
|
||||
? tr::lng_context_open_group(tr::now)
|
||||
|
@ -72,12 +71,25 @@ void FillTopPeerMenu(
|
|||
|
||||
add({ .separatorSt = &st::expandedMenuSeparator });
|
||||
|
||||
add(tr::lng_recent_hide_top(tr::now), [=] {
|
||||
add({
|
||||
.text = tr::lng_recent_remove(tr::now),
|
||||
.handler = [=] { remove(peer); },
|
||||
.icon = &st::menuIconDeleteAttention,
|
||||
.isAttention = true,
|
||||
});
|
||||
|
||||
const auto hideAllConfirmed = [=] {
|
||||
controller->show(Ui::MakeConfirmBox({
|
||||
.text = tr::lng_recent_hide_sure(),
|
||||
.confirmed = [=](Fn<void()> close) { hideAll(); close(); }
|
||||
}));
|
||||
}, &st::menuIconCancel);
|
||||
};
|
||||
add({
|
||||
.text = tr::lng_recent_hide_top(tr::now).replace('&', u"&&"_q),
|
||||
.handler = hideAllConfirmed,
|
||||
.icon = &st::menuIconCancelAttention,
|
||||
.isAttention = true,
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -52,8 +52,6 @@ private:
|
|||
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> setupDivider();
|
||||
|
||||
void updateControlsGeometry();
|
||||
|
||||
const std::unique_ptr<Ui::ElasticScroll> _scroll;
|
||||
const not_null<Ui::VerticalLayout*> _content;
|
||||
const not_null<Ui::SlideWrap<TopPeersStrip>*> _topPeersWrap;
|
||||
|
|
|
@ -192,6 +192,7 @@ menuIconDisableAttention: icon {{ "menu/disable", menuIconAttentionColor }};
|
|||
menuIconReportAttention: icon {{ "menu/report", menuIconAttentionColor }};
|
||||
menuIconRestoreAttention: icon {{ "menu/restore", menuIconAttentionColor }};
|
||||
menuIconTagRemoveAttention: icon {{ "menu/tag_remove", menuIconAttentionColor }};
|
||||
menuIconCancelAttention: icon {{ "menu/cancel", menuIconAttentionColor }};
|
||||
|
||||
menuIconBlockSettings: icon {{ "menu/block", windowBgActive }};
|
||||
menuIconInviteSettings: icon {{ "menu/invite", windowBgActive }};
|
||||
|
|
|
@ -2608,7 +2608,9 @@ void MarkAsReadThread(not_null<Data::Thread*> thread) {
|
|||
}
|
||||
|
||||
void AddSeparatorAndShiftUp(const PeerMenuCallback &addAction) {
|
||||
addAction({ .isSeparator = true });
|
||||
addAction({
|
||||
.separatorSt = &st::popupMenuExpandedSeparator.menu.separator,
|
||||
});
|
||||
|
||||
const auto &st = st::popupMenuExpandedSeparator.menu;
|
||||
const auto shift = st::popupMenuExpandedSeparator.scrollPadding.top()
|
||||
|
|
Loading…
Add table
Reference in a new issue