[PATCH v2] Show sample time in the mouseover.
Anton Lundin
glance at acc.umu.se
Wed Sep 18 05:31:15 UTC 2013
This is really nice to have when looking at specific coutures of a dive
or events.
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 f722dd1..8098c27 100644
--- a/pref.h
+++ b/pref.h
@@ -47,6 +47,7 @@ struct preferences {
short show_invalid;
short unit_system;
struct units units;
+ short show_time;
};
enum unit_system_values { METRIC, IMPERIAL, PERSONALIZE };
diff --git a/profile.c b/profile.c
index 5c947fb..693b246 100644
--- a/profile.c
+++ b/profile.c
@@ -1224,6 +1224,10 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
depthvalue = get_depth_units(depth, NULL, &depth_unit);
snprintf(buf, bufsize, _("D:%.1f %s"), depthvalue, depth_unit);
+ if (prefs.show_time) {
+ memcpy(buf2, buf, bufsize);
+ snprintf(buf, bufsize, _("%s\nT:%d:%02d"), buf2, FRACTION(entry->sec, 60));
+ }
if (pressure) {
pressurevalue = get_pressure_units(pressure, &pressure_unit);
memcpy(buf2, buf, bufsize);
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 44cc9e6..8d6315d 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -559,6 +559,7 @@ void MainWindow::readSettings()
GET_INT("gflow", gflow);
GET_INT("gfhigh", gfhigh);
set_gf(prefs.gflow, prefs.gfhigh);
+ GET_BOOL("show_time", show_time);
s.endGroup();
s.beginGroup("Display");
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 19fa169..f206224 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -74,6 +74,7 @@ void PreferencesDialog::setUiFromPrefs()
ui->fontsize->setValue(prefs.font_size);
ui->defaultfilename->setText(prefs.default_filename);
ui->displayinvalid->setChecked(prefs.show_invalid);
+ ui->show_time->setChecked(prefs.show_time);
}
void PreferencesDialog::restorePrefs()
@@ -114,6 +115,7 @@ void PreferencesDialog::setPrefsFromUi()
prefs.font_size = ui->fontsize->value();
prefs.default_filename = strdup(ui->defaultfilename->text().toUtf8().data());
prefs.display_invalid_dives = ui->displayinvalid->isChecked();
+ SP(show_time, ui->show_time);
}
#define SB(V, B) s.setValue(V, (int)(B->isChecked() ? 1 : 0))
@@ -139,6 +141,7 @@ void PreferencesDialog::syncSettings()
SB("calcalltissues", ui->all_tissues);
s.setValue("gflow", ui->gflow->value());
s.setValue("gfhigh", ui->gfhigh->value());
+ SB("show_time", ui->show_time);
s.endGroup();
// Units
diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index 2ecd096..5507623 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -686,6 +686,17 @@
</item>
</layout>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_11">
+ <item>
+ <widget class="QCheckBox" name="show_time">
+ <property name="text">
+ <string>Show time</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index bf093ed..9548409 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -26,6 +26,7 @@ struct preferences default_prefs = {
.gfhigh = 75,
.font_size = 14.0,
.show_invalid = FALSE,
+ .show_time = FALSE,
#ifdef USE_GTK_UI
.map_provider = OSM_GPS_MAP_SOURCE_VIRTUAL_EARTH_HYBRID,
#endif
--
1.8.1.2
More information about the subsurface
mailing list