mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Feature to show or hide heart rate graph
Adds new push button "HR" to the button bar on the dive profile to toggle display of heart rate. TODO: New icon for the heart rate button is needed. Fixes #485 Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
20bde81023
commit
6a8d929876
10 changed files with 70 additions and 9 deletions
1
pref.h
1
pref.h
|
@ -42,6 +42,7 @@ struct preferences {
|
||||||
bool display_unused_tanks;
|
bool display_unused_tanks;
|
||||||
bool show_average_depth;
|
bool show_average_depth;
|
||||||
bool zoomed_plot;
|
bool zoomed_plot;
|
||||||
|
short heart_rate;
|
||||||
};
|
};
|
||||||
enum unit_system_values {
|
enum unit_system_values {
|
||||||
METRIC,
|
METRIC,
|
||||||
|
|
|
@ -1321,7 +1321,7 @@ static void plot_string(struct plot_info *pi, struct plot_data *entry, struct me
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entry->heartbeat)
|
if (entry->heartbeat && prefs.heart_rate)
|
||||||
put_format(b, translate("gettextFromC", "heartbeat: %d\n"), entry->heartbeat);
|
put_format(b, translate("gettextFromC", "heartbeat: %d\n"), entry->heartbeat);
|
||||||
if (entry->bearing)
|
if (entry->bearing)
|
||||||
put_format(b, translate("gettextFromC", "bearing: %d\n"), entry->bearing);
|
put_format(b, translate("gettextFromC", "bearing: %d\n"), entry->bearing);
|
||||||
|
|
|
@ -221,6 +221,7 @@ void MainWindow::setToolButtonsEnabled(bool enabled)
|
||||||
ui.profSAC->setEnabled(enabled);
|
ui.profSAC->setEnabled(enabled);
|
||||||
ui.profRuler->setEnabled(enabled);
|
ui.profRuler->setEnabled(enabled);
|
||||||
ui.profScaled->setEnabled(enabled);
|
ui.profScaled->setEnabled(enabled);
|
||||||
|
ui.profHR->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionClose_triggered()
|
void MainWindow::on_actionClose_triggered()
|
||||||
|
@ -702,6 +703,7 @@ void MainWindow::readSettings()
|
||||||
TOOLBOX_PREF_BUTTON(pp_graphs.phe, phegraph, profPhe);
|
TOOLBOX_PREF_BUTTON(pp_graphs.phe, phegraph, profPhe);
|
||||||
TOOLBOX_PREF_BUTTON(pp_graphs.pn2, pn2graph, profPn2);
|
TOOLBOX_PREF_BUTTON(pp_graphs.pn2, pn2graph, profPn2);
|
||||||
TOOLBOX_PREF_BUTTON(pp_graphs.po2, po2graph, profPO2);
|
TOOLBOX_PREF_BUTTON(pp_graphs.po2, po2graph, profPO2);
|
||||||
|
TOOLBOX_PREF_BUTTON(heart_rate, hrgraph, profHR);
|
||||||
ui.profRuler->setChecked(s.value("rulergraph").toBool());
|
ui.profRuler->setChecked(s.value("rulergraph").toBool());
|
||||||
TOOLBOX_PREF_BUTTON(show_sac, show_sac, profSAC);
|
TOOLBOX_PREF_BUTTON(show_sac, show_sac, profSAC);
|
||||||
}
|
}
|
||||||
|
@ -1164,6 +1166,11 @@ void MainWindow::on_profPO2_clicked(bool triggered)
|
||||||
prefs.pp_graphs.po2 = triggered;
|
prefs.pp_graphs.po2 = triggered;
|
||||||
TOOLBOX_PREF_PROFILE(po2graph);
|
TOOLBOX_PREF_PROFILE(po2graph);
|
||||||
}
|
}
|
||||||
|
void MainWindow::on_profHR_clicked(bool triggered)
|
||||||
|
{
|
||||||
|
prefs.heart_rate = triggered;
|
||||||
|
TOOLBOX_PREF_PROFILE(hrgraph);
|
||||||
|
}
|
||||||
void MainWindow::on_profRuler_clicked(bool triggered)
|
void MainWindow::on_profRuler_clicked(bool triggered)
|
||||||
{
|
{
|
||||||
TOOLBOX_PREF_PROFILE(rulergraph);
|
TOOLBOX_PREF_PROFILE(rulergraph);
|
||||||
|
|
|
@ -140,6 +140,7 @@ slots:
|
||||||
void on_profPO2_clicked(bool triggered);
|
void on_profPO2_clicked(bool triggered);
|
||||||
void on_profPhe_clicked(bool triggered);
|
void on_profPhe_clicked(bool triggered);
|
||||||
void on_profPn2_clicked(bool triggered);
|
void on_profPn2_clicked(bool triggered);
|
||||||
|
void on_profHR_clicked(bool triggered);
|
||||||
void on_profRuler_clicked(bool triggered);
|
void on_profRuler_clicked(bool triggered);
|
||||||
void on_profSAC_clicked(bool triggered);
|
void on_profSAC_clicked(bool triggered);
|
||||||
void on_profScaled_clicked(bool triggered);
|
void on_profScaled_clicked(bool triggered);
|
||||||
|
|
|
@ -449,11 +449,27 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" rowspan="14">
|
<item row="13" column="0">
|
||||||
|
<widget class="QToolButton" name="profHR">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Show/hide heart rate</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>HR</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" rowspan="15">
|
||||||
<widget class="ProfileWidget2" name="newProfile"/>
|
<widget class="ProfileWidget2" name="newProfile"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="0">
|
<item row="14" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
|
|
@ -268,6 +268,7 @@ void PreferencesDialog::loadSettings()
|
||||||
GET_BOOL("calcceiling3m", calc_ceiling_3m_incr);
|
GET_BOOL("calcceiling3m", calc_ceiling_3m_incr);
|
||||||
GET_BOOL("calcndltts", calc_ndl_tts);
|
GET_BOOL("calcndltts", calc_ndl_tts);
|
||||||
GET_BOOL("calcalltissues", calc_all_tissues);
|
GET_BOOL("calcalltissues", calc_all_tissues);
|
||||||
|
GET_BOOL("hrgraph", heart_rate);
|
||||||
GET_INT("gflow", gflow);
|
GET_INT("gflow", gflow);
|
||||||
GET_INT("gfhigh", gfhigh);
|
GET_INT("gfhigh", gfhigh);
|
||||||
GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth);
|
GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth);
|
||||||
|
|
|
@ -221,6 +221,7 @@ DiveHeartrateItem::DiveHeartrateItem()
|
||||||
pen.setCosmetic(true);
|
pen.setCosmetic(true);
|
||||||
pen.setWidth(1);
|
pen.setWidth(1);
|
||||||
setPen(pen);
|
setPen(pen);
|
||||||
|
visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveHeartrateItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
void DiveHeartrateItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||||
|
@ -297,6 +298,27 @@ void DiveHeartrateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
||||||
painter->drawPolyline(polygon());
|
painter->drawPolyline(polygon());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiveHeartrateItem::preferencesChanged()
|
||||||
|
{
|
||||||
|
QSettings s;
|
||||||
|
s.beginGroup("TecDetails");
|
||||||
|
setVisible(s.value(visibilityKey).toBool());
|
||||||
|
if (s.value(visibilityKey).toBool())
|
||||||
|
visible = true;
|
||||||
|
else
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiveHeartrateItem::setVisibilitySettingsKey(const QString &key)
|
||||||
|
{
|
||||||
|
visibilityKey = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DiveHeartrateItem::isVisible()
|
||||||
|
{
|
||||||
|
return visible == true;
|
||||||
|
}
|
||||||
|
|
||||||
DiveTemperatureItem::DiveTemperatureItem()
|
DiveTemperatureItem::DiveTemperatureItem()
|
||||||
{
|
{
|
||||||
QPen pen;
|
QPen pen;
|
||||||
|
|
|
@ -100,9 +100,14 @@ public:
|
||||||
DiveHeartrateItem();
|
DiveHeartrateItem();
|
||||||
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
virtual void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
|
virtual void preferencesChanged();
|
||||||
|
void setVisibilitySettingsKey(const QString &setVisibilitySettingsKey);
|
||||||
|
bool isVisible();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createTextItem(int seconds, int hr);
|
void createTextItem(int seconds, int hr);
|
||||||
|
QString visibilityKey;
|
||||||
|
bool visible;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DiveGasPressureItem : public AbstractProfilePolygonItem {
|
class DiveGasPressureItem : public AbstractProfilePolygonItem {
|
||||||
|
|
|
@ -193,6 +193,8 @@ void ProfileWidget2::setupItemOnScene()
|
||||||
setupItem(gasPressureItem, timeAxis, cylinderPressureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1);
|
setupItem(gasPressureItem, timeAxis, cylinderPressureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1);
|
||||||
setupItem(temperatureItem, timeAxis, temperatureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1);
|
setupItem(temperatureItem, timeAxis, temperatureAxis, dataModel, DivePlotDataModel::TEMPERATURE, DivePlotDataModel::TIME, 1);
|
||||||
setupItem(heartBeatItem, timeAxis, heartBeatAxis, dataModel, DivePlotDataModel::HEARTBEAT, DivePlotDataModel::TIME, 1);
|
setupItem(heartBeatItem, timeAxis, heartBeatAxis, dataModel, DivePlotDataModel::HEARTBEAT, DivePlotDataModel::TIME, 1);
|
||||||
|
heartBeatItem->setVisibilitySettingsKey("hrgraph");
|
||||||
|
heartBeatItem->preferencesChanged();
|
||||||
setupItem(diveProfileItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::DEPTH, DivePlotDataModel::TIME, 0);
|
setupItem(diveProfileItem, timeAxis, profileYAxis, dataModel, DivePlotDataModel::DEPTH, DivePlotDataModel::TIME, 0);
|
||||||
|
|
||||||
#define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS, VISIBILITY_SETTINGS) \
|
#define CREATE_PP_GAS(ITEM, VERTICAL_COLUMN, COLOR, COLOR_ALERT, THRESHOULD_SETTINGS, VISIBILITY_SETTINGS) \
|
||||||
|
@ -400,11 +402,15 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
|
||||||
temperatureAxis->setMinimum(pInfo.mintemp);
|
temperatureAxis->setMinimum(pInfo.mintemp);
|
||||||
temperatureAxis->setMaximum(pInfo.maxtemp);
|
temperatureAxis->setMaximum(pInfo.maxtemp);
|
||||||
|
|
||||||
if (pInfo.maxhr) {
|
if (heartBeatItem->isVisible()) {
|
||||||
heartBeatAxis->setMinimum(pInfo.minhr);
|
if (pInfo.maxhr) {
|
||||||
heartBeatAxis->setMaximum(pInfo.maxhr);
|
heartBeatAxis->setMinimum(pInfo.minhr);
|
||||||
heartBeatAxis->updateTicks(); // this shows the ticks
|
heartBeatAxis->setMaximum(pInfo.maxhr);
|
||||||
heartBeatAxis->setVisible(true);
|
heartBeatAxis->updateTicks(); // this shows the ticks
|
||||||
|
heartBeatAxis->setVisible(true);
|
||||||
|
} else {
|
||||||
|
heartBeatAxis->setVisible(false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
heartBeatAxis->setVisible(false);
|
heartBeatAxis->setVisible(false);
|
||||||
}
|
}
|
||||||
|
@ -656,6 +662,7 @@ void ProfileWidget2::setProfileState()
|
||||||
temperatureAxis->setPos(itemPos.temperature.pos.on);
|
temperatureAxis->setPos(itemPos.temperature.pos.on);
|
||||||
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
|
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
|
||||||
heartBeatAxis->setLine(itemPos.heartBeat.expanded);
|
heartBeatAxis->setLine(itemPos.heartBeat.expanded);
|
||||||
|
heartBeatItem->setVisible(s.value("hrgraph").toBool());
|
||||||
meanDepth->setVisible(true);
|
meanDepth->setVisible(true);
|
||||||
|
|
||||||
diveComputerText->setVisible(true);
|
diveComputerText->setVisible(true);
|
||||||
|
|
|
@ -18,6 +18,7 @@ struct preferences default_prefs = {
|
||||||
.mod = false,
|
.mod = false,
|
||||||
.mod_ppO2 = 1.6,
|
.mod_ppO2 = 1.6,
|
||||||
.ead = false,
|
.ead = false,
|
||||||
|
.heart_rate = true,
|
||||||
.profile_dc_ceiling = true,
|
.profile_dc_ceiling = true,
|
||||||
.profile_red_ceiling = false,
|
.profile_red_ceiling = false,
|
||||||
.profile_calc_ceiling = false,
|
.profile_calc_ceiling = false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue