mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 16:39:57 +00:00
combine setActive and rideSelected
And pay attention to MainWindow::activeTab, such that only the active tab redraws itself when changing rides. This change really increases GC's responsiveness when scrolling through the ride list.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
#include <QXmlSimpleReader>
|
||||
|
||||
CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent) :
|
||||
QWidget(parent), home(home), mainWindow(parent), active(false)
|
||||
QWidget(parent), home(home), mainWindow(parent), currentRide(NULL)
|
||||
{
|
||||
QVBoxLayout *vlayout = new QVBoxLayout;
|
||||
|
||||
@@ -115,25 +115,13 @@ CriticalPowerWindow::deleteCpiFile(QString rideFilename)
|
||||
ride_filename_to_cpi_filename(rideFilename));
|
||||
}
|
||||
|
||||
void
|
||||
CriticalPowerWindow::setActive(bool new_value)
|
||||
{
|
||||
bool was_active = active;
|
||||
active = new_value;
|
||||
if (active && !was_active) {
|
||||
currentRide = mainWindow->rideItem();
|
||||
if (currentRide) {
|
||||
cpintPlot->calculate(currentRide);
|
||||
cpintSetCPButton->setEnabled(cpintPlot->cp > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CriticalPowerWindow::rideSelected()
|
||||
{
|
||||
if (mainWindow->activeTab() != this)
|
||||
return;
|
||||
currentRide = mainWindow->rideItem();
|
||||
if (active && currentRide) {
|
||||
if (currentRide) {
|
||||
cpintPlot->calculate(currentRide);
|
||||
cpintSetCPButton->setEnabled(cpintPlot->cp > 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user