2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 23:45:44 +00:00

Add touchscreen preview to recent / channels.

This commit is contained in:
John Preston
2024-05-31 19:12:22 +04:00
parent 0fffeac8da
commit a1049ec7ce
10 changed files with 154 additions and 24 deletions

View File

@@ -1526,7 +1526,7 @@ void InnerWidget::mousePressEvent(QMouseEvent *e) {
if (alt && showChatPreview()) {
return;
} else if (!alt && isUserpicPress()) {
scheduleChatPreview();
scheduleChatPreview(e->globalPos());
}
if (base::in_range(_collapsedSelected, 0, _collapsedRows.size())) {
@@ -2440,12 +2440,16 @@ void InnerWidget::chatPreviewShown(bool shown, RowDescriptor row) {
}
}
bool InnerWidget::scheduleChatPreview() {
bool InnerWidget::scheduleChatPreview(QPoint positionOverride) {
const auto row = computeChatPreviewRow();
const auto callback = crl::guard(this, [=](bool shown) {
chatPreviewShown(shown, row);
});
_chatPreviewScheduled = _controller->scheduleChatPreview(row, callback);
_chatPreviewScheduled = _controller->scheduleChatPreview(
row,
callback,
nullptr,
positionOverride);
return _chatPreviewScheduled;
}
@@ -2544,8 +2548,7 @@ bool InnerWidget::processTouchEvent(not_null<QTouchEvent*> e) {
return false;
}
selectByMouse(*point);
const auto onlyUserpic = true;
if (isUserpicPress() && scheduleChatPreview()) {
if (isUserpicPressOnWide() && scheduleChatPreview(*point)) {
_chatPreviewTouchGlobal = point;
} else if (!_dragging) {
_touchDragStartGlobal = point;