mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 18:13:24 +00:00
Optimizations and fixes on the new profile.
This patch optimizes a few items when hitting the 'save preferences' dialog, since when a preference is modified, all the items try to reload their visual based on wether a preference changed or not, the correct code for 'hey, my pref changed, let's update' needed to be done. now the axis will only set a new maximum if it's different from the old one ( and thus, going to a new dive with the same maxdepth or maxtime as the old one will not touch their axis, not triggering gratuitous animations. ) also, the 'incr by 3m' was not being called - it seems that our 'syncsettings' method is not storing things on the 'prefs' global var. I added just for the incr by 3m case, but it's something that we need to check later. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
25b0a846af
commit
7b9400685d
5 changed files with 18 additions and 4 deletions
|
@ -157,6 +157,7 @@ void PreferencesDialog::syncSettings()
|
|||
SB("redceiling", ui.red_ceiling);
|
||||
SB("calcceiling", ui.calculated_ceiling);
|
||||
SB("calcceiling3m", ui.increment_3m);
|
||||
prefs.calc_ceiling_3m_incr = ui.increment_3m->isChecked() ? 1 : 0;
|
||||
SB("calcndltts", ui.calc_ndl_tts);
|
||||
SB("calcalltissues", ui.all_tissues);
|
||||
s.setValue("gflow", ui.gflow->value());
|
||||
|
|
|
@ -21,12 +21,16 @@ static QPen gridPen(){
|
|||
}
|
||||
void DiveCartesianAxis::setMaximum(double maximum)
|
||||
{
|
||||
if (max == maximum)
|
||||
return;
|
||||
max = maximum;
|
||||
emit maxChanged();
|
||||
}
|
||||
|
||||
void DiveCartesianAxis::setMinimum(double minimum)
|
||||
{
|
||||
if (min == minimum)
|
||||
return;
|
||||
min = minimum;
|
||||
}
|
||||
|
||||
|
@ -255,7 +259,7 @@ QColor DepthAxis::colorForValue(double value)
|
|||
return QColor(Qt::red);
|
||||
}
|
||||
|
||||
DepthAxis::DepthAxis()
|
||||
DepthAxis::DepthAxis() : showWithPPGraph(false)
|
||||
{
|
||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||
settingsChanged(); // force the correct size of the line.
|
||||
|
@ -267,11 +271,16 @@ void DepthAxis::settingsChanged()
|
|||
|
||||
s.beginGroup("TecDetails");
|
||||
bool ppGraph = s.value("phegraph").toBool() || s.value("po2graph").toBool() || s.value("pn2graph").toBool();
|
||||
if ( ppGraph == showWithPPGraph){
|
||||
return;
|
||||
}
|
||||
|
||||
if (ppGraph) {
|
||||
animateChangeLine(QLineF(0,2,0,60));
|
||||
} else {
|
||||
animateChangeLine(QLineF(0,2,0,98));
|
||||
}
|
||||
showWithPPGraph = ppGraph;
|
||||
}
|
||||
|
||||
QColor TimeAxis::colorForValue(double value)
|
||||
|
@ -419,6 +428,9 @@ void PartialGasPressureAxis::preferencesChanged()
|
|||
max = model->po2Max();
|
||||
|
||||
qreal pp = floor(max * 10.0) / 10.0 + 0.2;
|
||||
if (maximum() == pp)
|
||||
return;
|
||||
|
||||
setMaximum(pp);
|
||||
setTickInterval( pp > 4 ? 0.5 : 0.25 );
|
||||
updateTicks();
|
||||
|
|
|
@ -63,6 +63,8 @@ protected:
|
|||
QColor colorForValue(double value);
|
||||
private slots:
|
||||
void settingsChanged();
|
||||
private:
|
||||
bool showWithPPGraph;
|
||||
};
|
||||
|
||||
class TimeAxis : public DiveCartesianAxis {
|
||||
|
|
|
@ -471,9 +471,8 @@ void DiveCalculatedCeiling::preferencesChanged()
|
|||
if ( dataModel && is3mIncrement != shouldShow3mIncrement){
|
||||
// recalculate that part.
|
||||
dataModel->calculateDecompression();
|
||||
is3mIncrement = shouldShow3mIncrement;
|
||||
}
|
||||
|
||||
is3mIncrement = shouldShow3mIncrement;
|
||||
setVisible(s.value("calcceiling").toBool());
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class DiveCalculatedTissue : public DiveCalculatedCeiling {
|
|||
Q_OBJECT
|
||||
public:
|
||||
DiveCalculatedTissue();
|
||||
void preferencesChanged();
|
||||
virtual void preferencesChanged();
|
||||
};
|
||||
|
||||
class MeanDepthLine : public DiveLineItem {
|
||||
|
|
Loading…
Add table
Reference in a new issue