Commit graph

408 commits

Author SHA1 Message Date
Lubomir I. Ivanov
341eb05f83 MainWindow: prevent a possible crash on "re-plan"
MainWindow::on_actionReplanDive_triggered():

If a dive in the divelist does not have a "DC Model" for some reason,
selecting "re-plan" from the menu will pass a NULL value
current_dive->dc.model to strcmp() and break before the debug output.

To fix that we check if the said .model value is NULL.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27 07:35:15 -07:00
Miika Turkia
8fcc074b49 Support for importing Poseidon MK6 logs
This patch adds support for importing the logs from a Poseidon MK6
rebreather. This DC produces logs that contain of a .txt file that has
all the meta data and a .csv file that contains the sample readings. The
CSV file is different from the others in that it has a line per each
sample reading at given time. Thus we have to merge all the lines from
one point in time into one sample reading of ours.

[Dirk Hohndel: addressed some compiler warnings]

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-26 20:33:50 -07:00
Tomaz Canabrava
84fdbefb58 Fix typo that broke settings.
A small typo broke the disabling of the graphs for the
newly added curves. ( btw, we need a designer to display
the graphs in a better way, just too much information. )

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-20 18:36:08 -07:00
Robert C. Helling
3fc9c1e005 Tissue saturation plot a la Sherwater Pretel
This adds a toolbox icon to turn on a tissue plot inspired by the bar
graph of the Sherwater Petrel,

It shows the inert gas partial pressures for individual compartments. If
they are below the ambient pressure (grey line) they are shown in units of
the ambient pressure, if they are above, the excess is shown as a
percentage of the allowed overpressure for plain Buehlmann. So it has the
same units as a gradient factor. Thus also the a gradient factor line (for
the current depth) is shown.

The different tissues get different colors, greener for the faster ones and bluer
for the slower ones.

Positioning and on/off icon action still need some tender loving care.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-19 21:46:30 -07:00
Dirk Hohndel
0d1da0563b Random whitespace update
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:39:49 -07:00
Tomaz Canabrava
a6e9a1eab5 Implement the TagFilter model.
This model accepts check / unchedk. Now, I need to also
plug the result of the check / uncheck to the list model.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:28:04 -07:00
Tomaz Canabrava
7a90b9d764 Trigger the log->filter by tag to open the tag filter.
You can't really close it for now.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-17 15:27:50 -07:00
Dirk Hohndel
ab4d232bc2 Don't set up fonts twice
Turns out that the mainwindow reads the settings and sets up things -
except that this has already happened in the constructor of the static
PreferencesDialog. So only keep those parts that aren't handled there.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-27 15:46:06 -07:00
Tomaz Canabrava
1c56c9f626 Create stub methods and connects the model with the new statistics
Connects the YearlyStatistics model with the YearlyStatisticsWidget
nothing is shown right now, mostly because I need to do everything
but now it's easyer to add the things that are missing.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-25 13:58:38 -07:00
Tomaz Canabrava
750fc529b7 Add the old Statistics to have a reference view while programming
Added the old statistics panel at the botton of the new one to have
a reference view of the statistics while programming the new one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-25 13:58:26 -07:00
Tomaz Canabrava
2fe1dfe83a Remove a lot of non-necessary boilerplate code.
We used to have a very sad way of controlling the statistics,
now we will create the model when there's a need for it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-25 13:57:28 -07:00
Anton Lundin
0e91352e96 Fix NO_USERMANUAL building for android
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-25 13:54:20 -07:00
Tomaz Canabrava
9acf1caca3 A much better Toolbar for the profile.
Using QToolBar I was able to remove much of the dead code
from the mainwindow.ui xml file by transforming the QToolButtons
into actions and loading them dynamically in the .cpp code.
I couldn't use the designer for this ( as I wanted ) because
Qt has no notion of ToolBars outside of the areas where the
MainWindow should have one, and we use it in a very different
area.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-23 08:09:11 -07:00
Dirk Hohndel
642ad1e0fe Fix crash when calling the planner twice in a row
Turns out that the fix in commit f7119bdccf ("Planner: make sure no old
handles are around when entering Add/Plan") was incorrect. We ONLY want to
remove the existing handlers when we re-plan a dive, NOT when we call add
or plan.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19 21:57:15 -05:00
Dirk Hohndel
1894bdd3cb Don't trigger creation of dive from invalid plan in planCreated()
This is subtle. The modifications to the selection cause a redraw of the
profile. So we need to make sure that we leave the plan state and return
to profile state BEFORE we do this, otherwise we'll call into
createTemporaryPlan() with invalid data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19 21:18:26 -05:00
Dirk Hohndel
d45a991460 Planner: after canceling a plan, redraw the profile
While planning we might have made changes to the displayed_dive. So we
need to make sure that the profile is redrawn after we cancel a plan (or a
re-plan).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19 21:18:26 -05:00
Dirk Hohndel
d7630032e2 Planner: clear out model before re-planning a dive
Otherwise points from a previous run might be around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19 21:18:26 -05:00
Dirk Hohndel
a85a219df3 Add ability to replan a dive that we planned before
When doing this, all waypoints of the calculated ascent are now waypoints
in the plan - so the user has to remove the ascent part of the dive in
order to really replan the dive. That's a pain, but we don't keep the data
around that would tell us which waypoints are user input and which ones
were calculated.

Fixes #527

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19 21:17:52 -05:00
Dirk Hohndel
150676ce3d Merge branch 'joshua-gsoc' of git://github.com/thiagomacieira/subsurface into josh
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>

Conflicts:
	subsurface.pro
2014-08-18 20:25:06 -05:00
Dirk Hohndel
0f1381f160 Planner: assign a dive number if the right number seems obvious
Use the same logic as we do for newly added dives.
As a side effect this patch appears to fix the issues with getting the
newly planned dive selected.

Fixes #692

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-18 14:12:05 -05:00
Dirk Hohndel
29f50c6aee Cut'n'paste for dive data: implement paste side
This should correctly set all the values and puts us in edit mode.
Testing so far looks good for both single dive and multiple dives selected
(i.e., you can paste into multiple dives).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-17 11:58:11 -06:00
Dirk Hohndel
34fceb4a1b Cut'n'paste for dive data: implement copy side
Admittedly not very useful without working paste, but it's progress.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-16 10:07:06 -06:00
Dirk Hohndel
e8d430341c TankBar: hook into prefs and make ppGraphs resize accordingly
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-15 08:11:14 -06:00
Joseph W. Joshua
ec02737eda Create Dive Computer configuration dialog
Create a dialog for reading and writing settings to and
from dive computers, with a menu entry in MainWindow to
open the dialog.

I will build up on this dialog and change it as needed.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
2014-08-09 11:50:14 -03:00
Tomaz Canabrava
e95fa6c6dc Disable the Toolbox when in edit mode.
Some of the toolbox icons will trigger a recalculation of the dive,
triggering then a replot, that will copy the dive to the displayed_dive
again, but in the case of a edit this would discard the edition (
that would still be shown on the UI ) leaving the dive in an
unconsistent state.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 09:48:35 -07:00
Robert C. Helling
1508f95775 Update pictures when entering/exiting planner
This fixes the problem I pointed out im my comment to #667 and hopefully also
the original problem although I cannot confirm since i cannot reproduce the
problem in the first place.

See #677

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-02 15:13:51 -07:00
Robert C. Helling
a7eb316b1f In recent files use native directory separators
Qt internally always uses / as directory separator. #651 shows that in the recent
files menu, under windows we can have double entries with both versions of the
separator. This patch should normalize the menu entires to use the native separator
(i.e. \ on Windows). (Untested due to lack of Windows computer).

See #651

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-02 15:11:43 -07:00
Tomaz Canabrava
357f5c19da C++ Correctness and code cleanup.
Use const-reference where we can gain a bit of speed from that
and clear an else { if {}} by using else if.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 09:38:10 -07:00
Dirk Hohndel
edea301252 Don't mess with the selection when closing a file
Our core structures are kept consistent by calling delete_single_dive()
and there is no reason at all to even touch the UI selection as this all
goes away with cleanUpEmpty()

Fixes #660

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29 09:11:42 -07:00
Tomaz Canabrava
bebcbfe92a Desselects the trip before dive add / plan, and reselects it on cancel
When we had a trip selected, we ignored that and simply called
the DiveAdd functions, but the mainTab code that deal with selections
to show one or more dives or trips asked how many trips were selected
to the DiveList, and since a trip was selected things go kabum.

Fixes #606

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 16:08:22 -07:00
Tomaz Canabrava
9d4b8c8218 Force replot of selected_dive when canceling plan
The profile was still the planner one, so we need to force
a replot.

Fixes #621

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 16:07:31 -07:00
Tomaz Canabrava
c34ee894ab Use 'this' instead of ::instance() when iside of same class.
Do not use MainWindow::instance() inside of a non-static
mainWindow method, that's just bogus.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 16:07:01 -07:00
Sergey Starosek
42e8e6406b Disable DC shortcuts on closing data file
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 09:14:39 -07:00
Tomaz Canabrava
887f9e63c3 Save and restore Dive Planner Settings
This patch adds the code that saves and restores the dive planner
settings.

Fixes #608

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-15 17:05:38 -07:00
Anton Lundin
64d7c5c042 Remove unused menu "Filter"
The filter menu wasn't connected to anything other than a debug print.
This removes that menu.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-14 18:33:54 -07:00
Tomaz Canabrava
9661926131 It's safe to delete NULL pointers
Small code cleanup, it's safe to delete null pointers.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 09:58:55 -07:00
Tomaz Canabrava
040e172d33 Read the preferences upon initialization for the show/hide pictures
Forgot to add this one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 09:57:27 -07:00
Tim Wootton
3a16a64616 misc capitalisation and spelling
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 07:06:26 -07:00
Tomaz Canabrava
b9d04c0cf4 Show/Hide pictures working.
This code hoocks the pictures with the preferences change.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:54 -07:00
Tomaz Canabrava
a00d8101c5 Fix memory leak on the Export Dialog
The export dialog was being created but never free'd.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:45 -07:00
Tomaz Canabrava
31e0ec8696 Macro to simplify the creation of toggle buttons on the Profile
The new macro hides all 5 lines of code from the old code to just one,
since we already have 15 buttons and more are comming, and *every*
code is just the same, it's a logical change that will make us reduce
now 75 lines of code to just 15, in the future this can be bigger.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:39 -07:00
Tomaz Canabrava
dd94831d90 Correctly sets the 'enabled' flag on the picture button
Forgot to add this one, oops.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:27 -07:00
Tomaz Canabrava
503a150af0 Added the toggle picture button and hoocked it up
This patch adds the toggle picture button and hoocks
it up with the rest of the code. I'v also changed a call
from ProfileWidget because it caused errors on the ui
generated code, where it would try to call an still-to-be
instantiated object.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:23 -07:00
Tim Wootton
5538fd4baa mainwindow capitalisation consistency
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 16:30:05 -07:00
Dirk Hohndel
cd5b2a372f UI restructure: cleanup the code when canceling an edit
This was way too complicated because we used to edit a "live" dive that
was on the dive list. All we really need to do is systematically make
sure that all the widgets are in the correct state.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-06 12:50:30 -07:00
Dirk Hohndel
3c4439ee27 UI restructure: simplify setup of add and plan mode
Recreate the helper function (which now does something fairly different)
to share the common code between the two modes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 07:24:52 -07:00
Dirk Hohndel
0cfea5205d UI restructure: correctly setup planning
I had tested this mostly with add dive and completely forgot to track the
same changes in the planning routine. Oops.

This allowed to get rid of a no longer useful helper as well.

Fixes #594

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 06:53:33 -07:00
Dirk Hohndel
9b4bd80e84 UI restructure
Don't clear out the model after we already set up the cylinders.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-04 06:52:50 -07:00
Dirk Hohndel
5fca5f421d UI restructure: when adding a dive via displayed_dive it needs valid id
Otherwise we have one (or - yikes - more) dives with id 0.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 21:33:44 -07:00
Dirk Hohndel
611bae3441 UI restructure: use displayed_dive for add dive and plan dive
This gets rid of the stagingDive and stops the constant adding and
removing of dives from the divelist (that was an INSANE design,
seriously).

When adding or planning a dive all work is now done in the dedicated
displayed_dive.

Add dive mostly works - when the user clicks save the dive is added to the
dive list and selected.

Plan dive is mostly untested. It passed trivial "start planner, save"
testing so it's not entirely broken, but I'm sure there's more work to be
done there.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 14:45:01 -07:00