Commit graph

24 commits

Author SHA1 Message Date
Dirk Hohndel
4029c87ec7 Hide any pictures shown when closing divelog
Fixes #776

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-09 21:16:34 -07:00
Lubomir I. Ivanov
874754e22b dive.h: add a variant of FOR_EACH_PICTURE
This prevents a warning caused by -Waddress, that the address
of 'displayed_dive' will always be defined.

Exact macro variant suggested by Dirk.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-28 09:10:12 -07:00
Giuseppe Bilotta
60702f104c Resolution-indepent dive pictures
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-19 07:23:27 -07:00
Dirk Hohndel
4583cd8e09 Picture handling: cleaning up the mess
We had pointers to data structures on the stack which we frequently
reallocated. These data structure contain basically a filename and an
offset. We then create a hash of the pointers to those datastructures with
the filename being the key. And then we passed those pointers around
through a Qt model(!!!) only in order to then later look up by filename
what the offset might be.

I am at a loss for words for the lunacy behind this design.

How about we just remember the offsets and pass the integers around?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-05 12:37:14 -07:00
Dirk Hohndel
055ac2a1a2 Mark divelist changed after removing a picture
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 14:19:34 -07:00
Tomaz Canabrava
3b9bceacb6 Implement the functionality of remove_picture.
Added the remove_picture functionality, with code
shamelessy stolen from remove_event, and hoock it
up with the interface.

Fixes #650

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-30 12:52:31 -07:00
Tomaz Canabrava
d993684fec Do not create a backup for Q_FOREACH container
Q_FOREACH will expand and already creates a copy of the
contained container, so this is just a waste of cpu cycles
and also increases a tiny bit the memory consumption.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 16:55:10 -07:00
Dirk Hohndel
56501dda1e UI restructure: updateDiveInfo displays displayed_dive
Instead of passing in a divenr of -1 to make it clear things this changes
things to use an options "clear" flag.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
ce47683de8 UI restructure: always display pictures for displayed dive
The only time this is ever wrong is in print mode, so let's never show
pictures in print mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 09:37:55 -07:00
Dirk Hohndel
6548773ad6 Implement a cache for the scaled images
No point in scaling them every time the user looks at the dive. Over time
this may waste some memory (especially if people have a ton of pictures
and let the process run a very long time). For now I won't worry about
that.

Fixes #577

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-01 09:02:10 -07:00
Sergey Starosek
d1511aa968 Emit signal on photo double-click
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-27 06:56:16 -07:00
Tomaz Canabrava
89816f64c2 Headers cleanup.
Too much noise on the headers, this commit remove uneeded
headers when they are uneeded.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-26 15:47:02 -07:00
Dirk Hohndel
64236388e4 Prevent using uninitialized variable
numberOfPictures was be read before it is written.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-13 07:11:06 -07:00
Dirk Hohndel
1fec6453a2 Another futile attempt to keep whitespace consistent
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 16:49:56 -07:00
Tomaz Canabrava
b1847f9ebb Also hold a pointer to the struct picture on the model.
Changes to hold a pointer to the struct picture on the model, so we can
use it to determine the correct positioning of the image on the profile.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 16:46:03 -07:00
Tomaz Canabrava
eb24d90c8e Add a static 'instance()' member for the Photos model.
This will make referencing it from  a few places more easy.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 16:40:01 -07:00
Tomaz Canabrava
dbdff1c0af Change from QPixmap to QImage due to thread issues.
QPixmap cannot be accessed from outside the Main thread, but QImage can.
so change that. Also, make the Photo widget display in Icon mode.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 00:06:42 -07:00
Tomaz Canabrava
3595ad0294 Make the new picture widget display the pictures.
Small changes in the model to display the pictures of the dives.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 00:05:24 -07:00
Tomaz Canabrava
2cded299ac Add the data() method of the Picture Model.
This method should give the correct data to all views that the model is
connected to.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 00:04:15 -07:00
Tomaz Canabrava
42f36d6315 Update the picture model to use the new picture function calls.
Update the picture model to use the new picture function calls, wich made
the code smaller and easyer to understand. AND as a plus, it doesn't use
the magic 123 identifier for pictures.  AND it correctly adds images
without timestamp to the list.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 00:01:13 -07:00
Tomaz Canabrava
f1d67cfbac Add threaded processing of image pixmaps
This code adds threaded processing of a batch of images. It uses the
QtConcurrent implementations to call a function repeteadly using
MAX_THREADS (Qt gets that for us) and returns a list of it.

This call is blocking, so while the pixmaps are being scaled in threads,
it will wait for all scalling to be done.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 15:54:29 -07:00
Tomaz Canabrava
e140703d34 Add a method to update the dive pictures on the model.
Call that method from the mainWindow when the dive changes.
The updateDivePictures walks around the events of the first dc (since all
pictures are distributed allong all dive computers) to get the events of
type '123' (I wonder if there's not a better way to save pictures on the
dive, like an linked list of char* named pictures.)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 15:54:29 -07:00
Tomaz Canabrava
4b520a8fbc Add a new widget on the main tab: Pictures.
Currently this does nothing, but since "dive photos" can also mean
photos that were taken during the trip to the dive, some of them
will not be visible on the profile. this currently shows nothing,
because I didn't work out the Model bits yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 15:54:29 -07:00
Tomaz Canabrava
1c34c831a4 Add stub for a widget to show the dive pictures.
This has a few classes: the model is the list of pictures for the current
dive, the delegate is how this pictures will be displayed on screen, the
widget is the collection of delegates, and the DivePictureThumbnailThread
is a worker-thread to generate the thumbnails so the UI will not freeze.

[Dirk Hohndel: added the new files to subsurface.pro]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 15:54:07 -07:00