Commit graph

3380 commits

Author SHA1 Message Date
Dirk Hohndel
7a6ff7a53c Fix a couple of problems with dive merging
- Dive list no longer has messed up trip entries
- Dive list is now correctly marked as modified after trips are merged
- When data file is closed, the list of selected trips is cleared which
  avoids a potential crash when loading a new data file

Fixes #286

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 14:41:12 -08:00
Dirk Hohndel
962abba1f7 Remove ununsed variables
The warnings are distracting - and the variables are truly obsolete by
now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 14:36:37 -08:00
Tim Wootton
0e9cd09442 Make editing message consistent with button labels
Changes Ok button to a Save button Modifies editing messages to reference
buttons Save and Cancel.

Fixes #245

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 13:44:52 -08:00
Henrik Brautaset Aronsen
092e8463fe Add more file types to import/default log file dialog
- Allow ssrf as a default log file suffix.
- Allow sde/dld/db as import log suffices (we don't use the LIBZIP
  and SQLITE3 ifdefs anymore)

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 13:39:57 -08:00
Tomaz Canabrava
188cdc7d06 Make it possible to set the coordinates via map for all selected dives.
This patch makes it possible to set the coordinates on the map for
all selected dives. Note however that after a coordinate is set,
user cannot edit it unless he multi-edit it with a dive that doesn't
have coordinate's set. this is just because it's missing a 'edit coords'
button.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 13:39:36 -08:00
Luisa Domingues
1b77b67fdf Mapped files of the planner icons on the subsurface.qrc file
[Dirk Hohndel: fixed several typos and changed the alias of the planner
               related plus / minus icons to avoid duplicate aliases]

Signed-off-by: Luisa Domingues <luisapiresdesign@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 08:07:52 -08:00
Luisa Domingues
4e08ee6eba just added the files with the parts of the buttons for the planner.
these parts must be put together, they were saved in parts to make it easy
for hover effects, etc.

Signed-off-by: Luisa Domingues <luisapiresdesign@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 08:04:37 -08:00
Anton Lundin
2b1c75a584 Use date format from system locale
Instead of hard coding a American date format, let qt use whatever the
locale suggests.

Fixes #248

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-17 07:08:53 -08:00
Tomaz Canabrava
612c5713b4 Fix crash when entering a dive via dive-add on a empty table.
We were selecting garbage, not anymore.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:33:21 -08:00
Tomaz Canabrava
47c833015b Fix showing the tooltips on the profile.
We incorrectly mapped the profile's widget tooltip based on the
global screen coordinates.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:33:02 -08:00
Tomaz Canabrava
5058d8914a Fix a crash with trying to show the tooltip on the profile.
Fixed a crash with trying to show the tooltip on the profile,
with an empty profile. Since the widgets are not created yet,
we got a crash trying to access the toolBarProxy.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:32:41 -08:00
Linus Torvalds
7e9a7b6223 Fix dive merging
This limits merging dives to dives that have at most half an hour of
surface time between them. That "half hour" is kind of a random thing
to pick, but it's not horribly horribly wrong.

It also changes the semantics of "merge selected dives" to something
that actually works pretty well: you can select a whole range of
dives, and it will merge only the ones that makes sense to merge. I
tested it, and it's reasonable. I could select all my dives from one
dive trip, and then do "Merge selected dives", and it did the right
thing (Dirk: I selected the florida trip, and it merged the aborted
"missed the trench" dive with the _actual_ "trench" dive).

I'm _slightly_ hesitant about this in the sense that maybe some crazy
person actually would want to merge dives with more than half an hour
of surface time between them, but it really doesn't seem to make much
sense.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:31:35 -08:00
Tomaz Canabrava
314cf4c628 Removed duplicated method.
This patch removes a duplicated method: get_divenr and
get_index_for_dive. The two are exactly the same  ( if my
c is not broken, but I may be broken since I'm working like
crazy for almost 30h nonstop. ), so please take a good look
before applying this one.

[Dirk Hohndel: Tomaz took the slightly broken of the two implementations,
               so I switched that out for the correct one]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:27:54 -08:00
Tomaz Canabrava
ad0aa8cc49 Small code cleanup.
This was bugging me for a while. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:24:01 -08:00
Tomaz Canabrava
4f1cae7a2f Expand the trip of the newly selected dive.
I hit this bug on deleting dives and the newly selected
one got inside a trip, that wasn't expanded. anyway, easy one.
:)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:23:33 -08:00
Tomaz Canabrava
8476ea5ea8 Selects the dive before the deleted ones.
This patch makes a selection just after the dives that got deleted,
or nothing if the list is empty.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:23:22 -08:00
Tomaz Canabrava
73cd8f3e56 Do not break Dive Headings on trip mode when a delete dive is done.
When the dive is deleted, we force a recreation of the dive list,
this is done because we were broken by design on the first transition
to the Qt infrastructure - one thing to change for 4.1, but no time
for 4.0.

We forgot to ask the headers to 'please, span more than one row,
please' when we recreate the model. easy =)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:19:55 -08:00
Tomaz Canabrava
4f9526ef81 Fix wrong handling of Dive Table, and revert some wrong changes.
This patch just reverts some wrong changes that I'v done on a
past commit ( sorry ) and correctly handles the selectDive,
by using a IDX instead of the dive pointer, as dirk told me
it's extremely error-prone since the pointer can change.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 20:19:55 -08:00
Anton Lundin
c1a05fd034 Planner: Make cylinder and time/depth boxes scale
When moving the horisontal splitter the cylinder and time/depth boxes
didn't scale down but got "stuck" on a certain height. This makes them
scale down when pulling the horisontal splitter up.

I would prefer if we could scale them individually, but i didn't manage
to get that going, but i didn't manage to get that going.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16 08:02:40 -08:00
Tomaz Canabrava
8827ea6f5d This moves the removal code to the model.
It's very important when programming via Model/View, in gtk or qt,
to not mess with the model data outside of the model. We were
deleting stuff that the model controlled outside of the model, so
it thought that there was still data there. This fixes the deletion
part, but there are also lots of other parts that I'll tackle in
the next commits.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 15:13:53 -08:00
Dirk Hohndel
06bf0e1849 Include icons in the Windows installer
Also fix the dependency / ordering issue with running makensis

Fixes #252

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 15:02:45 -08:00
Dirk Hohndel
0c833ef03b Don't close the active file or start "add dive" while editing a dive
Seems rather obvious to me - the language in the warning doesn't sound
very smooth, though.

Fixes #246

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 13:42:49 -08:00
Robert C. Helling
e5308c068f Forget old filename on starting a new log.
Fixes #253.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 12:43:53 -08:00
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