Desktop: Add a Button to Hide the Infobox in the Dive Profile.

Add a button that allows the user to hide the infobox with statistics
about the point in the dive under the mouse cursor in order to be able
to see the full dive profile unobstructed.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2023-06-18 15:28:51 +12:00 committed by bstoeger
parent b5007bde67
commit ce67c8b902
12 changed files with 63 additions and 3 deletions

View file

@ -1,3 +1,4 @@
desktop: added button to hide the infobox in the dive profile
desktop: use persisted device information for the dive computer configuration
export: fix bug resulting in invalid CSV for '""' in 'CSV summary dive details'
desktop: add support for multiple tanks to the profile ruler

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -2331,6 +2331,10 @@ M-value, corresponds to 100%), the time to surface (TTS), the calculated ceiling
as of the statistics in the Information Box, shown as four
buttons on the left of the profile panel. These are:
[icon="images/icons/InfoBox.png"]
[NOTE]
Show or hide the *Information Box*. This allows the Information Box to be hidden in order to see the entire dive profile without any obstructions.
[icon="images/icons/MOD.jpg"]
[NOTE]
Show the *Maximum Operating Depth (MOD)* of the dive, given the

View file

@ -204,6 +204,7 @@ struct preferences {
bool tankbar;
int vpmb_conservatism;
bool zoomed_plot;
bool infobox;
// ********** Units **********
bool coordinates_traditional;

View file

@ -39,6 +39,7 @@ void qPrefTechnicalDetails::loadSync(bool doSync)
disk_tankbar(doSync);
disk_vpmb_conservatism(doSync);
disk_zoomed_plot(doSync);
disk_infobox(doSync);
}
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "calcalltissues", calcalltissues);
@ -101,6 +102,8 @@ void qPrefTechnicalDetails::disk_gflow(bool doSync)
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "gf_low_at_maxdepth", gf_low_at_maxdepth);
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "InfoBox", infobox);
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "hrgraph", hrgraph);
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "mod", mod);

View file

@ -33,6 +33,7 @@ class qPrefTechnicalDetails : public QObject {
Q_PROPERTY(bool tankbar READ tankbar WRITE set_tankbar NOTIFY tankbarChanged)
Q_PROPERTY(int vpmb_conservatism READ vpmb_conservatism WRITE set_vpmb_conservatism NOTIFY vpmb_conservatismChanged)
Q_PROPERTY(bool zoomed_plot READ zoomed_plot WRITE set_zoomed_plot NOTIFY zoomed_plotChanged)
Q_PROPERTY(bool infobox READ infobox WRITE set_infobox NOTIFY infoboxChanged)
public:
static qPrefTechnicalDetails *instance();
@ -69,6 +70,7 @@ public:
static bool tankbar() { return prefs.tankbar; }
static int vpmb_conservatism() { return prefs.vpmb_conservatism; }
static bool zoomed_plot() { return prefs.zoomed_plot; }
static bool infobox() { return prefs.infobox; }
public slots:
static void set_calcalltissues(bool value);
@ -97,6 +99,7 @@ public slots:
static void set_tankbar(bool value);
static void set_vpmb_conservatism(int value);
static void set_zoomed_plot(bool value);
static void set_infobox(bool value);
signals:
void calcalltissuesChanged(bool value);
@ -125,6 +128,7 @@ signals:
void tankbarChanged(bool value);
void vpmb_conservatismChanged(int value);
void zoomed_plotChanged(bool value);
void infoboxChanged(bool value);
private:
qPrefTechnicalDetails() {}
@ -155,6 +159,7 @@ private:
static void disk_tankbar(bool doSync);
static void disk_vpmb_conservatism(bool doSync);
static void disk_zoomed_plot(bool doSync);
static void disk_infobox(bool doSync);
};
#endif

View file

@ -59,7 +59,8 @@ ProfileWidget::ProfileWidget() : d(nullptr), dc(0), originalDive(nullptr), placi
// what is a sane order for those icons? we should have the ones the user is
// most likely to want towards the top so they are always visible
// and the ones that someone likely sets and then never touches again towards the bottom
toolbarActions = { ui.profCalcCeiling, ui.profCalcAllTissues, // start with various ceilings
toolbarActions = { ui.profInfobox, // show / hide the infobox
ui.profCalcCeiling, ui.profCalcAllTissues, // various ceilings
ui.profIncrement3m, ui.profDcCeiling,
ui.profPhe, ui.profPn2, ui.profPO2, // partial pressure graphs
ui.profRuler, ui.profScaled, // measuring and scaling
@ -109,6 +110,7 @@ ProfileWidget::ProfileWidget() : d(nullptr), dc(0), originalDive(nullptr), placi
connect(ui.profTogglePicture, &QAction::triggered, tec, &qPrefTechnicalDetails::set_show_pictures_in_profile);
connect(ui.profTankbar, &QAction::triggered, tec, &qPrefTechnicalDetails::set_tankbar);
connect(ui.profTissues, &QAction::triggered, tec, &qPrefTechnicalDetails::set_percentagegraph);
connect(ui.profInfobox, &QAction::triggered, tec, &qPrefTechnicalDetails::set_infobox);
connect(ui.profTissues, &QAction::triggered, this, &ProfileWidget::unsetProfHR);
connect(ui.profHR, &QAction::triggered, this, &ProfileWidget::unsetProfTissues);
@ -142,6 +144,7 @@ ProfileWidget::ProfileWidget() : d(nullptr), dc(0), originalDive(nullptr), placi
ui.profTankbar->setChecked(qPrefTechnicalDetails::tankbar());
ui.profTissues->setChecked(qPrefTechnicalDetails::percentagegraph());
ui.profScaled->setChecked(qPrefTechnicalDetails::zoomed_plot());
ui.profInfobox->setChecked(qPrefTechnicalDetails::infobox());
}
ProfileWidget::~ProfileWidget()
@ -179,6 +182,7 @@ void ProfileWidget::setDive(const struct dive *d)
ui.profScaled->setDisabled(false); // measuring and scaling
ui.profTogglePicture->setDisabled(false);
ui.profHR->setDisabled(false);
ui.profInfobox->setDisabled(false);
}
void ProfileWidget::plotCurrentDive()

View file

@ -2,6 +2,18 @@
<ui version="4.0">
<class>ProfileWidget</class>
<widget class="QWidget" name="ProfileWidget">
<action name="profInfobox">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset>
<normaloff>:status-info-icon</normaloff>:status-info-icon</iconset>
</property>
<property name="text">
<string>Toggle infobox</string>
</property>
</action>
<action name="profTissues">
<property name="checkable">
<bool>true</bool>

View file

@ -4,6 +4,7 @@
#include "core/membuffer.h"
#include "core/metrics.h"
#include "core/settings/qPrefDisplay.h"
#include "core/settings/qPrefTechnicalDetails.h"
#include <QPropertyAnimation>
#include <QGraphicsView>
#include "core/qthelper.h"
@ -154,6 +155,9 @@ ToolTipItem::ToolTipItem(QGraphicsItem *parent) : RoundRectItem(8.0, parent),
title->setBrush(Qt::white);
setPen(QPen(Qt::white, 2));
connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::infoboxChanged, this, &ToolTipItem::settingsChanged);
refreshTime.start();
}
@ -268,3 +272,8 @@ void ToolTipItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
scene()->clearSelection();
QGraphicsItem::mousePressEvent(event);
}
void ToolTipItem::settingsChanged(bool value)
{
setVisible(value);
}

View file

@ -40,6 +40,7 @@ public:
void setTimeAxis(DiveCartesianAxis *axis);
void setPlotInfo(const plot_info &plot);
void clearPlotInfo();
void settingsChanged(bool value);
public
slots:
void setRect(const QRectF &rect);

View file

@ -111,6 +111,7 @@ ProfileWidget2::ProfileWidget2(DivePlannerPointsModel *plannerModelIn, double dp
connect(tec, &qPrefTechnicalDetails::show_pictures_in_profileChanged , this, &ProfileWidget2::actionRequestedReplot);
connect(tec, &qPrefTechnicalDetails::tankbarChanged , this, &ProfileWidget2::actionRequestedReplot);
connect(tec, &qPrefTechnicalDetails::percentagegraphChanged , this, &ProfileWidget2::actionRequestedReplot);
connect(tec, &qPrefTechnicalDetails::infoboxChanged , this, &ProfileWidget2::actionRequestedReplot);
auto pp_gas = qPrefPartialPressureGas::instance();
connect(pp_gas, &qPrefPartialPressureGas::pheChanged, this, &ProfileWidget2::actionRequestedReplot);
@ -215,8 +216,9 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, int flags)
shouldCalculateMax, zoom, zoomedPosition);
#ifndef SUBSURFACE_MOBILE
rulerItem->setVisible(prefs.rulergraph && currentState != PLAN && currentState != EDIT);
toolTipItem->setVisible(prefs.infobox);
toolTipItem->setPlotInfo(profileScene->plotInfo);
rulerItem->setVisible(prefs.rulergraph && currentState != PLAN && currentState != EDIT);
rulerItem->setPlotInfo(d, profileScene->plotInfo);
if ((currentState == EDIT || currentState == PLAN) && plannerModel) {
@ -423,7 +425,7 @@ void ProfileWidget2::setProfileState()
#ifndef SUBSURFACE_MOBILE
toolTipItem->readPos();
toolTipItem->setVisible(true);
toolTipItem->setVisible(prefs.infobox);
rulerItem->setVisible(prefs.rulergraph);
mouseFollowerHorizontal->setVisible(false);
mouseFollowerVertical->setVisible(false);

View file

@ -48,6 +48,7 @@ void TestQPrefTechnicalDetails::test_struct_get()
prefs.tankbar = true;
prefs.vpmb_conservatism = 123;
prefs.zoomed_plot = true;
prefs.infobox = true;
QCOMPARE(tst->calcceiling(), prefs.calcceiling);
QCOMPARE(tst->calcceiling3m(), prefs.calcceiling3m);
@ -73,6 +74,7 @@ void TestQPrefTechnicalDetails::test_struct_get()
QCOMPARE(tst->tankbar(), prefs.tankbar);
QCOMPARE(tst->vpmb_conservatism(), prefs.vpmb_conservatism);
QCOMPARE(tst->zoomed_plot(), prefs.zoomed_plot);
QCOMPARE(tst->infobox(), prefs.infobox);
}
void TestQPrefTechnicalDetails::test_set_struct()
@ -106,6 +108,7 @@ void TestQPrefTechnicalDetails::test_set_struct()
tst->set_tankbar(false);
tst->set_vpmb_conservatism(64);
tst->set_zoomed_plot(false);
tst->set_infobox(false);
QCOMPARE(prefs.calcceiling, false);
QCOMPARE(prefs.calcceiling3m, false);
@ -131,6 +134,7 @@ void TestQPrefTechnicalDetails::test_set_struct()
QCOMPARE(prefs.tankbar, false);
QCOMPARE(prefs.vpmb_conservatism, 64);
QCOMPARE(prefs.zoomed_plot, false);
QCOMPARE(prefs.infobox, false);
}
void TestQPrefTechnicalDetails::test_set_load_struct()
@ -164,6 +168,7 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
tst->set_tankbar(true);
tst->set_vpmb_conservatism(64);
tst->set_zoomed_plot(true);
tst->set_infobox(true);
prefs.calcalltissues = true;
prefs.calcceiling = true;
@ -190,6 +195,7 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
prefs.tankbar = false;
prefs.vpmb_conservatism = 123;
prefs.zoomed_plot = false;
prefs.infobox = false;
tst->load();
QCOMPARE(prefs.calcceiling, false);
@ -216,6 +222,7 @@ void TestQPrefTechnicalDetails::test_set_load_struct()
QCOMPARE(prefs.tankbar, true);
QCOMPARE(prefs.vpmb_conservatism, 64);
QCOMPARE(prefs.zoomed_plot, true);
QCOMPARE(prefs.infobox, true);
}
void TestQPrefTechnicalDetails::test_struct_disk()
@ -249,6 +256,7 @@ void TestQPrefTechnicalDetails::test_struct_disk()
prefs.tankbar = true;
prefs.vpmb_conservatism = 15;
prefs.zoomed_plot = true;
prefs.infobox = true;
tst->sync();
prefs.calcalltissues = false;
@ -302,6 +310,7 @@ void TestQPrefTechnicalDetails::test_struct_disk()
QCOMPARE(prefs.tankbar, true);
QCOMPARE(prefs.vpmb_conservatism, 15);
QCOMPARE(prefs.zoomed_plot, true);
QCOMPARE(prefs.infobox, true);
}
void TestQPrefTechnicalDetails::test_multiple()
@ -381,6 +390,8 @@ void TestQPrefTechnicalDetails::test_oldPreferences()
TEST(tecDetails->show_sac(), true);
tecDetails->set_show_pictures_in_profile(true);
TEST(tecDetails->show_pictures_in_profile(), true);
tecDetails->set_infobox(true);
TEST(tecDetails->infobox(), true);
tecDetails->set_ead(false);
TEST(tecDetails->ead(), false);
@ -416,6 +427,8 @@ void TestQPrefTechnicalDetails::test_oldPreferences()
TEST(tecDetails->show_sac(), false);
tecDetails->set_show_pictures_in_profile(false);
TEST(tecDetails->show_pictures_in_profile(), false);
tecDetails->set_infobox(false);
TEST(tecDetails->infobox(), false);
}
void TestQPrefTechnicalDetails::test_signals()
@ -445,6 +458,7 @@ void TestQPrefTechnicalDetails::test_signals()
QSignalSpy spy25(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::tankbarChanged);
QSignalSpy spy26(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::vpmb_conservatismChanged);
QSignalSpy spy27(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::zoomed_plotChanged);
QSignalSpy spy28(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::infoboxChanged);
prefs.calcalltissues = true;
qPrefTechnicalDetails::set_calcalltissues(false);
@ -491,6 +505,8 @@ void TestQPrefTechnicalDetails::test_signals()
qPrefTechnicalDetails::set_vpmb_conservatism(-64);
prefs.zoomed_plot = true;
qPrefTechnicalDetails::set_zoomed_plot(false);
prefs.infobox = true;
qPrefTechnicalDetails::set_infobox(false);
QCOMPARE(spy1.count(), 1);
QCOMPARE(spy2.count(), 1);
@ -517,6 +533,7 @@ void TestQPrefTechnicalDetails::test_signals()
QCOMPARE(spy25.count(), 1);
QCOMPARE(spy26.count(), 1);
QCOMPARE(spy27.count(), 1);
QCOMPARE(spy28.count(), 1);
QVERIFY(spy1.takeFirst().at(0).toBool() == false);
QVERIFY(spy2.takeFirst().at(0).toBool() == false);
@ -543,6 +560,7 @@ void TestQPrefTechnicalDetails::test_signals()
QVERIFY(spy25.takeFirst().at(0).toBool() == false);
QVERIFY(spy26.takeFirst().at(0).toInt() == -64);
QVERIFY(spy27.takeFirst().at(0).toBool() == false);
QVERIFY(spy28.takeFirst().at(0).toBool() == false);
}