Commit graph

18 commits

Author SHA1 Message Date
Robert C. Helling
e6482bbdc8 UI to learn hashes of local image files
This addes a menu entry for the user to select a directory that is recursively
traversed to look for image files and compute the hashes of those images (for
those images to be available to be displayed in dives according to their hash values).

This traversal and hash computation happens in and independend thread and so far
the only feedback to the user is that upon completion the dispayed images are updated.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:30:49 +01:00
Robert C. Helling
b02bf002a6 Add hashes to images
Upon successfull reading an image file, this computes a SHA1 hash of the
image and saves it with the picture tag in the log file. When a file is
not successfully loaded (for example because the log was created on a
different computer) we look up the hash in a dictionary that maps hashes
to local file names.

That dictionary (actually two for both directions), is loaded on startup
and saved upon destruction of the main window.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-27 06:29:44 +01:00
Dirk Hohndel
06bbf9f4c8 Use C API for printGPSCoords
This way we can call this helper from both C and C++ code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14 17:50:48 -08:00
Gehad elrobey
6f05194b02 HTML: Add dive photos to the detailed view
Dive photos are copied to the photos directory on export. The photos
section appears only if photos exist.

C++ helper functions are added to copy images to the photos directory,
Additionally the photos directory must be passed as a parameter to the
write_one_dive function to save photos to it. Some options structure may
be needed instead of passing many arguments.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 21:38:22 -07:00
Dirk Hohndel
eb9d6d0f94 Rewrite dive edit logic
The existing code took an odd approach. It tried to change all selected
dives whenever the user edited a field, and kept all this backup data in
case the user rejected the edits.

This code takes the opposite approach. Only edit a copy of the selected
dive and then when the user accepts it, edit all the dives and when the
user rejects the edit simply redraw the screen (as all the "real" data is
still unchanged).

This not only saves quite a bit of code, it should be much easier to get
correct.

Admitedly this code will need quite a bit more testing to make sure it
works as intended, but as far as I can tell it already gets more scenarios
right than the previous implementation.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-02 23:38:36 -07:00
Dirk Hohndel
d740ad1317 Convert plot_gas_value to gasmix
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 21:00:09 -07:00
Tomaz Canabrava
6ab05563b3 Move DiveList related methods/classes to own file.
The DiveList classes were a partial mess (and some of it is still in a
messy state). The classes that deal with it where done in 'qtHelpers.h',
the extern global variable in dive.h, a few methods here and there. This
concentrates most - but not all - functions in their own file. The reason
for that is to make the new developer faster when looking for things: if
it's a divecomputer related method, it should be in a single file, not
scattered around.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-13 09:20:28 +09:00
Tomaz Canabrava
2b06e4be67 Move printGpsCoords from MainTab to QtHelper
Last time I touched this I got a scream from dirk, but then I
looked at the code again and the problem that I faced was that
I broke translations in a sad way, well, now I broke it again.

However, this method shouldn't belong to MainTab ( because of
that thingy that I said before and also many others: Separate
the logic of your application from the UI specific code )

This generates a string that's going to be used on the Interface,
it doesn't display it on the interface. Move it down below makes
it easier to test ( I don't need to create an Widget and worry
about the parent-relationship with the mainwindow just to test
this function, for instance. )

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-13 09:16:11 +09:00
Tomaz Canabrava
4b8a66f489 When creating methods that pass QString, use const QString&
This removes unecessary creation and destruction of the object
making the code shine a bit more and be more fluffy. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11 01:57:28 -07:00
Tomaz Canabrava
4eaceb9861 'Class' string is unecessary when using a Container.
pretty self explanatory, the 'class' keyword is unecessary
when defining things inside a Container, be it a QList,
QVector, QMap, QHahs or anything else.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11 01:57:22 -07:00
Dirk Hohndel
76e6420f6b Massive automated whitespace cleanup
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 20:09:57 -08:00
Dirk Hohndel
9405895285 Improve GPS string handling
This adds support for two more GPS coordinate formats and also fixes a
couple of issues with the previous implementation.

We used to only support full degrees and decimal minutes. We now also
support fully decimal and degrees, minutes and decimal seconds.

The previous implementation would color the input field red if either it
couldn't parse the string, or if it was able to parse it but it was the
same as the previous location. That's misleading.

The previous implementation also changed all gps coordinates to the new
coordinates in a multi-dive edit - instead of just changing the ones that
are the same as the master dive.

Fixes #387

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-23 14:59:38 -08:00
Tomaz Canabrava
e175b1d1ab Remember Trip Selection.
This patch remembers the trip selection across the Dive Tree Model.
It's a tiny bit big because we used to have a variable 'selected
trips' that's now calculed dynamically - this is more future proof.

This is a start of Un-cluttering the view ( for 4.1 I hope to reduce the
code in this class to nearly a half. )

Fixes #303

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-26 11:25:50 -08:00
Dirk Hohndel
7813ac86bf Load translations at run time
This doesn't enable translation switching, but at least we try and load
the correct translation at startup.

We create two global pointers for the currently active translations.

This also removes the remainders of the gettext()/glib based translation
system.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-08 23:11:25 -07:00
Henrik Brautaset Aronsen
4d0b6e698a Changes to make the glib-removal-hack branch build on MacOSX
Tested with the Homebrew packaging system

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 10:42:32 -07:00
Dirk Hohndel
2c4ccc04bd Parse GPS text in C++ and re-implement GPS changed check
This is SO MUCH easier then the convoluted and fragile C / glib code it
replaces.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 10:42:32 -07:00
Benjamin
ae713763c7 Add a helper function to calculate weight display string
Add a helper function to unify the calculation of the
weight display string, instead of having the same calculation
in two places in the code.

Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04 11:57:28 -07:00
Dirk Hohndel
29b242c703 Converting the device_info list into a Qt data structure
This data structure was quite fragile and made 'undo' when editing
rather hard to implement. So instead I decided to turn this into a
QMultiMap which seemed like the ideal data structure for it.

This map holds all the dive computer related data indexed by the model. As
QMultiMap it allows multiple entries per key (model string) and
disambiguates between them with the deviceId.

This commit turned out much larger than I wanted. But I didn't manage to
find a clean way to break it up and make the pieces make sense.

So this brings back the Ok / Cancel button for the dive computer edit
dialog. And it makes those two buttons actually do the right thing (which
is what started this whole process). For this to work we simply copy the
map to a working copy and do all edits on that one - and then copy that
over the 'real' map when we accept the changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18 00:24:28 -07:00