mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Merge tag 'v6.7.8' into dev
# Conflicts: # .github/workflows/mac_packaged.yml # Telegram/Resources/winrc/Telegram.rc # Telegram/Resources/winrc/Updater.rc # Telegram/SourceFiles/api/api_chat_invite.h # Telegram/SourceFiles/boxes/language_box.cpp # Telegram/SourceFiles/boxes/send_files_box.h # Telegram/SourceFiles/boxes/sticker_set_box.cpp # Telegram/SourceFiles/core/version.h # Telegram/SourceFiles/data/data_types.h # Telegram/SourceFiles/history/history_item.cpp # Telegram/SourceFiles/history/history_widget.cpp # Telegram/SourceFiles/history/view/history_view_chat_section.cpp # Telegram/SourceFiles/history/view/history_view_message.cpp # Telegram/SourceFiles/history/view/history_view_translate_bar.cpp # Telegram/SourceFiles/history/view/history_view_translate_tracker.cpp # Telegram/SourceFiles/platform/mac/main_window_mac.mm # Telegram/SourceFiles/settings/sections/settings_main.cpp # Telegram/lib_ui # snap/snapcraft.yaml
This commit is contained in:
@@ -31,7 +31,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/history_unread_things.h"
|
||||
#include "history/view/history_view_item_preview.h"
|
||||
#include "history/view/history_view_send_action.h"
|
||||
#include "lang/lang_instance.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "lottie/lottie_icon.h"
|
||||
#include "main/main_session.h"
|
||||
@@ -91,8 +90,11 @@ void PaintRowTopRight(
|
||||
QPainter &p,
|
||||
const QString &text,
|
||||
QRect &rectForName,
|
||||
const PaintContext &context) {
|
||||
const auto width = st::dialogsDateFont->width(text);
|
||||
const PaintContext &context,
|
||||
int precomputedWidth = -1) {
|
||||
const auto width = (precomputedWidth >= 0)
|
||||
? precomputedWidth
|
||||
: st::dialogsDateFont->width(text);
|
||||
rectForName.setWidth(rectForName.width() - width - st::dialogsDateSkip);
|
||||
p.setFont(st::dialogsDateFont);
|
||||
p.setPen(context.active
|
||||
@@ -384,6 +386,19 @@ enum class Flag {
|
||||
};
|
||||
inline constexpr bool is_flag_type(Flag) { return true; }
|
||||
|
||||
void PaintDialogDate(
|
||||
QPainter &p,
|
||||
not_null<const Entry*> entry,
|
||||
const FakeRow *fakeRow,
|
||||
TimeId date,
|
||||
QRect &rectForName,
|
||||
const PaintContext &context) {
|
||||
const auto resolved = fakeRow
|
||||
? fakeRow->dateText(date, context.now)
|
||||
: entry->chatListTimestampText(date, context.now);
|
||||
PaintRowTopRight(p, resolved.text, rectForName, context, resolved.width);
|
||||
}
|
||||
|
||||
template <typename PaintItemCallback>
|
||||
void PaintRow(
|
||||
Painter &p,
|
||||
@@ -398,8 +413,9 @@ void PaintRow(
|
||||
const HiddenSenderInfo *hiddenSenderInfo,
|
||||
HistoryItem *item,
|
||||
const Data::Draft *draft,
|
||||
QDateTime date,
|
||||
TimeId date,
|
||||
const PaintContext &context,
|
||||
const FakeRow *fakeRow,
|
||||
BadgesState badgesState,
|
||||
base::flags<Flag> flags,
|
||||
PaintItemCallback &&paintItemCallback) {
|
||||
@@ -593,8 +609,7 @@ void PaintRow(
|
||||
|| (supportMode
|
||||
&& entry->session().supportHelper().isOccupiedBySomeone(history))) {
|
||||
if (!promoted) {
|
||||
const auto dateString = Ui::FormatDialogsDate(date);
|
||||
PaintRowTopRight(p, dateString, rectForName, context);
|
||||
PaintDialogDate(p, entry, fakeRow, date, rectForName, context);
|
||||
}
|
||||
|
||||
auto availableWidth = namewidth;
|
||||
@@ -725,8 +740,7 @@ void PaintRow(
|
||||
}
|
||||
} else if (!item->isEmpty()) {
|
||||
if ((thread || sublist) && !promoted) {
|
||||
const auto dateString = Ui::FormatDialogsDate(date);
|
||||
PaintRowTopRight(p, dateString, rectForName, context);
|
||||
PaintDialogDate(p, entry, fakeRow, date, rectForName, context);
|
||||
}
|
||||
|
||||
paintItemCallback(nameleft, namewidth);
|
||||
@@ -1073,18 +1087,10 @@ void RowPainter::Paint(
|
||||
}
|
||||
return nullptr;
|
||||
}();
|
||||
const auto displayDate = [&] {
|
||||
if (item) {
|
||||
if (cloudDraft) {
|
||||
return (item->date() > cloudDraft->date)
|
||||
? ItemDateTime(item)
|
||||
: base::unixtime::parse(cloudDraft->date);
|
||||
}
|
||||
return ItemDateTime(item);
|
||||
}
|
||||
return cloudDraft
|
||||
? base::unixtime::parse(cloudDraft->date)
|
||||
: QDateTime();
|
||||
const auto displayDate = [&]() -> TimeId {
|
||||
const auto itemDate = item ? item->date() : TimeId(0);
|
||||
const auto draftDate = cloudDraft ? cloudDraft->date : TimeId(0);
|
||||
return std::max(itemDate, draftDate);
|
||||
}();
|
||||
const auto displayPinnedIcon = badgesState.empty()
|
||||
&& entry->isPinnedDialog(context.filter)
|
||||
@@ -1184,6 +1190,7 @@ void RowPainter::Paint(
|
||||
cloudDraft,
|
||||
displayDate,
|
||||
context,
|
||||
nullptr,
|
||||
badgesState,
|
||||
flags,
|
||||
paintItemCallback);
|
||||
@@ -1293,8 +1300,9 @@ void RowPainter::Paint(
|
||||
hiddenSenderInfo,
|
||||
item,
|
||||
cloudDraft,
|
||||
ItemDateTime(item),
|
||||
item->date(),
|
||||
context,
|
||||
row,
|
||||
badgesState,
|
||||
flags,
|
||||
paintItemCallback);
|
||||
|
||||
@@ -382,9 +382,6 @@ int MessageView::countWidth() const {
|
||||
* (st::dialogsMiniPreview + st::dialogsMiniPreviewSkip))
|
||||
+ st::dialogsMiniPreviewRight;
|
||||
}
|
||||
if (_unreadMedia) {
|
||||
result += st::dialogsUnreadMediaSize + st::dialogsUnreadMediaSkip;
|
||||
}
|
||||
return result + _textCache.maxWidth();
|
||||
}
|
||||
|
||||
@@ -508,31 +505,6 @@ void MessageView::paint(
|
||||
rect.setLeft(rect.x() + st::dialogsMiniPreviewRight);
|
||||
}
|
||||
// Style of _textCache.
|
||||
if (_unreadMedia && rect.width()
|
||||
>= st::dialogsUnreadMediaSize + st::dialogsUnreadMediaSkip) {
|
||||
{
|
||||
PainterHighQualityEnabler hq(p);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(context.active
|
||||
? st::dialogsTextFgServiceActive
|
||||
: context.selected
|
||||
? st::dialogsTextFgServiceOver
|
||||
: st::dialogsTextFgService);
|
||||
p.drawEllipse(
|
||||
rect.x(),
|
||||
rect.y() + st::dialogsUnreadMediaTop,
|
||||
st::dialogsUnreadMediaSize,
|
||||
st::dialogsUnreadMediaSize);
|
||||
}
|
||||
p.setPen(context.active
|
||||
? st::dialogsTextFgActive
|
||||
: context.selected
|
||||
? st::dialogsTextFgOver
|
||||
: st::dialogsTextFg);
|
||||
rect.setLeft(rect.x()
|
||||
+ st::dialogsUnreadMediaSize
|
||||
+ st::dialogsUnreadMediaSkip);
|
||||
}
|
||||
static const auto ellipsisWidth = st::dialogsTextStyle.font->width(
|
||||
kQEllipsis);
|
||||
if (rect.width() > ellipsisWidth) {
|
||||
|
||||
@@ -596,7 +596,6 @@ private:
|
||||
|
||||
Fn<bool(not_null<PeerData*>)> _filterOut;
|
||||
rpl::producer<> _filterOutRefreshes;
|
||||
History *_activeHistory = nullptr;
|
||||
bool _requested = false;
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user