Commit graph

3500 commits

Author SHA1 Message Date
Tomaz Canabrava
05c5bf0919 Dive site rewrite: try to fix a crash
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:50:22 -07:00
Tomaz Canabrava
2fec1a88de Dive site rewrite: copy the current dive to the displayed dive
This way we can actually edit something.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:50:22 -07:00
Tomaz Canabrava
09f2d3b35d Dive site rewrite: fill and change the current dive site
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:50:22 -07:00
Tomaz Canabrava
6afd9161e8 Dive site rewrite: correctly position the edit site widget
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:50:22 -07:00
Tomaz Canabrava
32928b3880 Dive site rewrite: create a dive site edit dialog without borders
Plan is to make it pretty later.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:50:22 -07:00
Tomaz Canabrava
266e754d08 Dive site rewrite: remove a ton of code from the LocationManagement
The way I was doing the old location management was very dull: everything
was tangled on the mainwindow. Now I think I've found the correct way to
create this, and thus, this code can die.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:50:22 -07:00
Tomaz Canabrava
4c7ce4aa1d Dive site rewrite: change add icon to edit
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:50:22 -07:00
Tomaz Canabrava
3435d13509 Dive site rewrite: add the taxonomy labels for the dive sites
This doesn't work yet because we don't get the taxonomy from the geo
referencing services yet - but it's ready to be populated.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:50:14 -07:00
Tomaz Canabrava
e28af7c639 Dive site rewrite: use a QCompleter to show the list of dive sites
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:49:59 -07:00
Tomaz Canabrava
8bd9fb161a Dive site rewrite: location edit on notes tab is again a LineEdit
Hopefully we now have the UI semantics figured out.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 18:49:46 -07:00
Rick Walsh
425020d2de Add only switch at required stop option
Add the option to only switch at required stop to the planner UI.  This is not actually used yet.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26 06:14:24 -07:00
Dirk Hohndel
ea1f75d8d6 Don't show datafile version warning if no file was opened
Also remove most of the hard new lines in the text so it flows better
depending on the font size used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-25 10:55:40 -07:00
Dirk Hohndel
e5f4697f91 Rewrite GPS fix matching code for imports from our webservice
The longer I stared at the existing code the less it made sense.
So instead I rewrote it in a way that seems logical to me. And added a
boatload of debugging output (which needs to be removed, of course).

I tested this against more than a hundred dives and it seemed to always
pick the right fix.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-24 22:38:44 -07:00
Dirk Hohndel
4bdead6ad6 Avoid possible use of uninitialized variable
Errorcode doesn't get set if duppedfd is negative. So let's just issue an
error and bail.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 22:23:04 -07:00
Tomaz Canabrava
21c46b8c2d Preferences infrastructure for GeoManagement
Simple preferences infrastructure with default prefs, prefs and hooks for
the Qt Settings system and our preferences ui.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 17:11:51 -07:00
Tomaz Canabrava
ce4333e8fd Defaults for the Preferences dialog for GeoCoding
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 17:11:30 -07:00
Tomaz Canabrava
a19bbcc715 Add configuration options for geo coding
Just the interface changes for configuration options for geo coding.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 17:10:33 -07:00
Tomaz Canabrava
e27f9ab0a6 Show warning if user loads an old datafile
Show the user a warning if he opens an old version of the divelog
file, the warning tries to explain some things that are different
on the new version.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 17:09:48 -07:00
Tomaz Canabrava
7071bf0e23 Do not mess with dive location automatically
This might be what the user wanted, but also might not
be it. So wait for the user to request it manually.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 17:01:52 -07:00
Tomaz Canabrava
35a4ef88be Create layout on parent, not on items around it
Correctly handles resizing of interface items by
creating the layout on the parent instead of selecting the
items and applying the layout around them.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 17:01:24 -07:00
Tomaz Canabrava
5d236d6475 do not set default sizes for expanders
This was creating a lot of empty spaces on the preferences
dialog and making Dirk unhappy.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 16:59:59 -07:00
Dirk Hohndel
979eb464b3 Cloud storage: update File menu options once PIN is verified
The code didn't trigger the update routine after PIN verification, only if
just email/password were shown. A simple oversight. This is fixed now and
so the visibility of cloud open and cloud save options should refelect
whether verified credentials are in the preferences or not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 14:04:31 -07:00
Dirk Hohndel
90f20f4c76 Better error handling
Most of these will likely have no big impact, but it's better not to just
ignore them as they could lead to crashes.

Uemis downloader: if lseek fails, return 0
Uemis downloader: consistently check for failure to open req.txt
Zip file handling: dup could fail

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 10:57:56 -07:00
Dirk Hohndel
64c7202e2d Address of array is always non-NULL
We want to test the string instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 10:57:56 -07:00
Dirk Hohndel
1ecc9b0cc0 Address uninitialized member warnings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 10:57:51 -07:00
Dirk Hohndel
a4168ed591 Preferences: don't show error when resetting cloud email / password
Empty values won't work, of course, but they aren't an error, either.

Fixes #887

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22 06:42:35 -07:00
Dirk Hohndel
a6e9db196f Initialize members
Globe: initialize doubleClick member
ShiftTimesDialog: initialize when (not sure this could be a problem)
SetpointDialog: dc could be uninitialized or could be 0 and dereferenced

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 22:31:03 -07:00
Dirk Hohndel
b8b0364873 Prevent unintended integer division
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 22:11:49 -07:00
Dirk Hohndel
895d6e0000 Comparing the address of a member to 0 is pointless
Or... this code doesn't do what you think it does.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 22:11:49 -07:00
Dirk Hohndel
52ee5f28c2 Initialize variable to avoid false positive in coverity
We now that plotInfo.nr will always be positive. Still, this is cheap and
shuts up the "defect".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 21:35:04 -07:00
Dirk Hohndel
f5726c3d18 Fix a number of resource leaks
Free memory returned from parse_mkvi_value()
Free memory returned from printGPSCoords()
Free memory allocated in added_list and removed_list
Free memory allocated when adding suffix to dive site name
Free memory allocated in cache_deco_state()
Free memory allocated in build_filename()
Free memory allocated in get_utf8()
Free memory allocated in alloc_dive()
Free memory allocated as cache but never used

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 21:13:32 -07:00
Dirk Hohndel
152eeb45d6 Some file dialogs insist on adding a default extension
We already had code to deal with this in the Save As case, but similar
handling is needed in the Open case.

This commit also makes the regular expression handling a bit stricter and
identical between the two cases.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 16:28:38 -07:00
Dirk Hohndel
6f03aeaf08 Restructure preferences dialog so it fits on smaller screens again
Designer is such a pain to work with. Once I ended up editing the .ui file
by hand for the hard stuff and then just use designer to get it
consistently formated. Such a disappointment.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 15:21:56 -07:00
Dirk Hohndel
de35c88683 Track minimum datafile version
Add infrastructure and helper functions to track minimum datafile version.
To make this information useful we need to keep the XML and git data
format versions in track moving forward.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 06:45:12 -07:00
Dirk Hohndel
56d701dfff Merge branch 'custom-print' of https://github.com/neolit123/subsurface 2015-06-19 20:33:54 -07:00
Lubomir I. Ivanov
b039e1db8a Printing: amend some texts capitalization wise
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:59 +03:00
Gehad elrobey
60c5e3cf25 Printing: pass the print_options struct to TemplateLayout and Printer
As the print_options struct is needed by both TemplateLayout and Printer
class, it can be passed to their constructor.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:57 +03:00
Gehad elrobey
17470f6822 Printing: add a "one dive per page" option
Add another printing option to the print dialog.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19 21:41:57 +03:00
Rick Walsh
4dfdea1e1d Add planner minimum gas switch duration option
Add the option for a minimum gas switch duration to the planner UI.  This is not actually used yet.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-19 09:15:09 -07:00
Robert C. Helling
eca7d998e1 Set up signalling to display notes in planner again.
This got broken in a recent transition to more abstract models.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 20:33:07 -07:00
Dirk Hohndel
ccc9d80015 Remove all the no longer necessary code that aborts read of first V2 file
This was a poorly implemented hack when we executed the reverse geo lookup
in the main thread and opening a V2 file could take a very long time. We
need to do the "Welcome" message quite differently.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:41:56 -07:00
Dirk Hohndel
bd11988f74 Cloud storage: warn the user if we are not online
This isn't perfect, but at least tells the user if we weren't able to
connect and are working just off the local cache.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:09:37 -07:00
Dirk Hohndel
6a0e1cd9f6 HTML export: separate UI and logic code
In order to be able to initiate an HTML export from the core library we
need to separate the actual logic from the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 14:04:41 -07:00
Dirk Hohndel
854f55fd89 Move checking the cloud connection into its own files
This isn't UI related and shouldn't have been in a file full of UI
functionality.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 06:08:31 -07:00
Dirk Hohndel
0fa0eb2879 Code cleanup: implement window title update via signal
This seems quite convoluted to me but I can't seem to make a more straight
forward implementation work. The idea is that core code should never
directly call into the UI.

So instead the core code (this is C code) calls a helper function. That
helper function calls a member function of a class which in return emits a
signal. The UI code connects to that signal and acts accordingly when it
is received.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-16 06:04:34 -07:00
Dirk Hohndel
c593dea119 Cloud storage: use preference member instead of hard coded strings
This creates the basis to allow other backends to be used with the cloud
storage infrastructure.

So far this should all just transparently continue to work. A user would
have to manually add the cloud_base_url entry to the CloudStorage section
in their config file in order to use a different backend server.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-15 10:22:00 -07:00
Dirk Hohndel
617b105458 Cloud storage: create preference entry for base URL
This just deals with the mechanics. There is no UI to enter / change this
URL (and that's intentional), neither is it used, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-15 09:56:11 -07:00
Dirk Hohndel
8d05c71ca2 Fix renumbering of dives
The implementation in commit 182fe790c9 ("Add ability to undo
renumbering of dives") looks perfectly reasonable, but it depends on an
implementation detail: it assumes that the keys of the QMap are returned
in the same order in which they were placed there. Which apparently isn't
the case for some version of Qt.

With this commit we simply remember both the old and the new number for
each dive and therefore the order in which they are processed doesn't
matter.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 21:49:34 -07:00
Dirk Hohndel
60f4b37fab Cloud storage: only offer cloud storage related options when verified
If we don't have verified cloud credentials disable the menu options and
disallow the use of cloud storage as default data file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 15:42:28 -07:00
Dirk Hohndel
0c44bc7271 Cloud storage: clear our last error if verification succeeds
This is cosmetic but makes things friendlier, I think.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14 14:18:51 -07:00