Commit graph

8 commits

Author SHA1 Message Date
Dirk Hohndel
cc0f298980 When clearing dive file data, forget the saved git sha
Otherwise parse_file() thinks that this data has already been loaded and
doesn't re-read it, even though our internal data structures have been
erased - so a subsequent parse_file after clear_dive_file_data() that
opens the same git repository finishes successfully, but leaves the
dive_table empty which is of course incorrect.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-23 12:09:18 -07:00
Dirk Hohndel
d2f7732d22 Clean up signedness confusion in divelist.c
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 21:47:02 -08:00
Dirk Hohndel
01ae4af13d Don't access undefined dive
When walking the dive table we need to stop before accessing the
yet-to-be-added new dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-03 14:29:29 -08:00
Dirk Hohndel
62f54b54a2 QML UI: create a chronological dive list when manually adding dive
The dive list might contain dives in the future, don't add the new dive to
then end but instead add it at the correct spot in the list

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-02 04:50:00 -08:00
Robert C. Helling
c32f5cc278 Silence compiler warnings
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-01 18:01:05 -08:00
Salvador Cuñat
09c854fee0 Renumber dive list after manual dive merging
As Linus pointed out in mail list, user is forced to manually renumber
his dives after doing a merge, unless the merged dives were those at
the list tail.

This patch try to manage the more usual cases, letting the user to deal
with those more complex, based on some assumptions:

1.- We are working on an time ordered list of type:
      dive_table.nr           ... 100 -- 101 -- 102 -- 103 -- 104 ...
      dive_table.dives.number ... 234 -- 235 -- 236 -- 245 -- 246 ...
2.- It's unlikely to merge no consecutive dives, as merging is time
    based.
3.- It's unlikely (although possible) to find consecutive dives with
    no consecutive numbers.
4.- It would be rather bizarre to find that newer dive,of those to
    merge, has lower number than older.
5.- It can be found that one (or both) dives to merge are zero
    numbered.
6.- There is only need to renumber from merged dives in advance.

A variable, "factor", is fixed before reworking the dive table. This
number will be substracted from the original dive number.
If we are in point 5.- case, "factor" will be set to zero, meaning
that dive numbers will not change (if older dive is zero, merged one
will be numbered zero too and will let the user to manage this; if
newer dive is zero there won't be need of renumbering as following
dives will be correctly numbered, e.g. after splitting a dive which
is not at the tail of the table).

In most cases, "factor" *should* be set to 1.

While renumbering it can be found a dive with it's number set to zero,
this won't be changed and will remain zeroed to avoid negative
numbers. It, mostly, means that the user has pending work on his
dives.

I don't know why I've written such a big explanation for such a tiny
patch :-)

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-01-10 14:11:32 -08:00
K. \"pestophagous\" Heller
445dbe73bf Crash fix in add_single_dive. No writing to dive_table.dives[-1]
Signed-off-by: K. Heller <pestophagous@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-12-03 22:56:54 -08:00
Tomaz Canabrava
4c0156e3d5 Move all core-functionality to subsurface-core
And adapt a new CMakeLists.txt file for it. On the way I've also
found out that we where double-compilling a few files. I've also
set the subsurface-core as a include_path but that was just to
reduce the noise on this commit, since I plan to remove it from
the include path to make it obligatory to specify something like

 include "subsurface-core/dive.h"

for the header files. Since the app is growing quite a bit we ended
up having a few different files with almost same name that did
similar things, I want to kill that (for instance Dive.h, dive.h,
PrintDive.h and such).

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:48 -07:00
Renamed from divelist.c (Browse further)