Commit graph

448 commits

Author SHA1 Message Date
Lubomir I. Ivanov
8678e2d57c Better positioning of the plus sign icons in the Equip. tab
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>
2013-06-27 20:57:10 +08:00
Dirk Hohndel
937fef819a Remove unused code
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27 20:55:36 +08:00
Dirk Hohndel
3fa3f55163 Remove incorrect logic for first line in planner
This greatly simplifies the code.
Similar to (but not based on) code submitted by Robert Helling.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27 20:54:17 +08:00
Robert Helling
8eb2dc3d65 Removes circle in plan
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>
2013-06-27 19:51:04 +08:00
Dirk Hohndel
1ec8bc5de0 Merge branch 'divePlanner4' of github.com:tcanabrava/subsurface 2013-06-27 11:43:53 +08:00
Tomaz Canabrava
7a840d2668 Fixes most of the issues with the dive planner.
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>
2013-06-26 20:41:39 -03:00
Lubomir I. Ivanov
ab95da8fd2 Update main window title depending of current file state
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>
2013-06-27 07:23:12 +08:00
Lubomir I. Ivanov
c92cf925bd Reorder the 'View->View ..' list
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>
2013-06-27 07:22:49 +08:00
Lubomir I. Ivanov
fa96ebeed7 Enable 'View->View Globe'
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>
2013-06-27 07:22:26 +08:00
Lubomir I. Ivanov
865d4953df Add action to 'File->New'
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>
2013-06-27 07:22:18 +08:00
Lubomir I. Ivanov
488ff19fd9 Add the 'Import files' functionality
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>
2013-06-27 07:22:00 +08:00
Tomaz Canabrava
03572e233d Remove the bogus time/depth, and fix the positioning of the Handler after updateTicks.
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>
2013-06-26 19:14:55 -03:00
Dirk Hohndel
48ba01b807 Enable downloads from the UEMIS Zurich
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>
2013-06-24 15:14:07 -07:00
Lubomir I. Ivanov
f3b04a88df Add an 'About' dialog for the Qt UI
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>
2013-06-24 07:44:28 -07:00
Dirk Hohndel
ef0272f5ef Perform deco calculation for plan
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>
2013-06-23 21:36:50 -07:00
Dirk Hohndel
596095389b Start hooking in the deco calculations
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>
2013-06-23 20:32:32 -07:00
Dirk Hohndel
4a184a60fc Print the rounded values for time and depth in planner
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>
2013-06-23 17:32:23 -07:00
Tomaz Canabrava
a0e5244ffe Fix updateTicks
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>
2013-06-23 13:21:01 -07:00
Dirk Hohndel
106775b196 Clean up coding style
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>
2013-06-23 13:14:31 -07:00
Dirk Hohndel
31449dca22 Merge branch 'divePlannerTry3' of github.com:tcanabrava/subsurface 2013-06-22 15:57:26 -07:00
Tomaz Canabrava
880b98ed35 Added the skeleton implementation of the increaseTime and depth
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>
2013-06-21 16:51:13 -03:00
Tomaz Canabrava
28f48227f7 Added a new class to handle the pseudo-buttons on the canvas.
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>
2013-06-21 16:44:38 -03:00
Tomaz Canabrava
01d1a49d94 Make the plot and handle movement stick to an 'Grid'
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>
2013-06-21 16:28:17 -03:00
Tomaz Canabrava
c9159da43a Depth doesn't suppose to show broken numbers.
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>
2013-06-21 16:14:22 -03:00
Tomaz Canabrava
43657d9944 Makes the first and last line of the plot inside of the boundingrect
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>
2013-06-21 16:12:04 -03:00
Tomaz Canabrava
1e4d360d0c Do not plot dive handlers outside of the Plane area.
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>
2013-06-21 16:07:44 -03:00
Tomaz Canabrava
397a94fcd1 Created the posAtValue method for the ruler
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>
2013-06-21 15:53:20 -03:00
Tomaz Canabrava
062515ba6f Added back the menu entry 'Dive Planner'
Added back the menu entry Dive Planner, and removed the
calee code from the Print action.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-20 18:48:21 -03:00
Tomaz Canabrava
fdd8a4811b Added a new class to handle the DivePlanner dialog
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>
2013-06-20 18:40:59 -03:00
Tomaz Canabrava
8fcd465a65 Make skeleton of 'create_deco_stop'.
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>
2013-06-20 18:25:03 -03:00
Tomaz Canabrava
0539a5fab6 Restore the original color of the Handler as soon as mouseRelease.
Restore the original color of the handler as soon as mouseRelease,
also a bit of code cleanup.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-20 18:02:01 -03:00
Tomaz Canabrava
cbdd78c0fc Added text to the rules so the user knows what's happening at that point.
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>
2013-06-20 17:54:36 -03:00
Tomaz Canabrava
2d683b66a8 Added the code to set the Depth / Time on the user Handlers.
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>
2013-06-20 17:34:42 -03:00
Tomaz Canabrava
f129024fc7 Added a 2 Ruler Items, Time and Depth.
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>
2013-06-20 16:48:24 -03:00
Tomaz Canabrava
636550d413 Added the skeleton for the Ruler Item,
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>
2013-06-20 15:52:27 -03:00
Tomaz Canabrava
52a0e6c82d Make the plan handlers to not move across other handlers.
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>
2013-06-20 15:15:10 -03:00
Tomaz Canabrava
607f82ade3 Added drag and drop code to the dive plan
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>
2013-06-20 14:46:40 -03:00
Tomaz Canabrava
021a6a076e Created a class DiveHandle to make drag drop work.
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>
2013-06-20 14:29:32 -03:00
Tomaz Canabrava
1fb023d3c6 Make the cross red when you cant plot a dive stop
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>
2013-06-20 14:20:45 -03:00
Tomaz Canabrava
46483a096f Better defaults for placement of dive stops.
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>
2013-06-20 13:56:28 -03:00
Tomaz Canabrava
88e7aa36be Created a cross that follows the mouse on the dive planner.
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>
2013-06-20 13:53:12 -03:00
Tomaz Canabrava
b1c526ddb4 Fix creation of the poligon-based lines for the dive planner
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>
2013-06-20 13:39:41 -03:00
Tomaz Canabrava
364254ed36 Better handling of the scene size for the dive Plan
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>
2013-06-20 13:28:04 -03:00
Tomaz Canabrava
ab6aea73c1 Plots Lines and handles on the Planner
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>
2013-06-20 13:20:41 -03:00
Tomaz Canabrava
0d45c77572 Make double click work to put new items on the canvas.
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>
2013-06-20 12:37:41 -03:00
Tomaz Canabrava
beadeffaf5 Added the first scope of the visual dive planner.
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>
2013-06-20 12:33:26 -03:00
Linus Torvalds
09ee8ece5c Show sample pressures in the cylinder equipment page
If we don't have any manually set pressure data, show the data from the
samples instead.  It uses an italic font for this case, mainly because I
couldn't figure out how to gray things out.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 21:53:34 -07:00
Linus Torvalds
bc24b9320f Don't show '0.0%' gas percentages
It's just distracting.  Leave it empty.  No helium should be visually
very different from actual trimix, and for oxygen, zero means something
different anyway (it's air).  In neither case is '0.0%' a good string to
show, just show it as empty.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 21:52:58 -07:00
Linus Torvalds
45d9ca09de Fix the imperial cylinder size calculations in equipment handling
This makes us use the same linear calculations as we did in the Gtk
branch.  We don't take compressibility into account, since tank
manufacturers don't seem to either.  A Luxfer AL80 is 11.1 liters, and
with the standard (non-compressibility) calculations, 80 cuft of air at
3000 psi is 11.094 liter, so that is the right model to use.

Also, stop with the horrible "units in edited numbers" stuff.  It uses
up precious space, and doesn't look any better.  If the user asked for
cuft, give him cuft without making a big deal about it.

Oh, and if the working pressure doesn't exist, sizes are always in
liters.  That's what we did in the Gtk branch, that's what we do here.
Again, no reason to even bother stating units, it's not helping.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 21:40:38 -07:00
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