Commit graph

1595 commits

Author SHA1 Message Date
Lubomir I. Ivanov
f2bfc72648 Ruler: change how the ruler text drawing works
A couple of problems with the ruler:
- the rotated text doesn't look very well at all and interpolation doesn't
  help it much
- measuring towards the right most part of the profile makes the text go
  out of the screen

To solve these issues and attempt to improve the ruler this patch does the
following:
- place the text at the bottom of the lowest of the start and end points.
  this way the line will never intersect with the text
- clamp the x position, so that the text doesn't ever leave the screen
  horizontally
- place a white background behind the text so that it will cover text and
  graphics under the ruler item

(TODO: place the ruler on top of everything else)

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12 11:24:20 -07:00
Lubomir I. Ivanov
7ee1884f6e Make some dialogs modal to MainWindow
For most dialogs it would be much safer to make them Qt::WindowModal to
the parent (MainWindow).
For now we are not doing this for the preferences dialog as there are
situations where the user might want to be able to move it around and even
interact with the main window.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12 10:14:17 -07:00
Tomaz Canabrava
9cc942376e Only anim if not first dive when openning subsurface with a divelog.
The animation appeared when the user started subsurface with a default
file, wich was a little annoying since it didn't had a 'from' position
to go and it was also increasing it's size on some window managers
that do subtle windows animations when a program starts. This patch
treats the first dive opened when the program loads with a divelog pa
rameter differently as the following ones storing the velocity value
on a temporary, and reassigning it later.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 17:42:42 -07:00
Tomaz Canabrava
751c76a578 Support save / load for the Animation Speed on the Preferences
User can now fine-tune the animation speed on the preferences,
a value of zero disables it completely.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 17:41:41 -07:00
Tomaz Canabrava
9f37bac07a Support Animation Speed via Settings.
This is very userfull for a ( yet to be implemented )
preference dialog about the animation speed, so the
user can enable / disable the animations or make it a bit
faster for it's taste.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 17:41:41 -07:00
Lubomir I. Ivanov
466f160c01 Profile2: provide means to disable the tool buttons
Once the poster is displayed when there are no dives in the list,
we may also want to disable the QToolButtons (PO2, SAC, etc..),
until a new dive is loaded and the profile is redrawn.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 11:30:31 -07:00
Lubomir I. Ivanov
b382228b7d MainWindow: close all windows once we close the main one
This is useful if we have more non-modal windows and we want
them simply to close with the main one without explicitly
creating class member variables to point to such instances.

A practical example would be the debug window created in
ProfileWidget2() (diveDepthTableView) which holds
the depth profile values.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-11 11:25:46 -07:00
Lakshman
6e4466aa0a Show temperature units in the label when editing dive
Currently when user wants to add a new dive information,
the ways to know what unit system is being used are

 - Through preferences panel.
 - Save the dive information, which displays units in
   the text field.

This patch provides an option to the user to show current
unit system by displaying the unit on the side of the label
when the user is editing the fields.

This feature can be enabled or disabled by using the new
checkbox option i.e. `Show units in text labels` included
in `preferences->units` section.

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 21:10:27 -07:00
Linus Torvalds
eb47b2a8d8 Get rid of crazy empty tag_list element at the start
So this is totally unrelated to the git repository format, except for
the fact that I noticed it while writing the git saving code.

The subsurface divetag list handling is being stupid, and has a
initial dummy entry at the head of the list for no good reason.

I say "no good reason", because there *is* a reason for it: it allows
code to avoid the special case of empty list and adding entries to
before the first entry etc etc.  But that reason is a really *bad*
reason, because it's valid only because people don't understand basic
list manipulation and pointers to pointers.

So get rid of the dummy element, and do things right instead - by
passing a *pointer* to the list, instead of the list. And then when
traversing the list and looking for a place to insert things, don't go
to the next entry - just update the "pointer to pointer" to point to
the address of the next entry. Each entry in a C linked list is no
different than the list itself, so you can use the pointer to the
pointer to the next entry as a pointer to the list.

This is a pet peeve of mine. The real beauty of pointers can never be
understood unless you understand the indirection they allow. People
who grew up with Pascal and were corrupted by that mindset are
mentally stunted. Niklaus Wirth has a lot to answer for!

But never fear. You too can overcome that mental limitation, it just
needs some brain exercise. Reading this patch may help. In particular,
contemplate the new "taglist_add_divetag()".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 11:36:17 -07:00
Lubomir I. Ivanov
41cec17cff Profile2: reset the zoom level when a new profile is drawn
If the user has zoomed in but then changes to a new dive,
we may want to reset the scale back to the original value (1.0)
based on the current zoomLevel, so that the profile is not stuck
in zoomed mode.

This patch adds a snippet that resets the QGraphicsView scale,
zoomLevel variable and also the toolTip position.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:02:31 -07:00
Lubomir I. Ivanov
324b8cbff1 Profile2: use a different image when no profile is visible
This patch adds a new image resource named poster.png which,
is shown instead of the 3 posters. The main reason for that
is due to the poster text not being visible. This new image
is pretty much the Subsurface logo only.

It also removes the grid lines, while the poster is visible.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:02:25 -07:00
Lubomir I. Ivanov
7d9849cfed Profile2: use an implicit initializer for a struct array
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:02:01 -07:00
Lubomir I. Ivanov
0325b267ee Profile2: fix some initializer list order warnings
Such can be disabled with -Wno-reorder and are clearly
more of a nuisance, but C++98 12.6.2.5 says the order should be
the same as in the class declaration.

On theory this would only speed the compile times a tiny amount.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:01:58 -07:00
Tomaz Canabrava
a052c63b00 Fix retrieving the initial position of the Notification Area.
We had all in place, all that was missing was to actually load
the position stored on the settings for the tooltips.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 08:50:54 -07:00
Tomaz Canabrava
24c5b2e3c1 Code Cleanup ( that fix 2 bugs )
This code cleanup fixes the two issues that I raised on
my last e-mail. hurrah.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 08:50:54 -07:00
Tomaz Canabrava
5bba84e57f Fix colors on the new profile.
This patch fixes the colors on the new profile, the init of the colors map
was not being done. This fixes it.

A few problems were spotted on the new profile dealing with the ruler
graph and a newly added dive, when using the dive add dialog.

I'll be on it later.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 20:37:17 -08:00
Dirk Hohndel
18303b6f43 Fix compile problem
QPointer was undefined (oddly I didn't run into this when test building
earlier).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 10:03:03 -08:00
Tomaz Canabrava
00c97e710f Remove a Lot of Dead Code.
This is just removal of dead code from the old profile, probably there's
still a bit more to remove, but this is a very good cleanup already.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:56:06 -08:00
Tomaz Canabrava
8f43ad8100 Remove the code for the old Profile.
This is simply a code removal, nothing was touched besides the
profilegraphics.h/cpp files.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:55:22 -08:00
Tomaz Canabrava
ac9a23ef3b Remove the old profile from the main screen of Subsurface
This patch partially removes the code for the old profile from
Subsurface. It removes the use of the old profile on the mainwindow,
but keeping the code in the tree for now.

A bit of code-cleanup also entered this commit because I had to change
every instance of the code that used the old profile.

Now to the real code-cleanup

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:54:20 -08:00
Tomaz Canabrava
6dec4b0556 Fix a crash on changing dives when the ruler is used.
The ruler is a weird beast - it has two child objects that access the
parent to call another function, that call the child functions.

When I updated the plot_info I didn't take that into consideration, what
happened is that when I set the parent's plot_info, the children's
plot_info are still invalid, but the update method is called anyhow.

This patch updates all plot_info's before calling anything else.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:53:14 -08:00
Dirk Hohndel
b51dd0a84b Prevent another file descriptor leak
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 15:08:27 -08:00
Dirk Hohndel
c64227efe0 Fix real memory leak
We can't keep the cache around (even though it's tempting) as the next
iteration might change the start time of the planned dive or other
parameters which would make the cached data invalid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-06 14:26:33 -08:00
Dirk Hohndel
4f4fff3917 Null terminate buffer at the correct spot
fread tells us how many bytes it read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-05 18:55:41 -08:00
Dirk Hohndel
1b103c5c69 Another small tweak to whitespace tool
clang-format doesn't appear to reindent multi line #define statements
correctly - so this hopefully will clean those up.

The included whitespace corrections to the code should stay in place when
using the updated tool.

This includes cleaning up some multi-line comments that were messed up the
last time around as well as a few other minor changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-05 13:02:23 -08:00
Willem Ferguson
480280937a Changes to icons in profile panel
- Replace dustbin icon.
- Replace NDL/TTS tool tip with "Show NDL / TTS"
- Create tool tip for scale icon: "Rescale depth axis"

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-04 12:59:17 -08:00
Willem Ferguson
8518348304 Reorganise buttons in profile panel
- Move the buttons of the profile window around to have more sane positions.
- All the buttons affecting the ceiling(s) are now grouped together.
- All the buttons affecting the Information Box are now grouped together.
- The previous icon for "Show calculated ceiling" has been reassigned to
  "Show all tissues"
- A new stand-in button hav been included for "Show calculated ceiling"

Signed-off-by: Willem Ferguson <willem@willem-Precision-M4700.(none)>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-04 07:54:52 -08:00
Dirk Hohndel
2513410132 Fix possibly uninitialized value
I'm not sure about this one. It's possible that there's something
happening behind the scenes that I don't understand. But let's just
initialize this to 0 and be sure.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 22:21:33 -08:00
Dirk Hohndel
f693bbd7a0 Don't use error after free
We need to reset the error pointer to NULL for this to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 22:11:24 -08:00
Dirk Hohndel
d24d2288f3 Remove pointless assignments
tissue_tolerance wasn't used after it was assigned.
type was overwritten after it was assigned.
serial was overwritten after the last /= 100.
event is assigned in the for loop.
clear isn't used after the assignment

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 21:40:56 -08:00
Andrey Zhdanov
64b7a3b85f Depth widget minor UX improvement
Decrease depth by tapping left part of widget. Icon is showing "up" (i.e. closer to surface).
Increase depth by tapping right part of widget. Icon is showing "down" (i.e. deeper).

Fixes #354

Signed-off-by: Andrey Zhdanov <andrjufka@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 13:33:03 -08:00
Dirk Hohndel
7c535452f9 Whitespace cleanup
Minor change to the perl postprocessing script and resulting changes to
the affected source files.

This deals with two issues:
- "foreach"-like structures were not always treated correctly
- some longer calculations that ended on "+ constant" were reformatted in
  a rather unatractive manner

In one source file (divelist.c) I ended up adding braces to the sources...
trying to cascade the indentation further down without having the block
there seemed a lot more trouble than it's worth.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 13:29:22 -08:00
Giuseppe 'ferdy' Miceli
9b0817596d Correct another typo
Non-stop Dive Limit (or No Deco Limit) abbreviation is not NTL but NDL

Signed-off-by: Giuseppe 'ferdy' Miceli <ferdy@ferdy.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 09:43:07 -08:00
Giuseppe 'ferdy' Miceli
3b1b01b293 Correct typo in partial pressure abbreviations
Partial pressures abbreviations should have capitalized chemical element
symbols  e.g. pn2 -> pN2

Signed-off-by: Giuseppe 'ferdy' Miceli <ferdy@ferdy.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 09:40:51 -08:00
Dirk Hohndel
c4f49d5075 Equivalent Air Density Depth was mislabeled
In commit c84ef319a2 ("Create a toolbox on the left side of the new
profile") Tomaz invented a new TLA: EED.

No one noticed. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 09:22:22 -08:00
Anton Lundin
909cfe7135 Set the prefs-value alongside the button status
Previous code just set the button-"status" based on what we stored on
the settings. This sets the corresponding value in our prefs-struct.

This fixes the same issue as in 63f7f3, without the side effect of
magically hiding the mean depth line.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 13:42:07 -08:00
Anton Lundin
3df506b081 Spelling fix, Its called Ndl
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 11:16:38 -08:00
Andrey Zhdanov
3be1358b46 Icons for new profile
Existing dummy icons are replaced with new ones for:
- o2 graph
- n2 graph
- He graph
- MOD
- EAD, EED, END
- DC reported ceiling
- calculated ceiling
- calculated ceiling in 3m increments
- SAC
- ruler

Fixes #446

Signed-off-by: Andrey Zhdanov <andrjufka@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 10:53:30 -08:00
Dirk Hohndel
d29d0e7a5d Revert "Switch profile button events, clicked to toggled"
This reverts commit 63f7f37e46.

For odd reasons this appears to make the mean depth line disappear. This
will require some further analysis, but for now I'll just revert it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 10:37:07 -08:00
Gopichand Paturi
9b07acbee8 Add Units to mean depth value
Fixes #445

Signed-off-by: Gopichand Paturi <gopichandpaturi@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-02 08:16:29 -08:00
Joshua Wambua
9cd3d61c11 Remove failed parses from recent files menu
This patch will remove all files that fail to parse from the recent
files menu.

Signed-off-by: Joshua Wambua <joshua@megvel.me.ke>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-28 07:51:41 -08:00
Dirk Hohndel
76e6420f6b Massive automated whitespace cleanup
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 20:09:57 -08:00
Tomaz Canabrava
006265d7a0 Try to fix the font issue on the ruler.
This changes the ruler a bit, I hope nobody gets offended by it. :)

The main issue is that the scene is now 100x100 pixels wide, so the font
was *really* huge. and setting itemIgnoresTransformations on the ruler
broke a lot of stuff.

I removed the code that painted the text and created a QGraphics TextItem
for that - that will hold the text for the ruler.

Then I played with the view to get the correct angle of the line, that was
in scene coordinates and thus, could not be used directly on the item that
had ignore transformation changes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 18:57:48 -08:00
Anton Lundin
63f7f37e46 Switch profile button events, clicked to toggled
This is needed so the underlaying struct preferences prefs, will be
updated when we set the buttons to there previous state after we
loaded the settings.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 18:55:54 -08:00
Anton Lundin
619d4acb6f Remove old leftover header
This got merged into a common divelogimportdialog.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 18:55:38 -08:00
Tomaz Canabrava
a4d0f7bdb3 New profile: Make the ruler work. (caution, fonts are BIIIG )
This patch makes the ruler work again, the problem is that the fonts are
*terribly* big, I'll fix that on the next commit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 12:03:59 -08:00
Tomaz Canabrava
0a24e13469 Remove the pInfo pointer, make it a real structure instead.
This fixes the invalid pointer stage crash.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 12:03:34 -08:00
Alberto Corona
0d62efaa39 Tune CVS import dialog
Increased vertical spacing between spinboxes and checkboxes for the manual
CVS import dialog

Fixes #448

Signed-off-by: Alberto Corona <albcoron@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 11:44:59 -08:00
Tomaz Canabrava
c356fac3b6 New profile: Toggle on / off the ruler via settings.
This patch toggles on / off the ruler via QSettings.
When the user clicks on the toolbar, this sets the settings to true /
false, in a way that if the user turns Subsurface on/ off, we still get
the last choosed option.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Tomaz Canabrava
35e102b176 New profile: add the RulerItem
This patch adds the RulerItem inside of the new profile, and already takes
settings into consideration.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00