Commit graph

103 commits

Author SHA1 Message Date
Tomaz Canabrava
a05ea5a6e8 Create a view for the Statistics Model and Fix displaying the header
This simply creates a view to show the model, while doing that
I noticed that the model header wasn't showing, so I fixed it too.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17 20:02:30 -03:00
Tomaz Canabrava
ae68ae38bb Changed a lot of code to reduce boilerplate on models in the future.
So, I changed a lot of code to reduce boilerplate on models in the
future. Currently we do not have a lot of models, but this can increase
quite rapdly. There's a second TreeModel in the works, the Yearly
Statistics, this patch will save around 250 LOC for this new model,
and more and more models will give us a greater saving.

Iwll do that for the table models in the future too - I did the tree
models now because they are the most complex case and I didn't wanted
to create a second tree model without this.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17 18:59:50 -03:00
Dirk Hohndel
14ccbbf6e8 Merge branch 'renumberDialog' of github.com:tcanabrava/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17 12:59:37 -07:00
Dirk Hohndel
f465230263 Merge branch '119_divecomputerManagement' of github.com:tcanabrava/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17 11:12:10 -07:00
Tomaz Canabrava
272338875d Addes a simple 'Renumber Dialog', very similar to the GTK one.
This code adds a Renumber Dialog, that's most a copy & paste
of the GTK visual, I didn't tried to do anything fance with it,
but I still dont like how it looks like. a better management
form is needed. :)

( Well, actually my dislike is mostly because it's on a menu
and it's on a popup, I think a 'toolbox' should exist to hold
all of those widgets that don't belong to the menu - will try
that later )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17 13:41:00 -03:00
Dirk Hohndel
e34da61362 Merge branch 'linusDiveList' of https://github.com/tcanabrava/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-13 19:56:36 +02:00
Tomaz Canabrava
7e9d6e2829 Fixed the show / hide dialog shortcuts to take the splitter into consideration
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>
2013-06-12 15:54:55 -03:00
Dirk Hohndel
863c485939 Add fifth view mode "Globe" for main window
For consistency I didn't change the meaning of Ctrl-1/2/3/4 and added
this as Ctrl-5 - but one could just as easily make the argument that
"ViewGlobe" should be Ctrl-4 and "ViewAll" should be Ctrl-5.

This ensures that only one of the four widgets is shown in the
individual modes, but it doesn't address the drawing issues with the
profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-12 14:53:23 -04:00
Tomaz Canabrava
939246acda Added a simple "TextEditor" in the graph, for a plan mode.
Added a simple TextEditor in the graph for the 'Dive Plan' mode,
this text editor is very simple, so the user can double click on
'depth' or 'duration' to set the depth or duration of the dive.
Since this was a test, only 'duration' was done, and I'll add
duration on the next commit.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10 20:59:58 -07:00
Tomaz Canabrava
1baef83791 Added the option to create a new dive from the menu.
This patch adds a dive from the menu, it's the dive that will
be used to add a new dive plan. so, I also removed the option
'add imput plan' from the menu.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10 15:34:57 -03:00
Dirk Hohndel
bd8470ebcf Merge branch 'fileopen' of github.com:heliocastro/subsurface 2013-06-09 21:01:04 -07:00
Helio Chissini de Castro
4b0c053e48 Ticket 127 - Repopulate context menu on preferences change
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>
2013-06-09 20:09:39 -03:00
Helio Chissini de Castro
1262a7c0bc Keep last open dives directory
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>
2013-06-08 00:03:58 -03:00
Tomaz Canabrava
ebed836ee5 Created a new dialog - Edit DiveComputer
Created a new dialog, Edit Divecomputer, it will currently only lists
the divecomputers that are used on the xml file. I used the same method
that the gtk version used, but only 2 divecomputers got visualized in the
dirk dive data. I'll assume that it's correct and will fix it in the next
couple of commits.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-07 11:43:45 -03:00
Dirk Hohndel
c774bab6e6 Merge branch '112_webservices' of https://github.com/tcanabrava/subsurface 2013-06-07 13:31:42 +09:00
Tomaz Canabrava
c1cf6c02a8 Added initial support for download dive info from the subsurface web service.
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>
2013-06-06 10:33:15 -03:00
Dirk Hohndel
6f7e13ac70 Try to get rid of unnecessary reloads of the dive list
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>
2013-06-06 11:28:20 +09:00
Dirk Hohndel
4d937051ca Fixing some issues with the dive selection after OK on preferences
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>
2013-06-05 17:15:32 +09:00
Dirk Hohndel
ca1c112424 Update the current dive when no dive was selected
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>
2013-06-05 09:51:40 +09:00
Dirk Hohndel
ed0f558efb Rewrite readSettings to do what it should have done from the start
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>
2013-06-04 21:40:28 +09:00
Dirk Hohndel
b38e2ab485 Tie all the pieces together and make Preferences work as intended
Not Apply / Close without Saving / OK work as designed. And things get
correctly stored and reset.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-03 21:08:49 +09:00
Dirk Hohndel
de8395e09e Merge branch 'selection' 2013-06-02 20:36:41 +09:00
Dirk Hohndel
e88a9aa83e Once again try to fix the selection
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>
2013-06-02 20:31:04 +09:00
Dirk Hohndel
a98a7a1351 Correctly implement Metric / Imperial / Personalize preference
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>
2013-06-02 19:52:18 +09:00
Dirk Hohndel
c972c7cbd9 Display the Subsurface manual in the help widget
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>
2013-05-31 06:26:56 +09:00
Tomaz Canabrava
7f732559d8 Added preliminary support for a Manual Display Widget.
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>
2013-05-31 05:32:41 +09:00
Robert Helling
344a429e48 Show ceilings for individual tissues
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>
2013-05-31 05:18:25 +09:00
Dirk Hohndel
f32e86eb32 Hook up the Download dialog
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>
2013-05-30 18:02:29 +09:00
Dirk Hohndel
da52ff56b2 Correct the ceiling preference handling
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>
2013-05-29 15:32:31 +09:00
Dirk Hohndel
4f53ad736d Connect preferences to the rest of the code
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>
2013-05-29 12:59:46 +09:00
Dirk Hohndel
b947cc924f Hook up most of the Preferences dialog
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>
2013-05-26 11:33:45 -07:00
Dirk Hohndel
96f74d9939 Repair the saving and loading of units
This way it should work...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26 10:49:05 -07:00
Dirk Hohndel
43892e36fd Fix colum visibility selection in the divelist
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>
2013-05-26 10:16:01 -07:00
Henrik Brautaset Aronsen
5d05bb1207 Avoid marble widget resize when switching dives
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>
2013-05-25 08:17:14 -07:00
Tomaz Canabrava
efb7f109e8 Added support for a preliminary Preferences Dialog
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>
2013-05-24 15:19:48 -03:00
Henrik Brautaset Aronsen
57e7c3f5d0 Improve wording in askSaveChanges()
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>
2013-05-24 06:16:10 -07:00
Dirk Hohndel
115e5e5fbc The never ending, futile fight for whitespace consistency
I just need to write a tool that does this...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 21:31:45 -07:00
Dirk Hohndel
478baf1076 Replace GError handling with a kMessageWidget based approach
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>
2013-05-21 23:39:49 -07:00
Dirk Hohndel
238c80a708 Merge branch 'microFixes' of https://github.com/tcanabrava/subsurface 2013-05-21 19:34:03 -07:00
Tomaz Canabrava
3fdea49e70 Fixed the hide / show columns using the settings.
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>
2013-05-21 23:07:19 -03:00
Dirk Hohndel
1752257fbb Correctly restore the column sizes in the dive list
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>
2013-05-21 18:29:23 -07:00
Tomaz Canabrava
c7a5d0490f Skeleton code for a non-blocking UI thread for downloading dives from the DC
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>
2013-05-20 16:43:33 -03:00
Dirk Hohndel
1d10289796 Close needs to clear the Globe and the DiveNotes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 20:47:10 -07:00
Dirk Hohndel
f67d3d4bbc Replace glib file/directory handling with equivalent Qt code
I hope this is indeed equivalent...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 17:18:44 -07:00
Dirk Hohndel
25b8092c03 Implenent file_save and file_save_as
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>
2013-05-19 15:29:54 -07:00
Dirk Hohndel
af2354c1f3 Show the correct question at exit when there are unsaved changes
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>
2013-05-19 14:48:25 -07:00
Tomaz Canabrava
0cb9b9ccfb Removed unused GTK calls onto the Qt version
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 07:19:20 -07:00
Tomaz Canabrava
046eacabe5 Make impossible to change dives while editing one.
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>
2013-05-18 21:30:54 -07:00
Tomaz Canabrava
7509360173 Prettification of the map view.
Just some prettifications, better defaults, etc.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 22:52:04 -03:00
Tomaz Canabrava
86021b24d9 Borrowed the KMessageWidget code to better show passive information.
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>
2013-05-17 21:58:49 -03:00