Commit graph

343 commits

Author SHA1 Message Date
Robert Helling
d2a834b0cd Rearrange planner UI elements
This is my first attempt at grouping UI elements of the planner in a
sensible way.

It might still be sensible to combine the two bottom panes into one.

In addition there is a new field "altutude" which is sychronized with the
surface pressure as for planning we often know the altitude of the dive
site rather than the atmospheric pressure.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-26 15:40:16 -07:00
Anton Lundin
5904be2e06 Fix NO_PRINTING building again
Back in 6699e3ab ("Add print button to planner") unconditional printing
code was added. This puts that same code behind NO_PRINTING macro.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-24 17:18:58 +08:00
Anton Lundin
d8ec3988b1 Fix building with NO_MARBLE again
Back in 708f19830e ("Planner: New plannerSettingsWidget") the Globe
widget handling changed, and this updates the NO_MARBLE build option to
work after that.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-18 04:56:08 -07:00
Dirk Hohndel
8bd535d092 User survey: force running the survey from command line
This way people can test the dialog much easier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-14 14:45:42 -07:00
Dirk Hohndel
cdd3b3d9cd Start a user survey dialog
The idea is that a week after the user starts using Subsurface we ask them
if they would like to submit a survey response.

If you are running a development build, don't wait seven days.

This patch doesn't do anything with the user's selections, doesn't submit
anything to our server, etc. It's just a placeholder to tune what we
should ask, etc.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-13 14:03:51 -07:00
Dirk Hohndel
21be237b0e Delay loading of some settings until later
This early in init_ui() the settings may not be available, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 11:52:59 -07:00
Robert C. Helling
708f19830e Planner: New plannerSettingsWidget
In planner mode, this replaces the globe with the dive plan and introduces
a new plannerSettingsWidget in the diveListPane. All new fields are still
disfunctional. This is WIP.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 09:30:46 -07:00
Lubomir I. Ivanov
90982a84fa mainwindow.cpp: fix a warning about parentheses
"warning: suggest parentheses around assignment used
as truth value [-Wparentheses]"

I think 4.8.2 is confused about this one, but we suppress
it regardless by separating into two assignments.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-09 16:55:24 -07:00
Dirk Hohndel
6f568fbecd Simplify the code that checks if it's OK to close the current file
And make sure it gets called whenever it needs to get called - it was
missing from the openRecentFile case.

Fixes #530

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-08 19:49:25 -07:00
Robert C. Helling
40dd6f4c39 Disclaimer included in the printed diveplan
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-04 14:45:54 -07:00
Dirk Hohndel
714fdc7ced Force TTS/NDL calculation off if things take too long
This is kind of a random cut off, but if plotting the dive takes more than
a second and TTS/NDL is on, we force it off. Because the algorithm for
that is fundamentally quadratic in nature it can take a VERY long time -
getting users to think something is broken.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-04 13:44:34 -07:00
Dirk Hohndel
b6fce3f556 Closing the window should behave like triggering Quit
It seems odd to have different behavior depending on whether the window
manager tells us that the user wants to close the window or whether the
user hits quit or ctrl-q.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 18:32:00 -07:00
Dirk Hohndel
a82411b67c Dive edit: when asked ti quit while editing, offer to discard current edit
This is equivalent behavior to what we do when planning a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 18:17:32 -07:00
Dirk Hohndel
49053e86aa Make most of the shortcuts widget specific
Having the window specific means that you can't have a key do different
things on different widgets.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 15:30:27 -07:00
Robert C. Helling
6699e3ab3e Add print button to planner
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 07:23:43 -07:00
Robert C. Helling
2785d7bc3e Layout improvements to the dive plan
Changed to html.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 07:23:37 -07:00
Tomaz Canabrava
3595ad0294 Make the new picture widget display the pictures.
Small changes in the model to display the pictures of the dives.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-03 00:05:24 -07:00
Tomaz Canabrava
e140703d34 Add a method to update the dive pictures on the model.
Call that method from the mainWindow when the dive changes.
The updateDivePictures walks around the events of the first dc (since all
pictures are distributed allong all dive computers) to get the events of
type '123' (I wonder if there's not a better way to save pictures on the
dive, like an linked list of char* named pictures.)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-01 15:54:29 -07:00
Dirk Hohndel
6333f3aa35 Planner: show the plan notes in the new widget
That was easy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31 21:14:44 -07:00
Dirk Hohndel
e93bf1e559 Planner: add dive plan output area that replaces dive list
When switching to / from plan mode, we switch to show either the dive plan
detail widget, or the dive list widget.

So far this widget does nothing. This just makes sure it's there.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-31 21:08:57 -07:00
Tomaz Canabrava
86d7f6ace0 Move code from the Planner that doesn't belongs there.
Moved the connections between DivePlannerPointsModel and
MainWindow from inside the Planner class to the MainWindow.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28 17:02:46 -07:00
Dirk Hohndel
412317c91f Planner: set up a cylinder, even if no current dive is selected
If there was no current dive we didn't set up any cylinder at all which
was a bit awkward as we use AIR but have no cylinder corresponding to it,
which breaks assumptions elsewhere.

Instead we use either the default cylinder or make one up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28 17:01:18 -07:00
Dirk Hohndel
5afabfc9eb Planner: really fix crash after aborting planner
Duh. We had to reload the list (and make sure the internal data structures
are recreated as well) before restoring the selection.

I also switched to simply accessing the widget directly, instead of via
the dive_list() call.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28 13:17:20 -07:00
Dirk Hohndel
97e56b0382 Planner: prevent crash when canceling plan with existing dive list
There is still something seriously wrong here.
For now let's just not restore the selection and at least this prevents us
from crashing. But I still don't understand why it crashes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28 13:12:56 -07:00
Tomaz Canabrava
1e4f744165 Fixes showing the Empty Profile when Add / Plan dive is cancelled.
for some reason the next selected dive is NULL after cancelling the
plan. I'm investigating.

This patch fixes the show of the empty profile and it also untangles
some parts of the code, keeping the mainwindow where it should belong
: the mainwindow.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28 12:25:36 -07:00
Dirk Hohndel
f936776069 Try to clear out the profile when dive list is empty
This only partially works. If I start from an empty dive list, plan a
dive, then abort, there are still leftovers in the profile widget.
Hitting Ctrl-W clears that out. But it just runs the same cleanUpEmpty()
again...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28 10:16:00 -07:00
Dirk Hohndel
f8a773b37f Dive planner: remember the selection before new dives get handled
On an empty dive list we would remember the new dive (which gets
auto-selected since it's the only dive) and then crash when we try to
restore that selection after cancel (in which case that new dive is gone).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28 10:12:33 -07:00
Dirk Hohndel
424d38e0c1 Dive add: remove duplicate code
This is already done when we create the fake dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-28 10:09:44 -07:00
Dirk Hohndel
c88a90f379 Planner: correctly refresh the display
We were making things way too hard (and were doing things that don't need
doing, like clearing the DivePlanPointModel).

Currently we still crash after manually adding a dive or when canceling
a plan.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27 15:44:47 -07:00
Dirk Hohndel
eb59b97c2b SetFocus only works if the widget is enabled
One could argue that this makes sense...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27 15:32:45 -07:00
Dirk Hohndel
7bed6e9873 Planner: use the gas in the first cylinder for initial plan
As Tomaz suggested, I don't need to pass the information whether we are on
the planner into the function - it's part of the DivePlannerPointsModel
and therefore already knows.

Also, we want to make sure we actually use the gas that's in the first
cylidner of the staging dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27 15:12:41 -07:00
Dirk Hohndel
d1cd1eb933 Planner: better handle the temporary dive used for planning
This still crashes when you abort the plan.
And when you accept the plan, the profile stays stuck in PLAN mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27 15:12:41 -07:00
Dirk Hohndel
7feea7ccfa Planner: disable the dive list when working on a plan
And reenable it when refreshing the screen.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27 15:12:09 -07:00
Dirk Hohndel
12b9c75676 Planner: clean up the logic for starting up the planner
The existing code had no chance of every working - on so many levels.
First unselect all dives, then extract data from a selected dive?
Set up the cylinder data (which didn't work), and then clear the data
again?
What the heck.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-27 15:09:47 -07:00
Tomaz Canabrava
fe2eb1a9fc Activate the Planner
On the cleanup dirk forgot to set the plan tipe to PLAN instead of ADD

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 14:07:06 -07:00
Dirk Hohndel
660235c9b7 Planner: Don't include the ascent in the default dive
Allow to both create the full default dive or ownly the descent and bottom
part (so the planner can deal with the ascent).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:19:35 -07:00
Tomaz Canabrava
eec0b327a3 Make the planner show something.
This is working in the wrong way, mostly because I'm setting the
plannermodel to ADD state ( and the planner graphic to the
correct PLAN state ), but I don't know why - when on PLAN state
on the model, things just don't work.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:53 -07:00
Tomaz Canabrava
9b9abd5f2a Created a function to create a fake dive for Add and Plan states.
This function should likely to move to C in the future, I'm only
adding this here because I'm changing this file so much ( already
4 rewrites of the function )

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:37 -07:00
Tomaz Canabrava
58d5d5ca41 Remove uneeded call.
The disableDcShortcuts is called inside of the ProfileGraphics
( I actually think that this method should be moved to there )

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:31 -07:00
Tomaz Canabrava
777f047247 Small code cleanup.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:22 -07:00
Tomaz Canabrava
dcd8381764 Planner: Move method down below to easy comparisson with another.
Planner and add states are driving me nuts.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:18:12 -07:00
Tomaz Canabrava
feff22c222 Planner: Re-enable using the new profile.
This correctly enables the planner on the new profile,
but it doesn't triggers the correct paint on the canvas.

[Dirk Hohndel: remove other remnants of the disabled planner as well]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26 13:17:32 -07:00
Tomaz Canabrava
b88e6dc5fa Remove leftovers from the planner.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 21:11:55 -07:00
Tomaz Canabrava
d2569c6688 Remove a ton of code.
The code removed was already ported to the New Profile.
We managed to clean quite a bit. huhhy

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:36:44 -07:00
Dirk Hohndel
5ba573240f Gratuitous whitespace changes
I keep trying to get to consistenct.
Completely hopeless.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 11:40:22 -07:00
Tomaz Canabrava
f99ccc8ac2 Profile now correctly displays the planned dive.
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-22 14:41:26 +09:00
Tomaz Canabrava
fe1df6b1cc Back to profile or empty state when finishing addition.
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-22 09:12:32 +09:00
Tomaz Canabrava
3661f291a4 Enable editing the 'Add dive' from the new profile.
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-22 09:11:50 +09:00
Gehad elrobey
51e5030c06 Shortcuts for the exporting window.
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-21 22:20:48 +09:00
Miika Turkia
7dc642860d Implementing export dialog
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-21 03:31:43 +09:00