This patch makes the behavior of inserting new hanflers
correct. it can only be inserted now inside of the plane
defined by the Depth ruler and Time ruler.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Created the posAtValue method for the ruler, you enter
a value, and it will return the coordinates in double
( coordinate system of a QGraphicsScene is double based )
this is not the best name for the function, but I couldn't
find any better suitable name.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added a new class named DivePlanner that is a QDialog,
and renamed the old DivePlanner class to DivePlannerGraphics.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is a skeleton of 'create_deco_stop' plus a bit of
code cleanup. I'v commented the create_deco_stop so that
the other developers can help me a bit here - since I don't
know too well the internals of subsurface. In the original
GTK code - a new dive was created every time a user changed
something on the dive, I don't know if this will be needed,
I jusst need two things: the correct time of dive calculated
by the app, and the points to put the decompression lines.
The usability of the widget right now is 'ok', nothing to
be proud of, it's ugly as hell too, and the Rules are in
the wrong position ( they are 'inside' the area where
the lines are being drawn, but htis is easily fixable. )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added text to the rules, so the user knows what's happening at that point
The text will move left / right ( for time ) and up / down ( for depth )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added the code to set the Depth / Time on the user handlers,
I think this finishes the difficult part. ( well, not really )
the depth and time is being set when handler is added or moved,
but as soon as the deco calculations enters on the code, the
handlers will need to be repositioned - and this code is not ready
yet.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The ruler items are needed so I can get the correct
coordinates of the planned dive. This is a very
rudimentary ruler and it needs a bit of love, but
it already gives me something to work on.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The ruler will deliver the Time and the Depth, later.
it should be vertical or horizontal, and will have
ticks
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch disables the hability to move handlers across
the others, making a 'zigzag' in the time line.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added drag and drop code to the dive plan, it can move the user-
inputted data, but will not touch the computer generated ones.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Create d a class DiveHandle to make drag drop works,
it has a from and to Lines, and it will move them
around.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Make the cross red when you cant plot a dive stop,
also make impossible to put a dive stop before the last one.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch makes it impossible to create a dive stop
outside of the scene - this, messing the complete
planning system.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Created a cross that follows the mouse on the dive planner,
this will help the user to know where it is placing the stop.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This fixes the creation of the poligon-based lines
next thing to do is to forbit creation of the next point
before the last one.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Better handling of the scene size for the dive plan,
The scene can be resized and a transform will be applied,
the handles will not resize however - they are 10x10px
and that's it.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This is still a bit bugged - the lines are going to the wrong
end - most probaly I messed something on the math. I'll now fix
the sizing issue then I'll try to make it behave in the proper
way.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Make double click work to put new items on the canvas.
Those items right now are QGraphicsEllipseItems, but
it will change to 'draggable' items.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added the first files and skeleton code for the visual
dive planner. now I need to fill things. The code is
using the print action borrowed, this will need to move
to a better choice in the future.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.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>
This sneaked into commit 9364436264.
It shouldn't be there.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
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>
The compiler on MacOSX seems stricter than others:
qthelper.cpp: In destructor ‘DiveComputerList::~DiveComputerList()’:
qthelper.cpp:10: error: expected class-name before ‘(’ token
Fixed with help from http://stackoverflow.com/a/14777627/13365
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
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>
When doing the early port from the Gtk code to Qt this function was just
stubbed out. Now we are correctly filling the internal data structures
with ALL the dive computers that we see.
Instead of the silly dialog asking the user for a nickname we simply
create one from the deviceid. The user can then use the device name
editing dialog to create more intuitive nicknames.
Signed-off-by: Dirk Hohndel <dirk@hohndel.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>