mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Printing: fix dive lookup for profile generation
The existing code (and templates) looked up dives by number and then used that as index into the dive table. This worked exactly in one case: if all dives were numbered consecutively starting with 1. While that is not an entirely unreasonable case, it's of course not an acceptable assumption to make. This commit adds the necessary changes to instead look up dives by their unique id. That's what it's there fore, after all. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
be47ce6241
commit
a4608f7c91
5 changed files with 15 additions and 4 deletions
|
|
@ -31,6 +31,7 @@ signals:
|
|||
class Dive {
|
||||
private:
|
||||
int m_number;
|
||||
int m_id;
|
||||
QString m_date;
|
||||
QString m_time;
|
||||
QString m_location;
|
||||
|
|
@ -56,6 +57,7 @@ public:
|
|||
: dive(dive)
|
||||
{
|
||||
m_number = dive->number;
|
||||
m_id = dive->id;
|
||||
put_date_time();
|
||||
put_location();
|
||||
put_duration();
|
||||
|
|
@ -68,6 +70,7 @@ public:
|
|||
Dive();
|
||||
~Dive();
|
||||
int number() const;
|
||||
int id() const;
|
||||
QString date() const;
|
||||
QString time() const;
|
||||
QString location() const;
|
||||
|
|
@ -87,6 +90,8 @@ Q_DECLARE_METATYPE(print_options)
|
|||
GRANTLEE_BEGIN_LOOKUP(Dive)
|
||||
if (property == "number")
|
||||
return object.number();
|
||||
else if (property == "id")
|
||||
return object.id();
|
||||
else if (property == "date")
|
||||
return object.date();
|
||||
else if (property == "time")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue