mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 16:39:57 +00:00
Optimize computation/draw of widgets and charts during training workouts, and Fix some train interface issues (#4624)
* Video widgets overlap non video layouts * Crash if video is selected but workout is not GPS based, ElevationZoom widget * Train widgets and charts optimized to not compute or draw if not visible
This commit is contained in:
@@ -231,6 +231,9 @@ void LiveMapWebPageWindow::configChanged(qint32)
|
||||
// Update position on the map when telemetry changes.
|
||||
void LiveMapWebPageWindow::telemetryUpdate(RealtimeData rtd)
|
||||
{
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
||||
QString code = "";
|
||||
geolocation geoloc(rtd.getLatitude(), rtd.getLongitude(), rtd.getAltitude());
|
||||
if (geoloc.IsReasonableGeoLocation()) {
|
||||
|
||||
@@ -808,6 +808,10 @@ void ElevationZoomedMeterWidget::updateRidePointsQ(int tDist) {
|
||||
|
||||
void ElevationZoomedMeterWidget::scalePointsToPlot() {
|
||||
|
||||
// In the weird situation where a video is selected but workout is not GPS based
|
||||
if (plotQ.empty())
|
||||
return;
|
||||
|
||||
double pixelX = -1;
|
||||
double pixelY = -1;
|
||||
m_zoomedElevationPolygon.clear();
|
||||
|
||||
@@ -259,7 +259,8 @@ RealtimePlotWindow::telemetryUpdate(RealtimeData rtData)
|
||||
rtPlot->o2hbData->addData(rtData.value(RealtimeData::O2Hb));
|
||||
rtPlot->hhbData->addData(rtData.value(RealtimeData::HHb));
|
||||
}
|
||||
rtPlot->replot(); // redraw
|
||||
if (isVisible())
|
||||
rtPlot->replot(); // redraw
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -149,6 +149,8 @@ SpinScanPlotWindow::telemetryUpdate(RealtimeData rtData)
|
||||
memcpy(history[current++], rtData.spinScan, 24);
|
||||
if (current==16) current=0;
|
||||
|
||||
plPlot->replot(); // redraw
|
||||
rtPlot->replot(); // redraw
|
||||
if (isVisible()) {
|
||||
plPlot->replot(); // redraw
|
||||
rtPlot->replot(); // redraw
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,8 @@ void VideoWindow::showMeters()
|
||||
p_meterWidget->AdjustSizePos();
|
||||
p_meterWidget->update();
|
||||
p_meterWidget->raise();
|
||||
p_meterWidget->show();
|
||||
if (isVisible())
|
||||
p_meterWidget->show();
|
||||
p_meterWidget->startPlayback(context);
|
||||
}
|
||||
prevPosition = mapToGlobal(pos());
|
||||
@@ -320,6 +321,24 @@ void VideoWindow::resizeEvent(QResizeEvent * )
|
||||
prevPosition = mapToGlobal(pos());
|
||||
}
|
||||
|
||||
void VideoWindow::showEvent(QShowEvent *event)
|
||||
{
|
||||
GcChartWindow::showEvent(event);
|
||||
if (init && (state == PlaybackState::Playing || state == PlaybackState::Paused)) {
|
||||
foreach(MeterWidget* p_meterWidget , m_metersWidget)
|
||||
p_meterWidget->show();
|
||||
}
|
||||
}
|
||||
|
||||
void VideoWindow::hideEvent(QHideEvent *event)
|
||||
{
|
||||
GcChartWindow::hideEvent(event);
|
||||
if (init) {
|
||||
foreach(MeterWidget* p_meterWidget , m_metersWidget)
|
||||
p_meterWidget->hide();
|
||||
}
|
||||
}
|
||||
|
||||
VideoSyncFilePoint VideoWindow::VideoSyncPointAdjust(const VideoSyncFilePoint& vsfp) const
|
||||
{
|
||||
VideoSyncFilePoint r(vsfp);
|
||||
@@ -546,6 +565,9 @@ void VideoWindow::resumePlayback()
|
||||
|
||||
void VideoWindow::telemetryUpdate(RealtimeData rtd)
|
||||
{
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
||||
Lock lock(stateLock);
|
||||
if (!hasActiveVideo())
|
||||
return;
|
||||
|
||||
@@ -270,6 +270,9 @@ class VideoWindow : public GcChartWindow
|
||||
|
||||
protected:
|
||||
|
||||
void showEvent(QShowEvent *event) override;
|
||||
void hideEvent(QHideEvent *event) override;
|
||||
|
||||
void resizeEvent(QResizeEvent *);
|
||||
|
||||
// media data
|
||||
|
||||
@@ -93,7 +93,8 @@ WorkoutPlotWindow::ergFileSelected(ErgFile *f)
|
||||
void
|
||||
WorkoutPlotWindow::setNow(long now)
|
||||
{
|
||||
ergPlot->setNow(now);
|
||||
if (isVisible())
|
||||
ergPlot->setNow(now);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -188,7 +188,8 @@ WorkoutWidget::stop()
|
||||
void
|
||||
WorkoutWidget::setNow(long x)
|
||||
{
|
||||
ensureVisible(x/1000);
|
||||
if (isVisible())
|
||||
ensureVisible(x/1000);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user