Commit graph

4254 commits

Author SHA1 Message Date
Linus Torvalds
50424df653 Use 'struct membuffer' for profile info string generation
The profile info was generated using nasty string concatenation that the
membuffers are much better at anyway.  And membuffers don't need those
arbitrarily sized fixed buffers (500 bytes? Why 500 bytes?).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 07:03:27 -08:00
Linus Torvalds
77da20196f Clean up membuffer internal structure names, add strip function
The "size" member was confusing - it's the size of the allocation, not
the size of the current string.  The size of the current string is the
member called "used".

This naming makes perfect sense for the internal implementation, but
it's confusing to users who actually do want to get the size of the
resulting string at the end.

So rename the fields to "alloc" and "len" - which is pretty clear.

This also adds a helper function to strip whitespace from the end:
"strip_mb()".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 07:03:25 -08:00
Linus Torvalds
22f66501ac Add support for heartrate and bearing information in samples
libdivecomputer already supports this, but we didn't save it.

Tested-by: Oscar Isoz <jan.oscar.isoz@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10 07:03:24 -08:00
Boris Barbulovski
b88958ded5 mainwindow.cpp improvements
* Add missing variable members to the initializer lists.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
359ea75516 maintab.cpp improvements.
* Initialize(lazy) MainTab::multiEditEquipmentPlaceholder struct

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
e88c198b93 globe.cpp improvements
* Add missing variable members to the initializer lists.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
18207c9189 downloadfromdivecomputer.cpp improvements
* Add missing variable members to the initializer lists.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
d48910b711 more diveplanner.cpp improvements
* Move variable members construction to the initializer lists.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
9ffb459ff3 diveplanner.cpp improvements
* Add missing variable members to the initializer lists.
* Add *lazy* structure initializations.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
1d871eb749 ProfileWidget2 class improvements
* Reorder ProfileWidget2 class constructor initialize list.
* Initialize(lazy) ProfileWidget2::plotInfo structure.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
8bb5cd6012 ToolTipItem class improvements
* Initialize every ToolTipItem variable member in initialize list.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
9b84f82160 DiveTextItem improvements
* Add colorIndex to initialize list.
* Reorder initialize to correct order.

Note: colorIndex initialize value is set too SAC_DEFAULT. I do not know
what is the rigth value since this variable member is not used anywhere.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:06 -08:00
Boris Barbulovski
6a6fe045b4 diveprofileitem.cpp improvements
* Initialize/construct all variable members in constructor list.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:06 -08:00
Boris Barbulovski
38f0104d10 DivePlotDataModel improvements
* Add missing improvements::diveId variable member to the initialize list.
* Cleanup DivePlotDataModel::pInfo structure instead only one member.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:06 -08:00
Boris Barbulovski
6ae870bd22 Initialize variable members in DiveCartesianAxis class.
* Initialize variable members in DiveCartesianAxis class.

Note: Initialized values I put needs to be doublechecked.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:06 -08:00
Boris Barbulovski
d120e861cb Indent fix
* Fix tagwidget.h indent.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:06 -08:00
Boris Barbulovski
76203abcb8 DivelogsDeWebServices class cleanup
* Initialize DivelogsDeWebServices::uploadMode in initialize list, instead
  of constructor body expression.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:06 -08:00
Boris Barbulovski
bbac1438cf DiveListView tiny cleanup
* Change 'searchBox' member type from 'QLineEdit *' to 'QLineEdit'

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:06 -08:00
Boris Barbulovski
2d3e48f4ae diveplanner.cpp cleanup
* Add missing DivePlannerPointsModel::tempDive to the constructor
  initialize list.
* ExpanderGraphics class: Construct pointer-variable members into
  initialize list,

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:41:49 -08:00
Boris Barbulovski
9eb47602dd Cleanup SubsurfaceWebServices class
* Remove statuic SubsurfaceWebServices::instance() member.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:04:37 -08:00
Lubomir I. Ivanov
a8823c1793 parse-xml.c: Fix a warning about missing braces
warning: suggest explicit braces to avoid ambiguous 'else'

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:03:57 -08:00
Boris Barbulovski
7c4c0802dc PrintDialog small improvements.
* Remove closeClicked() slot, and use QDialogs accept() slot
* Simplify QObject::connect call by removing the QObject scope.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 08:20:17 -08:00
Boris Barbulovski
aeaa050306 ShiftImageTimesDialog class cleanup.
* Remove static ShiftImageTimesDialog::instance() method
* Add ShiftImageTimesDialog::amount() member

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 08:19:38 -08:00
Boris Barbulovski
449c6fc6f2 DownloadFromDCWidget class cleanup
Remove static DownloadFromDCWidget::instance() method

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 08:17:08 -08:00
Boris Barbulovski
02e9a6d07b PrintDialog class cleanup.
* Remove static PrintDialog::instance() method
* Remove void PrintDialog::runDialog() method
* construct/destruct print dialog on demand

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 08:15:42 -08:00
Dirk Hohndel
3086741d49 Remove the graph options from the Preferences
All of these are now set from the toolbar next to the new profile. This
removes functionality for people using the old profile, but as we will rip
that out and switch to the new profile, soon, that seems an acceptable
side effect.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 14:29:40 -08:00
Michael Andreen
753ebc8ed4 Load preferences before they are saved.
Load all the settings in the PreferenceDialog constructor. Previously
all the settings were overwritten with default values the first time
PreferencesDialog::syncSettings() was called.

Signed-off-by: Michael Andreen <harv@ruin.nu>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 09:08:48 -08:00
Dirk Hohndel
2a3a1c1b41 Long over-due change to the About text
Giving Tomaz the credit he deserves.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 08:19:37 -08:00
Boris Barbulovski
3161114106 SubsurfaceAbout class cleanup.
Main change is that now SubsurfaceAbout doesn't have instance object, but
it constructs and destructs dynamically.

 * Remove the static SubsurfaceAbout::instance() class member
 * construct/destruct about dialog on demand
 * Other small aboutbox cleanups.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
ACK-ed-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 08:00:27 -08:00
Tomaz Canabrava
39a11d7092 Fix placement of notification area and dive computer name.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:22:42 -08:00
Tomaz Canabrava
cacf5b3b24 Fix the rest of item visibilities and a few alignment fixes.
Every item is now back on the profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:22:30 -08:00
Tomaz Canabrava
c05575e103 Re-enable more items on the new profile.
Temperature and DC Label.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:22:17 -08:00
Tomaz Canabrava
4882336315 Partial pressures and cylinder pressure back on profile.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:21:50 -08:00
Tomaz Canabrava
7fbeb71dce Remove code that was unused.
Ancient code that was unused and only adding complexity to the
DiveCartesianAxis.

Also remove the spacing between the text and the lines of the Axis.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:21:28 -08:00
Tomaz Canabrava
0ad2a69c42 Show the profile again.
This patch re-enables a few items on the profile, most notably, the
profile itself.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:21:13 -08:00
Tomaz Canabrava
ed72aabde5 Fix time and half of depth lines.
Comment out most of the items on the profile since they are
currently completely broken ( positioning, etc ).

Also, remove the settingsChanged stuff from the DepthAxis because it
doesn't have the shrinked / expanded size on it ( it sits on the profile
code ) so I'll most probably move that to the profile settingsChanged in
the future - or if anyone knows of a better place to have this, I'm all
ears.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:20:18 -08:00
Tomaz Canabrava
266daa326d Start the profile state
The setup of the item positions for the profile state should be done here.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:19:58 -08:00
Tomaz Canabrava
d66e4b5236 Fix the 'Empty' profile state that was broken for ages.
Show a nice poster that Luisa did for Subsurface ( we have a few other
options that I'm waiting her to send. )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:18:40 -08:00
Tomaz Canabrava
86bc3bd58f Start to make things sane again...
Change the 'namespace ItemPos' declared on the commit before this one to a
struct that will have all the 'on canvas' and 'off canvas' positions and
representations of all items, so we know where to change.

Also remove the remaining stuff from planer that was going to exist on
this profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:18:12 -08:00
Tomaz Canabrava
9756be59aa Remove duplicated additem
This addItem was being called twice, and a warning that the item was
already in the scene was annoying me.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:17:04 -08:00
Tomaz Canabrava
9cf6b2be6b Break everything to make it correct next time.
This commit breaks the whole new profile. <3
The problem with the old code is that I was using the QStateMachine
and I just got tired of it. I will implement a much-simpler state
machine to do what I want instead of hitting my head on the wall
to understand how that was supposed to work.

This commit also adds a few helper methods to simplify the understanding
of the constructor and tries to make the logic a bit better. No graphics
are being show right now. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:16:16 -08:00
Tomaz Canabrava
6de9b329d1 Huge code cleanup.
This patch starts the cleanup that will take a few iterations to finish.
The current profile code uses QStateMachine, and it's much too verbose
for something we can do with less than a third of its lines of code.

I also added on the beginning of the redesign of the profile code for
planner, edit and a few other things that are going to be ported to
the new profile in the future, but not currently - I just lack the time
to make that work for the next release.

This commit basically:
 - moves all 'new' calls to the initializer-list
 - create a new 'setupItem' private method to concentrate the calls
   that any item will do

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:14:50 -08:00
Miika Turkia
361f8ede76 Check XML attribute to detect correct XSLT
Very few dive log files can be identified by the name of the root
element in the XML log. As same element names are used between different
software, we need to use attributes as well to identify correct XSLT to
convert the log to Subsurface format. I would not be surprised if at
some point we'll just have to present a dialog to the user and ask which
software is in use...but this is enough for now.

This also adds the shearwater.xslt to the list.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:12:35 -08:00
Miika Turkia
0ac8ab3070 Add support for Shearwater Desktop XML logs
Fixes #342

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:12:18 -08:00
Dirk Hohndel
f7bb377287 User manual: update html file shipped with git repository
Every once in a while I need to update this so people building from source
who don't have asciidoc installed still have a reasonably current manual.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-07 06:53:01 -08:00
Willem Ferguson
cb7a87faef User manual: reorganize text on importing from other dive log software
Change and shorten in some places the section dealing with data import
from foreign software.

Create Appendix C, containing information on data export from foreign
packages.

Signed-off-by: Willem Ferguson <willem@willem-Precision-M4700.(none)>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-07 06:46:51 -08:00
Tomaz Canabrava
677e75fbe4 Process events just after starting the StateMachine
This is needed because of a braindead issue on the Qt event
loop:

http://stackoverflow.com/questions/10059721/qt-qstatemachine-sync-problems-initial-state-not-set-on-started-signali

For the "event 1" to be received, the machine must already be
in a state that react to that signal. Even it was a queued
connection, the slot would be queued but only after the signal
 was received, which it isn't since there is no connection
yet at that point.

To solve your problem, you can wait for the machine is in
"state A" before emitting the signal:

machine->start();
qApp->processEvents();

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 11:32:44 -08:00
Tomaz Canabrava
49f8456ce8 Remove a lot of unused code.
This will probably be added back in the future, but for now
they have no use and it was making me nauseaus.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 11:32:32 -08:00
Tomaz Canabrava
2322fdfc42 Load options as soon as the progrm starts
Populate the status of the profile tool box as soon as the program
starts.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 11:32:11 -08:00
Tomaz Canabrava
185b7a454a Save the old pref system when changing the new one
Since we have now a mix of old / new prefs, remember
to change both when we alter something.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 11:31:44 -08:00