Picture handling: change data structure to store offset instead timestamp

It makes no sense to store a 64bit time stamp with every picture. Even the
32bit offset (in seconds) from the dive start is WAY overkill. But
switching to that makes the code much more simple in a number of spots.
And makes what is saved to the XML file easier to read, too.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-08 17:17:49 -07:00
parent 3a14076b1d
commit 1604299a5b
5 changed files with 13 additions and 12 deletions

View file

@ -1307,13 +1307,13 @@ void ProfileWidget2::plotPictures()
struct picture *pic = (struct picture*) m->index(i,1).data(Qt::UserRole).value<void*>();
// it's a correct picture, but doesn't have a timestamp: only show on the widget near the
// information area.
if (!pic->timestamp)
if (!pic->offset)
continue;
DivePictureItem *item = new DivePictureItem();
item->setPixmap(m->index(i,0).data(Qt::DecorationRole).value<QPixmap>());
// let's put the picture at the correct time, but at a fixed "depth" on the profile
// not sure this is ideal, but it seems to look right.
x = timeAxis->posAtValue(pic->timestamp - current_dive->when);
x = timeAxis->posAtValue(pic->offset);
if (i == 0)
y = 10;
else