Facebook integration: improve the confirmation UI experience

Date and time needs to be a string, not a time_t.
Duration should be called that (and not time) and wasn't hooked up.
Also added a helper to get the duration string.
Finally reordered the components of the text that is shown to make it more
natural (or I should say, more in line with the order we use elsewhere).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-12-29 11:14:34 -08:00
parent adb5cc5d30
commit cab320201b
4 changed files with 31 additions and 7 deletions

View file

@ -416,6 +416,22 @@ int parseTemperatureToMkelvin(const QString &text)
return mkelvin;
}
QString get_dive_duration_string(timestamp_t when, QString hourText, QString minutesText)
{
int hrs, mins;
mins = (when + 59) / 60;
hrs = mins / 60;
mins -= hrs * 60;
QString displayTime;
if (hrs)
displayTime = QString("%1%2%3%4").arg(hrs).arg(hourText).arg(mins, 2, 10, QChar('0')).arg(minutesText);
else
displayTime = QString("%1%2").arg(mins).arg(minutesText);
return displayTime;
}
QString get_dive_date_string(timestamp_t when)
{
QDateTime ts;