The class member IntervalItem::name is redundant since it is a duplicate
of the text() member of the base class QTreeWidgetItem. By removing it
we both simplify the code and remove the need to keep name and text in
sync when renaming and creating intervals.
As a result the itemChanged signal that was connected for renames and
then disconnected when the items are cleared can be connected once
and no disconnect is neccessary.
This connect/disconnect oddity was originally to avoid a SEGV that
resulted from accessing text() whilst the QTreeWidgetItem was being
destroyed. The code for removing intervals when a new ride is selected
no longer destroys and recreats MainWindow::allIntervals (which was also an
artefact of the original code to avoid a SEGV).
The ConfigDialog is modal, so it needs to delete itself. However, the
existing code contained a bunch of destructors with calls to delete on
widgets. That's wrong. Widgets are automatically parented on being added to
layouts, the parent widgets delete their children in their own destructors.
So remove all the explicit deletes.
The new intervals code removed some replots() to stop flickering but
they also removed critical refreshes after CP and Cadence values
are updated by the user using the entry fields on PfPvWindow.
Additionally, the setData() function was used to refresh all curves
when intervals were selected which caused user entries to be reset.
This patch introduces PfPvPlot::showIntervals() to only refresh the
intervals curve and fixes replots() to a) replot when neccessary
after a user entry but b) to not replot mid-refresh in the zones
background function.
The PfpvPlot::setData() function only sets the main curve (all the
black points).
When the user changes CP, CAD, CL in the window dialog they call
replot() explicitly rather than assuming the utility functions will
do it for them, since the utility functions are called within
setData (amongst others) and results in multiple replots() that are
ugly, but more importantly make it difficult to spot the deltas on
the plot as new intervals are overlayed because they all disappear
for a split second.
This change allows us to connect the zonesChanged signal to the ride summary,
so that we don't have to call ride->htmlSummary as a special case whenever
we call zonesChanged. It will also come in useful later when I introduce a
rideSelected signal.