Commit graph

3507 commits

Author SHA1 Message Date
Dirk Hohndel
3b9c28bce7 Don't create stop at time zero when re-editing manually added dive
To our addStop method time = 0 & depth = 0 are a magic flag. And since we
always start at the surface, that is assumed, anyway. So let's just not
add a stop for that when re-creating a plan from a dive.

Fixes #254

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 12:42:21 -08:00
Dirk Hohndel
c4a47a7d60 Get rid of the planner
This is nothing but an indefinite time sink. Let's focus on things that
the majority of our users actually need and use.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 11:39:59 -08:00
Tomaz Canabrava
bae41ddafb Maintain opened the trips of the selected dive.
In various occasions the branches of selected dives
got collapsed because I'm dummy boy and didn't programmed
the logic correctly.

This one correctly works for the few cases that I'v tried,
I'm verifying if the current selected index is a trip or
a dive, and asking to expand it.

The expanded state is lost because we delete and recreate
the model ( and we do that because we can switch between
tree and table model ).

Now I think we correctly track the cornercases.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 11:14:46 -08:00
Tomaz Canabrava
1e63579cc6 Fix the sentense 'collapse' to 'collapse others' and scroll to it.
This patch changes the string 'collapse' to a more meaningfull
'collapse others', it also scrolls the view to the first selec
ted index, since after collapsing the others, things could be
in the wrong position.,

Fixes #233

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 11:13:31 -08:00
Dirk Hohndel
6bf12bde03 Make more context menu functions act on all selected dives
Remove from trip and delete both should deal with all selected dives.

Fixes #247

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 14:21:20 +09:00
Taiane Ramos
7e859da939 Make tooltips work in the profile toolbar
This patch enables tooltips on the profile toolbar. Tooltips were
being treated as text to be shown at notification area. Now it is
verified if the cursor was positioned over the toolbar when it
activated the event. If so, tooltip is shown normally.

Fixes #238

Signed-off-by: exhora <exhora.tat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:26:01 +09:00
Thiago Macieira
711f2ddf8c Avoid std::string: QByteArray is enough and already compiled in
No need to add more code to Subsurface by bringing in std::string too.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:19:58 +09:00
Dirk Hohndel
66f5f32f11 Once again remove debug output.
Oops again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:17:38 +09:00
Tomaz Canabrava
cec30c27d9 Enable a context menu to remove dive handlers.
This commit enables a context menu to remove dive handlers,
because it was hard to find that ctrl+click selected it,
then a delete button press removed it. it's better now. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:15:35 +09:00
Maximilian Güntner
3302ee11c1 changed tag completition to case-insensitive
When completing tags, the case of the completion prefix
should not matter.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:14:39 +09:00
Maximilian Güntner
80532a685a Escape all problematic characters when saving a tag
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:14:23 +09:00
Maximilian Güntner
17fbb6b17f Support translating UTF8 strings
Interpreting UTF8 encoded strings using tr() instead of trUtf8()
and encoding the string back to utf8 again leads to serious encoding
errors.

Fixes #230

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:13:15 +09:00
Dirk Hohndel
c0a6c136f0 Fix dive planner widget
In commit 0f50b73f9e ("Fix planner / add dive handling of DiveHandler
Points") some issues were introduced. While it is fine to remove the
artificial first point at the surface, the commit broke the special
handling for o2 == -1, i.e., the usual case where a default gas needs to
be picked.

This generalizes the algorithm previously used to also look to the right,
now that we are no longer guaranteed that there is a first point to our
left.

This also cleans up some whitespace damage introduced in the same commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 11:54:13 +09:00
Dirk Hohndel
5961579cda Manually add trips from dive list context menu
We had all the logic, we were just lacking the UI.

Fixes #243

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 11:32:19 +09:00
Dirk Hohndel
2c57568d56 Fix potential crash when merging trips
strdup doesn't like to be passed a NULL pointer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 11:31:35 +09:00
Tomaz Canabrava
0f50b73f9e Fix planner / add dive handling of DiveHandler Points
Dirk, is this really necessary or it's just something that you forgot
to remove? this is adding a bit of pain to fix some issues on the planner,
so I'm commenting this out untill you have a bit of time to look at it.
It looks like this was added to handle the gas in the pos-1, but you reverted
if so, this completely reverts it, and things works as expected again.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 09:27:41 +09:00
Tomaz Canabrava
1ee08005b2 Adds the first DiveNode at 5meters / 10minutes when clicking on plus
Adds the first DiveNode at 5m / 10 minutes when clicking on the plus
button on the DiveNotes Table.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 09:27:13 +09:00
Tomaz Canabrava
2235da57a7 Fix adding DivePoints on the planner via the table.
Somewhere we broke this, most probably in the code that activated the
planner to be used together as an 'add dive'. This commit makes the code
workable again.

There's one thing, though. if the model is empty, this will add something
in the first point - it's behaving strangely. I'll try to fix this in a
way that's invisible to the user, but overall, why are we inserting
something in the first(0,0) time and depth?

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 09:21:50 +09:00
Tomaz Canabrava
a07c3d62af Use the correct font for the Air Types Model.
The air types model had a font bigger than the
other models, this patch creates a data() method
that correctly delivers the correct font.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 09:21:05 +09:00
Tomaz Canabrava
96d5687ab8 Correctly handle changes on the CylinderModel to update the AirModel.
What happened before was that the AirTypes model was only being updated
when the user requested to change the air by clicking directly
on the Air, in the planner ( but not on the Air Table. ).

This fixes it by calling 'repopulate' whenever the cylinder model
changes ( by adding, removing and changing something.)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 09:19:14 +09:00
Tomaz Canabrava
b77d990ed6 Close the Air list when clicking outside of it.
This patch closes the air list when clicing outside of it,
making the use of the planner more pleasant.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 09:16:22 +09:00
Tomaz Canabrava
a6615f67cd More code cleanup.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 09:15:35 +09:00
Tomaz Canabrava
b28237309a Good deal of code Cleanup.
Rewrite of the way we handle the last used directory for the loading /
saving of files.
we didn't reuse anything for the code, and that's error prone
and also dumb =p. Reworked that so we have a nice method
to help us out on that. lastUsedDir and updateLastUsedDir

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 09:13:58 +09:00
Thiago Macieira
e2a4da767d Make qmake generate the install rule for user-manual.html
The default behaviour is to skip files that don't exist. It does that
to decide whether to create an $(INSTALL_FILE) rule or an
$(INSTALL_DIR) one. We need to add a setting so that it will ignore
the not-found error.

Found in Qt 4's own doc/doc.pri:
  # Install rules
  htmldocs.files = $$QT_BUILD_TREE/doc/html
  htmldocs.path = $$[QT_INSTALL_DOCS]
  htmldocs.CONFIG += no_check_exist directory

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 09:06:31 +09:00
Anton Lundin
419e425030 Remove some unneeded member functions
We can wire qt to call the right functions directly, so we don't need
these members.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 08:59:46 +09:00
Anton Lundin
83426c59e1 Planner: Default to GF from prefs.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 08:59:01 +09:00
Anton Lundin
bc6a1a4c53 Planner: use a QSpinBox for GFLow/GFHigh
Switch to using a QSpinBox instead of a QLineEdit. This makes it a bit
more intuitive and now you can see how the deco plan changes based on
the GF's.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 08:58:35 +09:00
Anton Lundin
2d8cd44370 Make the info box look as it did in 3.1
In the Gtk version there were no option to disable the showing of time
in the mouse over, so this removes that option to limit the amount of
clutter in the settings panel.

This also renames the time and temperature to match the names they used
to have. T -> @, Temp -> T

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 06:06:57 +09:00
Dirk Hohndel
277cf30aaa Update version number for 3.9 BETA
Our version numbers are purely numeric, so it's actually just 3.9 :-)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 23:23:32 +09:00
Dirk Hohndel
1b98738a72 First stab at updating ReleaseNotes.txt and README
This needs a lot more work. As does the manual that needs a major rewrite.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 22:32:12 +09:00
Dirk Hohndel
354a091e14 Change the menu structure
Mostly based on suggestions by Tomaz and Luisa (but with some changes
based on my rather strongly held believes).

I also tried to clean up the shortcut keys. Not sure if I got this right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 22:17:27 +09:00
Dirk Hohndel
8d284b0e24 Hook up the tank change and tank update for the planner
This failed spectacularly when I first tried it, so I put it on the back
burner. And it appears that with all my recent fixes for "add dive" as a
side effect this is working, too.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 21:58:04 +09:00
Tomaz Canabrava
77a1ef9ebe Expand the trip of the first selected dive.
I probably broke this a while ago, as I was not using the big
dirk dive file to test ( just using some random files over the
test folder. )

Now it's working as it should.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 21:26:33 +09:00
Tomaz Canabrava
942c8632de Code Cleanup - Removed unused var.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 21:24:49 +09:00
Tomaz Canabrava
6996930110 Correctly sets the size of the Air Types on the planner
The last commit correctly setted the minimumSize, but
I forgot to set the maximum size, and thus, it still
expanded. sigh.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 21:24:48 +09:00
Tomaz Canabrava
dbbdf62e26 Makes the Air Types widget on the planner smaller ( but expanding.)
This patch makes the Air Types widget on the planner smaller,
since on most dives users will only enter 1 to 2 dives, it's
not good to have so much whitespace. this makes it smaller for
small screens, and it will grow on bigger screens where space
is not an issue.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 21:24:48 +09:00
Tomaz Canabrava
37e7984e15 Fix Last Column adding a horizontal Scroll on the Dive List.
Fixes the last column adding a horizontal scroll on the dive list,
since we have the hability to show / hide columns, I had to create
a helper method to discover what is the last column and set the
size of it very small so no scroll is created.

Also, I'v set the setStrechLastSection to true. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 21:24:48 +09:00
Tomaz Canabrava
9f8577a5ea Fix edition of alphanumeric input on equipments.
This patch fixes the edition of alphanumeric input,
columns like depth accepted '23ft', '20m' or '30', with
an inplicit conversion to the unit. But the code ignored
that the input could have a 'ft' or 'm' ( ot anything else
for that matter.

Signed-off-by: Taiane Ramos <exhora.tat@gmail.com>
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 21:24:48 +09:00
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
ed41d5a744 Sort the dive table after adding a dive
This commit scares me. Any pointers to dives or indices into the dive
table... anything like that is invalid after we resort the table. Well,
not technically "invalid" (as in bad pointers), but after re-sorting the
table these will possibly not be pointing at what we expected.

This starts with the selection being "wrong" after we add a dive that
isn't the last dive (once we click OK the chronologically last dive will
be selected).

But of course without doing this, our #1 assumption about the dive_table
is broken. The dive_table is supposed to be in chronological order.

Best advice of course would be "don't enter dives out of order" - but of
course that's not realistic.

Fixes #234

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 19:36:41 +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
dfd17c7a7f Maintain the selection when aborting "dive add"
We remember what was selected before and restore it. Maybe there's a more
"Qt way" of doing this, but my implementation appears to work :-)

Also remove unconditional debug output that snuck into an earlier commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 17:58:14 +09:00
Dirk Hohndel
179615f3a9 Switch to the Dive Notes tab when manually adding a dive
This gives a more consistent and expected user experience.

Fixes #236

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 12:18:33 +09:00
Miika Turkia
a93b6011f1 Add file naming dialog for save as
When right clicking a dive on the divelist a dialog for selecting a dive
was opened. However, Save As requires a getSaveFileName dialog so that
user can give a new file name as well as selecting an old file to
overwrite.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 07:17:26 +09:00
Anton Lundin
179a5f6f33 Remove duplicated SAC data from information overlay
When reordering the info overlay content to make it jump around less,
somehow the SAC data got printed twice.

[Dirk Hohndel: rewrote incorrect commit message]

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 07:10:49 +09:00
Anton Lundin
39a4e38eea Break calculated deco info to separate vars
Store the calculated values in separate variables in the plot_data
struct, and display them separate. This makes sure we don't confuse the
calculated values with the ones from a dc, and now we can compare the
two.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-14 07:08:57 +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
c18464b44f Don't overwrite the new cylinders when adding a dive
We carefully assembled the correct data in the cylinders - don't replace
that data when manually editing a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 22:27:03 +09:00
Dirk Hohndel
dee1645de0 Correct behavior when adding a dive to an empty list and canceling the add
We need to leave the widget disabled and the date / time and coordinates
cleared.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 22:23:59 +09:00