mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show last updated topic preview on Alt+Click.
This commit is contained in:
parent
e2b78b673b
commit
7d636820ac
2 changed files with 19 additions and 4 deletions
|
@ -1429,12 +1429,25 @@ void InnerWidget::selectByMouse(QPoint globalPosition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Key InnerWidget::computeChatPreviewRow() const {
|
||||||
|
auto result = computeChosenRow().key;
|
||||||
|
if (const auto peer = result.peer()) {
|
||||||
|
const auto topicId = _pressedTopicJump
|
||||||
|
? _pressedTopicJumpRootId
|
||||||
|
: 0;
|
||||||
|
if (const auto topic = peer->forumTopicFor(topicId)) {
|
||||||
|
return topic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void InnerWidget::processGlobalForceClick(QPoint globalPosition) {
|
void InnerWidget::processGlobalForceClick(QPoint globalPosition) {
|
||||||
const auto parent = parentWidget();
|
const auto parent = parentWidget();
|
||||||
if (_pressButton == Qt::LeftButton
|
if (_pressButton == Qt::LeftButton
|
||||||
&& parent->rect().contains(parent->mapFromGlobal(globalPosition))
|
&& parent->rect().contains(parent->mapFromGlobal(globalPosition))
|
||||||
&& pressShowsPreview(false)) {
|
&& pressShowsPreview(false)) {
|
||||||
_chatPreviewWillBeFor = computeChosenRow().key;
|
_chatPreviewWillBeFor = computeChatPreviewRow();
|
||||||
showChatPreview(false);
|
showChatPreview(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1454,7 +1467,7 @@ void InnerWidget::mousePressEvent(QMouseEvent *e) {
|
||||||
const auto alt = (e->modifiers() & Qt::AltModifier);
|
const auto alt = (e->modifiers() & Qt::AltModifier);
|
||||||
const auto onlyUserpic = !alt;
|
const auto onlyUserpic = !alt;
|
||||||
if (pressShowsPreview(onlyUserpic)) {
|
if (pressShowsPreview(onlyUserpic)) {
|
||||||
_chatPreviewWillBeFor = computeChosenRow().key;
|
_chatPreviewWillBeFor = computeChatPreviewRow();
|
||||||
if (alt) {
|
if (alt) {
|
||||||
showChatPreview(onlyUserpic);
|
showChatPreview(onlyUserpic);
|
||||||
return;
|
return;
|
||||||
|
@ -2337,7 +2350,7 @@ void InnerWidget::fillArchiveSearchMenu(not_null<Ui::PopupMenu*> menu) {
|
||||||
void InnerWidget::showChatPreview(bool onlyUserpic) {
|
void InnerWidget::showChatPreview(bool onlyUserpic) {
|
||||||
const auto key = base::take(_chatPreviewWillBeFor);
|
const auto key = base::take(_chatPreviewWillBeFor);
|
||||||
cancelChatPreview();
|
cancelChatPreview();
|
||||||
if (!pressShowsPreview(onlyUserpic) || key != computeChosenRow().key) {
|
if (!pressShowsPreview(onlyUserpic) || key != computeChatPreviewRow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ClickHandler::unpressed();
|
ClickHandler::unpressed();
|
||||||
|
@ -3627,7 +3640,8 @@ bool InnerWidget::pressShowsPreview(bool onlyUserpic) const {
|
||||||
}
|
}
|
||||||
const auto key = computeChosenRow().key;
|
const auto key = computeChosenRow().key;
|
||||||
if (const auto history = key.history()) {
|
if (const auto history = key.history()) {
|
||||||
return !history->peer->isForum();
|
return !history->peer->isForum()
|
||||||
|
|| (_pressedTopicJump && _pressedTopicJumpRootId);
|
||||||
}
|
}
|
||||||
return key.topic() != nullptr;
|
return key.topic() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,6 +398,7 @@ private:
|
||||||
void trackSearchResultsForum(Data::Forum *forum);
|
void trackSearchResultsForum(Data::Forum *forum);
|
||||||
|
|
||||||
[[nodiscard]] QBrush currentBg() const;
|
[[nodiscard]] QBrush currentBg() const;
|
||||||
|
[[nodiscard]] Key computeChatPreviewRow() const;
|
||||||
|
|
||||||
[[nodiscard]] const std::vector<Key> &pinnedChatsOrder() const;
|
[[nodiscard]] const std::vector<Key> &pinnedChatsOrder() const;
|
||||||
void checkReorderPinnedStart(QPoint localPosition);
|
void checkReorderPinnedStart(QPoint localPosition);
|
||||||
|
|
Loading…
Add table
Reference in a new issue