[PATCH 2/2] Show SAC in the mouseover.

Anton Lundin glance at acc.umu.se
Thu Oct 17 14:32:20 UTC 2013


Any thoughts on this one? It haven't bin merged yet...

On 14 October, 2013 - Anton Lundin wrote:

> This is really nice to have when looking at specific parts of a dive.
> 
> Signed-off-by: Anton Lundin <glance at acc.umu.se>
> ---
>  pref.h                |  1 +
>  profile.c             |  4 ++++
>  qt-ui/mainwindow.cpp  |  1 +
>  qt-ui/preferences.cpp |  3 +++
>  qt-ui/preferences.ui  | 11 +++++++++++
>  subsurfacestartup.c   |  1 +
>  6 files changed, 21 insertions(+)
> 
> diff --git a/pref.h b/pref.h
> index 8d181f2..e59ad1c 100644
> --- a/pref.h
> +++ b/pref.h
> @@ -36,6 +36,7 @@ struct preferences {
>  	short unit_system;
>  	struct units units;
>  	short show_time;
> +	short show_sac;
>  };
>  enum unit_system_values { METRIC, IMPERIAL, PERSONALIZE };
>  
> diff --git a/profile.c b/profile.c
> index 8f0615b..57e0994 100644
> --- a/profile.c
> +++ b/profile.c
> @@ -1247,6 +1247,10 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
>  		else
>  			snprintf(buf, bufsize, translate("gettextFromC","%s\nNDL:%umin"), buf2, DIV_UP(entry->ndl, 60));
>  	}
> +	if (entry->sac && prefs.show_sac) {
> +		memcpy(buf2, buf, bufsize);
> +		snprintf(buf, bufsize, translate("gettextFromC","%s\nSAC:%2.1fl/min"), buf2, entry->sac / 1000.0);
> +	}
>  	if (entry->tts) {
>  		memcpy(buf2, buf, bufsize);
>  		snprintf(buf, bufsize, translate("gettextFromC","%s\nTTS:%umin"), buf2, DIV_UP(entry->tts, 60));
> diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
> index 247cfdf..ce0879a 100644
> --- a/qt-ui/mainwindow.cpp
> +++ b/qt-ui/mainwindow.cpp
> @@ -586,6 +586,7 @@ void MainWindow::readSettings()
>  	GET_INT("gfhigh", gfhigh);
>  	set_gf(prefs.gflow, prefs.gfhigh);
>  	GET_BOOL("show_time", show_time);
> +	GET_BOOL("show_sac", show_sac);
>  	s.endGroup();
>  
>  	s.beginGroup("Display");
> diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
> index e188cdb..9208991 100644
> --- a/qt-ui/preferences.cpp
> +++ b/qt-ui/preferences.cpp
> @@ -73,6 +73,7 @@ void PreferencesDialog::setUiFromPrefs()
>  	ui.defaultfilename->setText(prefs.default_filename);
>  	ui.displayinvalid->setChecked(prefs.show_invalid);
>  	ui.show_time->setChecked(prefs.show_time);
> +	ui.show_sac->setChecked(prefs.show_sac);
>  	ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
>  	ui.vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
>  }
> @@ -117,6 +118,7 @@ void PreferencesDialog::setPrefsFromUi()
>  	prefs.default_filename = strdup(ui.defaultfilename->text().toUtf8().data());
>  	prefs.display_invalid_dives = ui.displayinvalid->isChecked();
>  	SP(show_time, ui.show_time);
> +	SP(show_sac, ui.show_sac);
>  }
>  
>  #define SB(V, B) s.setValue(V, (int)(B->isChecked() ? 1 : 0))
> @@ -143,6 +145,7 @@ void PreferencesDialog::syncSettings()
>  	s.setValue("gflow", ui.gflow->value());
>  	s.setValue("gfhigh", ui.gfhigh->value());
>  	SB("show_time", ui.show_time);
> +	SB("show_sac", ui.show_sac);
>  	s.endGroup();
>  
>  	// Units
> diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
> index 18767a7..85ff60d 100644
> --- a/qt-ui/preferences.ui
> +++ b/qt-ui/preferences.ui
> @@ -724,6 +724,17 @@
>                </item>
>               </layout>
>              </item>
> +            <item>
> +             <layout class="QHBoxLayout" name="horizontalLayout_11">
> +              <item>
> +               <widget class="QCheckBox" name="show_sac">
> +                <property name="text">
> +                 <string>Show SAC</string>
> +                </property>
> +               </widget>
> +              </item>
> +             </layout>
> +            </item>
>             </layout>
>            </widget>
>           </item>
> diff --git a/subsurfacestartup.c b/subsurfacestartup.c
> index 9a03be6..e52e0df 100644
> --- a/subsurfacestartup.c
> +++ b/subsurfacestartup.c
> @@ -26,6 +26,7 @@ struct preferences default_prefs = {
>  	.font_size = 14.0,
>  	.show_invalid = FALSE,
>  	.show_time = FALSE,
> +	.show_sac = FALSE,
>  };
>  
>  struct units *get_units()
> -- 
> 1.8.1.2

-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list