Fixed the show / hide dialog shortcuts to take the splitter into consideration,
So, here's the deal.
We have a few QSplitters that takes care of helping us with the
size of a few widgets, they are ok, and we should continue using them
to manage the visibility of them too. But the way that we did before was to
widget->hide(); something, and if you hided something using the splitter,
by holding it's handle and collapsing the widget, then you used the 'ctrl+number'
shortcut to show it, it whould only show a gray panel.
This patch makes everything behave using the splitters.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Ticket 127 mention that context menu is fixed on imperial mode, which is
partial true. Context menu only not have the changes on header model updated
when preferences are chenges during execution. Hard to note because if
program is closed and opened again, the context is initialized properly.
Since actions aren't bound to the header model, we need iteract of current
items and change the title.
Signed-off-by: Helio Chissini de Castro <helio@kde.org>
Last open dives directory is stored in settings, so no need to walk through all
subdirectories all the time.
Signed-off-by: Helio Chissini de Castro <helio@kde.org>
Added initial support for download dive info from subsurface web service,
the current code only downloads and output the xml downloaded in the debug
area. Now I need to parse things up and plug the unplugged stuff.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Don't call refreshDisplay() after preferences change. This strangely
somehow leads to a situation where I need to move the mouse over the dive
list before changes to the units are reflected.
When calling reload() do not force layout change / resort unless that is
the intention.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These changes should be correct - but they still don't fix the problem
that after we click 'OK' on the preferences (regardless of whether any
changes were made), the first dive is set as current dive and shown in the
map window.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The check to only update the dive if there were already dives selected
before seems bogus. I'm sure I put it there for a reason but it seems
flat out wrong.
This gets triggered when you select a trip by clicking on the trip
header. In that case all dives get unselected (amount_selected = 0) and
then we try to select the first dive in the trip - which fails because
of this check.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This function was supposed to take the default_prefs into account but
clearly wasn't.
Now it should be much more readable and maintainable.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Things got broken. Again. We no longer kept track of the selected dives in
our structures which broke statistics.
This attempts to fix that, but appears to still have a bug when selecting
trips. Sometimes this results in 0 dives being selected according to our
data structures, while Qt happily shows all dives of the trip as seected.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The code so far had completely ignored Metric / Imperial. Turning this
into a three way radio box seemed to make much more sense.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds a helper function to determine the Subsurface data directory
(are we running from build directory? installed on Linux? installed on
Mac? - still need to add support for Windows). This same function is
then used by both the setup for Marble and for the help browser.
This assumes that the user-manual.html file has actually been built and
installed (which we don't do by default with the current Makefile).
Right now there are rendering issues with our manual in the help browser
widget - I'm sure this can be fixed...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added a preliminary support for a manual display widget,
it's a very basic HTML text-browser, so it can have
hyperlinks, images and everything that a 1995 browser
has.
The long term plan is to subsittute this manual by
a more modern 'help' using QGraphicsView, that will
interact on the application level.
See #121
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
I think that displaying tissue loadings either as pressure or as
percentages is not very intuitive but that it makes much more sense when
translated to ceiling depths.
This change enables just that for the 16 tissues in our calculated ceiling
and visualizes this in the profile graph.
There is a checkbox in the preferences to turn this on. If enabled, all
tissues having non-trivial ceilings are also shown in the info box.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The download already worked, but we didn't display the new dives. This
introduces a new slot for MainWindow that updates what is displayed in
Subsurface after files were imported.
With this change we can successfully download ONCE - but when trying to
download a second dive the dialog doesn't appear to get refreshed the
right way - the OK button doesn't appear to work anymore (Cancel however
does).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the red dc ceiling as preference option.
Hooked them all up together so the sub-preferences are enabled when the
master preference is set (for 3m and red ceiling).
Use the options in the profile plotting functions.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The biggest problem here was that bool has different sizes in C and C++
code. So using this in a structure shared between the two sides wasn't a
smart idea.
Instead I went with 'short', but that caused problems with Qt being to
smart for its own good and not doing the right thing when dealing with
'boolean' settings and a short value. This may be something in the way I
implemented things (as I doubt that something this fundamental would be
broken) but the workaround implemented here (explicitly using 0 or 1
depending on the value of the boolean) seems to work.
I also decided to get rid of the confusion of where gflow/gfhigh are
floating point (0..1) and when they are integers (0..100). We now use
integers anywhere outside of deco.c.
I also applied some serious spelling corrections to the preferences
dialog's ui file.
Finally, this enables the code that selects which partial pressure graph
to show.
Still to do: font size, metric/imperial logic
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The imperial/metric super setting doesn't have any effect. But changing
the individual units now works and is tracked. And causes the display to
change after clicking "OK" (but not yet when clicking "Apply").
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Several changes:
- split the reload of the DiveListView from the reload of the header
- don't include the column title in the name of the setting; the title
will change depending on the units and localization chosen by the user
- rename the slot that toggles visibility to make the code more readable
- use setCollumHidden() method to simplify the code
- don't save the width of hidden columns (as they would be saved as zero
width and can then no longer be enabled)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The "no dive location" message box was displayed above the marble
widget, which made the layout splitter move horizontally.
Made the message box as an overlay on the map instead.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Dirk asked me to try to make it more modern, so I
used as a base, the Firefox preferences. currently
it saves / loads the preferences, and also smits
a signal 'preferencesChanged' that should be connected
to anything that uses preferenes, via the PreferencesDialog::intance()
object. In the future, I plan to make it have a signal / slot for each
member that changes.
I also moved the icons to a new folder this time, because the
amount of icons is now more than just two, and it was
becoming messy.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Don't Save/Cancel/Save is less ambiguous than OK/Cancel/Save. Also
being slightly more verbose when creating the QMessageBox.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of passing pointers to GError around we pass just pointers to
error message texts around and use kMessageWidget to show those. Problem
is that right now the close button on that doesn't do a thing - so the
error stays around indefinitely. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This also changed a bit the behavior on how the QSettings are managed,
till now, we used the QSettings constructor passing the name of the
software and the 'company', but this is now default - so there's no
need to pass anything by the QSettings contructor.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Ordering here is important - we can't resize the columns before they are
created. On the other hand this now means that we explicitly need to
expand to the first dive shown.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the skeleton code for a non-blocking ui-thread
It already creates the first-thread ( 'do not block the ui' )
and the second thread ('download from the dive computer')
We can in the future merge both in the same place - I didn't
want to do that now because the download function is written
in the libdivecomputer.c code, and I cant just transform that
to a QThread and use signals, so I used two threads for that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This allows us to do the right thing at exit (and also connects to more of
the menu actions to actually do something).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We want to give the user the option to 'cancel' and not exit the program,
to 'save' the file, or to say I'm 'OK' with losing the unsaved data.
This does NOT implement the actual save / save-as, yet.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is to prevent loss of data, so if the user is editing something,
either cancel the edition or save it, to continue moving around on
the Dive List. - Only the dive list is affected, user can still
play with the globe and the profile.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Borrowed the code from KMessageWidget from Aurelian Gateau, Kdelibs,
to better show passive information and notifications. instead of a
popup blowing in the user's face, a nice, animated and well designed
widget will gracefully fade-in, show the notes, and fade out when
not needed anymore.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The marble widget now shows the dive locations
and also will center on the dive that the user clicked
in the dive list.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch fixes loading a second dive-file after the first
one had been loaded. it simply clears some information and
makes sure that the current selected dive is invalid when
the file closes. I also did a bit of code cleanup on this one
to make things simpler in the future.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The selected dive was being set to zero when the program
started, but zero is actually the first dive. There
were workarounds on the gtk code for that probably
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
And rip out all the code that Dirk put there to do that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Figure out what is our first selected element (in case we start out from a
multiple selection) and then move to the next logical element. So the code
traverses an expanded tree (from a trip 'down' to its first dive or 'up'
to the last dive of the previous trip - and similar from a first dive in a
trip 'up' to its trip and from a last dive in a trip 'down' to the next
trip.
This does not take 'shift-cursor-up/down' into account (i.e. manual
selection extension). Instead with just cursor up and down a single dive
(or single trip) is selected.
My guess is that the code will make someone's eyes bleed. Be warned.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If a user clicks on a trip, all the dives in a trip should be selected.
But if a user selects a range of dives that happens to have a trip header
in it, then only the range of dives should be selected (the trip header is
marked as 'selected' for visual consistency, even though not all dives in
this trip are selected).
This also changes the code to scrollTo the first selected dive instead of
just expanding the parent. This seems to give us a more pleasant visual
appearance (trying to keep the selected dive centered in the dive list)
and as a side effect no longer hides the first dive trip at program start
(before this change the first dive in the first trip would be the top
entry in the dive list, with its trip just out of sight above).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>