Commit graph

6112 commits

Author SHA1 Message Date
Tomaz Canabrava
f49a9007a7 Added a background for the ShowDate widget.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-20 15:41:28 -07:00
Anton Lundin
bb44908507 planner: Switch to QSpinBox for SAC
QSpinBox is nice to see how different sac rate would affect our dive
plan.
"Hey, What would happen if I would be stressed and my sac goes up by 50%?"

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-20 06:37:44 -07:00
Anton Lundin
3f74389b88 CNS doesn't increase when PO2 is below 0.5 atm
When chasing other bug in CNS code i found this.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-18 05:05:54 -07:00
Anton Lundin
9400e1190b Enable Info box in the planner again.
Its great to be able to see the planned "turn pressure", EADD at
different points and so on.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-18 04:56:20 -07:00
Anton Lundin
d8ec3988b1 Fix building with NO_MARBLE again
Back in 708f19830e ("Planner: New plannerSettingsWidget") the Globe
widget handling changed, and this updates the NO_MARBLE build option to
work after that.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-18 04:56:08 -07:00
Thiago Macieira
aad393aa4f Clean up SubsurfaceSysInfo by inheriting QSysInfo
Most of the mechanics are already in QSysInfo, we only need to add the
extra details that were missing until Qt 5.4. This greatly simplifies
the code and will allow us to update it more easily from upstream.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-18 04:55:23 -07:00
Thiago Macieira
44f872cc59 Disable the Q_PROCESSOR_xxx macros in Qt 5.0
We don't want to redefine, we just need what Qt 5 already has.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-18 04:54:25 -07:00
Thiago Macieira
ee11e1540e Don't use std::string in our code
This also explicitly states the encoding. It's just a file name and it's
always ASCII for us, but it's clear now.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-18 04:44:59 -07:00
Thiago Macieira
2fcf8411af Use __typeof__ instead of typeof in the header
This allows us to compile Subsurface with strict C or C++ mode.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-18 04:44:53 -07:00
Gehad elrobey
818bd9903a HTML: move between dives in detailed view.
Move between next/prev dives in detailed view, and be able to go back to
the list.
Also fix the initial state of the sorting by number.
(its already exported in ascending order)

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-15 09:25:47 -07:00
Gehad elrobey
d363722c16 HTML: remove theme file if already exist in the export directory
as QFile:copy doesn't overwrite files by default, we must check before
copying if file exist and remove it.

We must be able to overwrite files here, user is already notified and
choosed to replace them.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-15 09:25:37 -07:00
Gehad elrobey
262472c9de HTML: fix the exporting dialog
export HTML into the file name choosen and export additional files into
a subdirectoy beside the html file, called htmlfilename_files

This is to follow the convension and doesn't create additional
directories to wrap the exports.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-15 09:25:17 -07:00
Gehad elrobey
5169adbeb3 HTML: Dynamically loading an external JavaScript or CSS file
This enable the HTML template from linking JS and CSS files dynamically
when starting. This helps to recognize the folder name where js and css
where exported dynamically.

The HTML template will succesfully find the attached files as long as they
exist in a directory named as the HTML file.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-15 09:25:01 -07:00
Gehad elrobey
8ea5441b79 HTML: Show dive profile embedded in HTML5 canvas
Plot samples from dive computer (depth,time) with HTML5 canvas.
Add very small API for curve drawing and coloring. Add the dive
equipment to the detailed dive view.

in the dive list when a dive is expanded you can show the dive
profile,equipments and dive information by clicking on 'show more
details'.

Fixing the two themes to work well with the new div added that
carry detailed dive information.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-15 09:23:27 -07:00
Gehad elrobey
29c2f88802 HTML: define the visited array type to boolean
The boolean array must be defined explicitly, to prevent type casting.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-15 09:20:40 -07:00
Gehad elrobey
5861513364 HTML: Write cylinder data to the JSON files.
Iterate the cylinders in each dive and write cylinders data to the
exported JSON files.

Moving the write attribute function to the top of the file.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-15 09:18:28 -07:00
Gehad elrobey
c7bc364ca1 HTML: export DC samples to JSON format.
-Export Dive computer samples to JSON format, for dive profile plotting.
-Add maxdepth and duration to attributes of the JSON dive object.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-15 09:18:11 -07:00
Gehad elrobey
4a69dea972 HTML: Report saving to file errors.
Use subsurface report_error function in save-html and worldmap-save
instead of the ridiculous print to standard output.

Also use subsurface_fopen for the sake of different platforms.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-15 09:17:45 -07:00
Joshua Joseph
d209d35f64 OS Detection
--001a113a374080d8af04fbd33a62
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Sun, Jun 15, 2014 at 1:07 AM, Thiago Macieira <thiago@macieira.org>
wrote:

> Em s=C3=A1b 14 jun 2014, =C3=A0s 15:05:24, Thiago Macieira escreveu:
>
>
> Also, please keep the original copyright headers from the files you copie=
d.
> --
>

Attached patch adds Qt copyright to both files.

--=20
Thanks,
Joshua

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Jun 15, 2014 at 1:07 AM, Thiago Macieira <span dir="ltr">&lt;<a href="mailto:thiago@macieira.org" target="_blank">thiago@macieira.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Em sáb 14 jun 2014, às 15:05:24, Thiago Macieira escreveu:<br>
<div class=""><br>
<br>
</div>Also, please keep the original copyright headers from the files you copied.<br>
<div class="HOEnZb"><div class="h5">--<br></div></div></blockquote><div><br></div><div>Attached patch adds Qt copyright to both files. </div></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Thanks,</div><div>
Joshua</div><div><b><br></b></div></div>
</div></div>

From 092bea260da8b02437c54eac51fd4fa044069e0e Mon Sep 17 00:00:00 2001
From: "Joseph W. Joshua" <joejoshw@gmail.com>
Date: Sun, 15 Jun 2014 01:20:12 +0300
Subject: [PATCH] Include Qt copyright headers in SubsurfaceSysInfo

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-14 20:20:53 -07:00
Joseph W. Joshua
f59b30ca5a OS Detection: Use QFile when reading /etc/os-release
Improves and simplifies reading of /etc/os-release on
linux system to read the PRETTY_NAME value. The previously
used method is unnecessarily lengthy and too complicated.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-14 14:46:42 -07:00
Dirk Hohndel
8bd535d092 User survey: force running the survey from command line
This way people can test the dialog much easier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-14 14:45:42 -07:00
Dirk Hohndel
181d4e2fa6 User survey: small updates
Just make it behave a little more sanely
- support Ctrl-W and Ctrl-Q
- remove the silly placeholder text for system info
- add language and version information

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-14 14:35:17 -07:00
Dirk Hohndel
5e345fba0a Make system detection compile on Mac
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-14 13:29:13 -07:00
Joseph W. Joshua
1ec5e6ffc4 OS Detection
Implements automatic OS and architecture detection. This code has
been taken from the Qt repositories for Qt 5.4 (LGPL) and slightly
modified into the SubsurfaceSysInfo class.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-14 12:50:35 -07:00
Dirk Hohndel
cdd3b3d9cd Start a user survey dialog
The idea is that a week after the user starts using Subsurface we ask them
if they would like to submit a survey response.

If you are running a development build, don't wait seven days.

This patch doesn't do anything with the user's selections, doesn't submit
anything to our server, etc. It's just a placeholder to tune what we
should ask, etc.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-13 14:03:51 -07:00
Dirk Hohndel
64236388e4 Prevent using uninitialized variable
numberOfPictures was be read before it is written.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-13 07:11:06 -07:00
Dirk Hohndel
ed5a805929 Fix tank size display
In commit 11380a5deb ("Really display liters with script el")
I inadvertantly broke the display of cylinder sizes in the imperial case.
This patch restores that and also tries to give slightly more useful
guidance on the number of decimals to display.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 15:39:42 -07:00
Robert C. Helling
1b2d3c29d3 Correct pO2 formula in CNS calculation.
In commit e58f54cac1 ("Fix ATM-vs-bar confusion") Linus broke the CNS
calculations; The partial pressure is fraction of gas times ambient
pressure, not divided by.

[Dirk Hohndel: identical patch sent by Robert and Anton; I combined the
               commit messages and added the ACK from the perpetrator]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 14:12:30 -07:00
Dirk Hohndel
a4050c2a71 Don't copy the current dive ontop of editedDive after edit has started
If you switch to edit mode by making a change to cylinders or weights,
then the data in the editedDive was changed and afterwards the current
dive was once again copied into the editedDive - even though we already
did that earlier when setting up the display.

Fixes #539

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 13:34:57 -07:00
Tomaz Canabrava
748198891d Much needed clean on the HTML export dialog code.
Correct usage of QFile, QString and code cleanup.

[Dirk Hohndel: plus whitespace cleanup and removal of qDebug() calls]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 12:42:35 -07:00
Dirk Hohndel
21be237b0e Delay loading of some settings until later
This early in init_ui() the settings may not be available, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 11:52:59 -07:00
Dirk Hohndel
6227372c2f Planner: don't show the planner panes by default
With commit 708f19830e ("Planner: New plannerSettingsWidget") we
suddenly started out showing the planner widget. Not useful. So let's
switch us back to the default screen :-)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 09:51:10 -07:00
Dirk Hohndel
69139782df Planner: update tabstop order again
Robert's commit 708f19830e ("Planner: New plannerSettingsWidget")
moved several of the widgets from the maintab area to the new planner
settings widget.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 09:34:58 -07:00
Robert C. Helling
708f19830e Planner: New plannerSettingsWidget
In planner mode, this replaces the globe with the dive plan and introduces
a new plannerSettingsWidget in the diveListPane. All new fields are still
disfunctional. This is WIP.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-12 09:30:46 -07:00
Dirk Hohndel
1644be22ac Add beginning of pretend CCR XML file
Note that we are missing code to write out the new attributes, so saving
this test dive back to a file loses them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 19:03:30 -07:00
Dirk Hohndel
0c8dbc2061 Simplify code
Since trimspace() null terminates the string, we can simply use strdup()
here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 19:02:49 -07:00
Willem Ferguson
a0f5a74847 Provide for a dive_computer_type variable within dc structure
This patch lays the foundation for differentiating
 between open-circuit(OC)dives and rebreather dives
 (CCR). The following were done:
 1) In dive.h add an enum type dive_computer_type
 2) In dive.h add two more fields to the dc structure:
    a) dctype  (an enum field indicating dc type)
    b) no_o2sensor (indicating number of o2 sensors for this dc)
 3) In parse-xml.c add a function trimspace that strips any
    whitespace from a string. This is used by two functions:
    utf8_string as well as by get_dc_type, described below.
    The pointer to buffer is not changed in order to ensure
    consistency when the buffer is freed.
 4) In parse-xml.c add a function get_dc_type. This parses the
    dc_type string from xml and assigns an enum value which will
    later be returned to the function that parses
    the dc variables.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 18:49:28 -07:00
Tomaz Canabrava
6a9c4097c0 Change the QDialog for html export to getExistingFolder
The QDialog for html creates a folder, we need to choose a folder, not a
file. getSaveFileName was wrong. ;p

Fixes #533

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 14:28:19 -07:00
Tomaz Canabrava
c0593662b9 Fix layout of Dive Export
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 14:21:30 -07:00
Tomaz Canabrava
a20b3c192b Fix layout of import CVS
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 14:21:09 -07:00
Dirk Hohndel
79c68367c6 Fix uninitialized memory warning
It's kinda bogus, but since we add it to the Vector, we might as well
initialize all of it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 14:07:57 -07:00
Robert C. Helling
2d7b02726e Have explicit "%s" format strings in printf style statements
Not having a format string that explicitly references the arguments is
considered a potential security issue in code.
This gets rid of a compiler warning that turned into an error on Fedora 21.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 13:58:20 -07:00
Dirk Hohndel
2b59765da3 Allow the user to delete a dive computer from a dive
This can't be the only dive computer, of course. Goes nicely with the
ability to reprder them.

Fixes #551

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 13:56:33 -07:00
Dirk Hohndel
c4aa1f542c Profile: add a flag to force redrawing the profile
This is needed if something has changed that requires a redraw, but the
plotDives() function can't tell (for example when a dive computer has been
deleted and there's now a different DC in the same spot, with the same
number - see next commit).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 13:55:51 -07:00
Dirk Hohndel
397e39eb4f Qmake: make clean failed on Windows cross builds
For some reason the docclean rule wasn't included in the Makefile when
cross building for Windows on Linux. Doing some searching into the issue I
found a much easier way to handle the make clean stage and sidestepped the
actual problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 11:09:24 -07:00
Dirk Hohndel
de6ee1f8a9 ENABLE_PLANNER is obsolete
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 09:38:03 -07:00
Dirk Hohndel
b70c877b3c Deal with some uninitialized variable warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 09:37:12 -07:00
Dirk Hohndel
b42df1dab6 Globe: do a better job detecting double clicks and setting GPS coordinates
For some reasons Marble appears to sometimes not detect double clicks and
call the correct callback. With this commit we manually intercept the
double clocks and route them to the right function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 09:31:01 -07:00
Dirk Hohndel
6ab95af9ac Don't silently ignore suspcious data from libdivecomputer
Otherwise possible bugs in libdivecomputer won't get reported and fixed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 07:15:40 -07:00
Anton Lundin
692ad31ad3 Don't ignore actual diveable mixes
Fist is really obvious. I quite regularly decompress using pure O2.
It's as good a last decompression gas as you get.

The second is a bit harder. There are very few that dive with 80%+ helium
in their mixes but they exist, and there are real weirdos that dive
heliox, so they are actual diveable gases too.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-10 14:55:21 -07:00