summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2014-05-22Gratuitous whitespace changesGravatar Dirk Hohndel
I keep trying to get to consistenct. Completely hopeless. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Small tweaks to our whitespace handlingGravatar Dirk Hohndel
This is still not (and likely will never be) intended to just be blindly run and mechanically applied to all files. It tries to implement our rules but it is not perfect and more importantly, we have parts of the code where we intentionally break our rules for various reasons of readability in that particular situation. But running this against the sources files you touch often will point out things that are wrong and should be fixed. This fixes the indentation for continuation lines and the handling of the for each style loops (clang 3.5 should have this built in - I'll play with the current development version of this later). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Good code cleanup on the old DivePlanner code.Gravatar Tomaz Canabrava
All code that was removed already is working on the New Profile, The code that's behind #if 0 means that it still needs to be ported and because of some removal, it was not possible to keep it compiling (mostly the removal of the Ruler class, that is the Axis, on the new profile). The rest of the code that's untouched - most probably will keep that way. The DivePlannerPointsModel is correct and well done, no need to change that, only the Graphics part. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Profile now correctly displays the planned dive.Gravatar Tomaz Canabrava
But it doesn't move the handlers yet, and when you confirm it you also must click on the dive to select it or the profile will show garbage. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Code Cleanup: connections can be made between signals.Gravatar Tomaz Canabrava
A signal can connect to another signal, so I removed a slot that had the sole purpose to call another signal and replaced that with a direct call. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Disconnect temporary connections on the Profile.Gravatar Tomaz Canabrava
This code adds the disconnections of temporaries. A temporary connection is a connection that should be active only on a certain state, and we need to clean that for the new state that will enter after. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Move two necessary functions for the Planner behavior to the Profile code.Gravatar Tomaz Canabrava
Those two functions are important and necessary for the Planner, they create and remove the little balls that act as handlers so the profile can be edited with the mouse. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Back to profile or empty state when finishing addition.Gravatar Tomaz Canabrava
This patch adds a signal to MainTab, that should be removed from there when we finish the rework on the edit part, to go to the edit classes, but in the meantime, let's keep it there. The signal is connected to the ProfileWidget in a way that the end of the edit will also trigger the profile to go back to ProfileState (show the dive, if there's any) or empty Profile (if there's none). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Enable editing the 'Add dive' from the new profile.Gravatar Tomaz Canabrava
This is highly broken in many ways - but it's the right first step. I ported two of the most important methods from the old profile and now if you are in add dive mode, double clicking on the new profile will correctly add a handler on the planned dive. To see and move the handler around, however, you need to activate the old planner. Next step: add the handlers on the new profile. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Temporary Tab Widget for the planner and the Profile View.Gravatar Tomaz Canabrava
This is a temporary measure to help me port the planner to the new profile. it will be removed when I finish the port, but it makes the software still usable, so there's no worris. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Source and dest are created on the constructor, no need to check for them.Gravatar Tomaz Canabrava
The code checked if dest and source existed before trying to call an method on them, but dest and source are created on the constructor, and thus, the if is dummy. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Move settings of the Ruler to the Ruler.Gravatar Tomaz Canabrava
As with any other graphics object, the settings for the ruler should be managed by the ruler, clearing up the Profile logic and making the code easier to read. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22PreferencesChanged -> settingsChanged.Gravatar Tomaz Canabrava
We used both preferencesChanged and settingsChanged in different methods and classes to mean the same thing, this adds consistency. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Don't replot every time a pref changes, regardless of what preferences.Gravatar Tomaz Canabrava
The list of preferences that should trigger a full repaint are at the top of this method, *if* this introduces a bug it is because some of the preferences are not being correctly triaged yet and that needs to be fixed. Regardless of that, now the profile will only enable / disable the *ruler* instead of replotting everything. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Remove use of QSettings for ruler visibility, use prefs.rulergraph instead.Gravatar Tomaz Canabrava
The QSettings is a bit bloated on its use, so we are trying to narrow down the amount of calls to it. We have a preferences struct, use that instead. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Code Cleanup: Move the Hide/Show ruler to an internal methodGravatar Tomaz Canabrava
By moving the Hide/Show of the ruler to an internal method, we gain a bit of codecleanuperism by removing a lot of unnecessary calls to their dest and source drag-handlers. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Create a 'remove_event' function that removes an event.Gravatar Tomaz Canabrava
The logic of removing the event was in the UI, and this makes the code harder to test because we need to take into account also the events that the interface is receiving, instead of only relying on the algorithm to test. so, now it lives in dive.h/.c and a unittest is easyer to make. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22Fix compilation with CMake.Gravatar Tomaz Canabrava
This changes are only to make CMake compile again after the addition of the export dialog. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21Shortcuts for the exporting window.Gravatar Gehad elrobey
Add the ability to close the exporting window, also Quit Subsurface with this window in front, for consistency. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21Add ability to export only selected dives in worldmap exporterGravatar Gehad elrobey
This patch adds the ability to export selected dives only in the worldmap exporter. After Miika added the export dialog in commit 7dc642860def ("Implementing export dialog") and exporting only selected dives became a choice while exporting. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-21Implementing export dialogGravatar Miika Turkia
As our menus are getting many export entries, it is better to create a single export dialog where user is able to select the export type and whether to export selected dives or all of them. This should also be more intuitive than the current way when export from file menu export all dives and right click menu on divelist exports only selected dives. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Code Cleanup: use qMin instad of if( min ) setMin else setMax.Gravatar Tomaz Canabrava
silly code cleanup. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Speed Improvement: Unhide all events by calling event->show()Gravatar Tomaz Canabrava
The old code replotted the whole dive, while what we really wanted was to show the events. so just ->show() them. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Speed Improvement: hide events instead of replotting everythingGravatar Tomaz Canabrava
The 'Hide Similar Events' function asked the Profile to replot eveything, only because some events were hidden from the interface. Instead of that we can simply hide the events since the graph will be the same. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Only set the state to profile if it's empty, not if it's Add or Plan.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Remove silly macro to pretend that we were doing things the right way.Gravatar Tomaz Canabrava
That macro was useless, I should have been drunk when I wrote it, and I don't drink. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20CVS import/export instead of CSVGravatar Jeremiah Mahler
The ReleaseNotes.txt refer to improved "CVS" import/export. But there doesn't appear to be any such format. There is, however, support for "CSV" formats. Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Use the last 'diveid' when merging dives for one dive computerGravatar Linus Torvalds
When we merge two dives into the same dive because a divecomputer had incorrectly considered it two separate dives (due to surface time within the dive) we should pick the dive ID from the later dive to be the diveid of the resulting merged dive. Otherwise we might re-download the (now merged) partial dive. This is a rather unusual special case, but it actually hit me with the Uemis on my last dive in Palau: Chandelier Cave has multiple surface points where you can spend time admiring the cave above water, and the Uemis (but not my Suunto's) decided that the dive was actually four short dives back-to-back. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Add math.h because of usage of rint()Gravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Use get_o2 instead of local versionGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Migrate code to for_each_dive and for_each_dcGravatar Anton Lundin
[Dirk Hohndel: this overlapped with my commit 09e7c61feeea ("Consistently use for_each_dive (and use it correctly)") so I took the pieces that I had missed] Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Fix building with NO_MARBLE prepareForGetDiveCoordinatesGravatar Anton Lundin
Commit fb82da58a2 ("Globe: assume that we are looking at the current_dive") changed the prototype for GlobeGPS::prepareForGetDiveCoordinates. This patches the dummy in NO_MARBLE. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Fix building with NO_MARBLE, centerOnCurrentDiveGravatar Anton Lundin
Commit 2bc76beb65 ("Globe: we always center on the current dive") changed GlobeGPS::centerOn to GlobeGPS::centerOnCurrentDive. This patches the dummy in NO_MARBLE, too. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Consistently use for_each_dive (and use it correctly)Gravatar Dirk Hohndel
The way the macro is written there is no need to test the dive against NULL before dereferencing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Dive list: add context menu function to renumber dive(s)Gravatar Dirk Hohndel
No attempt is made to ensure that what the user does is sane. So this can result in duplicate numbers, non-consecutive numbers, non-monotonous numbers, whatever floats the users boat. You can renumber a single dive or all selected dives (with a starting number given that is applied to the oldest selected dive and then for each newer selected dive that number is incremented by one). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Remove unused variablesGravatar Dirk Hohndel
These were leftover in commit 90638180d21a ("Use the used flag on cylinders in get_dive_gas"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Add ability to make a dive computer the first dive computer of a diveGravatar Dirk Hohndel
If a dive has multiple dive computers we enable a special context menu when the user right-clicks on the dive computer name AND is not already showing the first dive computer. In that case we offer to make the currently shown dive computer the first one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Show the dive computer number (if a dive has more than one)Gravatar Dirk Hohndel
For most users this is no change at all. For the few who download from multiple dive computers this now shows them which of them is the primary dive computer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Make the code easier to readGravatar Dirk Hohndel
This uses the new helper function from commit fc4f133f19d0 ("Add new helper function that looks up the index of a dive by its uniq ID") to make the logic implemented in commit 122593a63a46 ("Fix selection after downloading dives from the dive computer") much saner to read. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Add new helper function that looks up the index of a dive by its uniq IDGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Fix selection after downloading dives from the dive computerGravatar Dirk Hohndel
If we successfully download dives, the old selection should be cleared and the one of the newly downloaded dives should be selected. I decided to pick the last dive downloaded, which for most dive computers (but for example not for the Uemis SDA) will be the first or earliest of the dives. That seems much more intuitive than keeping the previous selection around. Of course this is harder than it should be because of the way we track selections and because we need a consistent dive list model in order to change the selection. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Assign the uniq dive ID the moment a dive is allocatedGravatar Dirk Hohndel
Previously we only did this when we did fixup_dive(), but that way we can't reference dives "early" in their life cycle (e.g., right after they got downloaded). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Change get_dive_by_diveid to get_dive_by_uniq_idGravatar Dirk Hohndel
The original name was a really bad choice as we have a 'diveid' as part of struct divecomputer - and that is not the diveid that is being used here. Instead we use the 'id' member of struct dive which holds the "unique ID" for this dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Download from dive computer: Fix the broken selection of devicesGravatar Dirk Hohndel
The old code was completely bogus - it's confused about what the variable 'i' is counting. This also let's us select the Uemis mount point by default if that's the only valid "device" that we found. Compile tested on Windows, untested on Mac. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19Divecomputer download: try to offer only those devices that make senseGravatar Dirk Hohndel
If the user selects a Uemis divecomputer, don't show serial devices. If the user selects a serial divecomputer, don't show the Uemis filesystem. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-18Improve the tag widget to allow us to tab to the next fieldGravatar Dirk Hohndel
If the last key that went in ended a tag and the next key is a tab - deliver that to the TabWidget instead so we can navigate between input fields. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-14git save: add list of dive computers to the commit messageGravatar Linus Torvalds
This makes it much more obvious what is going on when you save in between importing multiple dive computers, since the last dive description otherwise stays the same. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-14git load: initialize dive computer timestamp and duration from diveGravatar Linus Torvalds
We don't save the dive computer timestamp and duration if they match the dive timestamp and duration. But that means that on loading, we need to default the dive computer time/duration to the dive one. If they differ, the loading of the divecomputer file will then override the default timestamp/duration. This mainly matters if a later dive merge then changes the timestamp of the dive: the dive computer timestamp needs to have been set correctly and not change. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-14Mark new dives "downloaded" when importing new divesGravatar Linus Torvalds
We used to do this just for dive computer downloads, but we should do it for all imports, so that merging new import data always does the expected thing: any new dive computers will be added to the end of the list of preexisting dives, rather than the other way around. (Of course, if you set the "prefer downloaded" flag, that reverses this logic, and makes the newly imported dive computer data be the primary dive computer. That flag is currently only exported for dive computer downloads, not for imports). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-14Don't merge divecomputers if we know they are differentGravatar Dirk Hohndel
When merging dives, if we know for sure that the dive computers are different, don't merge them into one (by interleaving the data), but instead keep both as separate dive computers in the same dive. This fixes a bug when due to a faulty download the same dive from two dive computers looks quite different. They don't get merged automatically (which is fine - they are quite different), but when manually merging them, we of course want one dive with two dive computers, not one dive with one merged dive computer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>