Commit graph

8 commits

Author SHA1 Message Date
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
Dirk Hohndel
f465230263 Merge branch '119_divecomputerManagement' of github.com:tcanabrava/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17 11:12:10 -07:00
Tomaz Canabrava
3eac2360e7 Moved the 'create fake dc' to it's own function in device.c
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10 13:35:27 -03:00
Tomaz Canabrava
54128aa52f Added the code to remove a dive computer.
Added the code to remove a dive computer, plus a few fixes

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-07 15:25:29 -03:00
Linus Torvalds
b5a232cf32 Sort the devices when adding them to the device list
This doesn't change any real semantics, but it means that we will write
out the device computer information in a well-defined order, rather than
in some random order (before this: reverse order of reading them in).

Having the XML file be as stable as possible is important so that *real*
changes stand out when you make changes to your dives.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-02-03 21:28:13 +11:00
Linus Torvalds
52050fdc92 Save all dive computer nicknames - whether used or not
We used to save dive computer information only if that dive computer was
actually used in any of the dives we saved.  But we can simplify the
code if we just always save any dive computers we know about.  And it
does allow for some usage cases where you have nicknames for other
peoples computers that you may not actively use, but you want to see if
you end up loading multiple XML files in one go.

So there's just no compelling reason to not just save all the info we
have.  And this will make it less painful to remove the "use system
config for dive computer nicknames", because you can also use this to
continue to gather dive computer info in a separate XML file if you want
to.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-24 12:59:31 -08:00
Amit Chaudhuri
334e51988d Add facility to edit nicknames / remove nickname entry
This allows users to edit one or more nick name entries in a single
session. Entries can also be removed individually.

Based on mock up by Lubomir Ivanov and various conversations from Dirk.
Thanks to both.

[Dirk Hohndel: quite a bit of editing for coding style and whitespace]

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-18 07:32:39 -08:00
Linus Torvalds
ec38d3708d Move device_info handling into a new 'device.c' file
The legacy nickname wrappers (that use the device_info structure) are
left in gtk-gui.c.  We can slowly start moving away from them, we don't
want to start exporting that thing as some kind of generic interface.

This isn't a pure code movement - because we leave the legacy interfaces
alone, there are a few new interfaces in device.c (like "create a new
device_info entry") that were embedded into the legacy "create nickname"
code, and needed to be abstracted out.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-01-09 16:19:38 -08:00