diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-12-29 11:14:34 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-12-29 11:14:34 -0800 |
commit | cab320201bc76f8ab5ca4cea5a5876ac31e79ee2 (patch) | |
tree | 3633f4f919c70c9282e0660c0dc8c50252c39161 /qt-gui.cpp | |
parent | adb5cc5d306f11f8b3749259623ce6aae616f532 (diff) | |
download | subsurface-cab320201bc76f8ab5ca4cea5a5876ac31e79ee2.tar.gz |
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>
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r-- | qt-gui.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp index 70aef1817..e007a2563 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -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; |