Set the Cylinder/Weigth even if it's the same old value.

Since the cylinders and weigths have other data attached
to it, like size and working pressure, one could mess the
other data and want it to revert to the cylinder / weigth
defaults, but for that the user had to choose another
item, then go back to the previous one, so the cache would
be clean.

This patch fixes that by reverting the values to the
it fixes linus bug n2, where he had invalid data
on the other fields and had to go back and forth for it
to be fixed.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Code Cleanup, less magic indexes.

This patch removes the magic indexes used to control the mainwindow
display of the profile and planner by an enum. a bit more verbose
but hard to miss.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Cleanup the prettyness of subsurface on Gtk+ style.

Fix some stuff concerning the pretyness of subsurface while running
on Gnome and XFCE enviroments. This is the kind of stuff that I
really didn`t want to put on the code but sometimes it`s for the
best. this makes the MainTab much more bearable. There are still
things to fix, like the size and positioning of some of the icons.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
More cleanup for the Gtk+ Style

This patch eliminates 18px offset from the MainWindow main
layout, making the window feel less spacy. Good on the Gtk+
style, but seems to also make a good work on the Oxygen one.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Only set documentMode on tab if in Oxygen style.

This is much better looking in the Oxygen style, and
on the other styles it looks like crap - so let`s not
use that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fixed the display of Subsurface in Smaller Screens

This patch fixes the display of subsurface in smaller
screens by creating ScrollArea containers that are
now englobbing each of the Tab-pages and the Planner
Widget. Some of those widgets were pretty big by the
amount of things on it and it was too big for small
( 14" and 15" ) screens.

This seems to fix it, and looks good both on Gtk+ and
Oxygen styles.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fix the edition of cylinders and weigths by keypress

This patch fixes the cylinders and weigth edition
by keypress. I don`t know when I broke this and linus found,
most probably when I added the code for showing the
cylinder size and working press while moving the mouse
around the list - sorry guys.

So, now this *seems* fixed, tested for a fairly good
amount of time and everything seemed ok.

I was unable to reproduce the behavior that linus got
on two value overlapped on each other, tougth.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Fix the positioning of the `add` button when on Gtk style

Fix the positioning of the `add` button when on Gtk style,
in my XFCE install (and thus, may differ a bit from the
Gnome3 one ) the Plus button to add cylinders and weigths
got really strange placements, this seems to fix this,
I also tested on Oxygen and nothing broke there.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Hack to make the subsurface work on Gnome3 shell

The Gtk+ style on the Gnome shell is somewhat broken on Qt for
some reason. This hack pokes the system, checks if it's running
gnome-shell, and if the current style is gtk+ ( I couldn't just
check for gtk+ since it worked on XFCE and other Gtk based enviro
ments. so a double check is needed. ) then I changed the Pallete
of the affected widgets by hand.
not a pretty hack but worked.

[Dirk Hohndel: redid the patch to be simpler and more consistent]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Print: provide means for profile layouting

printlayout.cpp(h):

This patch cleans some test code and adds the function
printProfileDives() that accepts a number of dives
per rows and columns. It can technically fit any number
of dives on a page given the page size allows it. Both
landscape and portrait layouts are supported.

It now replaces the old methods:
printTwoDives()
printSixDives()

Space is reserved for data tables that will be placed
bellow profiles on a later stage.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
plot seconds with a fixed width of 2

before: 0:50 1:0 1:10
after:  0:50 1:00 1:10

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
implemented zoom action

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Added a ruler which can be dragged along the profile

This patch adds a ruler QGraphicsItem which can be dragged
along the profile. The ruler displays minimum, maximum and
average for depth and speed (ascent/descent rate). Also, all used
gas will be displayed.

This also adds a new attribute to struct plot_data to store the
speed (not just as velocity_t).

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Added a toolbar to the profile

The toolbar adds two buttons to the profile.
The user can now toggle the scaling (zoomed to dive/round up to 30 mins)
and adding /removing ruler to/from the profile using this toolbar.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
correct the placement of  pressure markers

Adding +30 (seconds) to the position works fine for long dives but
when zoomed in on short dives, 30 seconds are a lot.
This commit sets the offset to +10 px regardless of the scaling.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Merge branch 'toolbar-ruler-rb' of github.com:mguentner/subsurface
Make the renumbering of dives accept numbers up to 99999

Fixes #201

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Ascending/descending speeds are usually expressed in x/min

There is debate on this one, as free divers WANT the xx/sec values.
This needs to become flexible depending on whether you are in freedive
mode or not.

Fixes #202

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix weight adding in the Qt UI & fix the header height for tables

Fixes #203

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added a spacer at the bottom of the dive info and stats grids

Fixes #204

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>