Re: [PATCH] Planner notes - revise logic for gasmix output

2015-06-22 Thread Robert C. Helling
Hi Rick,On 21 Jun 2015, at 03:13, Dirk Hohndel d...@hohndel.org wrote:Robert, I consider you the maintainer of the planner. I took Rick's ratherstraight forward looking patches earlier, but would you take a look atthis one before I apply it?I am currently looking at the patch and write down things I notice.The gas change looks good for our case of a switch at a depth without a stop (even when mandatory stop time is set to 0). But when I turn on displayed transitions I would expect the gas change to be shown on the stop rather than on the upwards transition that leads to it (as the later is only the place to print it if there is no stop for it). I attached a patch (to be applied on top of yours or for yours to be amended with it) to fix that.From 778f8afd3e7a413491de88176e67a7e196bf1ab5 Mon Sep 17 00:00:00 2001
From: Robert C. Helling hell...@atdotde.de
Date: Mon, 22 Jun 2015 22:45:56 +0200
Subject: [PATCH] When displaying transitions show the gaschange at the stop if
 there is one

Signed-off-by: Robert C. Helling hell...@atdotde.de
---
 planner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/planner.c b/planner.c
index 49b0990..481d10c 100644
--- a/planner.c
+++ b/planner.c
@@ -654,7 +654,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, 
struct dive *dive, bool
len += snprintf(buffer + len, 
sizeof(buffer) - len, td style='padding-left: 10px; float: right;'%s/td, 
temp);
}
 
-   if (isascent  gaschange) {
+   if (isascent  gaschange  dp-next  
dp-depth != nextdp-depth) {
if (dp-setpoint) {
snprintf(temp, sizeof(temp), 
translate(gettextFromC, (SP = %.1fbar)), (double) nextdp-setpoint / 
1000.0);
len += snprintf(buffer + len, 
sizeof(buffer) - len, td style='padding-left: 10px; color: red; float: 
left;'b%s %s/b/td, gasname(newgasmix),
-- 
1.9.5 (Apple Git-50.3)

My compiler gives a warning that in that very long if statement there is || next to  and thus some parenthesis might add clarity. I would like to chime in here and also suggest to break that condition over several more lines essentially with one part of the || statement per line and to add comments there so we will not be as confused again when we look at this in a few months.Another stylistic thing: The bool gaschange is not a good name anymore and should be renamed to something like gaschange_after and a similar abbreviation gaschange_before could be introduced. Here is a second patch for that:From cd617348596fb723db56234d72dd4403c76f6f8c Mon Sep 17 00:00:00 2001
From: Robert C. Helling hell...@atdotde.de
Date: Mon, 22 Jun 2015 23:07:43 +0200
Subject: [PATCH 2/2] Refactor to use gaschage_before and gaschange_after

... for better readability.

Signed-off-by: Robert C. Helling hell...@atdotde.de
---
 planner.c | 32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/planner.c b/planner.c
index 481d10c..afcbfa6 100644
--- a/planner.c
+++ b/planner.c
@@ -524,7 +524,8 @@ static void add_plan_to_notes(struct diveplan *diveplan, 
struct dive *dive, bool
int len, lastdepth = 0, lasttime = 0, lastsetpoint = -1, newdepth = 0, 
lastprintdepth = 0, lastprintsetpoint = -1;
struct gasmix lastprintgasmix = { -1, -1 };
struct divedatapoint *dp = diveplan-dp;
-   bool gaschange = !plan_verbatim;
+   bool gaschange_after = !plan_verbatim;
+   bool gaschange_before;
struct divedatapoint *nextdp = NULL;
 
disclaimer =  translate(gettextFromC, DISCLAIMER / WARNING: THIS IS 
A NEW IMPLEMENTATION OF THE BUHLMANN 
@@ -587,17 +588,18 @@ static void add_plan_to_notes(struct diveplan *diveplan, 
struct dive *dive, bool
dp-setpoint == nextdp-setpoint 
dp-depth != lastdepth 
nextdp-depth != dp-depth
-!gaschange)
+!gaschange_after)
continue;
-   if (dp-time - lasttime  10  !(gaschange  dp-next  
dp-depth != dp-next-depth))
+   if (dp-time - lasttime  10  !(gaschange_after  dp-next 
 dp-depth != dp-next-depth))
continue;
 
len = strlen(buffer);
if (nextdp  (gasmix_distance(gasmix, newgasmix) || 
dp-setpoint != nextdp-setpoint))
-   gaschange = true;
+   gaschange_after = true;
+   gaschange_before =  (gasmix_distance(lastprintgasmix, gasmix) 
|| lastprintsetpoint != dp-setpoint);
if (plan_verbatim) {
if (dp-depth != lastprintdepth) {
-   if (plan_display_transitions || dp-entered || 
!dp-next || (gaschange  dp-next  dp-depth != nextdp-depth)) {
+  

Re: dive site management enhancements (request)

2015-06-22 Thread Anton Lundin
On 22 June, 2015 - Dirk Hohndel wrote:

 On Mon, Jun 22, 2015 at 12:47:34PM -0700, Linus Torvalds wrote:
  On Mon, Jun 22, 2015 at 6:00 AM, Dirk Hohndel d...@hohndel.org wrote:
   On Mon, Jun 22, 2015 at 05:42:33PM +0800, Miika Turkia wrote:
  
   - Allow editing of multiple sites on divesite management. E.g. when
   selecting a few days worth of dives, it would be nice to be able to
   add names to these all with one go, seeing all the selected dives on
   divelist and switching between them. (I used the automated mode when
   recording GPS coordinates.)
  
   Not sure how the UI for that would work. Can you explain a bit more?
  
  So I don't know what Anton had in mind, but from my experience last
  week, what *I* would like to see is:
  

How did I get involved into this?

   - when downloading the GPS data, do something very similar to the
  dive download window, where you list the dives that have matched up
  to new GPS information *before* applying the state.
  
   - but in addition to the dive list (and the checkboxes so that you
  can select to use downloaded GPS locations for only a subset of the
  dives), you'd have a text-entry box to name the new sites.
 
 Oh wow, that is a cool idea. I really like that.
 If that kernel hacking thing doesn't work out for you, maybe you could go
 into user interface design. On second thought, never mind.
 (I need to see if I can still build Subsurface 1.0...)
 

http://www.acc.umu.se/~glance/ssrf-1.0.jpg

Doesn't it look lovely? =)

  IOW, I think the dive computer download dialogue really works as a
  good example of what the GPS download should do. It's a very similar
  multi-phase operation: first we download the information (without
  actually applying it), then we select the dives we want to add info
  for, and then we apply it. The only difference would be that we'd have
  that text-field for naming the dive sites as we go along.
  
  (Which wouldn't be wrong for the divecomputer download dialogue
  either, for that matter - maybe there is room for some sharing of
  setup code).
 
 Yeah - I'm thinking there could be some really cool similarity /
 consistency between all these dialogs.
 
 Think about it this way. Whether you download from your second dive
 computer or download GPS data, you are doing something quite similar: you
 are adding data to the existing dive list.
 
 This could turn into a really cool user experience if done right.
 If only I had any talent and/or skill for this stuff... that would be neat
 to work on.
 
 Great idea from our Finns...
 

I really like it.

Way better than typing git diff to see what actually happened after this
operation.


//Anton


-- 
Anton Lundin+46702-161604
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: [PATCH] Planner notes - revise logic for gasmix output

2015-06-22 Thread Rick Walsh
Thanks Robert,

I'm on my phone so I've read but haven't tested your patches.

On 23 Jun 2015 7:09 am, Robert C. Helling hell...@atdotde.de wrote:

 Hi Rick,

 I am currently looking at the patch and write down things I notice.

 The gas change looks good for our case of a switch at a depth without a
stop (even when mandatory stop time is set to 0). But when I turn on
displayed transitions I would expect the gas change to be shown on the stop
rather than on the upwards transition that leads to it (as the later is
only the place to print it if there is no stop for it). I attached a patch
(to be applied on top of yours or for yours to be amended with it) to fix
that.


I deliberately didn't do that, but I prefer your logic, and the more I
think about it the more it makes sense.



 My compiler gives a warning that in that very long if statement there is
|| next to  and thus some parenthesis might add clarity. I would like to
chime in here and also suggest to break that condition over several more
lines essentially with one part of the || statement per line and to add
comments there so we will not be as confused again when we look at this in
a few months.

 Another stylistic thing: The bool gaschange is not a good name anymore
and should be renamed to something like gaschange_after and a similar
abbreviation gaschange_before could be introduced. Here is a second patch
for that:


Thanks for the feedback and code cleanup.  I've never done any c coding
before; I tried to be consistent with style but those changes make sense.



 But apart from that, this finally seems to do the right thing. Thanks a
lot for sorting this out!


Not a problem.  I'm only being selfish because I want to use the planner
and understand what it does.

 Best
 Robert

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: dive site management enhancements (request)

2015-06-22 Thread Miika Turkia




 On 22 Jun 2015, at 21:00, Dirk Hohndel d...@hohndel.org wrote:
 
 On Mon, Jun 22, 2015 at 05:42:33PM +0800, Miika Turkia wrote:
 I have just tested out companion app on iPhone and this brings a few
 enhancement requests. Some of these might already have been discussed,
 but with poor Internet and heavy diving I cannot keep up with the bit
 life :D
 
 - Allow editing of multiple sites on divesite management. E.g. when
 selecting a few days worth of dives, it would be nice to be able to
 add names to these all with one go, seeing all the selected dives on
 divelist and switching between them. (I used the automated mode when
 recording GPS coordinates.)
 
 Not sure how the UI for that would work. Can you explain a bit more?

Linus already improved this beyond my imagination

 - Some indication of the coordinates available on the notes pane next
 to the selected site name
 
 Again, I don't understand what that means.

gps icon to indicate this dive has coordinates associated witg it. Now I cannot 
tell if there are coords or not especially with the globe acting weird.

 - Possibility to clear added Location (e.g. first item on the list empty)
 - I am not able to store trip location
 
 Known bugs
 
 - The order of the dive sites changes between saves on XML log
 
 Ok, that should be easy to fix.
 
 - When adding a divesite from the plus sign on notes, one has to
 restart Subsurface for it to be added to the list of available sites
 (and to actually assign it to the currently selected dive)
 
 Yeah, Tomaz is working on that whole flow...
 
 - Segmentation fault when adding divesite from the divesite management
 feature  - stack trace below
 - Selecting coordinates from the map is close to impossible (at least
 when on divesite management)
 
 Odd - this is the one thing that works fairly well for me.
 I did fix a weird bug in the double click handling yesterday, but that
 should only affect the first time you click on the globe...
 Are you working with latest master or something older?

Just pulled yesterday before testing out. Globe was zooming out while I was 
trying to zoom in, and even rotated the globe on its own.

 And one extra from DC download:
 - When I first download from air integrated Vyper, and next from
 Stinger (with no idea of cylinders), I get a bunch of error messages
 different number of gases (1) and tanks (0), the order of numbers
 might change occasionally. I assume there is one error line for each
 downloaded dive.
 
 That's very odd. I've never seen that. Need to poke around in the sources
 to figure out what that means.

T-15 for the 2-tank morning boat :D

miika
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: dive site management enhancements (request)

2015-06-22 Thread Dirk Hohndel
On Tue, Jun 23, 2015 at 07:15:46AM +0800, Miika Turkia wrote:
  
  Not sure how the UI for that would work. Can you explain a bit more?
 
 Linus already improved this beyond my imagination

Yeah, he does that some times. But it passes.

Now if he sent the patches to IMPLEMENT all this. Now THAT would be
awesome...

  - Some indication of the coordinates available on the notes pane next
  to the selected site name
  
  Again, I don't understand what that means.
 
 gps icon to indicate this dive has coordinates associated witg it. Now I
 cannot tell if there are coords or not especially with the globe acting
 weird.

Ha, and indeed we are back to Subsurface ca. 3.0 - when we had the gps
icon :-)

  Odd - this is the one thing that works fairly well for me.
  I did fix a weird bug in the double click handling yesterday, but that
  should only affect the first time you click on the globe...
  Are you working with latest master or something older?
 
 Just pulled yesterday before testing out. Globe was zooming out while I
 was trying to zoom in, and even rotated the globe on its own.

Gremlins?
NO idea. Are you building with my Marble branch or linking against
upstream?

  And one extra from DC download:
  - When I first download from air integrated Vyper, and next from
  Stinger (with no idea of cylinders), I get a bunch of error messages
  different number of gases (1) and tanks (0), the order of numbers
  might change occasionally. I assume there is one error line for each
  downloaded dive.
  
  That's very odd. I've never seen that. Need to poke around in the sources
  to figure out what that means.
 
 T-15 for the 2-tank morning boat :D

Have fun. I'll be doing some cold water low viz diving tomorrow and
Wednesday... just so I don't forget how it feels to be under water...

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: dive site management enhancements (request)

2015-06-22 Thread Linus Torvalds
On Mon, Jun 22, 2015 at 2:29 PM, Anton Lundin gla...@acc.umu.se wrote:

 How did I get involved into this?

What can I say? The letters for Anton and Miika are right next to
each other on the keyboard. In one case, it's even the exact same
letter!

Or maybe I'm incompetent.

 Linus and the same number of letters too! Torvalds
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: dive site management enhancements (request)

2015-06-22 Thread Dirk Hohndel
On Mon, Jun 22, 2015 at 03:48:51PM -0700, Linus Torvalds wrote:
 On Mon, Jun 22, 2015 at 2:29 PM, Anton Lundin gla...@acc.umu.se wrote:
 
  How did I get involved into this?
 
 What can I say? The letters for Anton and Miika are right next to
 each other on the keyboard. In one case, it's even the exact same
 letter!
 
 Or maybe I'm incompetent.

Let's see... what would Occam say...

  Linus and the same number of letters too! Torvalds

And the same number of letter as Linus AND Tomaz. The plot thickens.

So the actual question is how did I get involved, given I have only four
letters in my first name...

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: [PATCH] Planner notes - revise logic for gasmix output

2015-06-22 Thread Dirk Hohndel
On Mon, Jun 22, 2015 at 11:09:19PM +0200, Robert C. Helling wrote:
 Hi Rick,
 
  On 21 Jun 2015, at 03:13, Dirk Hohndel d...@hohndel.org wrote:
  
  Robert, I consider you the maintainer of the planner. I took Rick's rather
  straight forward looking patches earlier, but would you take a look at
  this one before I apply it?
 
 I am currently looking at the patch and write down things I notice.
 
 The gas change looks good for our case of a switch at a depth without a stop 
 (even when mandatory stop time is set to 0). But when I turn on displayed 
 transitions I would expect the gas change to be shown on the stop rather than 
 on the upwards transition that leads to it (as the later is only the place to 
 print it if there is no stop for it). I attached a patch (to be applied on 
 top of yours or for yours to be amended with it) to fix that.
 
 
 
 My compiler gives a warning that in that very long if statement there is || 
 next to  and thus some parenthesis might add clarity. I would like to chime 
 in here and also suggest to break that condition over several more lines 
 essentially with one part of the || statement per line and to add comments 
 there so we will not be as confused again when we look at this in a few 
 months.
 
 Another stylistic thing: The bool gaschange is not a good name anymore and 
 should be renamed to something like gaschange_after and a similar 
 abbreviation gaschange_before could be introduced. Here is a second patch for 
 that:
 
 
 
 But apart from that, this finally seems to do the right thing. Thanks a lot 
 for sorting this out!


Thanks to both of you for working on this.

Because of some of the code cleanup that I did over the weekend these were
kinda hard to apply. I tried to close a few dozen Coverity issues and
ended up changing some of those very same conditional statements since
Coverity convinced me that it was possible for nextdp to be NULL...

Please take a close look at what I just pushed to make sure I didn't end
up breaking things now that you finally got them right.

Thanks

/D

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


yet another tryout of the locationmanagement

2015-06-22 Thread Tomaz Canabrava
What this batch of patches does:
nothing much - setting the ground for the locationmanagement.

it's a start of the third attempt ( or fourth? ) of a rewrite from scratch.
From 1781ef7c8b034e5844dd4381bdf501a8cfa1d0e1 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava tomaz.canabr...@intel.com
Date: Mon, 22 Jun 2015 18:44:05 -0300
Subject: [PATCH 8/8] 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.canabr...@intel.com
---
 pref.h| 10 ++
 qt-ui/preferences.cpp | 32 
 subsurfacestartup.c   | 10 +-
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/pref.h b/pref.h
index ff5fd3d..d70e009 100644
--- a/pref.h
+++ b/pref.h
@@ -24,6 +24,15 @@ typedef struct {
 	char *album_id;
 } facebook_prefs_t;
 
+typedef struct {
+	bool enable_geocoding;
+	bool parse_dive_without_gps;
+	bool tag_existing_dives;
+	char *first_item;
+	char *second_item;
+	char *third_item;
+} geocoding_prefs_t;
+
 struct preferences {
 	const char *divelist_font;
 	const char *default_filename;
@@ -100,6 +109,7 @@ struct preferences {
 	bool save_password_local;
 	short cloud_verification_status;
 	bool cloud_background_sync;
+	geocoding_prefs_t geocoding;
 };
 enum unit_system_values {
 	METRIC,
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 34960f6..d9622d2 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -1,6 +1,7 @@
 #include preferences.h
 #include mainwindow.h
 #include models.h
+#include divelocationmodel.h
 
 #include QSettings
 #include QFileDialog
@@ -45,6 +46,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Qt::WindowFlags f) : QDial
 	ui.proxyType-addItem(tr(SOCKS proxy), QNetworkProxy::Socks5Proxy);
 	ui.proxyType-setCurrentIndex(-1);
 
+	ui.first_item-setModel(GeoReferencingOptionsModel::instance());
+	ui.second_item-setModel(GeoReferencingOptionsModel::instance());
+	ui.third_item-setModel(GeoReferencingOptionsModel::instance());
 	// Facebook stuff:
 #if !defined(Q_OS_ANDROID)  defined(FBSUPPORT)
 	FacebookManager *fb = FacebookManager::instance();
@@ -232,6 +236,14 @@ void PreferencesDialog::setUiFromPrefs()
 	ui.save_password_local-setChecked(prefs.save_password_local);
 	cloudPinNeeded();
 	ui.cloud_background_sync-setChecked(prefs.cloud_background_sync);
+
+	// GeoManagement
+	ui.enable_geocoding-setChecked( prefs.geocoding.enable_geocoding );
+	ui.parse_without_gps-setChecked(prefs.geocoding.parse_dive_without_gps);
+	ui.tag_existing_dives-setChecked(prefs.geocoding.tag_existing_dives);
+	ui.first_item-setCurrentText(prefs.geocoding.first_item);
+	ui.second_item-setCurrentText(prefs.geocoding.second_item);
+	ui.third_item-setCurrentText(prefs.geocoding.third_item);
 }
 
 void PreferencesDialog::restorePrefs()
@@ -438,6 +450,16 @@ void PreferencesDialog::syncSettings()
 	// it could go into some sort of advanced setup or something
 	SAVE_OR_REMOVE(cloud_base_url, default_prefs.cloud_base_url, prefs.cloud_base_url);
 	s.endGroup();
+
+	s.beginGroup(geocoding);
+	s.setValue(enable_geocoding, ui.enable_geocoding-isChecked());
+	s.setValue(parse_dives_without_gps, ui.parse_without_gps-isChecked());
+	s.setValue(tag_existing_dives, ui.tag_existing_dives-isChecked());
+	s.setValue(first_item, ui.first_item-currentText());
+	s.setValue(second_item, ui.second_item-currentText());
+	s.setValue(third_item, ui.third_item-currentText());
+	s.endGroup();
+
 	loadSettings();
 	emit settingsChanged();
 }
@@ -575,6 +597,16 @@ void PreferencesDialog::loadSettings()
 	GET_TXT(cloud_base_url, cloud_base_url);
 	prefs.cloud_git_url = strdup(qPrintable(QString(prefs.cloud_base_url) + /git));
 	s.endGroup();
+
+	// GeoManagement
+	s.beginGroup(geocoding);
+	GET_BOOL(enable_geocoding, geocoding.enable_geocoding);
+	GET_BOOL(parse_dives_without_gps, geocoding.parse_dive_without_gps);
+	GET_BOOL(tag_existing_dives, geocoding.tag_existing_dives);
+	GET_TXT(first_item, geocoding.first_item);
+	GET_TXT(second_item, geocoding.second_item);
+	GET_TXT(third_item, geocoding.third_item);
+	s.endGroup();
 }
 
 void PreferencesDialog::buttonClicked(QAbstractButton *button)
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index 7130f0f..655a1a5 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -68,7 +68,15 @@ struct preferences default_prefs = {
 		.access_token = NULL
 	},
 	.defaultsetpoint = 1100,
-	.cloud_background_sync = true
+	.cloud_background_sync = true,
+	.geocoding = {
+		.enable_geocoding = false,
+		.parse_dive_without_gps = false,
+		.tag_existing_dives = false,
+		.first_item = NULL,
+		.second_item = NULL,
+		.third_item = NULL
+	}
 };
 
 int run_survey;
-- 
2.4.4

From 14b7c509ea9fda596f87ee63447d3b902745c207 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava tomaz.canabr...@intel.com
Date: Mon, 22 Jun 2015 17:29:06 -0300
Subject: [PATCH 7/8] Defaults on the 

GSoC Status - Week 4 (VPM-B)

2015-06-22 Thread Jan Darowski
Hi!
Last week I've managed to fix previous problems with crushing pressure
calculation and implemented critical volume algorithm for vpm-b. It
means that now we can generate vpm-b based deco plans. I've spent a
lot of time on finding the way to merge this new method with the
previous algorithm but I think the result is fine.

Now I will focus on testing these deco plans, integrating with
Subsurface (ui part) and cleaning up the code. By the end of the week,
code should be ready for pull request.

-- 
Jan Darowski
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Cloud storage and web view

2015-06-22 Thread Jan Mulder

On 21-06-15 22:02, Dirk Hohndel wrote:

Another morning of hacking, and another set of patches are pushed...

This time around I added the ability to store pictures in a git
repository. Instead of just storing a reference to a local file we now
actually store the pictures themselves in the git repository. We try to be
clever about this, so if loading from git, if we can find the pictures
(using the picture hash featuer in case they were moved) we don't bother
writing the pictures from the repository out into local files.

But if we can't find them we do just that.

With this I can save my repo to cloud storage and then see my pictures on
the web view. In order for that to work you need to open your data file
with the latest Subsurface and then save to the cloud again - your local
Subsurface needs to be new enough to push the actual pictures out to the
server...


I did some testing. My log did not contain any pictures, so I added one 
picture to one dive. Working locally, I saved, and after that forced a 
save to cloud. Opened the cloud storage, and the picture does show 
correctly (on the desktop machine that has the picture on disk).


Went to the cloud website, see that the modified dive is correctly 
stored. However, I do not see any reference to the stored picture. 
Checked the HTML source, and see that there is a div id=divephotos. 
This does not show any pictures (eg. the one picture I added to one dive).


Checked on a second machine. Open cloud in ssrf. I do not see the 
picture. I do see the reference to the picture (including the path it is 
stored (on hover on the  photos tab) on the (first) desktop machine. I 
also see a dot  where the small thumbnail in the profile is shown. 
Verified that ssrf is looking at the location of the picture on the 
originating machine. Verified the local cache and see the file (for the 
specific dive), in the Pictures subdir. It contains a reference to the 
picture on the originating machine (so no actual image). Off course, I 
might be confused how it is supposed to work, but I expected an image in 
the local cache.


Off course, above test with latest master :-)

best,

--jan
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


dive site management enhancements (request)

2015-06-22 Thread Miika Turkia
I have just tested out companion app on iPhone and this brings a few
enhancement requests. Some of these might already have been discussed,
but with poor Internet and heavy diving I cannot keep up with the bit
life :D

- Allow editing of multiple sites on divesite management. E.g. when
selecting a few days worth of dives, it would be nice to be able to
add names to these all with one go, seeing all the selected dives on
divelist and switching between them. (I used the automated mode when
recording GPS coordinates.)
- Some indication of the coordinates available on the notes pane next
to the selected site name
- Possibility to clear added Location (e.g. first item on the list empty)
- I am not able to store trip location
- The order of the dive sites changes between saves on XML log
- When adding a divesite from the plus sign on notes, one has to
restart Subsurface for it to be added to the list of available sites
(and to actually assign it to the currently selected dive)
- Segmentation fault when adding divesite from the divesite management
feature  - stack trace below
- Selecting coordinates from the map is close to impossible (at least
when on divesite management)

And one extra from DC download:
- When I first download from air integrated Vyper, and next from
Stinger (with no idea of cylinders), I get a bunch of error messages
different number of gases (1) and tanks (0), the order of numbers
might change occasionally. I assume there is one error line for each
downloaded dive.

miika

---8---
Program received signal SIGSEGV, Segmentation fault.
0x0058f4d4 in LocationInformationWidget::acceptChanges (this=0x1521c20)
at 
/home/mturkia/source/static/test/subsurface/qt-ui/locationinformation.cpp:70
70  currentDs-latitude = displayed_dive_site.latitude;
(gdb) bt
#0  0x0058f4d4 in LocationInformationWidget::acceptChanges (
this=0x1521c20)
at 
/home/mturkia/source/static/test/subsurface/qt-ui/locationinformation.cpp:70
#1  0x0059f1eb in LocationInformationWidget::qt_static_metacall (
_o=0x1521c20, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0x7fffcf90)
at 
/home/mturkia/source/static/test/subsurface/build/moc_locationinformation.cpp:153
#2  0x72ddd9c9 in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x736ac722 in QAction::triggered(bool) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#4  0x736aee28 in QAction::activate(QAction::ActionEvent) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#5  0x737b323d in ?? ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#6  0x737b3454 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
...
---8---
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: dive site management enhancements (request)

2015-06-22 Thread Linus Torvalds
On Mon, Jun 22, 2015 at 6:00 AM, Dirk Hohndel d...@hohndel.org wrote:
 On Mon, Jun 22, 2015 at 05:42:33PM +0800, Miika Turkia wrote:

 - Allow editing of multiple sites on divesite management. E.g. when
 selecting a few days worth of dives, it would be nice to be able to
 add names to these all with one go, seeing all the selected dives on
 divelist and switching between them. (I used the automated mode when
 recording GPS coordinates.)

 Not sure how the UI for that would work. Can you explain a bit more?

So I don't know what Anton had in mind, but from my experience last
week, what *I* would like to see is:

 - when downloading the GPS data, do something very similar to the
dive download window, where you list the dives that have matched up
to new GPS information *before* applying the state.

 - but in addition to the dive list (and the checkboxes so that you
can select to use downloaded GPS locations for only a subset of the
dives), you'd have a text-entry box to name the new sites.

IOW, I think the dive computer download dialogue really works as a
good example of what the GPS download should do. It's a very similar
multi-phase operation: first we download the information (without
actually applying it), then we select the dives we want to add info
for, and then we apply it. The only difference would be that we'd have
that text-field for naming the dive sites as we go along.

(Which wouldn't be wrong for the divecomputer download dialogue
either, for that matter - maybe there is room for some sharing of
setup code).

 Linus
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: dive site management enhancements (request)

2015-06-22 Thread Dirk Hohndel
On Mon, Jun 22, 2015 at 12:47:34PM -0700, Linus Torvalds wrote:
 On Mon, Jun 22, 2015 at 6:00 AM, Dirk Hohndel d...@hohndel.org wrote:
  On Mon, Jun 22, 2015 at 05:42:33PM +0800, Miika Turkia wrote:
 
  - Allow editing of multiple sites on divesite management. E.g. when
  selecting a few days worth of dives, it would be nice to be able to
  add names to these all with one go, seeing all the selected dives on
  divelist and switching between them. (I used the automated mode when
  recording GPS coordinates.)
 
  Not sure how the UI for that would work. Can you explain a bit more?
 
 So I don't know what Anton had in mind, but from my experience last
 week, what *I* would like to see is:
 
  - when downloading the GPS data, do something very similar to the
 dive download window, where you list the dives that have matched up
 to new GPS information *before* applying the state.
 
  - but in addition to the dive list (and the checkboxes so that you
 can select to use downloaded GPS locations for only a subset of the
 dives), you'd have a text-entry box to name the new sites.

Oh wow, that is a cool idea. I really like that.
If that kernel hacking thing doesn't work out for you, maybe you could go
into user interface design. On second thought, never mind.
(I need to see if I can still build Subsurface 1.0...)

 IOW, I think the dive computer download dialogue really works as a
 good example of what the GPS download should do. It's a very similar
 multi-phase operation: first we download the information (without
 actually applying it), then we select the dives we want to add info
 for, and then we apply it. The only difference would be that we'd have
 that text-field for naming the dive sites as we go along.
 
 (Which wouldn't be wrong for the divecomputer download dialogue
 either, for that matter - maybe there is room for some sharing of
 setup code).

Yeah - I'm thinking there could be some really cool similarity /
consistency between all these dialogs.

Think about it this way. Whether you download from your second dive
computer or download GPS data, you are doing something quite similar: you
are adding data to the existing dive list.

This could turn into a really cool user experience if done right.
If only I had any talent and/or skill for this stuff... that would be neat
to work on.

Great idea from our Finns...

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: [PATCH] Planner notes - revise logic for gasmix output

2015-06-22 Thread Robert C. Helling
Hi Dirk,

 On 23 Jun 2015, at 02:53, Dirk Hohndel d...@hohndel.org wrote:
 
  I tried to close a few dozen Coverity issues and
 ended up changing some of those very same conditional statements since
 Coverity convinced me that it was possible for nextdp to be NULL...

looks good to me. But I think those tests you inserted are not needed: In 
particular in the very long in clause, there is early in the long list of ||’s 
a !dp-next and as there is logic short circuit and the standard says || is 
evaluated left to right it should be safe to evaluate dp-next right of that 
statement and it does not have to be tested again.

In my experience with that part of the code, forgetting to test dp-next leads 
very reliably to crashes (I had forgotten some before) so the fact it does not 
immediately crash makes me quite confident the above is true ;-)

Best
Robert


signature.asc
Description: Message signed with OpenPGP using GPGMail
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Questions related to the dive profile widget

2015-06-22 Thread Lubomir I. Ivanov
On 22 June 2015 at 14:43, Gehad Elrobey gehadelro...@gmail.com wrote:
 Hello,

 I have some questions regarding the dive profile widget, as currently I am
 integrating the dive profile with the print module.

 when I change the font scale of the dive profile using setFontPrintScale()
 the dive computer name is stuck unchanged, until the dive computer string is
 changed by selecting another dive/trip. I am not sure if this is a bug or I
 don't understand the API correctly, I have attached a picture that shows the
 described behavior.

 Also the grid behind the dive profile is not changed using
 setFontPrintScale(). And with some printing resolutions wide white lines
 appear in the background that corrupts the view, Is there some API that can
 change the grid width? I have also attached a picture that shows this.



see if the profile item diveComputerText in ProfileWidget2 obeys the
print scale of (fontPrintScale). probably not.

the big lines thing smells like a Qt bug which is still present in
Qt5.x; see my comment here, experiment with that solution or find
alternatives:
https://github.com/torvalds/subsurface/commit/1cff998f8412218fd2447f390eadf05b2ea9ae34#diff-751fa8bb6601c4bd7a5827e6ed74360bL202

the downside of that QImage solution was that it rasterizes the
profile on Linux.

lubomir
--
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Cloud storage and web view

2015-06-22 Thread Dirk Hohndel
Hi Jan,

as discussed on IRC, here's a quick patch, just to get some idea on what's
going wrong for you...

Save it somewhere and apply it with 
patch -p1  /tmp/diff
rebuild and run Subsurface, make a small change and save to the cloud
again
then please send me the stderr output

Thanks

/D
diff --git a/save-git.c b/save-git.c
index 1914a07eed78..3fbfa6a923c8 100644
--- a/save-git.c
+++ b/save-git.c
@@ -564,8 +564,10 @@ static int blob_insert_fromdisk(git_repository *repo, 
struct dir *tree, const ch
git_oid blob_id;
 
ret = git_blob_create_fromdisk(blob_id, repo, filepath);
-   if (ret)
+   if (ret) {
+   fprintf(stderr, error when inserting the blob\n);
return ret;
+   }
return tree_insert(tree-files, filename, 1, blob_id, 
GIT_FILEMODE_BLOB);
 }
 
@@ -624,13 +626,16 @@ static int save_one_picture(git_repository *repo, struct 
dir *dir, struct pictur
offset -= h *3600;
error = blob_insert(repo, dir, buf, %c%02u=%02u=%02u,
sign, h, FRACTION(offset, 60));
+   fprintf(stderr, stored picture information for %s, error code %d\n, 
pic-filename, error);
if (!error) {
/* next store the actual picture; we prefix all picture names
 * with PIC- to make things easier on the parsing side */
struct membuffer namebuf = { 0 };
const char *localfn = local_file_path(pic);
+   fprintf(stderr, based on the hashes, the actual file is at 
%s\n, localfn);
put_format(namebuf, PIC-%s, pic-hash);
error = blob_insert_fromdisk(repo, dir, localfn, 
mb_cstring(namebuf));
+   fprintf(stderr, inserted the picture as %s, error code %d\n, 
mb_cstring(namebuf), error);
free((void *)localfn);
}
return error;
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: GSoC Status - Week 4 (VPM-B)

2015-06-22 Thread Dirk Hohndel
On Mon, Jun 22, 2015 at 01:28:04PM +0200, Jan Darowski wrote:
 Hi!
 Last week I've managed to fix previous problems with crushing pressure
 calculation and implemented critical volume algorithm for vpm-b. It
 means that now we can generate vpm-b based deco plans. I've spent a
 lot of time on finding the way to merge this new method with the
 previous algorithm but I think the result is fine.
 
 Now I will focus on testing these deco plans, integrating with
 Subsurface (ui part) and cleaning up the code. By the end of the week,
 code should be ready for pull request.

Good. I was going to send out email today that prior to the mid term
evaluation I want to have seen a first pull request from every student.

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Cloud storage and web view

2015-06-22 Thread Dirk Hohndel
Hi Jan,

thanks for testing!

On Mon, Jun 22, 2015 at 11:14:55AM +0200, Jan Mulder wrote:
 
 I did some testing. My log did not contain any pictures, so I added one
 picture to one dive. Working locally, I saved, and after that forced a save
 to cloud. Opened the cloud storage, and the picture does show correctly (on
 the desktop machine that has the picture on disk).

Yes, that has always worked because we simply save the reference to the
local file path in the cloud. So opening on the same machine gives you the
existing path back and all is good.

 Went to the cloud website, see that the modified dive is correctly stored.
 However, I do not see any reference to the stored picture. Checked the HTML
 source, and see that there is a div id=divephotos. This does not show
 any pictures (eg. the one picture I added to one dive).
 
 Checked on a second machine. Open cloud in ssrf. I do not see the picture. I
 do see the reference to the picture (including the path it is stored (on
 hover on the  photos tab) on the (first) desktop machine. I also see a
 dot  where the small thumbnail in the profile is shown. Verified that ssrf
 is looking at the location of the picture on the originating machine.
 Verified the local cache and see the file (for the specific dive), in the
 Pictures subdir. It contains a reference to the picture on the originating
 machine (so no actual image). Off course, I might be confused how it is
 supposed to work, but I expected an image in the local cache.
 
 Off course, above test with latest master :-)

I took the liberty of looking at your git repository and I can see that
you saved twice with -853 and that Subsurface decided not to upload the
picture to the remote server (and that of course prevented the HTML export
from working).

Now I need to figure out what Subsurface didn't push the picture... it did
for me in my test with two different accounts.

Dirk Bugs Are Us investigating...

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: dive site management enhancements (request)

2015-06-22 Thread Dirk Hohndel
On Mon, Jun 22, 2015 at 05:42:33PM +0800, Miika Turkia wrote:
 I have just tested out companion app on iPhone and this brings a few
 enhancement requests. Some of these might already have been discussed,
 but with poor Internet and heavy diving I cannot keep up with the bit
 life :D
 
 - Allow editing of multiple sites on divesite management. E.g. when
 selecting a few days worth of dives, it would be nice to be able to
 add names to these all with one go, seeing all the selected dives on
 divelist and switching between them. (I used the automated mode when
 recording GPS coordinates.)

Not sure how the UI for that would work. Can you explain a bit more?

 - Some indication of the coordinates available on the notes pane next
 to the selected site name

Again, I don't understand what that means.

 - Possibility to clear added Location (e.g. first item on the list empty)
 - I am not able to store trip location

Known bugs

 - The order of the dive sites changes between saves on XML log

Ok, that should be easy to fix.

 - When adding a divesite from the plus sign on notes, one has to
 restart Subsurface for it to be added to the list of available sites
 (and to actually assign it to the currently selected dive)

Yeah, Tomaz is working on that whole flow...

 - Segmentation fault when adding divesite from the divesite management
 feature  - stack trace below
 - Selecting coordinates from the map is close to impossible (at least
 when on divesite management)

Odd - this is the one thing that works fairly well for me.
I did fix a weird bug in the double click handling yesterday, but that
should only affect the first time you click on the globe...
Are you working with latest master or something older?

 And one extra from DC download:
 - When I first download from air integrated Vyper, and next from
 Stinger (with no idea of cylinders), I get a bunch of error messages
 different number of gases (1) and tanks (0), the order of numbers
 might change occasionally. I assume there is one error line for each
 downloaded dive.

That's very odd. I've never seen that. Need to poke around in the sources
to figure out what that means.

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Provide planner option to switch gas only when a stop is required

2015-06-22 Thread Rick Walsh
These patches add the planner option to postpone a gas switch to the next
required stop.  I haven't managed to make it do silly things, but please do
check when you get a chance - no rush apply.

The option is ignored when the current gas is hypoxic.

It's interesting to see what effect delaying the gas switch has until the
next stop has on the calculated profile.  It doesn't make much difference.
From 08e86c47a5cb42be59ae5b1a36103af9ae183e44 Mon Sep 17 00:00:00 2001
From: Rick Walsh rickmwa...@gmail.com
Date: Mon, 22 Jun 2015 22:43:20 +1000
Subject: [PATCH] Implement planner option to switch only at required stops

When option is enabled, if a stop is not otherwise required, a gas switch will be delayed until a stop is reached.  This option is ignored if the current gas is hypoxic.

Signed-off-by: Rick Walsh rickmwa...@gmail.com
---
 planner.c | 48 
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/planner.c b/planner.c
index e5aa19e..7199d15 100644
--- a/planner.c
+++ b/planner.c
@@ -869,6 +869,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
 	int gaschangenr;
 	unsigned int *stoplevels = NULL;
 	bool stopping = false;
+	bool pendinggaschange = false;
 	bool clear_to_ascend;
 	int clock, previous_point_time;
 	int avg_depth, max_depth, bottom_time = 0;
@@ -1034,7 +1035,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
 		if (depth = 0)
 			break; /* We are at the surface */
 
-		if (gi = 0  stoplevels[stopidx] == gaschanges[gi].depth) {
+		if (gi = 0  stoplevels[stopidx] = gaschanges[gi].depth) {
 			/* We have reached a gas change.
 			 * Record this in the dive plan */
 			plan_add_segment(diveplan, clock - previous_point_time, depth, gas, po2, false);
@@ -1042,21 +1043,29 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
 			stopping = true;
 
 			/* Check we need to change cylinder.
-			 * We might not if the cylinder was chosen by the user */
+			 * We might not if the cylinder was chosen by the user
+			 * or user has selected only to switch only at required stops.
+			 * If current gas is hypoxic, we want to switch asap */
 			if (current_cylinder != gaschanges[gi].gasidx) {
-current_cylinder = gaschanges[gi].gasidx;
-gas = displayed_dive.cylinder[current_cylinder].gasmix;
+if (!prefs.switch_at_req_stop ||
+		!trial_ascent(depth, stoplevels[stopidx - 1], avg_depth, bottom_time, tissue_tolerance,
+		displayed_dive.cylinder[current_cylinder].gasmix, po2, diveplan-surface_pressure / 1000.0) || get_o2(displayed_dive.cylinder[current_cylinder].gasmix)  160) {
+	current_cylinder = gaschanges[gi].gasidx;
+	gas = displayed_dive.cylinder[current_cylinder].gasmix;
 #if DEBUG_PLAN  16
-printf(switch to gas %d (%d/%d) @ %5.2lfm\n, gaschanges[gi].gasidx,
-	(get_o2(gas) + 5) / 10, (get_he(gas) + 5) / 10, gaschanges[gi].depth / 1000.0);
+	printf(switch to gas %d (%d/%d) @ %5.2lfm\n, gaschanges[gi].gasidx,
+		(get_o2(gas) + 5) / 10, (get_he(gas) + 5) / 10, gaschanges[gi].depth / 1000.0);
 #endif
-/* Stop for the minimum duration to switch gas */
-tissue_tolerance = add_segment(depth_to_mbar(depth, displayed_dive) / 1000.0,
-	displayed_dive.cylinder[current_cylinder].gasmix,
-	prefs.min_switch_duration, po2, displayed_dive, prefs.decosac);
-clock += prefs.min_switch_duration;
-			}
+	/* Stop for the minimum duration to switch gas */
+	tissue_tolerance = add_segment(depth_to_mbar(depth, displayed_dive) / 1000.0,
+		displayed_dive.cylinder[current_cylinder].gasmix,
+		prefs.min_switch_duration, po2, displayed_dive, prefs.decosac);
+	clock += prefs.min_switch_duration;
+} else {
+	pendinggaschange = true;
+}
 			gi--;
+			}
 		}
 
 		--stopidx;
@@ -1078,6 +1087,21 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
 stopping = true;
 			}
 
+			if (pendinggaschange) {
+current_cylinder = gaschanges[gi + 1].gasidx;
+gas = displayed_dive.cylinder[current_cylinder].gasmix;
+#if DEBUG_PLAN  16
+printf(switch to gas %d (%d/%d) @ %5.2lfm\n, gaschanges[gi + 1].gasidx,
+	(get_o2(gas) + 5) / 10, (get_he(gas) + 5) / 10, gaschanges[gi + 1].depth / 1000.0);
+#endif
+/* Stop for the minimum duration to switch gas */
+tissue_tolerance = add_segment(depth_to_mbar(depth, displayed_dive) / 1000.0,
+	displayed_dive.cylinder[current_cylinder].gasmix,
+	prefs.min_switch_duration, po2, displayed_dive, prefs.decosac);
+clock += prefs.min_switch_duration;
+pendinggaschange = false;
+			}
+
 			/* Deco stop should end when runtime is at a whole minute */
 			int this_decotimestep;
 			this_decotimestep = DECOTIMESTEP - clock % DECOTIMESTEP;
-- 
2.4.3

From 3377675ab7dbb993550237398f0b4abe8c25c334 Mon Sep 17 00:00:00 2001
From: Rick Walsh rickmwa...@gmail.com
Date: Mon, 22 Jun 2015 21:48:42 +1000
Subject: