1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix call duration label after 1 hour

Fixes #2617
This commit is contained in:
tux3 2015-12-04 15:51:10 +01:00
parent 104095c6be
commit 49d11549b9
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -868,16 +868,15 @@ QString ChatForm::secondsToDHMS(quint32 duration)
int hours = (int) (duration % 24);
int days = (int) (duration / 24);
if (minutes == 0)
return cD + res.sprintf("%02ds", seconds);
if (hours == 0 && days == 0)
return cD + res.sprintf("%02dm %02ds", minutes, seconds);
if (days == 0)
// I assume no one will ever have call longer than a month
if (days)
return cD + res.sprintf("%dd%02dh %02dm %02ds", days, hours, minutes, seconds);
else if (hours)
return cD + res.sprintf("%02dh %02dm %02ds", hours, minutes, seconds);
//I assume no one will ever have call longer than ~30days
return cD + res.sprintf("%dd%02dh %02dm %02ds", days, hours, minutes, seconds);
else if (minutes)
return cD + res.sprintf("%02dm %02ds", minutes, seconds);
else
return cD + res.sprintf("%02ds", seconds);
}
void ChatForm::setFriendTyping(bool isTyping)