[PATCH] Minor code cleanup in profilewidget2.cpp
Willem Ferguson
willemferguson at zoology.up.ac.za
Fri Jan 9 09:40:20 PST 2015
On 09/01/2015 19:15, Dirk Hohndel wrote:
> On Fri, Jan 09, 2015 at 09:08:26AM +0200, Willem Ferguson wrote:
>> 1) Delete a few commented-out lines that I created myself.
> I'll do this in the initial commit when applying it.
>
>> 2) Delete two groups of 4 instructions which are duplicated in the existing
>> code.
> Are you certain those aren't needed. We frequently end up having the same
> code in multiple places as different code paths end up needing to do the
> same thing. I'm a bit uncomfortable with a patch that just removes random
> code without a better explanation how these specific actions are
> redundant. The simple fact that the same code shows up elsewhere isn't
> sufficient.
>
> /D
>
>> From 348a26b1bcbcb3774eb6e4b3a35ca4b4a4e82438 Mon Sep 17 00:00:00 2001
>> From: willem ferguson <willemferguson at zoology.up.ac.za>
>> Date: Fri, 9 Jan 2015 09:03:13 +0200
>> Subject: [PATCH 2/2] Minor code cleanup in profilewidget2.cpp
>>
>> 1) Delete a few commented-out lines that I created myself.
>> 2) Delete two groups of 4 instructions which are duplicated in the existing code.
>>
>> Signed-off-by: willem ferguson <willemferguson at zoology.up.ac.za>
>> ---
>> qt-ui/profile/profilewidget2.cpp | 11 -----------
>> 1 file changed, 11 deletions(-)
>>
>> diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
>> index 7d29f7a..aa86a5d 100644
>> --- a/qt-ui/profile/profilewidget2.cpp
>> +++ b/qt-ui/profile/profilewidget2.cpp
>> @@ -532,9 +532,6 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
>> }
>>
>> o2SetpointGasItem->setVisible(current_dive && (currentdc->dctype == CCR) && prefs.show_ccr_setpoint && prefs.pp_graphs.po2);
>> -// o2SetpointGasItem->setVisible(true);
>> -// else
>> -// o2SetpointGasItem->setVisible(false);
>>
>> /* This struct holds all the data that's about to be plotted.
>> * I'm not sure this is the best approach ( but since we are
>> @@ -688,10 +685,6 @@ void ProfileWidget2::settingsChanged()
>> temperatureAxis->setPos(itemPos.temperature.pos.on);
>> temperatureAxis->animateChangeLine(itemPos.temperature.intermediate);
>> cylinderPressureAxis->animateChangeLine(itemPos.cylinder.intermediate);
>> - gasYAxis->setPos(itemPos.partialPressure.pos.on);
>> - gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
>> - percentageAxis->setPos(itemPos.percentage.pos.on);
>> - percentageAxis->setLine(itemPos.percentage.expanded);
>> heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
>> heartBeatAxis->setLine(itemPos.heartBeat.expanded);
>> if (prefs.tankbar) {
>> @@ -962,10 +955,6 @@ void ProfileWidget2::setProfileState()
>> temperatureAxis->setPos(itemPos.temperature.pos.on);
>> temperatureAxis->animateChangeLine(itemPos.temperature.intermediate);
>> cylinderPressureAxis->animateChangeLine(itemPos.cylinder.intermediate);
>> - gasYAxis->setPos(itemPos.partialPressure.pos.on);
>> - gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
>> - percentageAxis->setPos(itemPos.percentage.pos.on);
>> - percentageAxis->setLine(itemPos.percentage.expanded);
>> heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
>> heartBeatAxis->setLine(itemPos.heartBeat.expanded);
>> if (prefs.tankbar) {
>> --
>> 1.9.1
>>
>> _______________________________________________
>> subsurface mailing list
>> subsurface at subsurface-divelog.org
>> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
>
Here is one of the cases:
}else if (PP_GRAPHS_ENABLED || prefs.hrgraph ||
prefs.percentagegraph) {
profileYAxis->animateChangeLine(itemPos.depth.intermediate);
temperatureAxis->animateChangeLine(itemPos.temperature.intermediate);
cylinderPressureAxis->animateChangeLine(itemPos.cylinder.intermediate);
gasYAxis->setPos(itemPos.partialPressure.pos.on);
gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
percentageAxis->setPos(itemPos.percentage.pos.on);
percentageAxis->setLine(itemPos.percentage.expanded);
heartBeatAxis->setPos(itemPos.heartBeat.pos.on);
heartBeatAxis->setLine(itemPos.heartBeat.expanded);
if (prefs.tankbar) {
percentageAxis->setPos(itemPos.percentageWithTankBar.pos.on);
percentageAxis->animateChangeLine(itemPos.percentageWithTankBar.expanded);
gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on);
gasYAxis->setLine(itemPos.partialPressureWithTankBar.expanded);
}else {
gasYAxis->setPos(itemPos.partialPressure.pos.on);
gasYAxis->animateChangeLine(itemPos.partialPressure.expanded);
percentageAxis->setPos(itemPos.percentage.pos.on);
percentageAxis->setLine(itemPos.percentage.expanded);
}
Kind regards,
Willem
More information about the subsurface
mailing list