mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Renaming the prefs struct members to be consistent with the QSettings.
-Renaming prefs members for consistency. -Changing references of QSettings to the prefs structure instead. -Removing unused functions in pref.h were left over from an old version. -Changing the data-type of bool members to short for consistency with other members. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4bd4c01108
commit
8380f09619
8 changed files with 80 additions and 97 deletions
|
@ -353,10 +353,7 @@ QColor DepthAxis::colorForValue(double value)
|
|||
|
||||
static bool isPPGraphEnabled()
|
||||
{
|
||||
QSettings s;
|
||||
|
||||
s.beginGroup("TecDetails");
|
||||
return s.value("phegraph").toBool() || s.value("po2graph").toBool() || s.value("pn2graph").toBool();
|
||||
return prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe;
|
||||
}
|
||||
|
||||
DepthAxis::DepthAxis() : showWithPPGraph(false)
|
||||
|
@ -426,11 +423,9 @@ void PartialGasPressureAxis::setModel(DivePlotDataModel *m)
|
|||
|
||||
void PartialGasPressureAxis::preferencesChanged()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("TecDetails");
|
||||
bool showPhe = s.value("phegraph").toBool();
|
||||
bool showPn2 = s.value("pn2graph").toBool();
|
||||
bool showPo2 = s.value("po2graph").toBool();
|
||||
bool showPhe = prefs.pp_graphs.phe;
|
||||
bool showPn2 = prefs.pp_graphs.pn2;
|
||||
bool showPo2 = prefs.pp_graphs.po2;
|
||||
setVisible(showPhe || showPn2 || showPo2);
|
||||
if (!model->rowCount())
|
||||
return;
|
||||
|
|
|
@ -145,11 +145,11 @@ void DiveProfileItem::modelDataChanged(const QModelIndex &topLeft, const QModelI
|
|||
if (polygon().isEmpty())
|
||||
return;
|
||||
|
||||
show_reported_ceiling = prefs.profile_dc_ceiling;
|
||||
reported_ceiling_in_red = prefs.profile_red_ceiling;
|
||||
show_reported_ceiling = prefs.dcceiling;
|
||||
reported_ceiling_in_red = prefs.redceiling;
|
||||
|
||||
/* Show any ceiling we may have encountered */
|
||||
if (prefs.profile_dc_ceiling && !prefs.profile_red_ceiling) {
|
||||
if (prefs.dcceiling && !prefs.redceiling) {
|
||||
QPolygonF p = polygon();
|
||||
plot_data *entry = dataModel->data().entry + dataModel->rowCount() - 1;
|
||||
for (int i = dataModel->rowCount() - 1; i >= 0; i--, entry--) {
|
||||
|
@ -197,7 +197,7 @@ void DiveProfileItem::modelDataChanged(const QModelIndex &topLeft, const QModelI
|
|||
void DiveProfileItem::preferencesChanged()
|
||||
{
|
||||
//TODO: Only modelDataChanged() here if we need to rebuild the graph ( for instance,
|
||||
// if the prefs.profile_dc_ceiling are enabled, but prefs.profile_red_ceiling is disabled
|
||||
// if the prefs.dcceiling are enabled, but prefs.redceiling is disabled
|
||||
// and only if it changed something. let's not waste cpu cycles repoloting something we don't need to.
|
||||
modelDataChanged();
|
||||
}
|
||||
|
@ -552,9 +552,7 @@ DiveCalculatedTissue::DiveCalculatedTissue()
|
|||
|
||||
void DiveCalculatedTissue::preferencesChanged()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("TecDetails");
|
||||
setVisible(s.value("calcalltissues").toBool() && s.value("calcceiling").toBool());
|
||||
setVisible(prefs.calcalltissues && prefs.calcceiling);
|
||||
}
|
||||
|
||||
void DiveReportedCeiling::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||
|
@ -579,7 +577,7 @@ void DiveReportedCeiling::modelDataChanged(const QModelIndex &topLeft, const QMo
|
|||
setPolygon(p);
|
||||
QLinearGradient pat(0, p.boundingRect().top(), 0, p.boundingRect().bottom());
|
||||
// does the user want the ceiling in "surface color" or in red?
|
||||
if (prefs.profile_red_ceiling) {
|
||||
if (prefs.redceiling) {
|
||||
pat.setColorAt(0, getColor(CEILING_SHALLOW));
|
||||
pat.setColorAt(1, getColor(CEILING_DEEP));
|
||||
} else {
|
||||
|
@ -592,23 +590,17 @@ void DiveReportedCeiling::modelDataChanged(const QModelIndex &topLeft, const QMo
|
|||
|
||||
void DiveCalculatedCeiling::preferencesChanged()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("TecDetails");
|
||||
|
||||
bool shouldShow3mIncrement = s.value("calcceiling3m").toBool();
|
||||
if (dataModel && is3mIncrement != shouldShow3mIncrement) {
|
||||
if (dataModel && is3mIncrement != prefs.calcceiling3m) {
|
||||
// recalculate that part.
|
||||
dataModel->calculateDecompression();
|
||||
}
|
||||
is3mIncrement = shouldShow3mIncrement;
|
||||
setVisible(s.value("calcceiling").toBool());
|
||||
is3mIncrement = prefs.calcceiling3m;
|
||||
setVisible(prefs.calcceiling);
|
||||
}
|
||||
|
||||
void DiveReportedCeiling::preferencesChanged()
|
||||
{
|
||||
QSettings s;
|
||||
s.beginGroup("TecDetails");
|
||||
setVisible(s.value("dcceiling").toBool());
|
||||
setVisible(prefs.dcceiling);
|
||||
}
|
||||
|
||||
void DiveReportedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "planner.h"
|
||||
#include "device.h"
|
||||
#include "ruleritem.h"
|
||||
#include "../../dive.h"
|
||||
#include "../../pref.h"
|
||||
#include "dive.h"
|
||||
#include "pref.h"
|
||||
#include <libdivecomputer/parser.h>
|
||||
#include <QSignalTransition>
|
||||
#include <QPropertyAnimation>
|
||||
|
@ -477,7 +477,7 @@ void ProfileWidget2::settingsChanged()
|
|||
{
|
||||
QSettings s;
|
||||
s.beginGroup("TecDetails");
|
||||
if (s.value("phegraph").toBool() || s.value("po2graph").toBool() || s.value("pn2graph").toBool()) {
|
||||
if (prefs.pp_graphs.phe || prefs.pp_graphs.po2 || prefs.pp_graphs.pn2) {
|
||||
profileYAxis->animateChangeLine(itemPos.depth.shrinked);
|
||||
temperatureAxis->animateChangeLine(itemPos.temperature.shrinked);
|
||||
cylinderPressureAxis->animateChangeLine(itemPos.cylinder.shrinked);
|
||||
|
@ -486,8 +486,8 @@ void ProfileWidget2::settingsChanged()
|
|||
temperatureAxis->animateChangeLine(itemPos.temperature.expanded);
|
||||
cylinderPressureAxis->animateChangeLine(itemPos.cylinder.expanded);
|
||||
}
|
||||
if (s.value("zoomed_plot").toBool() != isPlotZoomed) {
|
||||
isPlotZoomed = s.value("zoomed_plot").toBool();
|
||||
if (prefs.zoomed_plot != isPlotZoomed) {
|
||||
isPlotZoomed = prefs.zoomed_plot;
|
||||
replot();
|
||||
}
|
||||
|
||||
|
@ -635,9 +635,7 @@ void ProfileWidget2::setProfileState()
|
|||
cylinderPressureAxis->setVisible(true);
|
||||
|
||||
profileYAxis->setPos(itemPos.depth.pos.on);
|
||||
QSettings s;
|
||||
s.beginGroup("TecDetails");
|
||||
if (s.value("phegraph").toBool() || s.value("po2graph").toBool() || s.value("pn2graph").toBool()) {
|
||||
if (prefs.pp_graphs.phe || prefs.pp_graphs.po2 || prefs.pp_graphs.pn2) {
|
||||
profileYAxis->setLine(itemPos.depth.shrinked);
|
||||
temperatureAxis->setLine(itemPos.temperature.shrinked);
|
||||
cylinderPressureAxis->setLine(itemPos.cylinder.shrinked);
|
||||
|
@ -646,9 +644,9 @@ void ProfileWidget2::setProfileState()
|
|||
temperatureAxis->setLine(itemPos.temperature.expanded);
|
||||
cylinderPressureAxis->setLine(itemPos.cylinder.expanded);
|
||||
}
|
||||
pn2GasItem->setVisible(s.value("pn2graph").toBool());
|
||||
po2GasItem->setVisible(s.value("po2graph").toBool());
|
||||
pheGasItem->setVisible(s.value("phegraph").toBool());
|
||||
pn2GasItem->setVisible(prefs.pp_graphs.pn2);
|
||||
po2GasItem->setVisible(prefs.pp_graphs.po2);
|
||||
pheGasItem->setVisible(prefs.pp_graphs.phe);
|
||||
|
||||
gasYAxis->setPos(itemPos.partialPressure.pos.on);
|
||||
gasYAxis->setLine(itemPos.partialPressure.expanded);
|
||||
|
@ -660,21 +658,22 @@ void ProfileWidget2::setProfileState()
|
|||
temperatureAxis->setPos(itemPos.temperature.pos.on);
|
||||
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
|
||||
heartBeatAxis->setLine(itemPos.heartBeat.expanded);
|
||||
heartBeatItem->setVisible(s.value("hrgraph").toBool());
|
||||
heartBeatItem->setVisible(prefs.hrgraph);
|
||||
meanDepth->setVisible(true);
|
||||
|
||||
diveComputerText->setVisible(true);
|
||||
diveComputerText->setPos(itemPos.dcLabel.on);
|
||||
|
||||
diveCeiling->setVisible(s.value("calcceiling").toBool());
|
||||
reportedCeiling->setVisible(s.value("dcceiling").toBool());
|
||||
diveCeiling->setVisible(prefs.calcceiling);
|
||||
reportedCeiling->setVisible(prefs.dcceiling);
|
||||
|
||||
if (s.value("calcalltissues").toBool()) {
|
||||
if (prefs.calcalltissues) {
|
||||
Q_FOREACH(DiveCalculatedTissue * tissue, allTissues) {
|
||||
tissue->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup("TecDetails");
|
||||
bool rulerVisible = s.value("rulergraph", false).toBool();
|
||||
rulerItem->setVisible(rulerVisible);
|
||||
rulerItem->destNode()->setVisible(rulerVisible);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue