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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>