Commit graph

822 commits

Author SHA1 Message Date
Maximilian Güntner
04cdfce782 Added a custom widget for tagging dives
A custom tag widget has been added to MainTab.
Tags are seperated by a comma ",". The implementation
supports escaping a comma by using "\,".
While typing, the widget supports the user by suggesting
tags using a QCompleter.

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-11-02 03:37:31 +01:00
Dirk Hohndel
9e63539237 Merge branch 'editMode' of github.com:tcanabrava/subsurface 2013-11-01 11:19:23 -07:00
Tomaz Canabrava
0e96c9f62e Enable undo for the Edit mode on Added Dives.
This enables undo for the edit mode on added dives, it uses the
premade backup to fill the old dive with data. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 14:06:03 -04:00
Tomaz Canabrava
23a193b0d1 Changed the backup implementation of the samples on EditDive.
Changed the backup implementation of the samples on EditDive,
it's way cleaner now what's happening, and it's also better for
the cancel edit.

Next: The Cancel Edit.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 13:45:14 -04:00
Tomaz Canabrava
f7cd3e780c Enable editing a dive that was manually entered.
This patch enables editing a dive that was manually entered,
it doesn't cover dive plans yet because on the plan I need to
figure out what are the 'user-entered' points, and what are
the algorithm point. and I feel lazy. =p

One last thing that's missing is to revert the dive to the
previous condition if the user cancels the edition, currently
canceling and applying ok is the same thing.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 11:48:34 -04:00
Tomaz Canabrava
d9afcdc8cb Code cleanup - Stop calling the same 6 lines everywhere.
There's a method named refreshDisplay, fairly unused, let's
use it a bit mroe.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 09:43:41 -04:00
Tomaz Canabrava
69d4ccae6d Added a new option to edit the dives.
Added a new option to edit the dive in the profile view. The option
will only be visible if the dive was manually entered or if the dive
is a plan.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-11-01 09:33:39 -04:00
Tomaz Canabrava
a7b19b251d Removed Reference to dangling pointer.
We cannot use tr("").toLocal8bit().constData(); on a function
that expects a char* because the object will be deleted on the
next line, so a strdup is necessary.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
2013-10-31 16:50:09 -04:00
Miika Turkia
1a4d098ef2 Add alt based shortcuts to access menus
This adds alt-f shortcut to access file menu as well as other similar
alt based shortcuts for other menu items.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-27 10:58:52 -07:00
Tomaz Canabrava
a4da3004da code cleanup: removed unused function from mainwindow.h
The setupSplitters method was created quite a while ago
to deal with the splitters when I didn't used a more sane
approach. I forgot to delete it back them, removing now.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 23:04:34 -02:00
Tomaz Canabrava
7bea2e1be0 Minimum hooking-up done, divelogs.de shows on menu-activation.
This patch does the hooking up to show the dialog of the
divelogs.de window when the user selects it on the menu.:

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 23:02:59 -02:00
Tomaz Canabrava
6cf875ed92 Reorganized the downlads menu for the inclusion of more webservices.
This patch moves around a few items on the menu to a new submenu
downloads/uploads. I think it's not the best way, but it already
fives a bit more of 'unverbosity', because the old menu had
'Download from Dive Computer', 'Download from Webservices', and
now we would introduce a new 'Download from Divelogs.de'
I tougth it was better to have a 'parent' named 'Download' and
put all children inside. this can grow quite big as soon as I implement
the plugin system for that.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 22:57:43 -02:00
Tomaz Canabrava
216f9212b9 Added the skeleton for the Download / Upload from Divelogs.de
Added the skeleton code for the Download / Upload from Divelogs.
de webservice. Now I need to hoopup things from the .ui side and
do the actual implementation of the code.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 22:52:11 -02:00
Tomaz Canabrava
06ba04ab78 fix the string of the subsurfice webservice on the settings.
The setting was 'webservice', but this is too wide, since we are
supporting more than one. changed it to 'subsurface_webservice_uid'

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 22:39:21 -02:00
Tomaz Canabrava
d2b87e0eb5 Fixed a crash when the user canceled the download from webservice dialog.
Null references, ah, love them.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 22:38:41 -02:00
Tomaz Canabrava
5eb2cc4594 Created a 'WebService' dialog that will handle download and upload.
Created a WebService dialog that will handle download and upload
from all child based webservices. Also, ported the currently - only
- one webservice to use the new dialog.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-24 22:30:21 -02:00
Michael Andreen
695f64a23a Subject: [PATCH] No need to center on dive after editing coordinates.
This is done automatically now.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-24 16:58:05 +01:00
Miika Turkia
3e48511318 Export dives in UDDF format
Implement exporting in UDDF format as was done in Gtk version. File menu
exports all the dives, right click on selection exports the selected
ones.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-20 15:26:02 +02:00
Thiago Macieira
f22065874b Remove the "in C" part about Subsurface's description
It's not written purely in C anymore. There's quite a lot of C++ now,
not to mention Perl, XSLT, shell scripting, etc. :-)

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 20:28:22 -07:00
Dirk Hohndel
75a004d44a Some adjustments to "save as"
The popup menu entries should be all lowercase.
Also we should handle this the same as regular save and open when it comes
to remembering the last path.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 20:26:38 -07:00
Tomaz Canabrava
ed28628449 Added 'Save As' option on the dive list menu.
This adds the 'Save As' option on the dive list,
very straigth forward, just simple and beauty.
tested and working.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 20:19:50 -07:00
Dirk Hohndel
8259b1a59a Implement hook up autogroup menu
This tracks the autogroup state remembered in data files. Toggling the
checkable menu item causes the divelist to be marked as changed. This
might actually be untrue - but that's really hard to track so this is the
"better safe than sorry" approach.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 16:30:32 -07:00
Dirk Hohndel
8f623c2c72 Fix marble losting track of zoom level
Marble had a bug on the way it treats zoom level, there's
no way for it to find out if it's user-input or algorithm input
and when a user clicks on a dive, it spins and centers on it,
but if the user clicks on another dive when it's still spinning,
it will get the zoom in the actual state ( spinning, usually zoom
is far away from the first position ) and continue the spin to the
other position.

This patch works by saving the first location and triggering a
helper function with a timer that will only update the zoom level
if the timer is not active ( and thus, will not get the bugged
zoom state set by the animation. ).

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 15:00:22 -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
Anton Lundin
437246d3ed Move sac-calculation to profile.c
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 14:54:11 -07:00
Lubomir I. Ivanov
861b524e7a Helpers: move some date related function to qt-gui.cpp
divelist.c:
get_dive_date_string()
get_short_dive_date_string()
get_trip_date_string()

MinGW support for *printf and parameter positions (e.g. %1$d)
is horribly broken. Instead of implementing *proper* support
for this feature Microsoft decide to ignore the standard (again)
and they implement new functions with the '_p' suffix,
such as 'sprintf_p', which seem to be available from a 2003 runtime.
To top that 'sprintf_p' is not really a 'sprintf' but rather
a 'snprintf'.

It seems that the MinGW people ignore the issue and do not provide
wrappers of any sort, or at least for the current recommended compiler
for Qt 4.8.5 on Windows - which is a 4.4.0. A note of warning;
inspecting how MinGW does certain things in headers such as stdio.h,
can ensue bad dreams or other negative effects on to the viewer.

This forces us to move the following functions from the 'back-end'
(divelist.c) to the 'front-end' (qt-gui.cpp) and use QString.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-16 15:04:44 -07:00
Miika Turkia
4c49670cdb GUI for CSV import
This patch implements GUI for importing CSV log files. One is able to
configure what columns contain time, depth and temperature fields.
Pre-configured log applications currently included are ADP log viewer
and XP5. (Both of these use actually tab as separator, so the field
separator currently hard-coded.)

[Dirk Hohndel: minor fixes]

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-16 12:44:07 -07:00
Patrick Valsecchi
4f23ff144f Prettier printing
Going through pixmaps for the profile was not needed and was making our prints
look very pixelated.

In Qt4, QWidget child classes are printed as bitmaps. So appart from
changing the code to print the tables to use a QGraphicsView instead,
there is nothing we can do, so the rest of the printing is still done as bitmaps.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-16 07:02:06 -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
Tomaz Canabrava
22afca58bf Fixed the moving around of the InfoPanel on non KDE enviroments.
This patch restores the ability to move the info-overlay panel on the
profile. For some reason the eventFilter wasn't working (and actually,
looking at the code, it really shouldn't, because I didn't see where I set
it to work, maybe someone (me) broke it a long time ago) well, it seems
fixed now at least. :)

Tested on XFCE, Gnome and KDE, with three different window managers.

[Dirk Hohndel: removed debug output]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 19:40:16 -07:00
Robert Helling
c59d594e00 Printing adjustments
Add units to the SAC in the print-out, reduce max depth in metric to one
decimal place, and leave some more characters of the notes to be printed..

Signed-off-by: Robert C. Helling <helling@atdotde.de
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 10:34:40 -07:00
Dirk Hohndel
252caeea1c Fix stupid editing error
Don't do "obvious cleanups" at 4 in the morning when you can't sleep because
of emotionally draining issues outside of your control... and if you do,
at least compile test them.

This was introduced by me in commit 2f9f46cb0253 ("Random white space
cleanup").

Sorry.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 10:25:53 -07:00
Tomaz Canabrava
34f2a5ecc7 Fixed the Tab behavior on the QCombobox Delegate
This Patch fixes the tab behavior on the QComboBox
delegate. For a QComboBox, tab was being treated as
'cancel' action on edit, but since it will send a
editingFinished() signal, and the Qt::Key_Return
will also send a editingFinished() signal, I couldn't
use that method and had to do a little hack around it.

The code is mostly clean and works.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 09:49:12 -07:00
Dirk Hohndel
6ccb541f1d Random white space cleanup
Because I can.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 04:37:31 -07:00
Lubomir I. Ivanov
2ec6303f50 printlayout.cpp: Remove convertPixmapToGrayscale()
Function is redundant as we should only render the profile
with a custom color table.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 04:24:27 -07:00
Lubomir I. Ivanov
2b98d28980 printdialog: Remove the pre-set DPI and some comments
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 04:24:15 -07:00
Lubomir I. Ivanov
005f8ecf83 profilegraphics.cpp: Use text sizes in plot_text()
Make the active font (fnt) use the 'size' member of the received
text_render_options_t. This allows changing the size of
certain text elements.

For the moment most text elements are set to 12px.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 04:24:02 -07:00
Lubomir I. Ivanov
88b1e09dee printlayout.cpp: Increase the font size in tables bellow profile
Because of varying font (screen) DPI we use pixel sized fonts
when printing. Apparently 8px does not look that good on Windows
default fonts, but kinda OK on Linux. We compensate by
increasing the font size and table rows to 9px.

Also decrease the padding between the table and profile to 5px.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 04:23:56 -07:00
Lubomir I. Ivanov
f818ece074 graphicsview-common.cpp: Add more contrast to certain B/W colors
There was a report that the depth and time texts were small
and require more contrast on the B/W print. Use BLACK1 for these.

Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 04:23:43 -07:00
Lubomir I. Ivanov
7861103139 Print: remove profile border when printing
Custom widget frame styles such as 'Sunken' and 'Raised' which seem to
varry between OS will be captured as well:
http://harmattan-dev.nokia.com/docs/library/html/qt4/qframe.html#Shape-enum

So instead we temporarily set the profile frame to QFrame::NoFrame and
then restore it to the previous value.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-14 13:15:58 -07:00
Miika Turkia
080b1bcc5a Enable file selection dialog for preferences
This enabled a file selection dialog for selecting default log file
under the preferences.

[Dirk Hohndel: added missing declaration to .h file]

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-14 13:14:09 -07:00
Patrick Valsecchi
291ce1d9ac Fix the DC ceiling in the profile.
entry->ndl is computed and therefore should not be used for showing
the DC's ceiling. That made the DC ceiling jump to 0m when the computed
celing was at 0.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-14 12:30:32 -07:00
Lubomir I. Ivanov
a2a93ff04b Models: fix two potential crashes
CylinderModels::setDive() and WeightModel::setDive() have
potential to pass the 'last' argument to beginInsertRows() as
a negative number which triggers an assert that 'last' cannot
be smaller than 'first'.

Patch attempts to fix that by only calling beginInsertRows()
when there is at least one row to insert.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-13 11:31:25 -07:00
Tim Wootton
a014fb1099 Adds missing "EndPress" column header for cylinder table
The end pressure was appearing in the column headed "O2"

Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-13 11:30:56 -07:00
Dirk Hohndel
f5fbbfddb2 Fix uninitialized variable
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-13 11:30:36 -07:00
Linus Torvalds
58b668c714 Fix dive planner sidebar depth units
The dive planner always showed the depth in our internal units, ie
millimeter, in the sidebar that showed the plan points.

That made little sense in metric mode, and none at all in imperial. The
_graph_ showed things in meter and feet.

So make the DivePlannerPointsModel always convert things to and from the
user units.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11 20:26:28 -07:00
Anton Lundin
dd3b8210a9 Remove unused arg in plot_cylinder_pressure
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11 10:18:07 -07:00
Tomaz Canabrava
beb40ae494 Finish clearing up the TableModels
There are other models ( Tree Models and Model Items
) that are not affected by this commits, this is
already a good cleanup but it can be extended
to also fix those two other possibilities.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-11 11:42:33 -03:00
Tomaz Canabrava
fac316865c Another Model Cleanup
Conversion of the WSInfoModel, that populates the list
of weigthsystems in the Equipment tab.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-11 11:13:16 -03:00
Tomaz Canabrava
a4efa8c444 Second model converted to be less boilerplated.
Second model converted to be less boilerplated,
there are right now 7 models that will need to
be ported. each model can remove around 30 to 40
LOC, so this is not such a bigger improvement,
but it's an 'keeping an eye on the future'.

Also fixed a bug where the returned value was dummy.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-11 11:04:27 -03:00
Tomaz Canabrava
26c87fafc2 Begin to Cleanup the Models, trying to reduce boilerplate.
The Model View system in Qt is *very* verbose, this is the
beginning of a series of patches that will concentrate
the boilerplate somewhere and reduce the amount of lines
and will also try to make the code cleaner and easyer to
understand,

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-11 10:50:40 -03:00
Tomaz Canabrava
1b9a4f2bf8 Good deal of whitespace fixes and code cleanup.
I just went thru all of subsurface code removing
some whitespaces issues and trying to make the
code prettyer, I also removed a few QString issues.d

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-11 10:21:04 -03:00
Patrick Valsecchi
1dccf84c67 Added salinity to the Dive Info tab.
Took the opportunity to remove some copy&paste.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
2013-10-10 07:11:32 -07:00
Patrick Valsecchi
c5a15c6a45 Fixed mix of spaces and tabs in maintab.ui
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
2013-10-10 07:11:18 -07:00
Dirk Hohndel
c74b286e70 Fix potential uninitialized variable
Most of the "possibly unitialized" warnings are bogus, but this one is a
potential real bug.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09 00:15:46 -07:00
Dirk Hohndel
8e8a631cbc Fix crash when cancelling 'Add Dive'
If selected_dive is -1 get_dive(selected_dive) will return NULL.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-08 23:24:44 -07:00
Thiago Macieira
00eba99039 Compile without depending on the global MAX macro
There's a C++ way for it. And, for some reason, it wasn't defined on my
MinGW build:

qt-ui/profilegraphics.cpp:1006:57: error: 'MAX' was not declared in this sscope

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 16:57:54 -07:00
Dirk Hohndel
054406b420 Remove even more code and declarations
There's lots more stuff that can go.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 13:43:17 -07:00
Dirk Hohndel
90b0f75d40 Remove info.c/info.h
The one remaining helper function in there was moved to maintab.cpp (which
was the one remaining user).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 11:48:14 -07:00
Lubomir I. Ivanov
edd2db6886 Print: allow optional table on top of profile
Patch enables the 'Profile on top' / 'Notes on top'
functionality in the print options dialog.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 09:29:40 -07:00
Benjamin
47ca630cc2 Maximum depth of a dive/a series of dives is not show correctly
After selecting a dive or a series of dives, the "Stats" tab shows the
minimum, average and maximum stats for the selected dives. The "Depth"
section does not display the correct value for the maximum depth.

Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07 09:22:16 -07:00
Dirk Hohndel
b3490213f4 Merge branch 'glib-removal-hack'
Fix obvious merge issue in Rules.mk

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06 10:57:16 -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
2c4ccc04bd Parse GPS text in C++ and re-implement GPS changed check
This is SO MUCH easier then the convoluted and fragile C / glib code it
replaces.

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
Robert C. Helling
05eabae62a Modify the dialog text for the question to make more sense.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-05 19:48:39 -07:00
Benjamin
ae713763c7 Add a helper function to calculate weight display string
Add a helper function to unify the calculation of the
weight display string, instead of having the same calculation
in two places in the code.

Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04 11:57:28 -07:00
Dirk Hohndel
f63605e02e Merge branch 'bugfixes' of git://github.com/tcanabrava/subsurface 2013-10-04 11:12:11 -07:00
Tomaz Canabrava
834800a179 Fix display sane values on subsurface at first time opening.
This patch fixes some unsane values that was being retrieved
by the ui-files on first time opening. it creates a basic layout
of the application using the current desktop size.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-04 15:07:36 -03:00
Tomaz Canabrava
3c97cc5b6a Fix showing all columns by default on first run.
Some columns are a nice addition, but not a must have,
and thus are hidden-by-default, uncluttering the user interface.

This was discussed with a few designers before writting the code,
and also discussed with dirk on irc.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-04 14:28:49 -03:00
Patrick Valsecchi
36c28089db Added the .ssrf extension to the open dialog filter.
Fixes #205

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04 09:46:26 -07:00
Benjamin
fb5ae28865 Correct spelling of "weight" throughout the code.
"Weight" was misspelled "weigth" in several places in the code
and comments.

Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04 09:40:56 -07:00
Benjamin
9961cf13b1 Use the same conversion grams->lbs in dive and equipment list
Subsurface stores weight values in grams. When displaying lbs,
the dive list was not rounding the converted weights up, but
rather truncating the value at the decimal place. The equipment
list was rounding the converted weights up. This gave two
different displayed values for the same weight value.

Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04 09:40:05 -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
Patrick Valsecchi
c28fe00bfe Added configuration options for vertical speed units.
Some people (free divers) are loving ft/s or m/s units for vertical speeds.
Now they can choose between /min or /s in the configuration (only Qt UI).

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-04 09:16:39 -07:00
Tomaz Canabrava
a5b351ed72 Fixed First run of subsurface - Start on Fullscreen.
For a new installation, subsurface will now start on fullscreen,
this fixes the bug where subsurface would start using the interface
file ( mainwindow.ui ) configured size, and that silly monster
always changes when editing something.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-10-04 12:28:40 -03:00
Tomaz Canabrava
7bd43bfaaf Fix the first load of Subsurface - "File not found" error.
The first time the user loads subsurface, the default_filename
is not configured yet, but yet the software tries to load "",
sending an error message that this file doesn't exists.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Taiane Ramos <exhora.tat@gmail.com>
2013-10-04 12:12:46 -03:00
Thiago Macieira
b3b729e629 Partially revert 7a368ab06b
If we #include "qt-ui/ui_anything" from anywhere, the Makefile rules
will blow up.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 15:45:06 -07:00
Anton Lundin
d53d00db02 Lookup gas via the plot_data, not the event
When straight decoding the event, it failed to handle older
SAMPLE_EVENT_GASCHANGE(11), the ones without he-part correctly. This was
shown clearly when it printed the 21/35 in dives/test20.xml as air.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 13:49:06 -07:00
Thiago Macieira
ad52301ca7 Turn off Qt including the C++ Standard Library headers
We don't use any of the Standard Library features or classes in
Subsurface, except for three uses of std::sort, for which I added the
necessary #include.

It's always a good idea to include directly the headers you want,
without relying on indirect inclusion

On my machine, the build time dropped from 16.96s to 13.38s or a 12%
improvement.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 13:47:24 -07:00
Dirk Hohndel
7a368ab06b Better fix for the compile problems
Still don't like the order dependency - but at least this seems to work
and correctly build after make confclean.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 13:21:36 -07:00
Thiago Macieira
8e81d3f100 Make the classes generated by uic be real members of our classes
This means we don't have to new/delete them, which is a waste of
overhead.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 12:13:48 -07:00
Thiago Macieira
f0f76056ac Include the ui_*.h headers in the main headers.
This means we can also remove the forward declarations.

This is the first step in removing the memory allocation for the ui
sub-classes. Without the second step, this commit is just making the
compilation time increase for no good reason :-)

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 12:13:15 -07:00
Lubomir I. Ivanov
c79def40b1 Print: small adjustments to table printing
PrintLayout::printTable():
- hide the QTableView widget border using a stylesheet
- add a guard to fix the last column extending post the page width
due to rounding
- use 1 extra pixel instead of 2 when grabbing the page region

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 09:39:16 -07:00
Lubomir I. Ivanov
e727b899a6 Print: provide means to print profile tables
This patch adds a couple of classes and some other modifications
in PrintLayout that handle the printing of tables under a profile.

models.h : ProfilePrintModel
The class uses a 'struct *dive' to output all required data
for a certain dive at specific rows and columns. It also handles
font formatting and text alignment.

modeldelagatates.h : ProfilePrintDelegate
The class is used only for drawing a custom grid for profile tables.

PrintLayout::createProfileTable()
The function is used to create and setup the profile table object

PrintLayout::printProfileDives()
The function now has correct padding of dive profiles on a page
and also the printing of actual tables below them.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 09:38:37 -07:00
Lubomir I. Ivanov
374f3d0de6 Profile: use a 10px font when printing profile text
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-03 09:38:26 -07:00
Patrick Valsecchi
adefc8805a 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>
2013-10-01 09:50:43 -07:00
Patrick Valsecchi
f02b5e5d90 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>
2013-10-01 09:49:41 -07:00
Patrick Valsecchi
413f649ad8 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>
2013-10-01 09:47:33 -07:00
Dirk Hohndel
ff0b2745a7 Merge branch 'toolbar-ruler-rb' of github.com:mguentner/subsurface 2013-09-27 10:03:13 -07:00
Maximilian Güntner
a3ce871e0a 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>
2013-09-27 18:45:07 +02:00
Maximilian Güntner
88172571ca 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>
2013-09-27 18:45:04 +02:00
Maximilian Güntner
248f1b86d1 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>
2013-09-27 18:42:19 +02:00
Maximilian Güntner
3312c9a3a4 implemented zoom action
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
2013-09-27 18:37:53 +02:00
Maximilian Güntner
59736a9d96 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>
2013-09-27 18:37:53 +02:00
Lubomir I. Ivanov
df8107830e 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>
2013-09-27 09:29:30 -07:00
Tomaz Canabrava
e81bbc1dab 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>
2013-09-27 09:22:19 -07:00
Tomaz Canabrava
d629321799 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>
2013-09-26 20:35:30 -03:00
Tomaz Canabrava
b036a318c6 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>
2013-09-26 19:59:58 -03:00
Tomaz Canabrava
098aa6343b 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>
2013-09-26 18:14:09 -03:00