Commit graph

165 commits

Author SHA1 Message Date
Dirk Hohndel
9c90d6790a Fix some random compiler warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 21:06:31 +09:00
Dirk Hohndel
f6eb26dbae Handle tank data correctly in profile editing mode for manually added dive
This is subtle. Normally you would expect someone to edit the tank data by
simply clicking on it in the equipment tab. But a user could conceivably
edit the tank data after clicking on the profile editing button instead.
This works now as well.

This also addresses the issue that start and end pressure were not shown
in profile editing mode.

Fixes #235

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 18:36:21 +09:00
Dirk Hohndel
98322a976c Correctly convert an existing dive into a plan
I missed this one spot when converting back to the different semantics for
divedatapoints.

With this change add dive appears to work correctly (fingers crossed).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 22:39:53 +09:00
Dirk Hohndel
bb041069a3 Fix addGas to look at the correct cylinder
That was a stupid bug. You have to actually update the variable to look at
the right cylinder. Duh.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 22:38:14 +09:00
Dirk Hohndel
1a3ea5636a Don't change gas used in segments if there is still a cylinder with that gas
Otherwise adding a second cylinder (to the default one cylinder of air)
and subsequently changing the gas of that cylinder will illogically change
the gas used in all the segments.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 21:56:51 +09:00
Dirk Hohndel
d7fb6853a3 Connect changes in the tanks with the dive that is being added
- you can no longer delete a tank when its gas is in use
- therefore you can no longer delete the last tank
- when you change the gas mix of a tank, the corresponding segments in the
  dive change as well
- when changing gas for a segment the correct available gases are offered

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 21:56:22 +09:00
Dirk Hohndel
aa76d35923 Instead of a "Cylinder for planning" use a default cylinder
Right now hardcoded to AL80. This way in the future we'll have a volume of
gas that's available. And this makes much more sense then a random string
in the description field.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 21:45:24 +09:00
Tomaz Canabrava
b98157a519 Partially revert d72c69db7a and fix its errors
In the offending commit a QWidget was changed to QTableView, but
only in the header - and thus making avaliable all method calls,
but the initialization of the widgets was still a QWidget, and
nothing of QTableView was used besides an incorrect call to
setColumnHidden.

This commit fixes that by using the view() method provided by the
TableView implementation which returns the true QTableView that should be
used for specific nitpicking, like hidding columns. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 11:58:47 +09:00
Dirk Hohndel
a683a217b9 First steps to make add dive work with the correct infrastructure
This just makes sure that we do the right thing with the staging drive,
that we don't mess up the selection, the we are smart about using our
helper functions, etc.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12 14:21:50 +09:00
Dirk Hohndel
94222fbe49 Remove some debug output
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12 11:20:23 +09:00
Dirk Hohndel
ad4812c22e Make planner work again
This partially reverts changes in commit 1b655d5c806b ("Correctly track
gases when manually adding and then editing dives") as it turns out this
did NOT help us correctly track gases (which is ironic, given the title of
that commit). I didn't actually want to revert that commit as
infrastructure has changed since then and this made the patches look even
more incomprehensible.

So we are back to tracking the "gas on which we arrive at this spot" in
each dive plan node as this makes the rest of our planning so much easier
- I had forgotten about the reasons why we did things this way when I made
the above mentioned commit.

Instead we now make sure that our available tanks are added the correct
way, that such entries are ignored when planning and when drawing the
editable profile, and that at the end it all gets assembled correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12 11:19:04 +09:00
Dirk Hohndel
d72c69db7a Add depth colum to cylinder model
To make the planner work this adds a new column to the Cylinder widget
(depth - for the depth at which we want to change to a certain gas
during deco).

This also tries to hide that column in the equipment view and hide the
start/end pressure columns in the planner view. Oddly that fails :-(

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-12 11:17:40 +09:00
Dirk Hohndel
cd1149e57f When entering a new point, pick the previous gas by default
This is much more useful than always picking air.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11 18:13:55 +09:00
Dirk Hohndel
0a8892379d Connect cylinders entered in planner with the gases available
Now the gases for which we have cylinders are offered in the gas selection
list and correctly recognized and added for the plan.

Still tons of work to be done to make this work the way it is designed,
but we are getting closer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11 17:09:19 +09:00
Dirk Hohndel
e5098c443f Hook up delegate to enable cylinder autocompletion in planner
That was easy

Hand-holding-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11 05:51:39 +09:00
Dirk Hohndel
55c127f7c3 Enable adding cylinders in the dive planner
This is in preparation of using those to define the gases available for
planning.

Right now this doesn't seem to work quite right - I don't get the
auto-completions for the cylinders that I was hoping for...

This commit also corrects the tooltip for addint dive data points.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-10 21:02:53 +09:00
Dirk Hohndel
aa4931e8c6 Show a cylinder widget in the dive planner
This is intended to allow the user to provide the gases / cylinders that
she will be diving with. With that information the planner can warn the
user about insufficient gases, but more importantly it can show relevant
gases in the gas select drop down.

Right now the add cylinder button doesn't add a cylinder - that's a
problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-10 07:07:59 +09:00
Dirk Hohndel
44c9316f14 Honor "last stop at 6m" in dive planner
And recalculate the dive when it changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-10 06:08:42 +09:00
Dirk Hohndel
2a0f1fcf4e Remove left over qDebug() call
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09 20:41:28 +09:00
Dirk Hohndel
487efb1ee9 Merge branch 'addDiveGasFix' 2013-11-09 20:35:09 +09:00
Dirk Hohndel
6d5b2d7592 Adjust planner to work with the new semantic
Insert the dive data point at 0,0 manually at the beginning of the plan.
Now everything should work. We still can't edit a plan created like this,
but at least we can once again plan things.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09 20:33:33 +09:00
Dirk Hohndel
5dce73f62b Fix position of depth reading when entering dives
At 5% it would overlap the scale - now it's much easier to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09 20:10:49 +09:00
Tomaz Canabrava
8a970c64c2 Removed inconsistency when user tried to add dive while planning.
The user could add a dive, and in the middle click on the 'plan'
button. Since we didn't cared about that on the widget, a lot of
inconsistencies could occour. this fixes that by setting a flag
on the Planner, that has now three modes: nothing, plan and add.
(maybe in the future an edit mode will be valid too.)

If in 'NOTHING' mode, user can enter the addition, edition and
planning. If in any other mode, user can't do a thing. The mode
gets back to NOTHING when user accepts or cancels a plan / add
/ edition.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-09 15:35:29 +09:00
Tomaz Canabrava
f850a0817c Fixes garbage left behind when canceling edit dive.
Garbage was left behind when canceling edit dive, and thus when the user
set his dive to be editted, after a first canceled edition, all points of
the first edition got messed up and showing on the second dive too. if the
user clicked 'ok', he got a really bad surprise.

Fixes #226

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-11-09 15:34:39 +09:00
Dirk Hohndel
8941e8677e Correctly track gases when manually adding and then editing dives
The code had quite a few odd special cases that may have been left-overs
from the old Gtk algorithm. With this the gas is actually in the dive plan
node where it's use starts. And we maintain the gas correctly between
multiple edit sessions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-08 21:22:59 +09:00
Dirk Hohndel
1578c1edb2 Be consistent when passing around gas data in the planner
We need to make sure that the correct segment has the correct gas assigned
to it - and that those gases are correctly tracked when editing a manually
added dive as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-08 18:15:04 +09:00
Dirk Hohndel
bf0bd88226 Correctly identify air
Because of rounding issues we need to use our macro to test for air
(especially since the events store gas percentages and not gas permille).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-08 18:12:26 +09:00
Dirk Hohndel
460aa4c1bd Include the cylinder information in a dive added with "Add Dive"
We only copied the samples, but not the related cylinder data.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-07 18:07:10 +09:00
Tomaz Canabrava
0e96c9f62e Enable undo for the Edit mode on Added Dives.
This enables undo for the edit mode on added dives, it uses the
premade backup to fill the old dive with data. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 14:06:03 -04:00
Tomaz Canabrava
23a193b0d1 Changed the backup implementation of the samples on EditDive.
Changed the backup implementation of the samples on EditDive,
it's way cleaner now what's happening, and it's also better for
the cancel edit.

Next: The Cancel Edit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 13:45:14 -04:00
Tomaz Canabrava
f7cd3e780c Enable editing a dive that was manually entered.
This patch enables editing a dive that was manually entered,
it doesn't cover dive plans yet because on the plan I need to
figure out what are the 'user-entered' points, and what are
the algorithm point. and I feel lazy. =p

One last thing that's missing is to revert the dive to the
previous condition if the user cancels the edition, currently
canceling and applying ok is the same thing.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 11:48:34 -04:00
Linus Torvalds
58b668c714 Fix dive planner sidebar depth units
The dive planner always showed the depth in our internal units, ie
millimeter, in the sidebar that showed the plan points.

That made little sense in metric mode, and none at all in imperial. The
_graph_ showed things in meter and feet.

So make the DivePlannerPointsModel always convert things to and from the
user units.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11 20:26:28 -07:00
Tomaz Canabrava
1b9a4f2bf8 Good deal of whitespace fixes and code cleanup.
I just went thru all of subsurface code removing
some whitespaces issues and trying to make the
code prettyer, I also removed a few QString issues.d

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-11 10:21:04 -03:00
Dirk Hohndel
b3490213f4 Merge branch 'glib-removal-hack'
Fix obvious merge issue in Rules.mk

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 10:57:16 -07:00
Dirk Hohndel
4d3e74a236 Trying to switch to Qt translation
This compiles and looks about right, but it doesn't appear to work, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 10:42:32 -07:00
Robert C. Helling
05eabae62a Modify the dialog text for the question to make more sense.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-05 19:48:39 -07:00
Thiago Macieira
ad52301ca7 Turn off Qt including the C++ Standard Library headers
We don't use any of the Standard Library features or classes in
Subsurface, except for three uses of std::sort, for which I added the
necessary #include.

It's always a good idea to include directly the headers you want,
without relying on indirect inclusion

On my machine, the build time dropped from 16.96s to 13.38s or a 12%
improvement.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 13:47:24 -07:00
Thiago Macieira
8e81d3f100 Make the classes generated by uic be real members of our classes
This means we don't have to new/delete them, which is a waste of
overhead.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 12:13:48 -07:00
Thiago Macieira
f0f76056ac Include the ui_*.h headers in the main headers.
This means we can also remove the forward declarations.

This is the first step in removing the memory allocation for the ui
sub-classes. Without the second step, this commit is just making the
compilation time increase for no good reason :-)

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 12:13:15 -07:00
Tomaz Canabrava
098aa6343b Fixed the display of Subsurface in Smaller Screens
This patch fixes the display of subsurface in smaller
screens by creating ScrollArea containers that are
now englobbing each of the Tab-pages and the Planner
Widget. Some of those widgets were pretty big by the
amount of things on it and it was too big for small
( 14" and 15" ) screens.

This seems to fix it, and looks good both on Gtk+ and
Oxygen styles.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-26 18:14:09 -03:00
Dirk Hohndel
6ce5704435 Support imperial measurements in dive planner / add dive
This was not as hard as I assumed it would be. I may still change the
horizontal dimension to be the more logical seconds instead of minutes,
but for now this achieves the main goal.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22 12:37:49 -07:00
Dirk Hohndel
ff58fd7dca Whitespace fixes in dive planner
I know this may seem anal retentive... but it's driving me insane.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22 12:34:50 -07:00
Dirk Hohndel
9ba7b12767 Prevent nodes in planner / dive add profile edit to run past each other
I always disliked the fact that when you moved the handlers around you
could just 'run over' the neighbors. This also (as a somewhat intended
side effect) prevents vertical descents and ascents).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22 11:01:18 -07:00
Dirk Hohndel
799b56a1f3 Don't exit profile editor when hitting ESC in dive add mode
I'm sure there are more issues like this where we need to handle things
differently depending on whether we are planning a dive or adding a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-22 08:45:14 -07:00
Dirk Hohndel
b1a3c1047a Simplify the default dive profile given in add dive
Suggested-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-21 08:56:19 -07:00
Dirk Hohndel
5e6ed53e40 In planner / add dive use 'ESC' to hide the gas selection popup
Not sure if there are other keys we should support.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-21 08:50:09 -07:00
Dirk Hohndel
a8888eaf26 Allow editing of date & time and air & water temperatures
Add two more rows to the widget - this is getting quite busy.
There still is some weirdness where the focus isn't returned where it
should be and a few other details, but overall getting there.

Added helper functions to parse a temperature and to deal with the
timezone offset - with that latter one I also fixed the time offset bug in
the planner.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-21 08:30:32 -07:00
Dirk Hohndel
5f4aec867e When manually adding a dive, start with a simple dive
This is much friendlier than just showing an empty profile. I picked a
nice and simple three level dive. 25 minutes at 18m, 15 minutes at 9m, and
a safety stop.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-20 07:38:15 -05:00
Dirk Hohndel
46c23c53a1 Merge branch 'addDive'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19 23:05:17 -05:00
Dirk Hohndel
46b125782e Hook up adding a dive
This gets things mostly right.

It creates a dive and uses the planner widget to create samples which are
copied into the dive. It fills in some reasonable defaults (DC model,
timestamp), but doesn't allow editing the timestamp (or the temperatures
and air pressure).

On accept the planner gets reset and the dive appears correctly in the
dive list.

Cancel still needs to be handled.

And I bet there are many subtle bugs lurking here and there. But it's a
start.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-19 22:54:00 -05:00