Commit graph

599 commits

Author SHA1 Message Date
Linus Torvalds
02f2768148 O2/He percentages aren't integral
We do gas mixes in permille, not in percent.  Some people really like
using the value they got from the analyzer, which is generally something
like 29.4% or whatever.  So don't truncate percentages to integers.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 21:39:12 -07:00
Dirk Hohndel
d126977e16 More logical layout for the Dive Info tab
Up until now the tiles seemed to be arranged rather randomly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 15:28:40 -07:00
Dirk Hohndel
77725ecfe9 Replace wet_volume calculation with straight forward pressure formula
Since no one else approximates gas volumes at higher pressures, we
shouldn't do that either when converting imperial tank names (cuft @
working pressure) into wet volumes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 14:36:48 -07:00
Dirk Hohndel
88f0f60439 Fix cylinder data O2/He percentage entry braindamage
I can't even begin to explain what got me to write this in the first
place. It makes no sense from any angle I look at it...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 13:46:00 -07:00
Dirk Hohndel
106327af43 Better minimum width for yearly statistics window
The Qt default was way too small.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 10:59:48 -07:00
Dirk Hohndel
138a00bd10 Improve readability of yearly statistics
Make the entries for years bold, keep the months non-bold.
It's still a sea of data, but this is an improvement.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 10:31:01 -07:00
Dirk Hohndel
07a16574e9 Consistently use slots / signals
We started out using Q_SLOTS and Q_SIGNALS but then changed our mind.
Let's make this consistent again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 10:20:56 -07:00
Dirk Hohndel
0a92052765 Fix yearly statistics
This commit fixes two issues. One is that there were situations where
the code would read an uninitialized parent pointer, the second was that
instead of the monthly statistics the tree view would show the yearly
statistics again under the yearly entries.

I assume that the second part of the fix (initializing the parent
pointers) actually takes care of both of them (that patch was suggested
by Tomaz), but the first part that just makes sure the pointer is at
least initialized to NULL seems to be at least not harmful, so I kept it
as well.

With this the yearly / monthly statistics seem to be pretty much at
feature parity.

Fixes: #115

Suggested-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18 13:31:12 -07:00
Dirk Hohndel
370673cc99 Improve display of yearly statistics
Display the units in the header, make the header more consistent
looking, convert the values into the right units with appropriate
precision.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18 10:48:46 -07:00
Dirk Hohndel
dda28c76aa Reduce the bleeding in my eyes
This is all just coding style and white space cleanup.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18 09:27:34 -07:00
Dirk Hohndel
f780a56847 Clean up the last merge
While the code is correct, splitting the class like this is silly and will
confuse me later.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18 09:25:24 -07:00
Dirk Hohndel
0773172f66 Merge branch 'qtHelper'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18 00:33:03 -07:00
Dirk Hohndel
29b242c703 Converting the device_info list into a Qt data structure
This data structure was quite fragile and made 'undo' when editing
rather hard to implement. So instead I decided to turn this into a
QMultiMap which seemed like the ideal data structure for it.

This map holds all the dive computer related data indexed by the model. As
QMultiMap it allows multiple entries per key (model string) and
disambiguates between them with the deviceId.

This commit turned out much larger than I wanted. But I didn't manage to
find a clean way to break it up and make the pieces make sense.

So this brings back the Ok / Cancel button for the dive computer edit
dialog. And it makes those two buttons actually do the right thing (which
is what started this whole process). For this to work we simply copy the
map to a working copy and do all edits on that one - and then copy that
over the 'real' map when we accept the changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-18 00:24:28 -07:00
Tomaz Canabrava
87e380c7a2 Yearly stats are being displayed.
Yearly stats are being displayed. the code is similar to the GTK one,
but I advise the reader that it's a bit risky  ( I got an unreproducible
crash but it seems to be fixed now. ). The selection behavior is *weird*
and I have no idea why, but I'm very sleepy - will try to look at
it again tomorrow.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17 21:05:17 -03:00
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
240cfa74be Started to do the Yearly Statistics
This is the fisrt bunch of compilable code for the new Yearly Statistics
there's nothing to see here, move along...

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17 19:41:05 -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
1ee894dced Show the device id in hex
This is consistent with what we used to do

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17 12:46:35 -07:00
Dirk Hohndel
9d611ba279 Improve the initial size of the device name editing dialog
This is not "automagic" as I had hoped but appears to give a good
starting point.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-17 12:42:52 -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
b00553919b add forgotten file.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-17 13:54:50 -03: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
Linus Torvalds
6fd1e32452 Properly initialize device_data_t when downloading
The old gtk branch started out with device_data_t explicitly cleared,
but the Qt version never did that.  And we actually depend on the
deviceid in particular being initialized to zero (and then we fill in
the details in the divecomputer download callbacks)

Not properly initializing it meant that we ended up with random
deviceid's that got added to the divecomputer device lists, and then
saved to the XML file without actually matching the data in the dive
computers in the actual *dives*.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-16 21:17:35 -07:00
Tomaz Canabrava
c917b29701 Save / Restore the sizes of the columns in Cylinders / Weigth widgets
This patch saves / restores the sizes of the columns in the cylinders
and weigth table widgets, so everything is now properly behaved. There
's still other things to do - but I'm tired. i's sunday and there's a
protest against the brazilian government to go.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 14:36:23 -03:00
Tomaz Canabrava
c809b5a35b Removed the grid lines of the table views.
Removed the grid lines of the table views, this makes the table view
more similar with the dive list - I'm searching for an application
identity here.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 13:53:56 -03:00
Tomaz Canabrava
751c234d03 Remove the Vertical Header on Cylinder and Weigth edit
Remove the vertical header on the cylinder and weigth edit,
It was strange to show, since we don't show a thing there.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 13:37:32 -03:00
Tomaz Canabrava
20849f014e Make the columns have a sane default width for 'type'
Make the columns on Cylinders edit and Wheight Edit to
have sane values for 'type', this is needed because the
old behavior was to set it fixed size, and the default fixed
size was silly. this calculates a good predefined value
taking the font size in consideration.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 13:28:59 -03:00
Tomaz Canabrava
f9b4c6b889 Better handling of default sizes on the Cylinder and Weight widgets
Better handling of default sizes on the Cylinder and weight widgets,
the weigth widget didn't had a CSS applied so it looked odd compared
to the cylinder one, also the default behavior for the combobox delegate
didn't worked very well with the css applied, being too small.
this patch fixes that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 12:33:27 -03:00
Tomaz Canabrava
349a084496 Made all models have the same font.
The models were a bit messy - some of them got the correct font,
other didnt. This patch creates a new function 'defaultModelFont()'
that is being used to return the font in all cases now.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 11:13:32 -03:00
Tomaz Canabrava
10ea572f5a Create a 'ComboBoxDelegate' to concentrate the comboboxness of delegates.
This patch creates a ComboBoxDelegate where the other specific delegates
should inherit from. this adds a little code cleanup for the current
version, and will help as soon as more delegates got added to the code.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-16 10:15:19 -03:00
Linus Torvalds
84d4a2dae0 Partially fix dive downloading
The Qt branch didn't set the preexisting dive count, so matching old
dives didn't work and it always downloaded all of them.

Also, we need to autogroup dives before displaying them if autogrouping
is on.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-15 17:03:23 -07:00
Dirk Hohndel
a960cd2d45 Show & edit trip location and notes when exactly one trip is selected
While we still show the selected_dive in the profile and use it for Dive
Info and Equipment, in the Dive Notes tab we now show the trip location
and trip notes (and none of the other fields), if the user directly
selects a whole trip by clicking on the trip header.

This clever reuse of the widget now allows trip location and notes to be
edited in place.

As a side note: the Gtk version has long allowed the user to edit the
trip location and trip notes, but nowhere did it ever SHOW the trip
notes... so this is more than just feature parity...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14 09:20:20 -07:00
Dirk Hohndel
8669de63e1 Don't offer "delete dive" context menu for trip
If we are not on a dive we shouldn't try to delete it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14 07:13:06 -07:00
Dirk Hohndel
d8c5f366c8 First deselect, then select
For reasons I still don't understand, sometimes (but not always) when
clicking on a trip header we appear to get a select notification for the
trip and at the same time deselect notifications for every dive in the
trip. This seems wrong but I can't seem to figure out why it happens -
and of course it causes us to have a mixed up interpretation of what is
selected in our internal selection tracking.

Simply acting on the new selection after the newly deselected items are
handled appears to fix the issue, but I do worry about this change.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14 06:17:38 -07:00
Dirk Hohndel
5e51d1e354 Plot cleanup
Use a helper to make things easier to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-14 14:34:44 +02:00
Linus Torvalds
788c513dd4 Improve the trip header
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-13 20:00:20 +02: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
9993d49966 Do not plot on showEvent if dive is already plotted.
We do a force-plot on showEvent because the user can
have asked to open a dive file via command line, so
the app needs to open already with a profile plotted.

if the user opens the program, loads a map, hides
the profile by hitting ctrl + 1, then shows the
profile again by hitting ctrl + 2, we do not want
to do all the math to show the profile again, because
we already have it in memory.

this also fixes dirk's strange behavior of funky profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-12 14:28:44 -03:00
Tomaz Canabrava
ab0213f28e Implements the DiveList to behave like Linus Explained.
Implements the divelist to behave like linus explained,
essentially, it filters the layoutChanges of the model,
greps for trips, and for each trip that it finds, it set
the 'firstColumnSpanned' property, to make the column
to have the size of the whole table. e

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-12 14:14:25 -03:00
Dirk Hohndel
04a7374917 Display the correct metric SAC rate in divelist
We were doing integer math by mistake.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-12 11:58:57 -04:00
Benjamin Fogel
7f60b2b0c6 Change title of dive download form
The title of the form to download dives from a computer was
simply "Form".

Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-12 07:27:58 -04:00
Tomaz Canabrava
72d0030509 Added a slot to set the full time of the dive plan
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10 21:00:30 -07: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
b4835badb6 Added a 'Plan' mode and a 'Dive' mode on the profile.
Added a 'Plan' mode and a 'Dive' mode on the profile. Those modes
tell the application what can be done: Plan - the dive's dinamyc and
can be changed, 'Dive', the dive is fixed ( most probably downloaded
from a dive computer and it's readonly. ) - now I need to properly
populate stuff.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-10 17:33:46 -03: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
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
Dirk Hohndel
81e27b6db9 Try to make the equipment tab more compact
My attempts to actually set the width of the columns with the
SizeHintRole all failed - so I gave up on that and am forcing things to
work by making the texts in the header somewhat longer and then resizing
to that. Definitely not what I wanted to do - but that plus reducing the
font size gives us a much more reasonable / compact look.

I really hope that someone else can explain to me how to get the
SizeHintRole to affect the width (and not just the height - that part
worked just fine) of a the cells in a column. Then we can replace this
hack by a much better solution (that won't fail if the translated strings
look different).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 20:07:36 -07:00
Dirk Hohndel
4409d61f7c Set a pleasant zoom level to start out with
If the user very quickly switches between dives the zoom level sometimes
gets reset to be much more "zoomed out" (basically if you change dives
before Marble had time to zoom all the way in to the previous dive it will
keep whatever was the last zoom level of the animation - I'd consider that
a Marble bug).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 11:13:15 -07:00
Dirk Hohndel
92ee374494 Find Google maps in Subsurface's source tree
This way the user doesn't need to move the two folders googlemaps and
googlesat around in the filesystem.

This only works if Subsurface is started from the build directory - it
doesn't work when Subsurface is installed (and it doesn't at all address
the need to install these files and bundle them as well).

I'd consider this a hack to show how the real solution should work.

There is one more part of this that is a hack: Marble no longer searches
its default data directory; the path we set replaces the Marble system
search path. Sadly, Marble doesn't support paths the way Unix thinks of
them with multiple directories, separated by ':'. So this means that
Marble no longer finds any of its default icons. For most of them that
seems fine as I don't think lacking the icons for "manned_landing",
"robotic_rover", "unmanned_hard_landing" or the various types of places of
worship that Marble supports is necessarily a big issues for Subsurface,
but at least the default_location icon seemed important. And since we now
need to carry our own, I replaced the boring circle with a tiny dive flag.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 08:58:37 -07:00
Sergey Starosek
dbb84188c2 Fix GPS coordinates rounding.
Better round the coordinates.

Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 08:18:13 -07:00
Dirk Hohndel
fe66fe5ff6 If we disable the compass, we don't need to place it, either
Just completing commit f1a4edc5497d ("Don't show the compass").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 08:18:06 -07:00
Henrik Brautaset Aronsen
bf7d61e74e Don't show the compass
North is always up anyway.  At least that's the way we've done it so far.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 08:18:01 -07:00
Dirk Hohndel
5ca3c11e60 Correct the code to enter dive locations
The existing code converted the lat/lon to int before multiplying with
1,000,000 (in order to create udeg). Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 08:17:56 -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
Dirk Hohndel
884e1c3379 Merge branch 'prefsDialog' of https://github.com/tcanabrava/subsurface 2013-05-24 12:30:29 -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
Dirk Hohndel
5926f9d4df Merge branch 'googleEarth' of https://github.com/tcanabrava/subsurface 2013-05-24 07:16:37 -07:00
Tomaz Canabrava
dfa59f9878 Trying the googlemaps integration 2013-05-24 11:07:59 -03:00
Alberto Mardegan
5e0a3cdad8 Fix usage of temporary QByteArrays
This commit fixes three different things:
 - a memory leak in WeightModel::setData()
 - getSetting() calling strdup() on a QByteArray
 - a possible usage of memory after deallocation

Here's an explanation of the last issue (taken from the mailing list, slightly
adapted):

toByteArray(), as well as others "toSomething()" methods, returns
a new object which the compiler allocates on the stack.  The compiler
will consider it a temporary data, and destroy it on the next line.  So,
when one does

	char *text= value.toByteArray().data(); // line 1
	if (strcmp(description, text)) {        // line 2

the compiler creates a QByteArray on line 1, calls ::data() on it, which
returns a valid char *, and assigns its value to "text".  So far, so
good.  But before jumping to line 2, the compiler destroys the temporary
QByteArray, and this will in turn invoke the QByteArray destructor,
which will destroy the internal data. The result is that on line 2,
"text" will point to some memory which has already been freed.

One solution is to store a copy of the temporary QByteArray into a local
variable: the compiler will still destroy the temporary QByteArray it created,
but (thanks to the reference-counted data sharing built in QByteArray) now the
destructor will see that the data is referenced by another instance of
QByteArray (the local variable "ba") and will not free the internal data.
In this way, the internal data will be available until the local variable is
destroyed, which will happen at the end of the {} block where it is defined.

Please note that when one uses the data in the same line, one doesn't need to
worry about this issue. In fact,

  text = strdup(value.toString().toUtf8().data());

works just fine.

Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-24 06:18:27 -07: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
Henrik Brautaset Aronsen
6fa670e612 Improve wording on buttons when editing a dive
Use the more familiar Save/Undo instead of OK/reset

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-24 06:15:28 -07:00
Dirk Hohndel
90a24255b2 Correctly add new weight / cylinder types, even when hitting 'tab'
We now detect if a weight / cylinder with this description exists and if
not add it on the fly. We also remember the additional values (weight and
size / workingpressure) for new entries and take the values for these
fields into account when autocompleting.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23 23:26:17 -07:00
Dirk Hohndel
01a3bd2cc6 Add weightsystem delegate to enable editing of weightsystem
This is very much analogous to the way cylinders are implemented.
That means that just like with cylinders, if the user enters a new type
and hits 'tab' before hitting 'enter', Subsurface will crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23 21:36:33 -07:00
Dirk Hohndel
ecbcd4db47 Enable the weightsystem info and move the declarations to dive.h
Having the tank_info declared in models.cpp seemed unintuitive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23 21:33:19 -07:00
Dirk Hohndel
8d359f8e57 Remove obsolete slots
The .ui components were removed in commit 0c7a575f7b3b ("Rework on the
Equipment tab to make it look more Modern.") but the "automagic" slots
were still here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23 18:35:04 -07:00
Dirk Hohndel
d273694954 Allow the CylindersModel delegate to pass data in without unit conversions
With this we should have tank editing mostly done.

See #122

(it's not quite fixed, we need the equivalent code for weight systems)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-23 13:31:46 -07:00
Tomaz Canabrava
87d3cd5234 Also changes the size and working pressure of the cylinders
this is more a 'Well, this is how we do it' than an actuall
good commit. I'm probably using the wrong conversion paradigm
( none ) to convert the data from psi / bar and such, it
changes the model with wrong data.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-23 15:59:12 -03:00
Tomaz Canabrava
babbfa9204 Added support for Completing on the Cylinder Type delegate
I had to immprove the TankInfoModel with two new methods,
insertRows and setData, because the delegate used this
model to show what kind of Tanks we are offering.
Since the user can enter a new type of Tank, it's important
to add this tank to all lists using the delegates.

I Also added two new methods on the delegate itself,
to correctly shows the data, and set the data on the
model. This also will help dirk with a working example
on how to edit things while using a delegate.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-23 15:33:20 -03:00
Dirk Hohndel
c917a99eb2 Implement default dive computer and device
The data is saved in the settings and the correct dive computer (vendor
and product) and device are picked when the download dialog is openend.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 23:24:33 -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
7757363953 Re-enable dive computer selectiom
This had been disabled by some redraw optimizations in commit
81406b80c6ec ("Fix loading a second dive, after the first file was
loaded."). We need to redraw the plot not only if the dive changed but
also if the selected divecomputer changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 20:59:50 -07:00
Dirk Hohndel
33135e37a5 Start editing Dive Notes when clicking on Rating or Visibility
Those widgets respond to MouseButtonPress and not FocusIn.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 20:00:26 -07:00
Dirk Hohndel
a5b14304f2 Merge branch 'fixResizeEvent' of https://github.com/tcanabrava/subsurface 2013-05-22 19:51:00 -07:00
Dirk Hohndel
7bf07b890a Small fixes to the model
Prevent a crash when no cylinder type description is set.

Correctly calculate the cylinder volume.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 16:22:21 -07:00
Dirk Hohndel
76903849de Get the math right for cylinder model setData function
This is a fun one.

We only want to mark the divelist changed if the user actually changed
something. So we try really hard to compare what was entered with what was
there and only if it is different do we overwrite existing values and
record this as a change to the divelist.

An additional challenge here is the fact that the user needs to enter a
working pressure before they can enter a size (when in cuft mode). That is
not really intuitive. We work around this by assuming working pressure is
3000psi if a size is given in cuft - but then if the user changes the
working pressure, that changes the volume. Now going back and changing the
volume again does the trick. Or enter the working pressure FIRST and then
the volume...

This also changes the incorrect MAXPRESSURE to WORKINGPRESSURE and uses
the text WorkPress in English (Gtk code used MaxPress which was simply
wrong - this is just the design pressure or working pressure, not some
hard maximum. In fact, people quite commonly "overfill" these tanks.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 14:51:41 -07:00
Tomaz Canabrava
fac8868903 Fixed update the plot as we resize the view.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 16:21:07 -03:00
Dirk Hohndel
63b6f7d5a2 Merge branch 'comboBoxDelegate' of https://github.com/tcanabrava/subsurface 2013-05-22 12:14:06 -07:00
Tomaz Canabrava
134e20bdc2 Removed the unused add cylinder and add weigthsystem dialogs.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 14:52:38 -03:00
Tomaz Canabrava
3e51476d87 Removed unused debug, and set the correct data on the delegates.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 14:27:41 -03:00
Dirk Hohndel
9c3b512701 Merge branch 'comboBoxDelegate' of https://github.com/tcanabrava/subsurface 2013-05-22 10:22:08 -07:00
Dirk Hohndel
56c58bdd24 Actually remove cylinders and weightsystems from the data structures
The UI had only stubbed this code out. This adds the implementation of the
helpers and calls them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 10:12:15 -07:00
Tomaz Canabrava
fc4243eef0 Added a Delegate for editing Cylinders
Now when you edit 'Type', a drop-down list will appear
and will enable you to choose from it's contents.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 14:11:49 -03:00
Dirk Hohndel
d6bee060af Shorten the 'set location' text
The old text was quite verbose and caused issues on smaller screens

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 09:00:07 -07:00
Dirk Hohndel
9946fe97c0 Merge branch 'randomFixes' of https://github.com/tcanabrava/subsurface 2013-05-22 08:47:41 -07:00
Tomaz Canabrava
75956f0f91 Added basic editing functionality for Cylinders and Weigthsystems
This patch adds basic editing functionality for Cylinders and Weigthsystems,
it still doesn't use delegates to show the data to the user in a better
way, and it does not take in consideration user preferences yet, but
it's a starting point.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 12:20:00 -03:00
Tomaz Canabrava
8cfb2aa237 Extend a bit the skeleton 'removes' on cylinder and weigth to help dirk.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 11:40:57 -03:00
Dirk Hohndel
d8673f9867 Calm down the Globe widget
This addresses two issues:
- the kMessageWidget did not word wrap, so if it was wider then the Globe
  widget the Globe would expand (and divelist shrink) when the user
  switched from a dive with location to a dive without location
- the code was also too aggressive removing and redrawing the message
  widget when switching from dive to dive. with this change we only hide
  the widget if the next dive has a location (and only show it if it isn't
  shown already). We also hide the message if no dive is selected.

Reported-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 07:34:14 -07:00
Tomaz Canabrava
0b30c821ae Added a 'trash' icon on the Cylinders and Weigthsystem models
So, the Cylinders and Weigthsystems got a new Trash icon,
and the interface already intercepts the clicks ( on all
columns ) and send this to the 'remove' method on boch
models. On the model I'm just filtering the indexes that
are not 'DELETE' and creating a stub method to be filled
later.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 11:00:20 -03:00
Tomaz Canabrava
94ba79c0fe Only enable the add buttons when there's a dive loaded
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 09:42:35 -03:00
Tomaz Canabrava
28deb3e65d Re Enable the option to add cylinders / weigthsystems.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 09:40:26 -03:00
Tomaz Canabrava
df57b657fd Rework on the Equipment tab to make it look more Modern.
Note that this is a WIP and it does break functionality
- ie, not possible to add Equipments, but this will be
fixed in the next commit. Removed add / edit / remove
buttons, only a single '+' icon appears on the widget
now. the edit / delete will be done in place.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 09:17:18 -03:00
Tomaz Canabrava
003729bde6 Fixed the 'click in close doesn't close' on KMessageWidget.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-22 08:10:02 -03: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
Dirk Hohndel
ace8b4f2ea Merge branch 'microFixes' of https://github.com/tcanabrava/subsurface 2013-05-21 13:24:32 -07:00
Tomaz Canabrava
37ada91000 Added code for handling of show / hide of columns.
The code also remembers to save in the config file.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 16:51:49 -03:00
Dirk Hohndel
3009930aee Correctly format the values shown for cylinders and weights
Make use of all the nice helpers that we have...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21 12:03:05 -07:00
Dirk Hohndel
19586081ed Correctly use the weightsystem_none / cylinder_none helpers
Plus a couple of minor formatting changes

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-21 11:29:21 -07:00
Tomaz Canabrava
e7b84233af Fixed memory leak
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 10:07:41 -03:00
Tomaz Canabrava
be31a53b0d Added support for visualization the Weigthssystems on the Equipment Tab.
This patch adds support showing and  for editing weigthsystems in the equipment tab,

so, now the two things that are missing are 'edit' and 'delete', wich are quite easy to do.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 09:59:41 -03:00
Tomaz Canabrava
126bc8cfa3 Added the code to show the cylinders from a dive.
i
Added the code to show the cylinders from a dive,
this code also already permits additions from the
interface, so the user can click 'add' and insert
what he wants there.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-21 09:33:55 -03:00
Dirk Hohndel
246fbd0333 Implement rudimentary divecomputer download
Small changes to the names of elements the divecomputer download UI and
very simplistic first stab at populating the device_data_t structure.

This is lacking lots of things
- it should remember the last vendor / product used
- it should figure out which device (mount point) to offer
- it needs proper error handling

But it's a step in the right direction.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-20 21:55:56 -07:00
Tomaz Canabrava
f4acbb02e4 Populate the Vendor && Dive computer information.
This uses the QStringListModel to populate the items
of the QComboBoxes. I used a QHash to hold every Computer
of a particular Vendor. so, products[vendor] gives me
the full list of products from each vendor.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-20 17:58:06 -03:00
Tomaz Canabrava
a542b25bde Added code to cancel the thread.
I think it's self explanatory - When user clicks on
'Cancel', the interface will wait for the trhead to quit
then will close itself.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-20 17:02:17 -03: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
0d370ba108 Integrate visibility Star widget into editing flow
This also removes some incorrect code from the clear() function for the
DiveInfo tab. Putting the readOnly() calls for the DiveNotes tab there was
wrong.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-20 06:25:16 -07:00
Dirk Hohndel
f548195761 Move visibility Star widget to the DiveNotes tab
This looks much better and seems much more contextual.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-20 06:15:30 -07:00
Dirk Hohndel
11a6b18690 Display the statistics
This would be correct if the current selection code wasn't broken. Right
now we only add to our internal notion of what is selected - we never
deselect anything.

Once that is fixed, thestatistics should be correctly displayed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 22:48:31 -07:00
Dirk Hohndel
e818f0352b Try to add a StarWidget for visibility
It's not editable. And of course it continues to look like utter crap -
even more so now since this is left aligned and everything else is
centered.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 21:44:21 -07: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
adc7654816 When no dive is displayed, the DiveNotes field should not be editable
This also fixes a potential crash if no dives were loaded and the user
started editing the fields and clicked OK.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 17:38:20 -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
Dirk Hohndel
920a2069b0 Figure out if the user changed anything when editing
And mark the divelist changed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 14:13:04 -07:00
Dirk Hohndel
9ffa37ab6f Rename buttons for dive edit
The old names made sense in the initial model (where you'd click on the
edit button to start an edit). The new names seem much more natural given
what we do now.

Also a tiny code cleanup removing a redundant if statement.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 12:59:36 -07:00
Dirk Hohndel
a4f243dfac Make direct edit the style of choice
Plus minor coding style fixes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 09:00:57 -07:00
Dirk Hohndel
9b1a3e09d1 Fix edit behavior
Commit 7b00668b400b ("Improve the Dirk edit mode.") had what looks like an
"autocomplete" typo. This also stops us from changing the text on the
button that in this edit mode is always just the "OK" button.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 08:42:58 -07:00
Dirk Hohndel
ae05498d94 Merge branch 'chooseEditMode' of https://github.com/tcanabrava/subsurface 2013-05-19 08:09:48 -07:00
Dirk Hohndel
1298aa87e5 Continue populating the DiveInfo tab
Pulled one more helper from statistics-gtk.c (but didn't modify the code
there to use it as that code is no longer being compiled).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-19 08:08:29 -07:00
Tomaz Canabrava
55b998d528 Improve the Dirk edit mode.
The dirk edit mode will be triggered as soon as the user
clicks on the field that he wants to edit. then he can
edit all fields, till he press ok / reset.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-19 11:45:01 -03:00
Tomaz Canabrava
206a148e07 Made possible to choose the edit style on compile time
This is just a for choosing the default edit style in the
future.  I prefer the new edit style as the user is sure
what the hell is going on ( ie - if he chooses to edit,
he is editing, there's a message warning him that he is
editing and everything else is blocked till he finishes
editing. ) and the GTK version is 'edit whenever I feel like',
wich I think is more unsafe but dirk asked me to put an option
and let the others choose.
e

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-19 11:19:57 -03: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
d853e9bcff Make the Text on the DiveList be 30% smaller than other text
This makes the DiveList be similiar to the GTK one, comparing
the size of the text. The current code makes text on the
table be 30% smaller.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-19 10:46:49 -03:00
Dirk Hohndel
ba30d070c9 While editing the left button is renamed to "OK" to accept the changes
This seemed more logical than keeping it as "edit" and basically having to
hit "edit" a second time in order to save a change.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 21:33:04 -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
c5e7a025e4 Added option to edit the selected dive.
Added option to edit the selected dive.
Now the user can click on 'Edit', and a nice box will
appear stating that the dive is in edit mode, and the user
can edit all of the 'Notes' tab fields, including the
rating. When the edition is finished, the user needs to
click on 'edit' again to mark as accepted, or in
reset to reset the fields to it's original state

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 17:06:48 -07:00
Dirk Hohndel
de50f66257 Work around broken Marble on Debian
This is a major hack. Debian appears to be missing a necessary header file
for Marble to work correctly. We include this header file for now and hack
the Configure process to recognize that we are on Debian and force using
our local copy of the header file in that case.

This may be needed on Ubuntu as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 09:49:37 -07:00
Dirk Hohndel
b9f0bc84c2 Compile fix
Forgot to add this before pushing the previous commits

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-17 22:27:50 -07:00
Tomaz Canabrava
cffc66f45a Don't add a dive on the globe twice ( well, actually, different dives with same location )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 22:56:21 -03: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
Tomaz Canabrava
56dbb7c2ff Added the possibility to change the coordinates of a dive.
Added the possibility to change the coordinates of a dive.
it's too intrusive in the moment, but it was a proof
of concept. so I'll commit as is and try to find a better
way to warn the user what's going on in the future, using
something less terrible than a popup exploding in his face.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 16:12:55 -03:00
Tomaz Canabrava
b89265c7f0 Adds rotation while selecting a dive.
This adds rotation, a very, very shinny feature.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 14:09:10 -03:00
Tomaz Canabrava
3a1a4c1874 removed whitespace.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 13:30:47 -03:00
Tomaz Canabrava
9038b3aa6e Added real support for the marble widget
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>
2013-05-17 13:28:02 -03:00
Tomaz Canabrava
4098922b55 Adds preliminary support for Marble Widget
Adds preliminary support for marble widget, alongside with the
dive list. my idea is to let the view stay there at the left of the
dive list since we got a lot of unused space and a globe is something
nice to have - so you can look around where did you dived, the
dives near the one that's currectly selected, and so on.

I'm not using OpenStreetMaps right now, but a good thing about
marble is that it is skinnable - so for instance, a dive school
could present a dive lesson using subsurface with a globe from the
1600, to make it feel like 'history'.

This version will only compile to Qt4.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 08:14:10 -03:00
Tomaz Canabrava
2f35c94026 Fix loading a dive via command line.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-16 21:25:31 -03:00
Thiago Macieira
3024b2b83c Don't deleteLater a null pointer
When the application launches, the oldModel is null.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-16 14:13:22 -07:00
Tomaz Canabrava
d39b1aedcd Fix loading a second dive, after the first file was loaded.
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>
2013-05-16 12:23:38 -07:00
Tomaz Canabrava
e3cb36498d Fixed the loading of some maps
On some maps, the lack of setting up the dc before plotting
the dive-computer nick caused a division by zero, breaking
the correct visualization of the dive.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-16 15:43:38 -03:00
Tomaz Canabrava
30297ebd4b Correctly set the unselected dive.
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>
2013-05-16 15:42:20 -03:00
Henrik Brautaset Aronsen
a55a2e5d88 Don't add half a kilo/pound when adding weights
The weight management widget added 500 grams / 0.5 lbs
when a new entry was added.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-14 09:26:45 -04:00
Tomaz Canabrava
c5590f835a Fix the focus issues, load a profile when load a file.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-14 08:34:16 -03:00
Tomaz Canabrava
b0374047dd code to show profile again
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-14 08:18:26 -03:00
Henrik Brautaset Aronsen
5868b37e6b Fix inaccurate weight and temperature display in dive list
A nonexisting temperature (mkelvin==0) was displayed as -273°C.
Weight was always displayed with an extra 500 grams/0.5 lbs.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-14 05:33:58 -04:00
Henrik Brautaset Aronsen
f9598f062c Clean up some typos
Cosmetic commit to clean up some of the annoying typos in qt-ui

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-14 05:24:28 -04:00