Commit graph

26 commits

Author SHA1 Message Date
Gehad Elrobey
8380f09619 Renaming the prefs struct members to be consistent with the QSettings.
-Renaming prefs members for consistency.
-Changing references of QSettings to the prefs structure instead.
-Removing unused functions in pref.h were left over from an old version.
-Changing the data-type of bool members to short for consistency with other members.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-16 13:09:55 -07:00
Gehad elrobey
cdf83f5ef6 Change some references of QSettings to the pref struct.
After adding the animation member in the preference struct, it is
very resonable to change these references of QSettings to the
preference structure instead.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-11 07:21:15 -07:00
Lakshman
6a8d929876 Feature to show or hide heart rate graph
Adds new push button "HR" to the button bar on the dive profile to
toggle display of heart rate.

TODO: New icon for the heart rate button is needed.

Fixes #485

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-10 09:21:43 -07:00
Lakshman
ecc8c1d995 Remove check option to show units in text label
Currently the feature to show temperature units while adding dive is
provided through checkbox in preferences->units section. This patch
disables this checkbox and always enables this feature.

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-05 13:27:53 -07:00
Lakshman
7696fbf9cd Toggle showing average depth
Add additional check box in "preferences->graph" section that allows
users to hide average depth on dive profile.
By default this option is checked to show average depth.

Fixes #475

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-28 09:38:08 -07:00
Lubomir I. Ivanov
74ed786d75 Add optional Win32 console allocation
This patch adds the optional --win32console command line option.
It does nothing on OSx and Linux, while is only useable on Win32.

On Win32 if the application was built as GUI (not console),
there is no way to view stdout and stderr. With windows.c's
subsurface_console_init() we are able to either redirect
stdout and stderr to the terminal from which subsurface.exe
was started (always happens; --win32console does nothing in
this case) or if --win32console is explicitly added to
a shortcut, create a dedicated console window and monitor
the output there.

if set, WIN32_CONSOLE_APP is a condition that will make the
subsurface_console_init() and subsurface_console_exit()
functions NOP on Windows. The definition will be created if
the user passes 'CONFIG += console' to qmake.

Fixes #436

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-25 07:57:27 -07:00
Anton Lundin
9cfc585563 Fix system default font handling
We didn't care about system default fonts and sizes, we just used the Qt
default font.

Due to how QFont is constructed, there was need to split font and font
size.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-21 21:30:39 -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
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
Danilo Cesar Lemes de Paula
5846ff972d Fixing default font on preference window
Default font was hardcoded as 14.
What happen if you change any other preference value is that the
application would start to use fontSize=14.

This commit loads the right value in the QDoubleSpinBox

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-26 11:51:33 -08:00
Anton Lundin
33391a77e9 Convert the C code to using stdbool and true/false
Earlier we converted the C++ code to using true/false, and this converts
the C code to using the same style.

We already depended on stdbool.h in subsurfacestartup.[ch], and we build
with -std=gnu99 so nobody could build subsurface without a c99 compiler.

[Dirk Hohndel: small change suggested by Thiago Macieira: don't include
               stdbool.h for C++]

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 09:34:50 +07:00
Dirk Hohndel
23973e8abd Don't show tanks that aren't used during a dive
Some dive computers will always download all tanks that they store, not
just the ones used in a dive. Most people only want to see the tanks that
they actually used during the dive (and for the others there's an option
to go back to the old behavior, just in case).

All this is only in memory / during runtime. If the dive computer provided
the extra data we will not throw it away.

Fixes #373

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11 22:02:35 +07:00
Patrick Valsecchi
fe2eabf375 Added a configuration option to have gf_low apply at max depth instead of at deepest ceiling.
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Patrick Valsecchi
4c4a7a6d96 Refactoring of the configuration handling.
Before, when clicking the OK button on the preferences GUI, we were
updating in-memory preferences from the GUI, saving them to the
configuration file from the GUI, reloading from the file to the
in-memory preferences. Then, to add to the ducplication, when the
application was exiting, some fields were saved again.
Basically the first step and the last step were useless appart from
the fact the the other steps where missing a few fields here and there.

This patch removes the first step and fixes the missing fields.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
ACKed-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Anton Lundin
2d8cd44370 Make the info box look as it did in 3.1
In the Gtk version there were no option to disable the showing of time
in the mouse over, so this removes that option to limit the amount of
clutter in the settings panel.

This also renames the time and temperature to match the names they used
to have. T -> @, Temp -> T

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 06:06:57 +09:00
Anton Lundin
4bb8368a20 Introduce an on/off switch for calculating ndl/tts
Let the user choose if the calculation of ndl and tts is worth the time
it takes.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 11:55:19 +09:00
Linus Torvalds
58fa613236 Speed up XML loading
This tries to speed up XML loading for large XML files (and thus
subsurface startup times) by trimming the fat off our own matching code.

The actual libxml overhead (particularly string allocation) tends to be
the dominant part, so this only speeds up a big load by about 12% for me,
but hey, it can be noticeable. Dirk's example nasty 175MB xml file with
~5200 dives takes "only' 7.7 seconds to load, when it used to take 8.8s.
And that's on a fast machine.

For smaller xml files, the dynamic loading costs etc startup costs tend to
be big enough that the xml parsing costs aren't as noticeable.

Aside from switching the node names around to "little endian" (ie least
significant name first) format to avoid some unnecessary strlen() calls,
this makes the nodename generation use a non-locale 'tolower()', and only
decodes up to two levels of names (since that's the maximum we ever match
against anyway).

It also introduces a "-q" argument to make startup timing easier. Passing
in "-q" just makes subsurface quit imediately after doing all necessary
startup code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-02 12:51:32 -07:00
Anton Lundin
579d1cb915 Show SAC in the mouseover.
This is really nice to have when looking at specific parts of a dive.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 14:56:52 -07:00
Dirk Hohndel
f96299ea94 Dependencies are too aggressive for version.h
Apparently qmake can't tell that #include "version.h" and #include
"libdivecomputer/version.h" are not the same thing. Instead of spending
another bunch of hours on fixing the buildsystem I decided to just cleanup
the spots where we actually use the version file and rename it to
ssrf-version.h.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 19:54:15 -07:00
Dirk Hohndel
193d20c479 Next step towards working translations
This may seem like a really odd change - but with this change the Qt tools
can correctly parse the C files (and qt-gui.cpp) and get the context for
the translatable strings right.

It's not super-pretty (I'll admit that _("string literal") is much easier
on the eye than translate("gettextFromC", "string literal") ) but I think
this will be the price of success.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 22:51:59 -07:00
Dirk Hohndel
34db6dc2be Delete code and files that are no longer used
Most of this is Gtk related, some of it is helpers that we don't need
anymore. I love the diffstat.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 17:32:50 -07:00
Dirk Hohndel
4d3e74a236 Trying to switch to Qt translation
This compiles and looks about right, but it doesn't appear to work, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 10:42:32 -07:00
Dirk Hohndel
4b12f28ca4 First steps towards removing glib dependencies
- remove the build flags and libraries from the Makefile / Configure.mk
- remove the glib types (gboolean, gchar, gint64, gint)
- comment out / hack around gettext
- replace the glib file helper functions
- replace g_ascii_strtod
- replace g_build_filename
- use environment variables instead of g_get_home_dir() & g_get_user_name()
- comment out GPS string parsing (uses glib utf8 macros)

This needs massive cleanup, but it's a snapshot of what I have right now, in
case people want to look at it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 10:41:44 -07:00
Tomaz Canabrava
30bee57b60 Code Cleanup - Uneeded preferences stored at the old prefs setting
Those preferences removed ( basically the ones about visibility of
the List View of the Table ) are now managed by the Qt Settings
system, and thus there's no need to have them there. wich gave us
a pretty good cleanup.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-04 13:17:37 -03:00
Anton Lundin
7d9c1e9ee4 Show sample time in the mouseover.
This is really nice to have when looking at specific coutures of a dive
or events.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-18 11:59:53 -05:00
Tomaz Canabrava
96d1cc570e Use the same code for command line and gui for file handling.
The Command line execution of Subsurface happened before the
GUI was created, this leaded to various bugs by me(tm) over
time. This patch seems to fix all of those, by reusing the
same code for GUI interaction and CommandLine interaction.

I had to rework how the main.c worked, it used to be C code
calling C++ code, and this is non desirable, since C doesn't
really understand C++.

I Moved all of C-related code to 'subsurfacestartup.c/h' and
created a tiny wrapper to call it, so all of the C code is still
C code, and the new main.cpp calls the mainwindow->loadFiles and
mainWindow->importFiles to get rid of the bugs that happened before.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-09 05:59:03 -03:00
Renamed from main.c (Browse further)