mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile/summary: implement firstDiveDate and lastDiveDate
Instead of transporting the global first and last dive date in the dive summary, calculate it in an external function. Since we already have time and date functions in qthelper.cpp implement those functions there. Provide a stub in QMLInterface so that QML can access these standalone functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
988ccba710
commit
f7c73f1987
4 changed files with 28 additions and 2 deletions
|
|
@ -948,6 +948,23 @@ char *get_dive_date_c_string(timestamp_t when)
|
|||
return copy_qstring(text);
|
||||
}
|
||||
|
||||
static QString get_dive_only_date_string(timestamp_t when)
|
||||
{
|
||||
QDateTime ts;
|
||||
ts.setMSecsSinceEpoch(when * 1000L);
|
||||
return loc.toString(ts.toUTC(), QString(prefs.date_format));
|
||||
}
|
||||
|
||||
QString get_first_dive_date_string()
|
||||
{
|
||||
return dive_table.nr > 0 ? get_dive_only_date_string(dive_table.dives[0]->when) : gettextFromC::tr("no dives");
|
||||
}
|
||||
|
||||
QString get_last_dive_date_string()
|
||||
{
|
||||
return dive_table.nr > 0 ? get_dive_only_date_string(dive_table.dives[dive_table.nr - 1]->when) : gettextFromC::tr("no dives");
|
||||
}
|
||||
|
||||
extern "C" char *get_current_date()
|
||||
{
|
||||
QDateTime ts(QDateTime::currentDateTime());;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue