2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 15:35:51 +00:00

Displaying time in chat list for all timestamps in the last 20 hours.

Fixed possible crash in MediaView video player seek after clip error.
Fixed possible crash in native event filter on Windows.
Removed unused lng_stickers_add key.
This commit is contained in:
John Preston
2016-07-26 15:09:40 +03:00
parent 82a0ac28ad
commit 832163c1b7
6 changed files with 26 additions and 18 deletions

View File

@@ -33,11 +33,16 @@ namespace Layout {
namespace {
// Show all dates that are in the last 20 hours in time format.
constexpr int kRecentlyInSeconds = 20 * 3600;
void paintRowDate(Painter &p, const QDateTime &date, QRect &rectForName, bool active) {
QDateTime now(QDateTime::currentDateTime()), lastTime(date);
QDate nowDate(now.date()), lastDate(lastTime.date());
QString dt;
if (lastDate == nowDate) {
bool wasSameDay = (lastDate == nowDate);
bool wasRecently = qAbs(lastTime.secsTo(now)) < kRecentlyInSeconds;
if (wasSameDay || wasRecently) {
dt = lastTime.toString(cTimeFormat());
} else if (lastDate.year() == nowDate.year() && lastDate.weekNumber() == nowDate.weekNumber()) {
dt = langDayOfWeek(lastDate);