Added the ok / cancel buttons on the dive planner canvas.
I still need to hook the esc button to cancel it too, but
since I removed the 'floating dialog' option and merged it
into the mainwindow, it's necessary.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Now, activating the dive planner will hide the profile
and show the planner on the same place. we still need
a way to 'cancel' or 'accept' the profile created.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
We always resize if the dive is longer than the current scale allows, but
we don't shrink it overly aggressively and we never shrink it below the
initial size.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Prior to this change the visual feedback (the handle that is drawn when
the user moves the mouse while pressing the left mouse button) would not
move to an illegal position (one that is impossible without time
travel), but it the user moved the mouse to such an illegal position and
then released the mouse button, we still added that illegal position to
the plan.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove a couple of TextLabel text entries from maintab.ui
which can be seen right after program start and if no dives
are present.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
1) Make a call mark_divelist_changed(TRUE) when the user adds new
cylinder or weight entries.
2) Call mark_divelist_changed(FALSE) in
MainWindow::on_actionClose_triggered() so that each time after
a file is closed or a new one is created it does not ask immediately
the user for a save confirmation for the blank file/divelist.
3) Call mark_divelist_changed(TRUE) once a dive's geo location
has changed in GlobeGPS::changeDiveGeoPosition().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are a couple of problems with said icons:
- When the Equip. tab is first seen, no relative event is monitored
so that the correct position is updated and the icons are positioned.
To solve that we connect the signal MainTab::currentChanged(int)
and call MainTab::equipmentPlusUpdate().
- When the info-profile QSplitter resizes with a snap towards/from
the edges of the main window, no resize handler is called such as
MainTab::resizeEvent().
A solution is to monitor the resize of the info-profile splitter
with MainWindow::on_infoProfileSplitter_splitterMoved() and again
call MainTab::equipmentPlusUpdate()
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove circle in plan by starting the first line at the first point
rather than the last.
In addition marks all entered points as entered and not just the first and
sets line color accordingly.
Makes plan_add_segment return the added data point.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fixes most of the issues with the dive planner,
The lines are removed when the drag starts, and
it's repopulated after. The time ruler updates
itself with the biggest time in the dive (I'll
add later the code to keep a minimum of 60 minutes,
and increase by 15 to 15 minutes, but for now
this will work ), Removed the code to do
line manipulation while we are moving handlers
around ( because it could trigger ruler-expansion,
that woul'd move everything, and that's not nice.
This showed that something bogus is going on with
the decompression algorithm - I don't know if it's
on the data or on the algorithm itself, but it's
creating a ring with the lines on the canvas
I painted all decompression-algorithm based lines
red so it's easier to spot where the hell things
got wrong.
midnight, sleepy.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
If a file has been opened from the command line or via the File
menu the main window title becomes "Subsurface: filename.ext".
Title also updates if 'File->Save As' is called. "Subsurface" only
is displayed when no active file is present or post 'File->New'
or 'File->Close'.
To make this work a new public method is added - MainWindow::setTitle()
and also an enum type MainWindowTitleFormat, which should allow
more complicated formatting, such as showing the selected dives
or the total number of dives (e.g. MWTF_FILENAME_N_DIVES).
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use Ctrl+1 for 'View All', while all the singular views follow
with Ctrl+2..5.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For viewing the Globe section (pane) we need to collapse
both the 'list' and the 'main' splitters.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
File->New in the GTK version performed the same as File->Close.
Creating a new file may also ask the user if the current file has
to be saved.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Similar to File->Open but for multiple files and without
calling on_actionClose_triggered().
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove the bogus time/depth that was duplicated in the
Handler - dirk didn't realized that I already created the
same data that he put on it later, but mine was double and
his his was int, I choosed his implementation since he knows
a bit more than I do about subsurface internals.
Besides that, I worked a bit on the logic that called update ticks,
because it was calling it for every mouseMoveEvent, it created
sooooo many ticks that it made the app unusable ( and slow. )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This behaves somewhat differently from the Gtk version - still needs
more investigation. But at least now it's hooked in.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The dialog is similar to the one in the GTK version
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This uses a bunch of default values that we eventually need to get from
the UI, but it's a first step towards a working dive planner.
This exhibits some graphical artifacts when running, but other than that
appears to be mostly correct.
Things go far worse if I enable the changing of the scale once the deco
makes the dive longer than the displayed time window. Things quickly
spiral out of control.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I expanded the DiveHandler to include the actual time / depth of each
node on the graph - this way things will stay consistent if we need to
rescale the graph.
One thing that this makes obvious is that the whole design for the
planner so far assumes metric data. We need to make sure this works well
with feet instead of meters as well (and that it uses the information in
the units settings).
With this change we actually create a dive based on the plan input and
add the deco stops (if needed) to it - but we don't do anything with the
results of those calculations, yet.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This looks much more natural than truncating the values. Now the displayed
numbers correspond to the "snap" behavior of the handles.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the correct way to add the ticks (and gets rid of two warnings).
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Just to keep me sane.
The code still shows compile time warnings which are the areas where we
need to complete things to actually do the deco calculations, etc. But now
seemed a good time to merge it into master as hopefully more people can
contribute.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the skeleton implementation of the increaseTime and
increaseDepth methods - they will increase the time / depth by
10 units ( feets / minutes ) each time they are clicked.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Added a new class, named Button, that has a clicked() signal,
and can be connected to the view to emulate buttons. While
I know that Qt supports widgets on canvas - I think it's too
nineties to have such square controls on something that can have
rounded borders.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Make the plot and the handle stick to a grid, the
grid is defined by the integers in the rulers, so
a time of 10,2 is converted to 10, and will put the
point at 10.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch makes the depth to show only integers, as
dirk asked. I'v also added a 'm' at the end, I know that
this will need to be taken from the settings but
i feel lazy today =p
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch makes the first line and the last line of the plot
inside of the boundingRect defined by the timeLine and depthLine
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
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>