Commit graph

402 commits

Author SHA1 Message Date
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
Tomaz Canabrava
ad5c186553 Implemented the movement of the ToolTip by Hand.
Reimplement the movement of the tooltip by hand,
we were adding / removing childs of the tooltip
quite often, wich broke the movement of the item
using the default behavior, aparently Qt uses
a cache of the transformation of the item, assuming
that the bounding box of it will not get modified
while dragging. wich in our particular case, is
a falacy.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10 14:48:31 -03:00
Tomaz Canabrava
34c6eec9ba Save / Restore toolTip information position on the Profile when switching dives.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10 14:28:44 -03:00
Tomaz Canabrava
45f80afc1f Fix memory leak
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10 13:54:17 -03:00
Tomaz Canabrava
3eac2360e7 Moved the 'create fake dc' to it's own function in device.c
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10 13:35:27 -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
Dirk Hohndel
bdee5ea9a6 Fix webservice download dialog
We need to close the dialog after applying what was downloaded, and we
should not try to delete the manager in case of cancel (as that reliably
causes the SIGSEGV.

Suggested-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-08 21:11:07 -07:00
Linus Torvalds
c9113a1f42 Sort 'dive number' column by date, not number
Ok, so this sounds insane, but it fixes our currently broken sorting
of dive trips vs plain dives not in trips.

The reason for that is simple: the dive trips are sorted by date, but
that's column #0, and for plain dives is the dive number.

So currently the trip-vs-dive sorting looks at the date of the trip,
and compares that to the number of the dive. Since the date of the
trip is expressed as seconds-since-1970-in-UTC, unsurprisingly the
dive number is generally much smaller (even for some very avid divers
;), and so the plain dives end up sorting way at the bottom (or at the
top, if you do "oldest trips first"

Since the dive number *should* sort as the date, this stupid attached
patch just makes us return the dive date instead.

Now, there are other possible solutions to this:

 - make the date of the dive be column 0, and make the dive number be column 1.

   Quite frankly, while more logical for this particular problem, it
probably sucks as a solution. We do want to have a column we can sort
dives by that is date-based, but doesn't include trips. And while the
dive number *should* sort identically to the date one, the fact is
that you can have dives without any numbering, so it doesn't.

   In contrast, all dives have dates, and sorting numbered dives by
date should still result in sane behavior (and if it doesn't, then the
insanity comes from the dive numbering, and odd sorting is the fault
of the user and indicative of a problem)

 - We could possibly do something magical like sorting dives by number
when they are inside trips, or when no trips exist at all. But then
we'd sort by date when there are trips and the dive is outside the
trip. But quite frankly, that just sounds insane.

So on the whole, I don't love this patch, but it seems to be the least
confusing of the possibilities.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-08 20:45:29 -07:00
Thiago Macieira
1ee38b4e5e Use the official QItemSelectionModel::SelectionFlags
It's a typedef to the QFlags<QItemSelectionModel::SelectionFlag>.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-08 07:12:08 -07:00
Thiago Macieira
7218fa3568 Fix compile: mixup of GeoDataCoordinates and GeoDataPoint
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07 22:06:46 -07:00
Henrik Brautaset Aronsen
0031b64df7 Disable Document Mode for MainTab on MacOSX
Commit c4f06dc536 introduced Document
Mode on the MainTab QTabWidget. This doesn't look good on MacOSX.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07 21:42:13 -07:00
Linus Torvalds
00d5ab1bdc Make a map ctrl-click toggle the selection state
This way the map selection works like normal selections do.  Except we
don't do "ranged" selections (shift-click) for fairly obvious reasons.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07 21:39:52 -07:00
Helio Chissini de Castro
ef873b4082 Hide/Show tooltip on mouse over view widget
Proper hide/show tooltip under ProfileGraphicsView. Events are not
properly handled and no custom tolltip status was stored.
Text are properly hidden now when tooltip is collapsed.

Reported-by: Tomaz Canabrava
Signed-off-by: Helio Chissini de Castro <helio@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07 21:25:16 -07: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
7681895fe0 Remove the dive computer clicking on the trash icon.
This code removes the dive computer clicking on the trash icon,
the result is not saved on the XML, this will need a bit of
hacking from some of the older guys. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-07 15:34:27 -03:00
Tomaz Canabrava
54128aa52f Added the code to remove a dive computer.
Added the code to remove a dive computer, plus a few fixes

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-07 15:25:29 -03:00
Tomaz Canabrava
478c24d797 Removed the buttons on the Edit Dive computers.
This edit dive computers thing doesn't really need buttons anyway.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-07 14:59:06 -03:00
Tomaz Canabrava
24446f9c3c Edit the name of the Dive Computer via dialog.
The GTK version seems to be bugged on this, since the dialog
doesn't save the dive computer nickname that I setted, but
the Qt version shows less dive-computers than the GTK one on the
same dive. I want somebody to do a quick review of my code too. :)

I also plan to remove the 'OK' and 'Cancel' buttom, they seem to
be overrated on this dialog - fairly uneeded.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-07 12:57:35 -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
Linus Torvalds
3677f4e5ea Allow ctrl-click to select dives incrementally from the globe view
I guess we should support de-selecting dives this way too, but right now
the interfaces only do selection.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07 13:36:15 +09:00
Linus Torvalds
d3442a81b3 Fix unused variable warning and spelling
Commit 4b405caa2c ("Clean up divelist dive selection") made the sort
model variable in headerClicked unused, so get rid of it.  Fix a speling
eror closeby while at it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07 13:36:01 +09:00
Dirk Hohndel
3cca9eaf94 Merge branch '129_moveOverlay' of https://github.com/tcanabrava/subsurface 2013-06-07 13:34:53 +09:00
Dirk Hohndel
c774bab6e6 Merge branch '112_webservices' of https://github.com/tcanabrava/subsurface 2013-06-07 13:31:42 +09:00
Tomaz Canabrava
840f943acd Fix movement of the tooltip overlay
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-06 13:00:18 -03:00
Tomaz Canabrava
2d05f4227e Hoocked up the Apply button.
Hoocked up the apply button - Didn't tested ( as I frankly don't know
what the expected result should be. ). but the app is not crashing, yey.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-06 11:57:12 -03:00
Tomaz Canabrava
f55ae15707 Hoocked up the buttons and the parsing of the XML.
The XML is now being correctly parsed, Clicking on Help
will open the browser pointing to the api site, and clicking
on cancel will cancel the download.

Clicking on Apply still doesn't apply, but that's next. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-06 11:31:55 -03: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
3f7490c205 Add delete dive context menu entry
Getting closer to the way this should work. Adjusted the call to reload
to not switch back to tree view and resort (oops).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06 10:37:18 +09:00
Dirk Hohndel
cd7488491f Implement the context menu a different way
It seems that this is the way this is supposed to be done - instead of
manually looking at what kind of click we get, Qt decides when to create
a context menu for us - this way things like the Windows Menu button
will work automagically.

As an example I also implemented the "remove dive from trip"
functionality, which exposes some other bugs (like the fact that the
dive that isn't part of a trip ends up being sorted at the very end of
the dive list).

This commit contains a "testSlot" implementation to remind me how to
figure out which dive / trip we are on.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06 09:06:42 +09:00
Dirk Hohndel
235833b93e Only show expand/collapse context menu when in tree mode
The options make no sense when in list view mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06 06:51:15 +09:00
Dirk Hohndel
582253fe88 Distinguish between "collapse" and "collapse all"
Some users might want to really see nothing but trips, others might want
to be able to keep the trip with the selected dive open.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06 06:39:54 +09:00
Dirk Hohndel
74d23ed83b Add context menu to dive list
So far we support "expand all" and "collapse" all. This still needs to
be restricted to only be shown when in trip / tree mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-06 03:29:11 +09:00
Linus Torvalds
4b405caa2c Clean up divelist dive selection
Since we have a "selectDive()" method, let's just use it rather than
opencoding it.  Similarly for "unselectDives()".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 17:49:39 +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
b115423aa1 Keep selected dive in view
Somehow we managed to break this. Again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 16:46:23 +09:00
Linus Torvalds
a737f59553 First cut at selecting dives from the map
We'll want to enhance this: better logic for which dives are near the
selection, and it's probably best to have a "control-click" that adds
the dives to the selection rather than deselecting all the old ones.

But it's already useful.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 16:40:27 +09:00
Dirk Hohndel
b533cf299f Get single click on the map widget in a callback for further processing
Now Linus can write the code that selects the right dives...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 14:44:12 +09:00
Dirk Hohndel
6f979b48ed Show locations with same name on the map if they are more than 50m apart
Not showing them at all was a little too blunt of an instrument. There
likely are dive spots with the same name at different resorts. And even
at the same resort you could have multiple morings for the same dive
site.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 12:16:34 +09:00
Dirk Hohndel
9dab886117 Reload globe after dive location was modified
This way a change to the location name is immediately reflected in the
map display.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 11:39:40 +09:00
Dirk Hohndel
3fa6d981b0 Merge branch 'minMaxAvgWidget' of https://github.com/tcanabrava/subsurface 2013-06-05 10:01:27 +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
Tomaz Canabrava
48dda4192f Added a new widget 'MinMaxAvgWidget'
Added a new widget, MinMaxAvgWidget, a simple widget
that displays values in 'min, max, avg' fashion.
it has a setMaximum, setAverage and setMinimum
methods, that is userful for setting the minimum,
maximum and average of stuff. Ah, it also shows
the minimum, maximum and average of things.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-04 18:51:27 -03:00
Dirk Hohndel
87decaa798 Stop showing the first dive after a preferences change
What is missing is the code to actually show the RIGHT dive...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-04 21:56:20 +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
46112cbcd6 Explicitly store UI values to prefs
This helper wasn't called as intended - but because of the syncSettings
call which emits settingsChanged this only became visible for the
default_filename.

Next I need to clean up what is called for the settingsChanged signal.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-04 06:29:33 +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
Tomaz Canabrava
77c4b8ef87 Implement Apply / Close without Saving for preferences
This hooks up the buttons correctly

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-03 06:02:05 +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
9a65798daf Use a slightly shorter date string for Info tab
This way the spacing of the elements looks nicer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 17:59:01 +10:00
Dirk Hohndel
a31a8ca759 Merge branch 'showGas' 2013-05-31 17:33:04 +10:00
Dirk Hohndel
6f7467de7a Show the gas with the pressure diagram
This is a feature that had been requested a few times in the past and when
debugging my "show only used gases" commit I realized that this would have
been extremely useful to have...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 17:31:53 +10:00
Linus Torvalds
8307763212 Scroll to (and re-expand) the selection when sorting and moving
The keyboard movement wouldn't scroll to the newly changed selection.
Similarly, when sorting the dive list, we'd end up losing the currently
selected dive (and generally collapsing the currently exposed trips).

This adds the scrolling/exposing logic for those cases.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 16:33:06 +10:00
Dirk Hohndel
abb43f0f1d Show GF for calculated ceiling above the graph
The hardcoded position we previously had would make the text invisible
if a ceiling was drawn during the middle of the dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 13:47:34 +09:00
Dirk Hohndel
ff6e730e30 List only the gases used in the Info tab
The equipment tab will still show all defined gases, but the info for
the dive should only list the ones used.

Also change the name of the two gas related boxes to better reflect the
data that is shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 13:43:49 +09:00
Dirk Hohndel
e6d419f6be Fix compiler warnings for maintab.ui
Simply renaming all the elements with name conflict. None of these names
appear to be referenced anywhere so this seems like a rather odd thing to
happen - why doesn't the tool just rename them for me when I open and
close the file in designer? Or at least warn about it?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 09:47:03 +09:00
Dirk Hohndel
06c9e59904 Merge branch 'bug123_designStatistics' of https://github.com/tcanabrava/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 07:16:24 +09:00
Dirk Hohndel
616a2e7e5a Merge branch 'bug_123_designInfo' of https://github.com/tcanabrava/subsurface 2013-05-31 07:11:56 +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
422e0f94d6 Added the 'F1' key as standard shortcut for the Help
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-31 05:32:59 +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
Dirk Hohndel
32d8051404 Cleanup minor issues with ceilings for individualy tissues
In commit b8d31d8534b ("Show ceilings for individual tissues") Robert
inadvertently broke the connection from dc_ceilings to red_ceilings and
also didn't correctly enable the checkbox for all_tissues when
calc_ceilings was already set in the preferences before the dialog was
created (and therefore the connection in the .ui file isn't run).

There's also a simplification / cleanup to the code deciding whether to
show all the tissues.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-31 05:28:24 +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
Tomaz Canabrava
8f71344708 Removed the code to center-allign labels on the Statistics
Since I already put the center-allign label on the interface designer,
this was just dead code. getting rid of it.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-30 11:46:06 -03:00
Tomaz Canabrava
085dca69e5 Redesign of the Statistics tab try1
This moves the contents of the statistics tab to groupboxes,
so it's similar to what we had in GTK, but a bit prettier.
it's not what I plan to do in the final form, since I think
that a few 'min max avg' can be in it's own widget ( and maybe
a cute graph showing the values would also be nice. ) but its
an improvement from what we had.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-30 11:44:27 -03:00
Tomaz Canabrava
bd6dfa1ebd Align Labels on center.
There was already a code for that on the maintab.cpp, but
since I moved all labels to groupboxes, the code stopped
working, and I tougth it'd better to kill the code since
it's faster and safer to use the interface builder for that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-30 11:30:23 -03:00
Tomaz Canabrava
533d18e069 This is a redesign-tryout of the Info panel.
This is a redesign-tryout of the info panel, it's not the way
that I want to do, actually - I think that textual representations
are quite boring, and we can do much better if we use better widgets,
for instance, a Calendar to show the date, a Termometer to show
the temperatures and so on. This version has a fixed layout, but
I'll most probably try to make it more dynamic in the future.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-30 11:22:33 -03:00
Tomaz Canabrava
77880b7a07 Add a proof of concept for filtering the Dive List,
Press CTRL+F and a line edit will appear, whenever you write on that will
be used as a filter against all columns. The results are maybe somewhat
surprising in trip mode, but when sorting by another column this shows
some potential.

Hit ESC to remove the filtering.

I need to find a better position to put the Widget, but it's a proof of
concept.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30 20:29:55 +09:00
Tomaz Canabrava
c4f06dc536 Puts maintab as 'DocumentMode'
This small patch enable maintab to be  in 'Document Mode', this means
basically that it size is smaller and there's not a line separating
the widget anymore, giving the user a more smooth experience.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-30 20:24:22 +09:00
Dirk Hohndel
2a4d981d09 Fixed running the Download dialog multiple times
We never reset the 'downloading' variable.

Solved-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30 18:21:08 +09:00
Henrik Brautaset Aronsen
56eaea6993 Enable Marble Google Sat lookup when run as a MacOSX app
Following Dirk's commit ae2c132, add support for custom google sat
data in a MacOSX app bundle

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30 18:05:02 +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
ae2c132a26 Do a better job finding Marble Google Sat files
First try if Google Sat is already installed as a provider (and just use
it if it is). Then use the executable path to make an educated guess where
these files might be found as part of Subsurface.

We now install the necessary directory tree under
$(DESTDIR)/usr/share/subsurface/marbledata

Still far from perfect - but this should work at least on Linux. MacOS
will need a different modifier for the path and Windows I haven't even
thought about, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30 14:00:55 +09:00
Thiago Macieira
7b75cfa808 Fix compilation: error: ‘GeoDataDocument’ does not name a type
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30 12:03:25 +09:00
Henrik Brautaset Aronsen
94baac4cf3 Don't display "show" in front of every column
When (de)selecting columns, a the list of columns have a "show"
in front of every entry.  We don't need that.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30 06:23:46 +09:00
Dirk Hohndel
85e3a4ad29 Fix sorting by rating
In commit beb4ed38f264 ("Add a "sort role" for sorting the dive list")
Linus forgot to add a case for the rating value.

Now all columns sort correctly.

With this I think we can close the bug...

Fixes #111

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30 05:53:50 +09:00
Dirk Hohndel
f037b9e13f Code layout changes
Tomaz convinced me (with help from Linus) that it might be a good idea
to go with the compacter "single line" case statements in some specific
instances where this makes the code much more compact and easier to
read.

While doing that I changed Linus' code to do 'retVal = ...; break;'
instead of just 'return ...;' - this is more consistent and makes
debugging a little easier.

And while doing all that, I also cleaned up divelistview.cpp a little bit.
And removed an unused variable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30 05:49:41 +09:00
Tomaz Canabrava
94c3545c18 Code Cleanup.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29 16:50:25 -03:00
Tomaz Canabrava
16d0a47853 Fixed the regression of selection not being stored from table to tree
This fixes the regression that I caused in the last commit,
where the selection was being correctly reestored from tree-to-table,
but it was incorrectly being restored from table-to-tree.

I also added a bit of speedup on the view while changing columns.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29 16:46:27 -03:00
Tomaz Canabrava
9cc04c1ca6 More work on bug 111, Sorting works as it should.
Sorting is now working as it should, changing
from table to tree, keeping the selection from
table to tree ( but there's a regression on
tree to table conversion, I'll try to fix it
in the following commit. ).

this commit also cleans a lot of boilerplate
code that I wrote to bypass a graphics bug,
that I seem to have correctly fixed in this
version.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29 14:03:36 -03:00
Tomaz Canabrava
f46a2d56bc Reimplement the Sort method to change from Tree / List, and remember selection.
Things are working as they should, but I hit on -probably- a Qt bug
that makes painting on the table view a bit weird ( it only updates
the painting by moving the mouse around ). I'll try to fake the
mouse movements in a couple of commits after this one.
There's also a few columns that are not being correctly sorted,
probably something to do with the SortRole.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-29 11:51:33 -03:00
Linus Torvalds
bb77f5a44e Add a "sort role" for sorting the dive list
By default, sorting is done by the display role, but then we end up
sorting by the string we display, which is almost always the wrong thing.

So this adds a new "SORT_ROLE" that is used for sorting, and then the
data lookup can return the raw data we want to sort by.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29 20:10:20 +09:00
Dirk Hohndel
8df20f4149 Merge branch 'bug111' of https://github.com/tcanabrava/subsurface 2013-05-29 19:55:24 +09:00
Sergey Starosek
4371a4a298 Fix message widget visibility.
Hide message widget when closing dive with no GPS coordinates.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29 19:24:20 +09:00
Sergey Starosek
823e870765 Fix default zooming.
Set default zoom level only when at least one dive selected
and user have not changed it.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29 19:23:07 +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
c78d0ad51b Correctly enable partial pressure threshold entry in preferences
The initial state needs to reflect the value of the checkbox. Once the
dialog is run, there is a signal/slot connection in the .ui file that
keeps things in sync.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-29 14:58:22 +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
Tomaz Canabrava
5a994b08f6 Saves the selection to select it later.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-28 17:46:40 -03:00
Tomaz Canabrava
4019fdaa24 Switch between Tree / list on column - click.
This patch adds support for switching Tree / List
while clicking on a column header. This triggers
a sad-painting bug on the list - I guess I'll have
to fix it too. I'd apreciate some help on it, tougth.
next: keep the selection.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-28 17:07:43 -03:00
Tomaz Canabrava
c6f84de37c Adds the code to make the dive list behave like tree or list
This code adds the possibility to make the DiveList behave
like a Tree or a List, depending on what layout is set.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-28 16:56:58 -03:00
Dirk Hohndel
8394828806 Fix the positioning of text in the dive profile
This had been bugging me for a while - the label texts were all not
quite where I expected them to be. I think this looks much better now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-28 09:57:49 -07: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
Dirk Hohndel
2896dbdaf1 Apply some CSS goodness to the Cylinders widget
Alternating color and some hover highlighting to make things prettier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-26 10:05:41 -07:00
Dirk Hohndel
a8cdc30dbf We had an extra column in the model for the dive list
It doesn't appear to be used anywhere, but it shows up in the UI and
confuses things.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 20:16:16 -07:00