Messages: Make the Date/Timestamps more usable

Previously timestamps were in the right-hand side of the messages which made it very hard to relate timestamps with their corresponding messages. 
Moving them right next to the name makes much better UX wise (and surprisingly didn't make the UI too crowded). I have tested this in dark light and bubbles mode, and it all looks good and comfortable to me.

I have also tweaked how the timestamps are formatted. 
- For messages on the same day, it will skip the date part.
- For recent days, it uses relative timestamp (yesterday, XX:XX) 
- For everything before its shows short form date and time

The tooltip now uses Long Format of Date and Time.
This commit is contained in:
Darshan Phaldesai
2026-02-11 00:32:36 +00:00
committed by Joshua Goins
parent 8ca1b8b1d3
commit 1289194b3f
3 changed files with 58 additions and 13 deletions

View File

@@ -27,6 +27,11 @@ QString NeoChatDateTime::shortDateTime() const
return QLocale().toString(m_dateTime.toLocalTime(), QLocale::ShortFormat);
}
QString NeoChatDateTime::longDateTime() const
{
return QLocale().toString(m_dateTime.toLocalTime(), QLocale::LongFormat);
}
QString NeoChatDateTime::relativeDate() const
{
KFormat formatter;
@@ -39,6 +44,14 @@ QString NeoChatDateTime::relativeDateTime() const
return formatter.formatRelativeDateTime(m_dateTime.toLocalTime(), QLocale::ShortFormat);
}
QString NeoChatDateTime::shortRelativeDateTime() const
{
if (m_dateTime > QDate::currentDate().startOfDay()) {
return hourMinuteString();
}
return relativeDate() + u", "_s + hourMinuteString();
}
bool NeoChatDateTime::isValid() const
{
return m_dateTime.isValid();