From 12450ececae7f8eb1844eb227acf56887ae51e43 Mon Sep 17 00:00:00 2001 From: defnax Date: Fri, 25 Sep 2009 16:19:58 +0000 Subject: [PATCH] added years to userFriendlyDuration git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1687 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/util/misc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/util/misc.h b/retroshare-gui/src/util/misc.h index 03642766e..cbefaf7c7 100644 --- a/retroshare-gui/src/util/misc.h +++ b/retroshare-gui/src/util/misc.h @@ -309,7 +309,7 @@ class misc : public QObject{ } int minutes = seconds / 60; if(minutes < 60) { - return tr("%1m","e.g: 10minutes").arg(QString::QString::fromUtf8(misc::toString(minutes).c_str())); + return tr("%1 minutes","e.g: 10minutes").arg(QString::QString::fromUtf8(misc::toString(minutes).c_str())); } int hours = minutes / 60; minutes = minutes - hours*60; @@ -321,6 +321,11 @@ class misc : public QObject{ if(days < 365) { return tr("%1d %2h %3m", "e.g: 2days 10hours 2minutes").arg(QString::fromUtf8(misc::toString(days).c_str())).arg(QString::fromUtf8(misc::toString(hours).c_str())).arg(QString::fromUtf8(misc::toString(minutes).c_str())); } + int years = days / 365; + days = days - years * 365; + if(years > 1) { + return tr("%1y %1d %2h %3m", "e.g: 2 years 2days 10hours 2minutes").arg(QString::fromUtf8(misc::toString(years).c_str())).arg(QString::fromUtf8(misc::toString(days).c_str())).arg(QString::fromUtf8(misc::toString(hours).c_str())).arg(QString::fromUtf8(misc::toString(minutes).c_str())); + } return tr("Unknown"); } };